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