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