This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [ID 20010624.001] debugger T, and Carp::carp don't trace arg of
[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#
252f4fb1 23# Generated on Sat Jun 23 17:56:36 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 1082: Find the basic shell for Bourne shell scripts
1083case "$sh" in
1084'')
8ff267be 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 1102 break
1103 elif test -f "$xxx.exe"; then
1104 sh="$xxx";
8ff267be 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 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 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 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
f8006fac 2000chmod
b4eb6b3d
JH
2001comm
2002cp
2304df62
AD
2003echo
2004expr
2005grep
a0d0e21e 2006ls
dfe9444c 2007make
b4eb6b3d 2008mkdir
2304df62
AD
2009rm
2010sed
b4eb6b3d 2011sort
85e6fe83 2012touch
2304df62 2013tr
b4eb6b3d 2014uniq
2304df62
AD
2015"
2016trylist="
2017Mcc
dfe9444c 2018ar
3659ebf1 2019bison
b4eb6b3d 2020byacc
2304df62 2021cpp
b4eb6b3d 2022csh
2304df62
AD
2023date
2024egrep
8ff267be 2025gzip
b4eb6b3d 2026less
8ff267be 2027ln
b4eb6b3d 2028more
693762b4 2029nm
b4eb6b3d
JH
2030nroff
2031pg
2304df62
AD
2032test
2033uname
8ff267be 2034zip
2304df62 2035"
8e07c86e 2036pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2037pth="$pth /lib /usr/lib"
2038for file in $loclist; do
dfe9444c
AD
2039 eval xxx=\$$file
2040 case "$xxx" in
2041 /*|?:[\\/]*)
2042 if test -f "$xxx"; then
2043 : ok
2044 else
2045 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2046 xxx=`./loc $file $file $pth`
2047 fi
2048 ;;
2049 '') xxx=`./loc $file $file $pth`;;
2050 *) xxx=`./loc $xxx $xxx $pth`;;
2051 esac
2304df62
AD
2052 eval $file=$xxx
2053 eval _$file=$xxx
2054 case "$xxx" in
2055 /*)
2056 echo $file is in $xxx.
2057 ;;
8e07c86e
AD
2058 ?:[\\/]*)
2059 echo $file is in $xxx.
2060 ;;
2304df62 2061 *)
25f94b33
AD
2062 echo "I don't know where '$file' is, and my life depends on it." >&4
2063 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2064 exit 1
2304df62
AD
2065 ;;
2066 esac
2067done
2068echo " "
2069echo "Don't worry if any of the following aren't found..."
2070say=offhand
2071for file in $trylist; do
dfe9444c
AD
2072 eval xxx=\$$file
2073 case "$xxx" in
2074 /*|?:[\\/]*)
2075 if test -f "$xxx"; then
2076 : ok
2077 else
2078 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2079 xxx=`./loc $file $file $pth`
2080 fi
2081 ;;
2082 '') xxx=`./loc $file $file $pth`;;
2083 *) xxx=`./loc $xxx $xxx $pth`;;
2084 esac
2304df62
AD
2085 eval $file=$xxx
2086 eval _$file=$xxx
2087 case "$xxx" in
2088 /*)
2089 echo $file is in $xxx.
2090 ;;
8e07c86e
AD
2091 ?:[\\/]*)
2092 echo $file is in $xxx.
2093 ;;
2304df62
AD
2094 *)
2095 echo "I don't see $file out there, $say."
2096 say=either
2097 ;;
2098 esac
2099done
2100case "$egrep" in
2101egrep)
2102 echo "Substituting grep for egrep."
2103 egrep=$grep
2104 ;;
2105esac
8ff267be 2106case "$ln" in
2107ln)
2108 echo "Substituting cp for ln."
2109 ln=$cp
2110 ;;
2111esac
2304df62
AD
2112case "$test" in
2113test)
2114 echo "Hopefully test is built into your sh."
2115 ;;
2116*)
73614538 2117 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2118 echo "Using the test built into your sh."
2304df62
AD
2119 test=test
2120 _test=test
2121 fi
2122 ;;
2123esac
2124case "$echo" in
2125echo)
2126 echo "Hopefully echo is built into your sh."
2127 ;;
2128'') ;;
2129*)
2130 echo " "
2131echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2132 $echo $n "hi there$c" >foo1
2133 echo $n "hi there$c" >foo2
2134 if cmp foo1 foo2 >/dev/null 2>&1; then
2135 echo "They are compatible. In fact, they may be identical."
2136 else
2137 case "$n" in
2138 '-n') n='' c='\c';;
2139 *) n='-n' c='';;
2140 esac
2141 cat <<FOO
2142They are not compatible! You are probably running ksh on a non-USG system.
2143I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2144have echo built in and we may have to run some Bourne shell scripts. That
2145means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2146
2147FOO
2148 $echo $n "The star should be here-->$c"
2149 $echo "*"
2150 fi
2151 $rm -f foo1 foo2
2152 ;;
2153esac
2154
2573c5f9
JH
2155cat <<EOS >checkcc
2156$startsh
2157EOS
2158cat <<'EOSC' >>checkcc
2159case "$cc" in
2160'') ;;
2161*) $rm -f try try.*
2162 $cat >try.c <<EOM
2163int main(int argc, char *argv[]) {
2164 return 0;
2165}
2166EOM
e4778687 2167 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2168 :
2169 else
2170 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2171 despair=yes
2172 trygcc=yes
2173 case "$cc" in
2174 *gcc*) trygcc=no ;;
2175 esac
2176 case "`$cc -v -c try.c 2>&1`" in
2177 *gcc*) trygcc=no ;;
2178 esac
2179 if $test X"$trygcc" = Xyes; then
2180 if gcc -o try -c try.c; then
2181 echo " "
2182 echo "You seem to have a working gcc, though." >&4
2183 rp="Would you like to use it?"
2184 dflt=y
2185 if $test -f myread; then
2186 . ./myread
2187 else
2188 if $test -f UU/myread; then
2189 . ./UU/myread
2190 else
2191 echo "Cannot find myread, sorry. Aborting." >&2
2192 exit 1
2193 fi
2194 fi
2195 case "$ans" in
e723fc21 2196 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2197 esac
2198 fi
2199 fi
2200 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2201 $cat >&4 <<EOM
2202You need to find a working C compiler.
2203Either (purchase and) install the C compiler supplied by your OS vendor,
2204or for a free C compiler try http://gcc.gnu.org/
2205I cannot continue any further, aborting.
2206EOM
2573c5f9
JH
2207 exit 1
2208 fi
2209 fi
2210 $rm -f try try.*
2211 ;;
2212esac
2213EOSC
2214
a0d0e21e
LW
2215: determine whether symbolic links are supported
2216echo " "
2217$touch blurfl
2218if $ln -s blurfl sym > /dev/null 2>&1 ; then
2219 echo "Symbolic links are supported." >&4
2220 lns="$ln -s"
2221else
2222 echo "Symbolic links are NOT supported." >&4
2223 lns="$ln"
2224fi
2225$rm -f blurfl sym
2226
dafca956
JH
2227: determine whether symbolic links are supported
2228echo " "
2229case "$lns" in
2230*"ln -s")
2231 echo "Checking how to test for symbolic links..." >&4
2232 $lns blurfl sym
4b661809 2233 if $test "X$issymlink" = X; then
73614538 2234 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2235 if test $? = 0; then
2236 issymlink="test -h"
2237 fi
2238 fi
2239 if $test "X$issymlink" = X; then
73614538 2240 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2241 issymlink="$test -h"
2242 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2243 fi
dafca956 2244 fi
4b661809 2245 if $test "X$issymlink" = X; then
dafca956 2246 if $test -L sym 2>/dev/null; then
5d644a95 2247 issymlink="$test -L"
dafca956
JH
2248 fi
2249 fi
4b661809 2250 if $test "X$issymlink" != X; then
5d644a95 2251 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2252 else
2253 echo "I do not know how you can test for symbolic links." >&4
2254 fi
2255 $rm -f blurfl sym
2256 ;;
2257*) echo "No symbolic links, so not testing for their testing..." >&4
2258 ;;
2259esac
2260echo " "
2261
2262
2263case "$mksymlinks" in
2264$define|true|[yY]*)
2265 case "$src" in
2266 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2267 exit 1
2268 ;;
4b661809 2269 *) case "$lns:$issymlink" in
7a800fca 2270 *"ln -s:"*"test -"?)
dafca956
JH
2271 echo "Creating the symbolic links..." >&4
2272 echo "(First creating the subdirectories...)" >&4
2273 cd ..
2274 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2275 read directory
2276 test -z "$directory" && break
2277 mkdir -p $directory
2278 done
2279 # Sanity check 1.
2280 if test ! -d t/base; then
2281 echo "Failed to create the subdirectories. Aborting." >&4
2282 exit 1
2283 fi
2284 echo "(Then creating the symlinks...)" >&4
2285 awk '{print $1}' $src/MANIFEST | while true; do
2286 read filename
2287 test -z "$filename" && break
2288 if test -f $filename; then
5d644a95 2289 if $issymlink $filename; then
dafca956
JH
2290 rm -f $filename
2291 fi
2292 fi
2293 if test -f $filename; then
2294 echo "$filename already exists, not symlinking."
2295 else
2296 ln -s $src/$filename $filename
2297 fi
2298 done
2299 # Sanity check 2.
2300 if test ! -f t/base/commonsense.t; then
2301 echo "Failed to create the symlinks. Aborting." >&4
2302 exit 1
2303 fi
2304 cd UU
2305 ;;
2306 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2307 ;;
2308 esac
2309 ;;
2310 esac
2311 ;;
2312esac
2313
5440bc8e
JH
2314
2315case "$usecrosscompile" in
2316$define|true|[yY]*)
93bc48fa 2317 $echo "Cross-compiling..."
5440bc8e
JH
2318 croak=''
2319 case "$cc" in
2320 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2321 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2322 ar=$targetarch-ar
2323 # leave out ld, choosing it is more complex
2324 nm=$targetarch-nm
2325 ranlib=$targetarch-ranlib
93bc48fa 2326 $echo 'extern int foo;' > try.c
f8006fac 2327 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2328 shift
2329 if $test $# -gt 0; then
2330 incpth="$incpth $*"
f8006fac
JH
2331 incpth="`$echo $incpth|$sed 's/^ //'`"
2332 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2333 for i in $*; do
f8006fac 2334 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2335 if $test -d $j; then
2336 libpth="$libpth $j"
2337 fi
2338 done
f8006fac
JH
2339 libpth="`$echo $libpth|$sed 's/^ //'`"
2340 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2341 fi
2342 $rm -f try.c
5440bc8e
JH
2343 ;;
2344 esac
2345 case "$targetarch" in
93bc48fa
JH
2346 '') echo "Targetarch not defined." >&4; croak=y ;;
2347 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2348 esac
2349 case "$incpth" in
93bc48fa 2350 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2351 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2352 esac
2353 case "$libpth" in
93bc48fa 2354 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2355 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2356 esac
93bc48fa
JH
2357 case "$usrinc" in
2358 '') for i in $incpth; do
2359 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2360 usrinc=$i
2361 echo "Guessing usrinc $usrinc." >&4
2362 break
2363 fi
2364 done
2365 case "$usrinc" in
2366 '') echo "Usrinc not defined." >&4; croak=y ;;
2367 esac
2368 ;;
2369 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2370 esac
93bc48fa
JH
2371 case "$targethost" in
2372 '') echo "Targethost not defined." >&4; croak=y ;;
2373 *) echo "Using targethost $targethost." >&4
5440bc8e 2374 esac
93bc48fa
JH
2375 locincpth=' '
2376 loclibpth=' '
5440bc8e 2377 case "$croak" in
93bc48fa 2378 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2379 esac
2380 case "$src" in
2381 /*) run=$src/Cross/run
93c0359c 2382 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2383 to=$src/Cross/to
2384 from=$src/Cross/from
2385 ;;
93bc48fa 2386 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2387 run=$pwd/Cross/run
f8006fac 2388 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2389 to=$pwd/Cross/to
2390 from=$pwd/Cross/from
2391 ;;
2392 esac
2393 case "$targetrun" in
2394 '') targetrun=ssh ;;
2395 esac
2396 case "$targetto" in
2397 '') targetto=scp ;;
2398 esac
2399 case "$targetfrom" in
2400 '') targetfrom=scp ;;
2401 esac
2402 run=$run-$targetrun
2403 to=$to-$targetto
2404 from=$from-$targetfrom
93bc48fa
JH
2405 case "$targetdir" in
2406 '') targetdir=/tmp
2407 echo "Guessing targetdir $targetdir." >&4
2408 ;;
2409 esac
5440bc8e 2410 case "$targetuser" in
93bc48fa
JH
2411 '') targetuser=root
2412 echo "Guessing targetuser $targetuser." >&4
2413 ;;
5440bc8e
JH
2414 esac
2415 case "$targetfrom" in
2416 scp) q=-q ;;
2417 *) q='' ;;
2418 esac
2419 case "$targetrun" in
2420 ssh|rsh)
2421 cat >$run <<EOF
2422#!/bin/sh
93c0359c
JH
2423case "\$1" in
2424-cwd)
2425 shift
2426 cwd=\$1
2427 shift
2428 ;;
2429esac
2430case "\$cwd" in
2431'') cwd=$targetdir ;;
2432esac
5440bc8e
JH
2433exe=\$1
2434shift
93c0359c
JH
2435if $test ! -f \$exe.xok; then
2436 $to \$exe
2437 $touch \$exe.xok
2438fi
2439$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2440EOF
2441 ;;
93bc48fa 2442 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2443 exit 1
2444 ;;
2445 esac
93c0359c
JH
2446 case "$targetmkdir" in
2447 */Cross/mkdir)
2448 cat >$targetmkdir <<EOF
2449#!/bin/sh
2450$targetrun -l $targetuser $targethost "mkdir -p \$@"
2451EOF
f8006fac 2452 $chmod a+rx $targetmkdir
93c0359c
JH
2453 ;;
2454 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2455 exit 1
2456 ;;
2457 esac
5440bc8e
JH
2458 case "$targetto" in
2459 scp|rcp)
2460 cat >$to <<EOF
2461#!/bin/sh
2462for f in \$@
2463do
93c0359c
JH
2464 case "\$f" in
2465 /*)
2466 $targetmkdir \`dirname \$f\`
2467 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2468 ;;
2469 *)
2470 $targetmkdir $targetdir/\`dirname \$f\`
2471 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2472 ;;
2473 esac
5440bc8e
JH
2474done
2475exit 0
2476EOF
2477 ;;
2478 cp) cat >$to <<EOF
2479#!/bin/sh
93c0359c
JH
2480for f in \$@
2481do
2482 case "\$f" in
2483 /*)
2484 $mkdir -p $targetdir/\`dirname \$f\`
2485 $cp \$f $targetdir/\$f || exit 1
2486 ;;
2487 *)
2488 $targetmkdir $targetdir/\`dirname \$f\`
2489 $cp \$f $targetdir/\$f || exit 1
2490 ;;
2491 esac
2492done
2493exit 0
5440bc8e
JH
2494EOF
2495 ;;
93bc48fa 2496 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2497 exit 1
2498 ;;
2499 esac
2500 case "$targetfrom" in
2501 scp|rcp)
2502 cat >$from <<EOF
2503#!/bin/sh
2504for f in \$@
2505do
93c0359c 2506 $rm -f \$f
5440bc8e
JH
2507 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2508done
2509exit 0
2510EOF
2511 ;;
2512 cp) cat >$from <<EOF
2513#!/bin/sh
2514for f in \$@
2515do
93c0359c 2516 $rm -f \$f
5440bc8e
JH
2517 cp $targetdir/\$f . || exit 1
2518done
2519exit 0
2520EOF
2521 ;;
93bc48fa 2522 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2523 exit 1
2524 ;;
2525 esac
93bc48fa
JH
2526 if $test ! -f $run; then
2527 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2528 else
f8006fac 2529 $chmod a+rx $run
5440bc8e 2530 fi
93bc48fa
JH
2531 if $test ! -f $to; then
2532 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2533 else
f8006fac 2534 $chmod a+rx $to
5440bc8e 2535 fi
93bc48fa
JH
2536 if $test ! -f $from; then
2537 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2538 else
f8006fac 2539 $chmod a+rx $from
5440bc8e 2540 fi
93bc48fa 2541 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2542 exit 1
2543 fi
2544 cat >&4 <<EOF
f8006fac
JH
2545Using '$run' for remote execution,
2546and '$from' and '$to'
93bc48fa 2547for remote file transfer.
5440bc8e
JH
2548EOF
2549 ;;
2550*) run=''
2551 to=:
2552 from=:
2553 usecrosscompile='undef'
2554 targetarch=''
2555 ;;
2556esac
2557
ecfc5424
AD
2558: see whether [:lower:] and [:upper:] are supported character classes
2559echo " "
ecfc5424
AD
2560case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2561ABYZ)
2562 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2563 up='[:upper:]'
2564 low='[:lower:]'
2565 ;;
28e8609d
JH
2566*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2567 # (0xc9 and 0xd1), therefore that is a nice testing point.
2568 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2569 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2570 ij) up='[A-Z]'
2571 low='[a-z]'
2572 ;;
2573 esac
2574 fi
2575 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2576 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2577 ij) up='A-Z'
2578 low='a-z'
2579 ;;
2580 esac
2581 fi
2582 if test "X$up" = X -o "X$low" = X; then
2583 case "`echo IJ | od -x 2>/dev/null`" in
2584 *C9D1*|*c9d1*)
2585 echo "Hey, this might be EBCDIC." >&4
2586 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2587 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2588 ij) up='[A-IJ-RS-Z]'
2589 low='[a-ij-rs-z]'
2590 ;;
2591 esac
2592 fi
2593 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2594 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2595 ij) up='A-IJ-RS-Z'
2596 low='a-ij-rs-z'
2597 ;;
2598 esac
2599 fi
2600 ;;
2601 esac
2602 fi
2603esac
3eaeeeae 2604case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2605ij)
2606 echo "Using $up and $low to convert case." >&4
2607 ;;
ecfc5424 2608*)
28e8609d
JH
2609 echo "I don't know how to translate letters from upper to lower case." >&4
2610 echo "Your tr is not acting any way I know of." >&4
2611 exit 1
2612 ;;
ecfc5424
AD
2613esac
2614: set up the translation script tr, must be called with ./tr of course
2615cat >tr <<EOSC
2616$startsh
2617case "\$1\$2" in
2618'[A-Z][a-z]') exec $tr '$up' '$low';;
2619'[a-z][A-Z]') exec $tr '$low' '$up';;
2620esac
2621exec $tr "\$@"
2622EOSC
2623chmod +x tr
2624$eunicefix tr
2625
2304df62
AD
2626: Try to determine whether config.sh was made on this system
2627case "$config_sh" in
2628'')
43999f95
JH
2629myuname=`$uname -a 2>/dev/null`
2630$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2631# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2632# because the A-Z/a-z are not consecutive.
a0d0e21e 2633myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2634 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2635newmyuname="$myuname"
2304df62 2636dflt=n
16d20bd9
AD
2637case "$knowitall" in
2638'')
2639 if test -f ../config.sh; then
2640 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2641 eval "`grep myuname= ../config.sh`"
2642 fi
2643 if test "X$myuname" = "X$newmyuname"; then
2644 dflt=y
2645 fi
2304df62 2646 fi
16d20bd9
AD
2647 ;;
2648*) dflt=y;;
2649esac
2304df62
AD
2650
2651: Get old answers from old config file if Configure was run on the
2652: same system, otherwise use the hints.
2653hint=default
2654cd ..
2655if test -f config.sh; then
16d20bd9
AD
2656 echo " "
2657 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2658 . UU/myread
2659 case "$ans" in
f83701cd
AD
2660 n*|N*) echo "OK, I'll ignore it."
2661 mv config.sh config.sh.old
2662 myuname="$newmyuname"
2663 ;;
2304df62 2664 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2665 tmp_n="$n"
2666 tmp_c="$c"
85cad39c 2667 tmp_sh="$sh"
2304df62
AD
2668 . ./config.sh
2669 cp config.sh UU
ecfc5424
AD
2670 n="$tmp_n"
2671 c="$tmp_c"
85cad39c 2672 : Older versions did not always set $sh. Catch re-use of such
2673 : an old config.sh.
2674 case "$sh" in
2675 '') sh="$tmp_sh" ;;
2676 esac
2304df62
AD
2677 hint=previous
2678 ;;
2679 esac
2680fi
2573c5f9 2681. ./UU/checkcc
2304df62
AD
2682if test ! -f config.sh; then
2683 $cat <<EOM
2684
4e2a5f63
AD
2685First time through, eh? I have some defaults handy for some systems
2686that need some extra help getting the Configure answers right:
2304df62
AD
2687
2688EOM
dfe9444c 2689 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2690 dflt=''
2691 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2692 : tests or hints, please send them to perlbug@perl.org
2304df62 2693 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2694 $test -f /irix && osname=irix
85e6fe83
LW
2695 $test -f /xenix && osname=sco_xenix
2696 $test -f /dynix && osname=dynix
2697 $test -f /dnix && osname=dnix
5f05dabc 2698 $test -f /lynx.os && osname=lynxos
2699 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2700 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2701 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2702 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2703 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2704 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2705 $test -d /usr/apollo/bin && osname=apollo
2706 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2707 $test -d /usr/include/minix && osname=minix
e060872b 2708 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2709 osname=machten
4633a7c4 2710 if $test -x /sbin/version; then
dfe9444c 2711 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2712 $sed -e 's/[A-Za-z]$//'`
2713 elif $test -x /usr/etc/version; then
dfe9444c 2714 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2715 $sed -e 's/[A-Za-z]$//'`
2716 else
2717 osvers="$2.$3"
2718 fi
2719 fi
aaacdc8b
GS
2720
2721 $test -f /sys/posix.dll &&
2722 $test -f /usr/bin/what &&
2723 set X `/usr/bin/what /sys/posix.dll` &&
2724 $test "$3" = UWIN &&
2725 osname=uwin &&
2726 osvers="$5"
2727
2304df62
AD
2728 if $test -f $uname; then
2729 set X $myuname
2730 shift
2731
2304df62 2732 case "$5" in
85e6fe83 2733 fps*) osname=fps ;;
2304df62
AD
2734 mips*)
2735 case "$4" in
85e6fe83
LW
2736 umips) osname=umips ;;
2737 *) osname=mips ;;
2304df62 2738 esac;;
85e6fe83
LW
2739 [23]100) osname=mips ;;
2740 next*) osname=next ;;
ecfc5424 2741 i386*)
c6912327
JH
2742 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2743 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2744 osname='sco'
2745 osvers=$tmp
2746 elif $test -f /etc/kconfig; then
ecfc5424 2747 osname=isc
bd628c73 2748 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2749 osvers=4
2750 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2751 osvers=3
2304df62 2752 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2753 osvers=2
ecfc5424
AD
2754 fi
2755 fi
2000072c 2756 tmp=''
ecfc5424 2757 ;;
c4f23d77
AD
2758 pc*)
2759 if test -n "$DJGPP"; then
2760 osname=dos
2761 osvers=djgpp
2762 fi
2763 ;;
2304df62
AD
2764 esac
2765
2766 case "$1" in
a0d0e21e
LW
2767 aix) osname=aix
2768 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2769 case "$tmp" in
1aef975c 2770 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2771 '<3240'|'<>3240') osvers=3.2.0 ;;
2772 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2773 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2774 *) osvers=$tmp;;
a0d0e21e
LW
2775 esac
2776 ;;
aaacdc8b
GS
2777 bsd386) osname=bsd386
2778 osvers=`$uname -r`
2779 ;;
2780 cygwin*) osname=cygwin
2781 osvers="$3"
2782 ;;
23f87696
SZ
2783 *dc.osx) osname=dcosx
2784 osvers="$3"
2785 ;;
a0d0e21e
LW
2786 dnix) osname=dnix
2787 osvers="$3"
2788 ;;
2789 domainos) osname=apollo
2790 osvers="$3"
2791 ;;
2792 dgux) osname=dgux
2793 osvers="$3"
2794 ;;
760ac839 2795 dynixptx*) osname=dynixptx
e58e581d 2796 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2797 ;;
a0d0e21e
LW
2798 freebsd) osname=freebsd
2799 osvers="$3" ;;
2800 genix) osname=genix ;;
2801 hp*) osname=hpux
bfb7748a 2802 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2803 ;;
a78b0d02 2804 irix*) osname=irix
a0d0e21e
LW
2805 case "$3" in
2806 4*) osvers=4 ;;
2807 5*) osvers=5 ;;
ecfc5424 2808 *) osvers="$3" ;;
a0d0e21e
LW
2809 esac
2810 ;;
2811 linux) osname=linux
2812 case "$3" in
a0d0e21e
LW
2813 *) osvers="$3" ;;
2814 esac
2815 ;;
28e8609d
JH
2816 MiNT) osname=mint
2817 ;;
2818 netbsd*) osname=netbsd
ecfc5424
AD
2819 osvers="$3"
2820 ;;
4e81affe
MM
2821 news-os) osvers="$3"
2822 case "$3" in
2823 4*) osname=newsos4 ;;
2824 *) osname=newsos ;;
2825 esac
2826 ;;
aaacdc8b 2827 next*) osname=next ;;
28bb1e2c 2828 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2829 POSIX-BC | posix-bc ) osname=posix-bc
2830 osvers="$3"
a0d0e21e 2831 ;;
ae3afa4e
TH
2832 powerux | power_ux | powermax_os | powermaxos | \
2833 powerunix | power_unix) osname=powerux
2834 osvers="$3"
2835 ;;
aaacdc8b
GS
2836 qnx) osname=qnx
2837 osvers="$4"
2838 ;;
a0d0e21e
LW
2839 solaris) osname=solaris
2840 case "$3" in
2841 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2842 *) osvers="$3" ;;
a0d0e21e
LW
2843 esac
2844 ;;
85e6fe83
LW
2845 sunos) osname=sunos
2846 case "$3" in
85e6fe83
LW
2847 5*) osname=solaris
2848 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2849 *) osvers="$3" ;;
2304df62
AD
2850 esac
2851 ;;
a0d0e21e 2852 titanos) osname=titanos
85e6fe83 2853 case "$3" in
a0d0e21e
LW
2854 1*) osvers=1 ;;
2855 2*) osvers=2 ;;
2856 3*) osvers=3 ;;
2857 4*) osvers=4 ;;
ecfc5424 2858 *) osvers="$3" ;;
2304df62
AD
2859 esac
2860 ;;
85e6fe83 2861 ultrix) osname=ultrix
ecfc5424 2862 osvers="$3"
2304df62 2863 ;;
28757baa 2864 osf1|mls+) case "$5" in
fed7345c
AD
2865 alpha)
2866 osname=dec_osf
2aa76180
JH
2867 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2868 case "$osvers" in
2869 [1-9].[0-9]*) ;;
2870 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2871 esac
ecfc5424
AD
2872 ;;
2873 hp*) osname=hp_osf1 ;;
2874 mips) osname=mips_osf1 ;;
85e6fe83
LW
2875 esac
2876 ;;
0337d152
BG
2877 unixware) osname=svr5
2878 osvers="$4"
2879 ;;
2880 uts) osname=uts
a0d0e21e
LW
2881 osvers="$3"
2882 ;;
85e6fe83 2883 $2) case "$osname" in
2304df62 2884 *isc*) ;;
a0d0e21e 2885 *freebsd*) ;;
5f05dabc 2886 svr*)
a0d0e21e
LW
2887 : svr4.x or possibly later
2888 case "svr$3" in
2889 ${osname}*)
2890 osname=svr$3
2891 osvers=$4
2892 ;;
2893 esac
2894 case "$osname" in
2895 svr4.0)
2896 : Check for ESIX
2897 if test -f /stand/boot ; then
2898 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2899 if test -n "$INITPROG" -a -f "$INITPROG"; then
2900 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2901 if test -n "$isesix"; then
a0d0e21e
LW
2902 osname=esix4
2903 fi
2904 fi
2905 fi
2906 ;;
2907 esac
2908 ;;
2304df62 2909 *) if test -f /etc/systemid; then
a0d0e21e
LW
2910 osname=sco
2911 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2912 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2913 osvers=$1.$2.$3
c4f23d77 2914 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2915 osvers=$1.$2
c4f23d77 2916 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2917 osvers=$1
2304df62 2918 fi
a0d0e21e
LW
2919 else
2920 case "$osname" in
2921 '') : Still unknown. Probably a generic Sys V.
2922 osname="sysv"
2923 osvers="$3"
2924 ;;
2925 esac
2304df62
AD
2926 fi
2927 ;;
2928 esac
2929 ;;
a0d0e21e
LW
2930 *) case "$osname" in
2931 '') : Still unknown. Probably a generic BSD.
2932 osname="$1"
2933 osvers="$3"
2934 ;;
2935 esac
2936 ;;
2304df62
AD
2937 esac
2938 else
dfe9444c
AD
2939 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2940 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2941 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2942 osname=news_os
2304df62 2943 fi
dfe9444c 2944 $rm -f UU/kernel.what
8e07c86e
AD
2945 elif test -d c:/.; then
2946 set X $myuname
2947 osname=os2
2948 osvers="$5"
2304df62
AD
2949 fi
2950 fi
85e6fe83 2951
5440bc8e
JH
2952 case "$targetarch" in
2953 '') ;;
2954 *) hostarch=$osname
2955 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2956 osvers=''
2957 ;;
2958 esac
2959
a0d0e21e
LW
2960 : Now look for a hint file osname_osvers, unless one has been
2961 : specified already.
2962 case "$hintfile" in
2963 ''|' ')
1e127011 2964 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2965 : Also try without trailing minor version numbers.
1e127011
DD
2966 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2967 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2968 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2969 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2970 case "$file" in
2971 '') dflt=none ;;
2972 *) case "$osvers" in
2973 '') dflt=$file
2974 ;;
dfe9444c 2975 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2976 dflt=$file
dfe9444c 2977 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2978 dflt=$xfile
dfe9444c 2979 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2980 dflt=$xxfile
dfe9444c 2981 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2982 dflt=$xxxfile
dfe9444c 2983 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2984 dflt=$xxxxfile
dfe9444c 2985 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2986 dflt="${osname}"
2987 else
2988 dflt=none
2989 fi
2990 ;;
2991 esac
85e6fe83
LW
2992 ;;
2993 esac
4e2a5f63
AD
2994 if $test -f Policy.sh ; then
2995 case "$dflt" in
2996 *Policy*) ;;
2997 none) dflt="Policy" ;;
2998 *) dflt="Policy $dflt" ;;
2999 esac
3000 fi
85e6fe83 3001 ;;
a0d0e21e 3002 *)
ecfc5424 3003 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3004 ;;
2304df62 3005 esac
1aef975c 3006
4e2a5f63
AD
3007 if $test -f Policy.sh ; then
3008 $cat <<EOM
3009
3010There's also a Policy hint file available, which should make the
3011site-specific (policy) questions easier to answer.
3012EOM
3013
3014 fi
3015
2304df62
AD
3016 $cat <<EOM
3017
3018You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3019A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3020is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3021
3022EOM
4e2a5f63 3023
2304df62 3024 rp="Which of these apply, if any?"
dfe9444c 3025 . UU/myread
85e6fe83
LW
3026 tans=$ans
3027 for file in $tans; do
4e2a5f63
AD
3028 if $test X$file = XPolicy -a -f Policy.sh; then
3029 . Policy.sh
3030 $cat Policy.sh >> UU/config.sh
3031 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3032 . $src/hints/$file.sh
3033 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3034 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3035 : nothing
3036 else
85e6fe83
LW
3037 : Give one chance to correct a possible typo.
3038 echo "$file.sh does not exist"
3039 dflt=$file
3040 rp="hint to use instead?"
dfe9444c 3041 . UU/myread
85e6fe83 3042 for file in $ans; do
dfe9444c
AD
3043 if $test -f "$src/hints/$file.sh"; then
3044 . $src/hints/$file.sh
3045 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3046 elif $test X$ans = X -o X$ans = Xnone ; then
3047 : nothing
3048 else
3049 echo "$file.sh does not exist -- ignored."
3050 fi
3051 done
2304df62
AD
3052 fi
3053 done
85e6fe83 3054
2304df62 3055 hint=recommended
85e6fe83 3056 : Remember our hint file for later.
dfe9444c 3057 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3058 hintfile="$file"
85e6fe83 3059 else
a0d0e21e 3060 hintfile=''
85e6fe83 3061 fi
2304df62
AD
3062fi
3063cd UU
3064;;
3065*)
3066 echo " "
3067 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3068 tmp_n="$n"
3069 tmp_c="$c"
2304df62
AD
3070 cd ..
3071 cp $config_sh config.sh 2>/dev/null
a78b0d02 3072 chmod +w config.sh
2304df62
AD
3073 . ./config.sh
3074 cd UU
3075 cp ../config.sh .
ecfc5424
AD
3076 n="$tmp_n"
3077 c="$tmp_c"
2304df62
AD
3078 hint=previous
3079 ;;
3080esac
1aef975c 3081test "$override" && . ./optdef.sh
2304df62
AD
3082
3083: Restore computed paths
3084for file in $loclist $trylist; do
3085 eval $file="\$_$file"
3086done
3087
85e6fe83 3088cat << EOM
a0d0e21e 3089
85e6fe83 3090Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3091The default value is probably right if the name rings a bell. Otherwise,
3092since spelling matters for me, either accept the default or answer "none"
3093to leave it blank.
a0d0e21e 3094
85e6fe83 3095EOM
85e6fe83 3096case "$osname" in
a0d0e21e 3097 ''|' ')
85e6fe83 3098 case "$hintfile" in
a0d0e21e 3099 ''|' '|none) dflt=none ;;
ecfc5424 3100 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3101 esac
3102 ;;
3103 *) dflt="$osname" ;;
3104esac
3105rp="Operating system name?"
3106. ./myread
3107case "$ans" in
ecfc5424
AD
3108none) osname='' ;;
3109*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3110esac
8ff267be 3111echo " "
3112case "$osvers" in
3113 ''|' ')
3114 case "$hintfile" in
3115 ''|' '|none) dflt=none ;;
3116 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3117 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3118 case "$dflt" in
3119 ''|' ') dflt=none ;;
3120 esac
3121 ;;
3122 esac
3123 ;;
3124 *) dflt="$osvers" ;;
3125esac
3126rp="Operating system version?"
3127. ./myread
3128case "$ans" in
3129none) osvers='' ;;
3130*) osvers="$ans" ;;
3131esac
3132
02e93a22
JH
3133
3134. ./posthint.sh
3135
2304df62 3136: who configured the system
59b83a6f 3137cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3138cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3139case "$cf_by" in
3140"")
8ff267be 3141 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3142 case "$cf_by" in
3143 "") cf_by=unknown ;;
8ff267be 3144 esac ;;
3145esac
2304df62 3146
b4eb6b3d
JH
3147: set up the script used to warn in case of inconsistency
3148cat <<EOS >whoa
3149$startsh
3150EOS
3151cat <<'EOSC' >>whoa
3152dflt=y
3153echo " "
3154echo "*** WHOA THERE!!! ***" >&4
3155echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3156rp=" Keep the $hint value?"
3157. ./myread
3158case "$ans" in
3159y) td=$was; tu=$was;;
3160esac
3161EOSC
3162
3163: function used to set $1 to $val
3164setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3165case "$val$was" in
3166$define$undef) . ./whoa; eval "$var=\$td";;
3167$undef$define) . ./whoa; eval "$var=\$tu";;
3168*) eval "$var=$val";;
3169esac'
3170
3171case "$usethreads" in
3172$define|true|[yY]*) dflt='y';;
3173*) dflt='n';;
3174esac
3175cat <<EOM
3176
3177Perl can be built to take advantage of threads on some systems.
3178To do so, Configure can be run with -Dusethreads.
3179
3180Note that threading is a highly experimental feature, and
3181some known race conditions still remain. If you choose to try
3182it, be very sure to not actually deploy it for production
3183purposes. README.threads has more details, and is required
3184reading if you enable threads.
3185
3186If this doesn't make any sense to you, just accept the default '$dflt'.
3187EOM
3188rp='Build a threading Perl?'
3189. ./myread
3190case "$ans" in
3191y|Y) val="$define" ;;
3192*) val="$undef" ;;
3193esac
3194set usethreads
3195eval $setvar
3196
3197case "$usethreads" in
3198$define)
3199 $cat <<EOM
3200
3201As of 5.5.640, Perl has two different internal threading implementations,
3202the 5.005 version (5005threads) and an interpreter-based version
3203(ithreads) that has one interpreter per thread. Both are very
3204experimental. This arrangement exists to help developers work out
3205which one is better.
3206
3207If you're a casual user, you probably don't want interpreter-threads
3208at this time. There doesn't yet exist a way to create threads from
3209within Perl in this model, i.e., "use Thread;" will NOT work.
3210EOM
3211 : Default to ithreads unless overridden on command line or with
3212 : old config.sh
3213 dflt='y'
3214 case "$use5005threads" in
3215 $define|true|[yY]*) dflt='n';;
3216 esac
3217 case "$useithreads" in
3218 $undef|false|[nN]*) dflt='n';;
3219 esac
3220 rp='Use interpreter-based ithreads?'
3221 . ./myread
3222 case "$ans" in
3223 y|Y) val="$define" ;;
3224 *) val="$undef" ;;
3225 esac
3226 set useithreads
3227 eval $setvar
3228 : Now set use5005threads to the opposite value.
3229 case "$useithreads" in
3230 $define) val="$undef" ;;
3231 *) val="$define" ;;
3232 esac
3233 set use5005threads
3234 eval $setvar
3235 ;;
3236*)
3237 useithreads="$undef"
3238 use5005threads="$undef"
3239 ;;
3240esac
3241
c915ce7f
JH
3242case "$useithreads$use5005threads" in
3243"$define$define")
3244 $cat >&4 <<EOM
3245
3246You cannot have both the ithreads and the 5.005 threads enabled
3247at the same time. Disabling the 5.005 threads since they are
3248much less stable than the ithreads.
3249
3250EOM
3251 use5005threads="$undef"
3252 ;;
3253esac
3254
b4eb6b3d
JH
3255case "$d_oldpthreads" in
3256'') : Configure tests would be welcome here. For now, assume undef.
3257 val="$undef" ;;
3258*) val="$d_oldpthreads" ;;
3259esac
3260set d_oldpthreads
3261eval $setvar
3262
3263
3264case "$usethreads" in
3265"$define"|true|[yY]*)
3266: Look for a hint-file generated 'call-back-unit'. If the
3267: user has specified that a threading perl is to be built,
3268: we may need to set or change some other defaults.
3269 if $test -f usethreads.cbu; then
3270 echo "Your platform has some specific hints for threaded builds, using them..."
3271 . ./usethreads.cbu
3272 else
3273 $cat <<EOM
3274(Your platform doesn't have any specific hints for threaded builds.
3275 Assuming POSIX threads, then.)
3276EOM
3277 fi
3278 ;;
3279esac
3280
3281cat <<EOM
3282
3283Perl can be built so that multiple Perl interpreters can coexist
3284within the same Perl executable.
3285EOM
3286
3287case "$useithreads" in
3288$define)
3289 cat <<EOM
3290This multiple interpreter support is required for interpreter-based threads.
3291EOM
3292 val="$define"
3293 ;;
3294*) case "$usemultiplicity" in
3295 $define|true|[yY]*) dflt='y';;
3296 *) dflt='n';;
3297 esac
3298 echo " "
3299 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3300 rp='Build Perl for multiplicity?'
3301 . ./myread
3302 case "$ans" in
3303 y|Y) val="$define" ;;
3304 *) val="$undef" ;;
3305 esac
3306 ;;
3307esac
3308set usemultiplicity
3309eval $setvar
3310
e5e20432
JH
3311: make some quick guesses about what we are up against
3312echo " "
3313$echo $n "Hmm... $c"
3314echo exit 1 >bsd
3315echo exit 1 >usg
3316echo exit 1 >v7
3317echo exit 1 >osf1
3318echo exit 1 >eunice
3319echo exit 1 >xenix
3320echo exit 1 >venix
3321echo exit 1 >os2
3322d_bsd="$undef"
3323$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3324if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3325then
3326 echo "Looks kind of like an OSF/1 system, but we'll see..."
3327 echo exit 0 >osf1
381aa1ff 3328elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3329 xxx=`./loc addbib blurfl $pth`
3330 if $test -f $xxx; then
3331 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3332 echo exit 0 >bsd
3333 echo exit 0 >usg
3334 else
3335 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3336 echo "Looks kind of like an extended USG system, but we'll see..."
3337 else
3338 echo "Looks kind of like a USG system, but we'll see..."
3339 fi
3340 echo exit 0 >usg
3341 fi
3342elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3343 echo "Looks kind of like a BSD system, but we'll see..."
3344 d_bsd="$define"
3345 echo exit 0 >bsd
3346else
3347 echo "Looks kind of like a Version 7 system, but we'll see..."
3348 echo exit 0 >v7
3349fi
3350case "$eunicefix" in
3351*unixtovms*)
3352 $cat <<'EOI'
3353There is, however, a strange, musty smell in the air that reminds me of
3354something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3355EOI
3356 echo exit 0 >eunice
3357 d_eunice="$define"
3358: it so happens the Eunice I know will not run shell scripts in Unix format
3359 ;;
3360*)
3361 echo " "
3362 echo "Congratulations. You aren't running Eunice."
3363 d_eunice="$undef"
3364 ;;
3365esac
3366: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3367: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3368: semicolon as a patch separator
e5e20432
JH
3369case "$p_" in
3370:) ;;
3371*)
3372 $cat <<'EOI'
3373I have the feeling something is not exactly right, however...don't tell me...
3374lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3375(Or you may be running DOS with DJGPP.)
e5e20432
JH
3376EOI
3377 echo exit 0 >os2
3378 ;;
3379esac
3380if test -f /xenix; then
3381 echo "Actually, this looks more like a XENIX system..."
3382 echo exit 0 >xenix
3383 d_xenix="$define"
3384else
3385 echo " "
3386 echo "It's not Xenix..."
3387 d_xenix="$undef"
3388fi
3389chmod +x xenix
3390$eunicefix xenix
3391if test -f /venix; then
3392 echo "Actually, this looks more like a VENIX system..."
3393 echo exit 0 >venix
3394else
3395 echo " "
3396 if ./xenix; then
3397 : null
3398 else
3399 echo "Nor is it Venix..."
3400 fi
3401fi
3402chmod +x bsd usg v7 osf1 eunice xenix venix os2
3403$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3404$rm -f foo
3405
5869b1f1
JH
3406case "$cc" in
3407'') dflt=cc;;
3408*) dflt="$cc";;
3409esac
3410rp="Use which C compiler?"
3411. ./myread
3412cc="$ans"
e5e20432
JH
3413: Look for a hint-file generated 'call-back-unit'. Now that the
3414: user has specified the compiler, we may need to set or change some
3415: other defaults.
3416if $test -f cc.cbu; then
3417 . ./cc.cbu
3418fi
2573c5f9 3419. ./checkcc
8a27cf78 3420
e5e20432
JH
3421echo " "
3422echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3423$cat >try.c <<EOM
e5e20432
JH
3424#include <stdio.h>
3425int main() {
3426#ifdef __GNUC__
3427#ifdef __VERSION__
3428 printf("%s\n", __VERSION__);
3429#else
3430 printf("%s\n", "1");
3431#endif
3432#endif
3433 exit(0);
3434}
3435EOM
5440bc8e
JH
3436if $cc -o try $ccflags $ldflags try.c; then
3437 gccversion=`$run ./try`
e5e20432
JH
3438 case "$gccversion" in
3439 '') echo "You are not using GNU cc." ;;
fc68435e 3440 *) echo "You are using GNU cc $gccversion."
e723fc21 3441 ccname=gcc
fc68435e 3442 ;;
e5e20432
JH
3443 esac
3444else
3445 echo " "
3446 echo "*** WHOA THERE!!! ***" >&4
3447 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3448 case "$knowitall" in
3449 '')
3450 echo " You'd better start hunting for one and let me know about it." >&4
3451 exit 1
3452 ;;
3453 esac
3454fi
5440bc8e 3455$rm -f try try.*
e5e20432
JH
3456case "$gccversion" in
34571*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3458esac
5b463ca7
KS
3459case "$gccversion" in
3460'') gccosandvers='' ;;
10b4ebb5
JH
3461*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3462 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3463 gccshortvers=''
5b463ca7 3464 case "$gccosandvers" in
02903077
JH
3465 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3466 $osname$osvers) ;; # looking good
5b463ca7
KS
3467 $osname*) cat <<EOM >&4
3468
3469*** WHOA THERE!!! ***
3470
3471 Your gcc has not been compiled for the exact release of
3472 your operating system ($gccosandvers versus $osname$osvers).
3473
3474 In general it is a good idea to keep gcc synchronized with
3475 the operating system because otherwise serious problems
3476 may ensue when trying to compile software, like Perl.
3477
3478 I'm trying to be optimistic here, though, and will continue.
3479 If later during the configuration and build icky compilation
02903077
JH
3480 problems appear (headerfile conflicts being the most common
3481 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3482 your operating system release.
3483
3484EOM
3485 ;;
81575342 3486 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3487 esac
3488 ;;
3489esac
e723fc21
JH
3490case "$ccname" in
3491'') ccname="$cc" ;;
3492esac
e5e20432 3493
640374d0
JH
3494case "$gccversion" in
3495'') ;;
3496*) case "$ccflags" in
3497 *-Wall*) ;;
a126002e 3498 *) ccflags="$ccflags -Wall" ;;
640374d0
JH
3499 esac
3500 ;;
3501esac
3502
8a27cf78
JH
3503: see how we invoke the C preprocessor
3504echo " "
3505echo "Now, how can we feed standard input to your C preprocessor..." >&4
3506cat <<'EOT' >testcpp.c
3507#define ABC abc
3508#define XYZ xyz
3509ABC.XYZ
3510EOT
3511cd ..
3512if test ! -f cppstdin; then
3513 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3514 # AIX cc -E doesn't show the absolute headerfile
3515 # locations but we'll cheat by using the -M flag.
3516 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
3517 else
3518 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3519 fi
3520else
3521 echo "Keeping your $hint cppstdin wrapper."
3522fi
3523chmod 755 cppstdin
3524wrapper=`pwd`/cppstdin
3525ok='false'
3526cd UU
3527
3528if $test "X$cppstdin" != "X" && \
3529 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3530 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3531then
3532 echo "You used to use $cppstdin $cppminus so we'll use that again."
3533 case "$cpprun" in
3534 '') echo "But let's see if we can live without a wrapper..." ;;
3535 *)
3536 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3537 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3538 then
3539 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3540 ok='true'
3541 else
3542 echo "(However, $cpprun $cpplast does not work, let's see...)"
3543 fi
3544 ;;
3545 esac
3546else
3547 case "$cppstdin" in
3548 '') ;;
3549 *)
3550 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3551 ;;
3552 esac
3553fi
3554
3555if $ok; then
3556 : nothing
3557elif echo 'Maybe "'"$cc"' -E" will work...'; \
3558 $cc -E <testcpp.c >testcpp.out 2>&1; \
3559 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3560 echo "Yup, it does."
3561 x_cpp="$cc -E"
3562 x_minus='';
3563elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3564 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3565 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3566 echo "Yup, it does."
3567 x_cpp="$cc -E"
3568 x_minus='-';
3569elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3570 $cc -P <testcpp.c >testcpp.out 2>&1; \
3571 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3572 echo "Yipee, that works!"
3573 x_cpp="$cc -P"
3574 x_minus='';
3575elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3576 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3577 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3578 echo "At long last!"
3579 x_cpp="$cc -P"
3580 x_minus='-';
3581elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3582 $cpp <testcpp.c >testcpp.out 2>&1; \
3583 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3584 echo "It works!"
3585 x_cpp="$cpp"
3586 x_minus='';
3587elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3588 $cpp - <testcpp.c >testcpp.out 2>&1; \
3589 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3590 echo "Hooray, it works! I was beginning to wonder."
3591 x_cpp="$cpp"
3592 x_minus='-';
3593elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3594 $wrapper <testcpp.c >testcpp.out 2>&1; \
3595 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3596 x_cpp="$wrapper"
3597 x_minus=''
3598 echo "Eureka!"
3599else
3600 dflt=''
3601 rp="No dice. I can't find a C preprocessor. Name one:"
3602 . ./myread
3603 x_cpp="$ans"
3604 x_minus=''
3605 $x_cpp <testcpp.c >testcpp.out 2>&1
3606 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3607 echo "OK, that will do." >&4
3608 else
3609echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3610 exit 1
3611 fi
3612fi
3613
3614case "$ok" in
3615false)
3616 cppstdin="$x_cpp"
3617 cppminus="$x_minus"
3618 cpprun="$x_cpp"
3619 cpplast="$x_minus"
3620 set X $x_cpp
3621 shift
3622 case "$1" in
3623 "$cpp")
3624 echo "Perhaps can we force $cc -E using a wrapper..."
3625 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3626 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3627 then
3628 echo "Yup, we can."
3629 cppstdin="$wrapper"
3630 cppminus='';
3631 else
3632 echo "Nope, we'll have to live without it..."
3633 fi
3634 ;;
3635 esac
3636 case "$cpprun" in
3637 "$wrapper")
3638 cpprun=''
3639 cpplast=''
3640 ;;
3641 esac
3642 ;;
3643esac
3644
3645case "$cppstdin" in
3646"$wrapper"|'cppstdin') ;;
3647*) $rm -f $wrapper;;
3648esac
3649$rm -f testcpp.c testcpp.out
3650
bd9b35c9
JH
3651: decide how portable to be. Allow command line overrides.
3652case "$d_portable" in
3653"$undef") ;;
3654*) d_portable="$define" ;;
104d25b7 3655esac
85ab1d1d 3656
bd9b35c9
JH
3657: set up shell script to do ~ expansion
3658cat >filexp <<EOSS
3659$startsh
3660: expand filename
3661case "\$1" in
3662 ~/*|~)
3663 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3664 ;;
3665 ~*)
3666 if $test -f /bin/csh; then
3667 /bin/csh -f -c "glob \$1"
3668 failed=\$?
3669 echo ""
3670 exit \$failed
e5e20432 3671 else
bd9b35c9
JH
3672 name=\`$expr x\$1 : '..\([^/]*\)'\`
3673 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3674 if $test ! -d "\$dir"; then
3675 me=\`basename \$0\`
3676 echo "\$me: can't locate home directory for: \$name" >&2
3677 exit 1
3678 fi
3679 case "\$1" in
3680 */*)
3681 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3682 ;;
3683 *)
3684 echo \$dir
e5e20432
JH
3685 ;;
3686 esac
3687 fi
b691c02f 3688 ;;
4633a7c4 3689*)
bd9b35c9 3690 echo \$1
2304df62
AD
3691 ;;
3692esac
4633a7c4
LW
3693EOSS
3694chmod +x filexp
3695$eunicefix filexp
2304df62
AD
3696
3697: now set up to get a file name
28757baa 3698cat <<EOS >getfile
3699$startsh
3700EOS
3701cat <<'EOSC' >>getfile
2304df62
AD
3702tilde=''
3703fullpath=''
3704already=''
3705skip=''
3706none_ok=''
3707exp_file=''
a0d0e21e 3708nopath_ok=''
2304df62
AD
3709orig_rp="$rp"
3710orig_dflt="$dflt"
b233458b
JH
3711case "$gfpth" in
3712'') gfpth='.' ;;
3713esac
2304df62
AD
3714
3715case "$fn" in
ecfc5424 3716*\(*)
381aa1ff 3717 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3718 fn=`echo $fn | sed 's/(.*)//'`
3719 ;;
3720esac
3721
3722case "$fn" in
a0d0e21e
LW
3723*:*)
3724 loc_file=`expr $fn : '.*:\(.*\)'`
3725 fn=`expr $fn : '\(.*\):.*'`
3726 ;;
3727esac
3728
3729case "$fn" in
2304df62
AD
3730*~*) tilde=true;;
3731esac
3732case "$fn" in
3733*/*) fullpath=true;;
3734esac
3735case "$fn" in
3736*+*) skip=true;;
3737esac
3738case "$fn" in
3739*n*) none_ok=true;;
3740esac
3741case "$fn" in
3742*e*) exp_file=true;;
3743esac
a0d0e21e
LW
3744case "$fn" in
3745*p*) nopath_ok=true;;
3746esac
2304df62
AD
3747
3748case "$fn" in
3749*f*) type='File';;
3750*d*) type='Directory';;
a0d0e21e 3751*l*) type='Locate';;
2304df62
AD
3752esac
3753
3754what="$type"
3755case "$what" in
3756Locate) what='File';;
3757esac
3758
3759case "$exp_file" in
3760'')
3761 case "$d_portable" in
3762 "$define") ;;
3763 *) exp_file=true;;
3764 esac
3765 ;;
3766esac
3767
3768cd ..
3769while test "$type"; do
3770 redo=''
3771 rp="$orig_rp"
3772 dflt="$orig_dflt"
3773 case "$tilde" in
3774 true) rp="$rp (~name ok)";;
3775 esac
3776 . UU/myread
ecfc5424
AD
3777 if test -f UU/getfile.ok && \
3778 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3779 then
3780 value="$ans"
3781 ansexp="$ans"
3782 break
3783 fi
2304df62
AD
3784 case "$ans" in
3785 none)
3786 value=''
3787 ansexp=''
3788 case "$none_ok" in
3789 true) type='';;
3790 esac
3791 ;;
3792 *)
3793 case "$tilde" in
3794 '') value="$ans"
3795 ansexp="$ans";;
3796 *)
3797 value=`UU/filexp $ans`
3798 case $? in
3799 0)
3800 if test "$ans" != "$value"; then
ecfc5424 3801 echo "(That expands to $value on this system.)"
2304df62
AD
3802 fi
3803 ;;
3804 *) value="$ans";;
3805 esac
3806 ansexp="$value"
3807 case "$exp_file" in
3808 '') value="$ans";;
3809 esac
3810 ;;
3811 esac
3812 case "$fullpath" in
3813 true)
3814 case "$ansexp" in
3815 /*) value="$ansexp" ;;
23da6c43 3816 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3817 *)
3818 redo=true
3819 case "$already" in
3820 true)
3821 echo "I shall only accept a full path name, as in /bin/ls." >&4
3822 echo "Use a ! shell escape if you wish to check pathnames." >&4
3823 ;;
3824 *)
3825 echo "Please give a full path name, starting with slash." >&4
3826 case "$tilde" in
3827 true)
3828 echo "Note that using ~name is ok provided it expands well." >&4
3829 already=true
3830 ;;
3831 esac
3832 esac
3833 ;;
3834 esac
3835 ;;
3836 esac
3837 case "$redo" in
3838 '')
3839 case "$type" in
3840 File)
b233458b
JH
3841 for fp in $gfpth; do
3842 if test "X$fp" = X.; then
3843 pf="$ansexp"
3844 else
3845 pf="$fp/$ansexp"
3846 fi
3847 if test -f "$pf"; then
3848 type=''
3849 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3850 then
3851 echo "($value is not a plain file, but that's ok.)"
3852 type=''
3853 fi
3854 if test X"$type" = X; then
3855 value="$pf"
3856 break
3857 fi
3858 done
2304df62
AD
3859 ;;
3860 Directory)
b233458b
JH
3861 for fp in $gfpth; do
3862 if test "X$fp" = X.; then
f78bfc9c
JH
3863 dir="$ans"
3864 direxp="$ansexp"
b233458b 3865 else
dd858076 3866 dir="$fp/$ansexp"
f78bfc9c 3867 direxp="$fp/$ansexp"
b233458b 3868 fi
f78bfc9c 3869 if test -d "$direxp"; then
b233458b 3870 type=''
f78bfc9c 3871 value="$dir"
b233458b
JH
3872 break
3873 fi
3874 done
2304df62
AD
3875 ;;
3876 Locate)
40000a8c 3877 if test -d "$ansexp"; then
a0d0e21e
LW
3878 echo "(Looking for $loc_file in directory $value.)"
3879 value="$value/$loc_file"
40000a8c 3880 ansexp="$ansexp/$loc_file"
2304df62 3881 fi
40000a8c 3882 if test -f "$ansexp"; then
2304df62
AD
3883 type=''
3884 fi
a0d0e21e
LW
3885 case "$nopath_ok" in
3886 true) case "$value" in
3887 */*) ;;
3888 *) echo "Assuming $value will be in people's path."
3889 type=''
3890 ;;
3891 esac
3892 ;;
3893 esac
2304df62
AD
3894 ;;
3895 esac
3896
3897 case "$skip" in
3898 true) type='';
3899 esac
3900
3901 case "$type" in
3902 '') ;;
3903 *)
3904 if test "$fastread" = yes; then
3905 dflt=y
3906 else
3907 dflt=n
3908 fi
3909 rp="$what $value doesn't exist. Use that name anyway?"
3910 . UU/myread
3911 dflt=''
3912 case "$ans" in
3913 y*) type='';;
3914 *) echo " ";;
3915 esac
3916 ;;
3917 esac
3918 ;;
3919 esac
3920 ;;
3921 esac
3922done
3923cd UU
3924ans="$value"
3925rp="$orig_rp"
3926dflt="$orig_dflt"
ecfc5424 3927rm -f getfile.ok
b233458b 3928test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3929EOSC
3930
bd9b35c9
JH
3931: What should the include directory be ?
3932echo " "
3933$echo $n "Hmm... $c"
3934dflt='/usr/include'
3935incpath=''
3936mips_type=''
3937if $test -f /bin/mips && /bin/mips; then
3938 echo "Looks like a MIPS system..."
3939 $cat >usr.c <<'EOCP'
3940#ifdef SYSTYPE_BSD43
3941/bsd43
3942#endif
3943EOCP
8a27cf78 3944 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3945 dflt='/bsd43/usr/include'
3946 incpath='/bsd43'
3947 mips_type='BSD 4.3'
3948 else
3949 mips_type='System V'
3950 fi
3951 $rm -f usr.c usr.out
3952 echo "and you're compiling with the $mips_type compiler and libraries."
3953 xxx_prompt=y
3954 echo "exit 0" >mips
3955else
3956 echo "Doesn't look like a MIPS system."
3957 xxx_prompt=n
3958 echo "exit 1" >mips
3959fi
3960chmod +x mips
3961$eunicefix mips
3962case "$usrinc" in
3963'') ;;
3964*) dflt="$usrinc";;
3965esac
3966case "$xxx_prompt" in
3967y) fn=d/
3968 echo " "
3969 rp='Where are the include files you want to use?'
3970 . ./getfile
3971 usrinc="$ans"
8e07c86e 3972 ;;
bd9b35c9 3973*) usrinc="$dflt"
8e07c86e
AD
3974 ;;
3975esac
2304df62 3976
bd9b35c9
JH
3977: Set private lib path
3978case "$plibpth" in
3979'') if ./mips; then
3980 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3981 fi;;
3982esac
3983case "$libpth" in
3984' ') dlist='';;
3985'') dlist="$loclibpth $plibpth $glibpth";;
3986*) dlist="$libpth";;
3987esac
3988
3989: Now check and see which directories actually exist, avoiding duplicates
3990libpth=''
3991for xxx in $dlist
3992do
3993 if $test -d $xxx; then
3994 case " $libpth " in
3995 *" $xxx "*) ;;
3996 *) libpth="$libpth $xxx";;
3997 esac
3998 fi
3999done
4000$cat <<'EOM'
4001
4002Some systems have incompatible or broken versions of libraries. Among
4003the directories listed in the question below, please remove any you
4004know not to be holding relevant libraries, and add any that are needed.
4005Say "none" for none.
8e07c86e
AD
4006
4007EOM
bd9b35c9
JH
4008case "$libpth" in
4009'') dflt='none';;
8e07c86e 4010*)
bd9b35c9
JH
4011 set X $libpth
4012 shift
4013 dflt=${1+"$@"}
8e07c86e 4014 ;;
a0d0e21e 4015esac
bd9b35c9
JH
4016rp="Directories to use for library searches?"
4017. ./myread
4018case "$ans" in
4019none) libpth=' ';;
4020*) libpth="$ans";;
4021esac
a0d0e21e 4022
bd9b35c9
JH
4023: compute shared library extension
4024case "$so" in
4025'')
4026 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4027 dflt='sl'
dd4e71fd 4028 else
bd9b35c9 4029 dflt='so'
dd4e71fd
JH
4030 fi
4031 ;;
bd9b35c9 4032*) dflt="$so";;
dd4e71fd 4033esac
dd4e71fd
JH
4034$cat <<EOM
4035
bd9b35c9 4036On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4037you want to suppress searching of shared libraries for the remainder
bd9b35c9 4038of this configuration.
dd4e71fd
JH
4039
4040EOM
bd9b35c9
JH
4041rp='What is the file extension used for shared libraries?'
4042. ./myread
4043so="$ans"
dd4e71fd 4044
bd9b35c9
JH
4045: Define several unixisms.
4046: Hints files or command line option can be used to override them.
4047: The convoluted testing is in case hints files set either the old
4048: or the new name.
4049case "$_exe" in
4050'') case "$exe_ext" in
4051 '') ;;
4052 *) _exe="$exe_ext" ;;
dd4e71fd 4053 esac
bd9b35c9 4054 ;;
bfb7748a 4055esac
bd9b35c9
JH
4056case "$_a" in
4057'') case "$lib_ext" in
4058 '') _a='.a';;
4059 *) _a="$lib_ext" ;;
dd4e71fd
JH
4060 esac
4061 ;;
dd4e71fd 4062esac
bd9b35c9
JH
4063case "$_o" in
4064'') case "$obj_ext" in
4065 '') _o='.o';;
4066 *) _o="$obj_ext";;
4067 esac
4068 ;;
4069esac
4070case "$p_" in
4071'') case "$path_sep" in
4072 '') p_=':';;
4073 *) p_="$path_sep";;
4074 esac
4075 ;;
4076esac
4077exe_ext=$_exe
4078lib_ext=$_a
4079obj_ext=$_o
4080path_sep=$p_
dd4e71fd 4081
b4eb6b3d
JH
4082: Which makefile gets called first. This is used by make depend.
4083case "$firstmakefile" in