This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Should have been in #14285 but I have sausages for fingers.
[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#
1c6861ad 23# Generated on Sat Jan 12 23:16:55 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
868439a2
JH
1039if test -f "/system/gnu_library/bin/ar.pm"; then
1040 _exe=".pm"
1041fi
1042
b4eb6b3d 1043i_whoami=''
a33c94aa
JH
1044ccname=''
1045ccversion=''
1046perllibs=''
1047: set useposix=false in your hint file to disable the POSIX extension.
1048useposix=true
1049: set useopcode=false in your hint file to disable the Opcode extension.
1050useopcode=true
1051: Trailing extension. Override this in a hint file, if needed.
a33c94aa
JH
1052: Extra object files, if any, needed on this platform.
1053archobjs=''
1054archname=''
ff935051
JH
1055: Possible local include directories to search.
1056: Set locincpth to "" in a hint file to defeat local include searches.
1057locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1058locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1059:
1060: no include file wanted by default
1061inclwanted=''
1062
b4eb6b3d 1063groupstype=''
64615a5e 1064libnames=''
732c9516
JH
1065: change the next line if compiling for Xenix/286 on Xenix/386
1066xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1067: Possible local library directories to search.
1068loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1069loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1070
1071: general looking path for locating libraries
5869b1f1 1072glibpth="/lib /usr/lib $xlibpth"
732c9516 1073glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1074test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1075test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1076
1077: Private path used by Configure to find libraries. Its value
1078: is prepended to libpth. This variable takes care of special
1079: machines, like the mips. Usually, it should be empty.
1080plibpth=''
1081
1cfa4ec7
GS
1082: default library list
1083libswanted=''
921b2963 1084: some systems want to use only the non-versioned libso:s
1cfa4ec7 1085ignore_versioned_solibs=''
b4eb6b3d
JH
1086archname64=''
1087ccflags_uselargefiles=''
1088ldflags_uselargefiles=''
1089libswanted_uselargefiles=''
1090: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1091: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1092: set usethreads on the Configure command line to enable threads.
cd040c5e 1093usereentrant='undef'
a33c94aa
JH
1094: full support for void wanted by default
1095defvoidused=15
1096
ecfc5424 1097: List of libraries we want.
693762b4 1098: If anyone needs -lnet, put it in a hint file.
997d70a2 1099libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1100libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1101libswanted="$libswanted ndir dir crypt sec"
e61ecf27 1102libswanted="$libswanted ucb bsd BSD PW x util"
1aef975c 1103: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1104: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1105glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1106glibpth="/usr/shlib $glibpth"
1107: Do not use vfork unless overridden by a hint file.
1108usevfork=false
1109
8ff267be 1110: Find the basic shell for Bourne shell scripts
1111case "$sh" in
1112'')
8ff267be 1113 case "$SYSTYPE" in
1114 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1115 *) xxx='/bin/sh';;
1116 esac
1117 if test -f "$xxx"; then
1118 sh="$xxx"
1119 else
1120 : Build up a list and do a single loop so we can 'break' out.
1121 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1122 for xxx in sh bash ksh pdksh ash; do
1123 for p in $pth; do
1124 try="$try ${p}/${xxx}"
1125 done
1126 done
1127 for xxx in $try; do
1128 if test -f "$xxx"; then
1129 sh="$xxx";
8ff267be 1130 break
a5a94ea5
JH
1131 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1132 sh="$xxx";
1133 break
8ff267be 1134 elif test -f "$xxx.exe"; then
1135 sh="$xxx";
8ff267be 1136 break
1137 fi
1138 done
1139 fi
1140 ;;
1141esac
1142
1143case "$sh" in
a33c94aa 1144'') cat >&2 <<EOM
8ff267be 1145$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1146
8ff267be 1147Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1148Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1149we'll try to straighten this all out.
8ff267be 1150EOM
1151 exit 1
1152 ;;
1153esac
1154
760ac839 1155: see if sh knows # comments
73614538 1156if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1157 shsharp=true
1158 spitshell=cat
760ac839 1159 xcat=/bin/cat
a931254c
JH
1160 test -f $xcat$_exe || xcat=/usr/bin/cat
1161 if test ! -f $xcat$_exe; then
4bdb8fb5 1162 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1163 if test -f $p/cat$_exe; then
1deb0a86 1164 xcat=$p/cat
3c728e00
JH
1165 break
1166 fi
1167 done
1deb0a86
JH
1168 if test ! -f $xcat$_exe; then
1169 echo "Can't find cat anywhere!"
3c728e00
JH
1170 exit 1
1171 fi
1172 fi
5440bc8e
JH
1173 echo "#!$xcat" >sharp
1174 $eunicefix sharp
1175 chmod +x sharp
1176 ./sharp > today
760ac839 1177 if test -s today; then
760ac839
LW
1178 sharpbang='#!'
1179 else
5440bc8e
JH
1180 echo "#! $xcat" > sharp
1181 $eunicefix sharp
1182 chmod +x sharp
1183 ./sharp > today
760ac839 1184 if test -s today; then
760ac839
LW
1185 sharpbang='#! '
1186 else
760ac839
LW
1187 sharpbang=': use '
1188 fi
1189 fi
1190else
dfe9444c 1191 echo " "
8ff267be 1192 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1193 shsharp=false
1194 cd ..
1195 echo "exec grep -v '^[ ]*#'" >spitshell
1196 chmod +x spitshell
1197 $eunicefix spitshell
1198 spitshell=`pwd`/spitshell
1199 cd UU
1200 echo "I presume that if # doesn't work, #! won't work either!"
1201 sharpbang=': use '
1202fi
5440bc8e 1203rm -f sharp today
760ac839
LW
1204
1205: figure out how to guarantee sh startup
8ff267be 1206case "$startsh" in
1207'') startsh=${sharpbang}${sh} ;;
1208*)
760ac839 1209esac
5440bc8e 1210cat >sharp <<EOSS
760ac839
LW
1211$startsh
1212set abc
1213test "$?abc" != 1
1214EOSS
1215
5440bc8e
JH
1216chmod +x sharp
1217$eunicefix sharp
1218if ./sharp; then
8ff267be 1219 : echo "Yup, it does."
760ac839 1220else
dfe9444c
AD
1221 echo "Hmm... '$startsh' does not guarantee sh startup..."
1222 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1223fi
5440bc8e 1224rm -f sharp
760ac839 1225
aebf16e7
AD
1226
1227: Save command line options in file UU/cmdline.opt for later use in
1228: generating config.sh.
1229cat > cmdline.opt <<EOSH
1230# Configure command line arguments.
1231config_arg0='$0'
1232config_args='$*'
1233config_argc=$#
1234EOSH
1235argn=1
ee45ea83
IZ
1236args_exp=''
1237args_sep=''
aebf16e7
AD
1238for arg in "$@"; do
1239 cat >>cmdline.opt <<EOSH
1240config_arg$argn='$arg'
1241EOSH
ee45ea83
IZ
1242 # Extreme backslashitis: replace each ' by '"'"'
1243 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1244$arg
1245EOC
1246 arg_exp=`cat cmdl.opt`
1247 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1248 argn=`expr $argn + 1`
ee45ea83 1249 args_sep=' '
aebf16e7 1250done
ee45ea83
IZ
1251# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1252# used by ./hints/os2.sh
1253rm -f cmdl.opt
aebf16e7 1254
2304df62
AD
1255: produce awk script to parse command line options
1256cat >options.awk <<'EOF'
1257BEGIN {
02e93a22 1258 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1259
1260 len = length(optstr);
1261 for (i = 1; i <= len; i++) {
1262 c = substr(optstr, i, 1);
1263 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1264 if (a == ":") {
1265 arg[c] = 1;
1266 i++;
1267 }
1268 opt[c] = 1;
1269 }
1270}
1271{
1272 expect = 0;
1273 str = $0;
1274 if (substr(str, 1, 1) != "-") {
1275 printf("'%s'\n", str);
1276 next;
1277 }
1278 len = length($0);
1279 for (i = 2; i <= len; i++) {
1280 c = substr(str, i, 1);
1281 if (!opt[c]) {
1282 printf("-%s\n", substr(str, i));
1283 next;
1284 }
1285 printf("-%s\n", c);
1286 if (arg[c]) {
1287 if (i < len)
1288 printf("'%s'\n", substr(str, i + 1));
1289 else
1290 expect = 1;
1291 next;
1292 }
1293 }
1294}
1295END {
1296 if (expect)
1297 print "?";
1298}
1299EOF
1300
1301: process the command line options
4633a7c4
LW
1302set X `for arg in "$@"; do echo "X$arg"; done |
1303 sed -e s/X// | awk -f options.awk`
2304df62
AD
1304eval "set $*"
1305shift
1306rm -f options.awk
1307
1308: set up default values
1309fastread=''
1310reuseval=false
1311config_sh=''
1312alldone=''
1313error=''
1314silent=''
1315extractsh=''
ecfc5424 1316override=''
16d20bd9 1317knowitall=''
02e93a22 1318rm -f optdef.sh posthint.sh
28757baa 1319cat >optdef.sh <<EOS
1320$startsh
1321EOS
2304df62 1322
dfe9444c 1323
2304df62
AD
1324: option parsing
1325while test $# -gt 0; do
1326 case "$1" in
1327 -d) shift; fastread=yes;;
1328 -e) shift; alldone=cont;;
1329 -f)
1330 shift
1331 cd ..
1332 if test -r "$1"; then
1333 config_sh="$1"
1334 else
a0d0e21e 1335 echo "$me: cannot read config file $1." >&2
2304df62
AD
1336 error=true
1337 fi
1338 cd UU
1339 shift;;
1340 -h) shift; error=true;;
1341 -r) shift; reuseval=true;;
dfe9444c 1342 -s) shift; silent=true; realsilent=true;;
2304df62 1343 -E) shift; alldone=exit;;
16d20bd9 1344 -K) shift; knowitall=true;;
ecfc5424 1345 -O) shift; override=true;;
dfe9444c 1346 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1347 -D)
1348 shift
1349 case "$1" in
1350 *=)
1351 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1352 echo "$me: ignoring -D $1" >&2
1353 ;;
ecfc5424 1354 *=*) echo "$1" | \
1aef975c
AD
1355 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1356 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1357 esac
1358 shift
1359 ;;
1360 -U)
1361 shift
1362 case "$1" in
1aef975c 1363 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1364 *=*)
1365 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1366 echo "$me: ignoring -U $1" >&2
1367 ;;
1aef975c 1368 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1369 esac
1370 shift
1371 ;;
02e93a22
JH
1372 -A)
1373 shift
1374 xxx=''
1375 yyy="$1"
02e93a22 1376 zzz=''
5f83a3e9 1377 uuu=undef
02e93a22 1378 case "$yyy" in
5f83a3e9
JH
1379 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1380 case "$zzz" in
1381 *:*) zzz='' ;;
1382 *) xxx=append
1383 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1384 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1385 esac
1386 ;;
1387 esac
1388 case "$xxx" in
1389 '') case "$yyy" in
1390 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1391 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1392 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1393 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1394 *) xxx=`echo $yyy|sed 's!:.*!!'`
1395 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1396 esac
1397 ;;
1398 esac
02e93a22
JH
1399 case "$xxx" in
1400 append)
5f83a3e9 1401 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1402 clear)
5f83a3e9 1403 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1404 define)
1405 case "$zzz" in
1406 '') zzz=define ;;
1407 esac
5f83a3e9 1408 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1409 eval)
5f83a3e9 1410 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1411 prepend)
5f83a3e9 1412 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1413 undef)
1414 case "$zzz" in
1415 '') zzz="$uuu" ;;
1416 esac
5f83a3e9
JH
1417 echo "$yyy=$zzz" >> posthint.sh ;;
1418 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1419 esac
bde6b06b 1420 shift
02e93a22 1421 ;;
dfe9444c 1422 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1423 exit 0;;
2304df62 1424 --) break;;
a0d0e21e 1425 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1426 *) break;;
1427 esac
1428done
1429
1430case "$error" in
1431true)
1432 cat >&2 <<EOM
2afac517 1433Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1434 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1435 -d : use defaults for all answers.
1436 -e : go on without questioning past the production of config.sh.
1437 -f : specify an alternate default configuration file.
1438 -h : print this help message and exit (with an error status).
1439 -r : reuse C symbols value if possible (skips costly nm extraction).
1440 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1441 -D : define symbol to have some value:
1442 -D symbol symbol gets the value 'define'
1443 -D symbol=value symbol gets the value 'value'
2304df62 1444 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1445 -K : do not use unless you know what you are doing.
ecfc5424 1446 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1447 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1448 -U : undefine symbol:
1449 -U symbol symbol gets the value 'undef'
1450 -U symbol= symbol gets completely empty
02e93a22 1451 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1452 -A symbol=value append " "value to symbol
02e93a22
JH
1453 -A append:symbol=value append value to symbol
1454 -A define:symbol=value define symbol to have value
02e93a22
JH
1455 -A clear:symbol define symbol to be ''
1456 -A define:symbol define symbol to be 'define'
1457 -A eval:symbol=value define symbol to be eval of value
1458 -A prepend:symbol=value prepend value to symbol
1459 -A undef:symbol define symbol to be 'undef'
1460 -A undef:symbol= define symbol to be ''
2304df62
AD
1461 -V : print version number and exit (with a zero status).
1462EOM
1463 exit 1
1464 ;;
1465esac
1466
dfe9444c
AD
1467: Sanity checks
1468case "$fastread$alldone" in
1469yescont|yesexit) ;;
1470*)
aaeb8e51
GS
1471 case "$extractsh" in
1472 true) ;;
1473 *)
1474 if test ! -t 0; then
1475 echo "Say 'sh Configure', not 'sh <Configure'"
1476 exit 1
1477 fi
1478 ;;
1479 esac
dfe9444c
AD
1480 ;;
1481esac
1482
2304df62
AD
1483exec 4>&1
1484case "$silent" in
1485true) exec 1>/dev/null;;
1486esac
1487
ecfc5424 1488: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1489touch optdef.sh
1490. ./optdef.sh
02e93a22
JH
1491: create the posthint manipulation script and leave the file out there...
1492touch posthint.sh
a0d0e21e 1493
2304df62 1494: set package name
85e6fe83 1495package=perl5
b4eb6b3d
JH
1496first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1497last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1498case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1499ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1500*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1501esac
2304df62 1502
2304df62
AD
1503: Some greps do not return status, grrr.
1504echo "grimblepritz" >grimble
1505if grep blurfldyick grimble >/dev/null 2>&1 ; then
1506 contains=contains
1507elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1508 contains=grep
1509else
1510 contains=contains
1511fi
1512rm -f grimble
1513: the following should work in any shell
1514case "$contains" in
1515contains*)
1516 echo " "
1517 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1518 cat >contains <<'EOSS'
1519grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1520EOSS
1521chmod +x contains
1522esac
1523
dfe9444c
AD
1524: Find the path to the source tree
1525case "$src" in
1526'') case "$0" in
b233458b
JH
1527 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1528 case "$src" in
1529 /*) ;;
8504afb7 1530 .) ;;
b233458b
JH
1531 *) src=`cd ../$src && pwd` ;;
1532 esac
1533 ;;
dfe9444c
AD
1534 *) src='.';;
1535 esac;;
1536esac
1537case "$src" in
1538'') src=/
1539 rsrc=/
1540 ;;
1541/*) rsrc="$src";;
1542*) rsrc="../$src";;
1543esac
1544if test -f $rsrc/Configure && \
1545 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1546then
1547 : found it, so we are ok.
1548else
1549 rsrc=''
1550 for src in . .. ../.. ../../.. ../../../..; do
1551 if test -f ../$src/Configure && \
1552 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1553 then
1554 rsrc=../$src
1555 break
1556 fi
1557 done
1558fi
1559case "$rsrc" in
1560'')
1561 cat <<EOM >&4
1562
1563Sorry, I can't seem to locate the source dir for $package. Please start
1564Configure with an explicit path -- i.e. /some/path/Configure.
1565
1566EOM
1567 exit 1
1568 ;;
1569../.) rsrc='..';;
1570*)
1571 echo " "
1572 echo "Sources for $package found in \"$src\"." >&4
1573 ;;
1574esac
1575
1576: script used to extract .SH files with variable substitutions
1577cat >extract <<'EOS'
a02608de 1578PERL_CONFIG_SH=true
dfe9444c 1579echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1580if test -f MANIFEST; then
1581 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1582else
1583 echo "(Looking for .SH files under the source directory.)"
1584 set x `(cd $src; find . -name "*.SH" -print)`
1585fi
1586shift
1587case $# in
15880) set x `(cd $src; echo *.SH)`; shift;;
1589esac
1590if test ! -f $src/$1; then
1591 shift
1592fi
1593mkdir_p='
1594name=$1;
1595create="";
1596while test $name; do
1597 if test ! -d "$name"; then
1598 create="$name $create";
1599 name=`echo $name | sed -e "s|^[^/]*$||"`;
1600 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1601 else
1602 name="";
1603 fi;
1604done;
1605for file in $create; do
1606 mkdir $file;
1607done
1608'
1609for file in $*; do
1610 case "$src" in
1611 ".")
1612 case "$file" in
1613 */*)
1614 dir=`expr X$file : 'X\(.*\)/'`
1615 file=`expr X$file : 'X.*/\(.*\)'`
1616 (cd $dir && . ./$file)
1617 ;;
1618 *)
1619 . ./$file
1620 ;;
1621 esac
1622 ;;
1623 *)
1624 case "$file" in
1625 */*)
1626 dir=`expr X$file : 'X\(.*\)/'`
1627 file=`expr X$file : 'X.*/\(.*\)'`
1628 (set x $dir; shift; eval $mkdir_p)
1629 sh <$src/$dir/$file
1630 ;;
1631 *)
1632 sh <$src/$file
1633 ;;
1634 esac
1635 ;;
1636 esac
1637done
1638if test -f $src/config_h.SH; then
1639 if test ! -f config.h; then
1640 : oops, they left it out of MANIFEST, probably, so do it anyway.
1641 . $src/config_h.SH
1642 fi
1643fi
1644EOS
1645
1646: extract files and exit if asked to do so
1647case "$extractsh" in
1648true)
1649 case "$realsilent" in
1650 true) ;;
1651 *) exec 1>&4;;
1652 esac
1653 case "$config_sh" in
1654 '') config_sh='config.sh';;
1655 esac
1656 echo " "
1657 echo "Fetching answers from $config_sh..."
1658 cd ..
1659 . $config_sh
1660 test "$override" && . ./optdef.sh
1661 echo " "
1662 . UU/extract
1663 rm -rf UU
24ccb310 1664 echo "Extraction done."
dfe9444c
AD
1665 exit 0
1666 ;;
1667esac
1668
1669: Eunice requires " " instead of "", can you believe it
1670echo " "
1671: Here we go...
1672echo "Beginning of configuration questions for $package."
1673
1674trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1675
2304df62
AD
1676: first determine how to suppress newline on echo command
1677echo " "
1678echo "Checking echo to see how to suppress newlines..."
1679(echo "hi there\c" ; echo " ") >.echotmp
1680if $contains c .echotmp >/dev/null 2>&1 ; then
1681 echo "...using -n."
1682 n='-n'
1683 c=''
1684else
1685 cat <<'EOM'
1686...using \c
1687EOM
1688 n=''
1689 c='\c'
1690fi
1691echo $n "The star should be here-->$c"
1692echo '*'
1693rm -f .echotmp
1694
1695: Now test for existence of everything in MANIFEST
1696echo " "
dfe9444c 1697if test -f $rsrc/MANIFEST; then
2304df62 1698 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1699 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1700 rm -f missing
dfe9444c 1701 tmppwd=`pwd`
2304df62 1702 for filelist in x??; do
dfe9444c 1703 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1704 done
1705 if test -s missing; then
1706 cat missing >&4
1707 cat >&4 <<'EOM'
1708
1709THIS PACKAGE SEEMS TO BE INCOMPLETE.
1710
1711You have the option of continuing the configuration process, despite the
1712distinct possibility that your kit is damaged, by typing 'y'es. If you
1713do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1714and contact the author (perlbug@perl.org).
2304df62
AD
1715
1716EOM
1717 echo $n "Continue? [n] $c" >&4
1718 read ans
1719 case "$ans" in
1720 y*)
1721 echo "Continuing..." >&4
1722 rm -f missing
1723 ;;
1724 *)
1725 echo "ABORTING..." >&4
1726 kill $$
1727 ;;
1728 esac
1729 else
dfe9444c 1730 echo "Looks good..."
2304df62
AD
1731 fi
1732else
1733 echo "There is no MANIFEST file. I hope your kit is complete !"
1734fi
1735rm -f missing x??
1736
5ff3f7a4
GS
1737echo " "
1738: Find the appropriate value for a newline for tr
1739if test -n "$DJGPP"; then
1740 trnl='\012'
1741fi
1742if test X"$trnl" = X; then
1743 case "`echo foo|tr '\n' x 2>/dev/null`" in
1744 foox) trnl='\n' ;;
1745 esac
1746fi
1747if test X"$trnl" = X; then
1748 case "`echo foo|tr '\012' x 2>/dev/null`" in
1749 foox) trnl='\012' ;;
1750 esac
1751fi
1752if test X"$trnl" = X; then
1753 cat <<EOM >&2
1754
1755$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1756
1757EOM
1758 exit 1
1759fi
1760
2304df62
AD
1761: compute the number of columns on the terminal for proper question formatting
1762case "$COLUMNS" in
1763'') COLUMNS='80';;
1764esac
1765
1766: set up the echo used in my read
1767myecho="case \"\$xxxm\" in
1768'') echo $n \"\$rp $c\" >&4;;
1769*) case \"\$rp\" in
1770 '') echo $n \"[\$xxxm] $c\";;
1771 *)
1772 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1773 echo \"\$rp\" >&4
1774 echo $n \"[\$xxxm] $c\" >&4
1775 else
1776 echo $n \"\$rp [\$xxxm] $c\" >&4
1777 fi
1778 ;;
1779 esac;;
1780esac"
1781
1782: now set up to do reads with possible shell escape and default assignment
1783cat <<EOSC >myread
28757baa 1784$startsh
2304df62
AD
1785xxxm=\$dflt
1786$myecho
1787ans='!'
1788case "\$fastread" in
1789yes) case "\$dflt" in
1790 '') ;;
1791 *) ans='';
1792 case "\$silent-\$rp" in
1793 true-) ;;
1794 *) echo " " >&4;;
1795 esac;;
1796 esac;;
1797*) case "\$silent" in
1798 true) case "\$rp" in
1799 '') ans='';;
1800 esac;;
1801 esac;;
1802esac
1803while expr "X\$ans" : "X!" >/dev/null; do
1804 read answ
1805 set x \$xxxm
1806 shift
dfe9444c 1807 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1808 case "\$answ" in
dfe9444c
AD
1809 "!")
1810 sh 1>&4
1811 echo " "
1812 $myecho
1813 ;;
1814 !*)
1815 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1816 shift
1817 sh 1>&4 -c "\$*"
1818 echo " "
1819 $myecho
1820 ;;
2304df62
AD
1821 "\$ans")
1822 case "\$ans" in
ecfc5424
AD
1823 \\&*)
1824 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1825 shift
1826 case "\$1" in
1827 -d)
1828 fastread=yes
40a7a20a 1829 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1830 ;;
1831 -*)
40a7a20a 1832 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1833 ;;
1834 esac
1835 $myecho
1836 ans=!
1837 ;;
2304df62
AD
1838 esac;;
1839 *)
1840 case "\$aok" in
1841 y)
1842 echo "*** Substitution done -- please confirm."
1843 xxxm="\$ans"
c9795ab7 1844 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1845 xxxm="\$ans"
1846 ans=!
1847 ;;
1848 *)
1849 echo "*** Error -- try again."
1850 ans=!
1851 ;;
1852 esac
1853 $myecho
1854 ;;
1855 esac
1856 case "\$ans\$xxxm\$nostick" in
1857 '')
1858 ans=!
1859 $myecho
1860 ;;
1861 esac
1862done
1863case "\$ans" in
1864'') ans="\$xxxm";;
1865esac
1866EOSC
1867
1868: create .config dir to save info across Configure sessions
1869test -d ../.config || mkdir ../.config
1870cat >../.config/README <<EOF
1871This directory created by Configure to save information that should
dfe9444c 1872persist across sessions for $package.
2304df62
AD
1873
1874You may safely delete it if you wish.
1875EOF
1876
9507cadf 1877xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1878case "$usedevel" in
0107c034 1879$define|true|[yY]*) ;;
9507cadf 1880*) case "$xversion" in
0107c034
JH
1881 *[13579])
1882 cat >&4 <<EOH
1883*** WHOA THERE!!! ***
1884
1885 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1886 The version of this $package distribution is $xversion, that is, odd,
1887 (as opposed to even) and that signifies a development release.
3d5d58b1 1888 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1889
1890 Do ***NOT*** install this into production use.
1891 Data corruption and crashes are possible.
1892
1893 It is most seriously suggested that you do not continue any further
1894 unless you want to help in developing and debugging Perl.
1895
6adc6a45
JH
1896 If you *still* want to build perl, you can answer 'y' now,
1897 or pass -Dusedevel to Configure.
1898
0107c034
JH
1899EOH
1900 rp='Do you really want to continue?'
1901 dflt='n'
1902 . ./myread
1903 case "$ans" in
8feeef0e
JH
1904 [yY]) echo >&4 "Okay, continuing."
1905 usedevel="$define" ;;
0107c034
JH
1906 *) echo >&4 "Okay, bye."
1907 exit 1
1908 ;;
1909 esac
1910 ;;
1911 esac
1912 ;;
1913esac
8feeef0e
JH
1914case "$usedevel" in
1915$define|true|[yY]*)
1916 case "$versiononly" in
1917 '') versiononly="$define" ;;
1918 esac
1919 case "$installusrbinperl" in
1920 '') installusrbinperl="$undef" ;;
1921 esac
1922 ;;
1923esac
0107c034 1924
2304df62
AD
1925: general instructions
1926needman=true
1927firsttime=true
760ac839 1928user=`(logname) 2>/dev/null`
dfe9444c
AD
1929case "$user" in
1930'') user=`whoami 2>&1`;;
760ac839 1931esac
2304df62
AD
1932if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1933 firsttime=false
1934 echo " "
1935 rp='Would you like to see the instructions?'
1936 dflt=n
1937 . ./myread
1938 case "$ans" in
1939 [yY]*) ;;
1940 *) needman=false;;
1941 esac
1942fi
1943if $needman; then
1944 cat <<EOH
4e2a5f63 1945
2304df62 1946This installation shell script will examine your system and ask you questions
a0d0e21e 1947to determine how the perl5 package should be installed. If you get
2304df62
AD
1948stuck on a question, you may use a ! shell escape to start a subshell or
1949execute a command. Many of the questions will have default answers in square
1950brackets; typing carriage return will give you the default.
1951
1952On some of the questions which ask for file or directory names you are allowed
1953to use the ~name construct to specify the login directory belonging to "name",
1954even if you don't have a shell which knows about that. Questions where this is
1955allowed will be marked "(~name ok)".
1956
1957EOH
1958 rp=''
1959 dflt='Type carriage return to continue'
1960 . ./myread
1961 cat <<'EOH'
1962
1963The prompter used in this script allows you to use shell variables and
1964backticks in your answers. You may use $1, $2, etc... to refer to the words
1965in the default answer, as if the default line was a set of arguments given to a
1966script shell. This means you may also use $* to repeat the whole default line,
1967so you do not have to re-type everything to add something to the default.
1968
1969Everytime there is a substitution, you will have to confirm. If there is an
1970error (e.g. an unmatched backtick), the default answer will remain unchanged
1971and you will be prompted again.
1972
1973If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1974the questions and use the computed defaults (or the previous answers if there
1975was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1976You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1977on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1978
1979EOH
1980 . ./myread
1981 cat <<EOH
1982
1983Much effort has been expended to ensure that this shell script will run on any
1984Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1985Configure and run it again. If you can't run Configure for some reason,
1986you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1987have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1988
1989This installation script affects things in two ways:
1990
19911) it may do direct variable substitutions on some of the files included
1992 in this kit.
19932) it builds a config.h file for inclusion in C programs. You may edit
1994 any of these files as the need arises after running this script.
1995
1996If you make a mistake on a question, there is no easy way to back up to it
1997currently. The easiest thing to do is to edit config.sh and rerun all the SH
1998files. Configure will offer to let you do this before it runs the SH files.
1999
2000EOH
2001 dflt='Type carriage return to continue'
2002 . ./myread
2003 case "$firsttime" in
2004 true) echo $user >>../.config/instruct;;
2005 esac
2006fi
2007
2304df62
AD
2008: find out where common programs are
2009echo " "
2010echo "Locating common programs..." >&4
2011cat <<EOSC >loc
2012$startsh
2013case \$# in
20140) exit 1;;
2015esac
2016thing=\$1
2017shift
2018dflt=\$1
2019shift
2020for dir in \$*; do
2021 case "\$thing" in
2022 .)
2023 if test -d \$dir/\$thing; then
2024 echo \$dir
2025 exit 0
2026 fi
2027 ;;
2028 *)
a0d0e21e 2029 for thisthing in \$dir/\$thing; do
ecfc5424 2030 : just loop through to pick last item
a0d0e21e 2031 done
25f94b33 2032 if test -f \$thisthing; then
a0d0e21e 2033 echo \$thisthing
2304df62 2034 exit 0
a5a94ea5
JH
2035 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2036 echo \$thisthing
2037 exit 0
2304df62 2038 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2039 if test -n "$DJGPP"; then
2040 echo \$dir/\$thing.exe
2041 else
2042 : on Eunice apparently
2043 echo \$dir/\$thing
2044 fi
2304df62
AD
2045 exit 0
2046 fi
2047 ;;
2048 esac
2049done
2050echo \$dflt
2051exit 1
2052EOSC
2053chmod +x loc
2054$eunicefix loc
2055loclist="
2056awk
2057cat
f8006fac 2058chmod
b4eb6b3d
JH
2059comm
2060cp
2304df62
AD
2061echo
2062expr
2063grep
a0d0e21e 2064ls
b4eb6b3d 2065mkdir
2304df62
AD
2066rm
2067sed
b4eb6b3d 2068sort
85e6fe83 2069touch
2304df62 2070tr
b4eb6b3d 2071uniq
2304df62
AD
2072"
2073trylist="
2074Mcc
dfe9444c 2075ar
3659ebf1 2076bison
b4eb6b3d 2077byacc
2304df62 2078cpp
b4eb6b3d 2079csh
2304df62
AD
2080date
2081egrep
1fef16b3 2082gmake
8ff267be 2083gzip
b4eb6b3d 2084less
8ff267be 2085ln
3c728e00 2086make
b4eb6b3d 2087more
693762b4 2088nm
b4eb6b3d
JH
2089nroff
2090pg
2304df62
AD
2091test
2092uname
8ff267be 2093zip
2304df62 2094"
8e07c86e 2095pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2096pth="$pth /lib /usr/lib"
2097for file in $loclist; do
dfe9444c
AD
2098 eval xxx=\$$file
2099 case "$xxx" in
2100 /*|?:[\\/]*)
2101 if test -f "$xxx"; then
2102 : ok
2103 else
2104 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2105 xxx=`./loc $file $file $pth`
2106 fi
2107 ;;
2108 '') xxx=`./loc $file $file $pth`;;
2109 *) xxx=`./loc $xxx $xxx $pth`;;
2110 esac
a5a94ea5 2111 eval $file=$xxx$_exe
2304df62
AD
2112 eval _$file=$xxx
2113 case "$xxx" in
2114 /*)
2115 echo $file is in $xxx.
2116 ;;
8e07c86e
AD
2117 ?:[\\/]*)
2118 echo $file is in $xxx.
2119 ;;
2304df62 2120 *)
25f94b33
AD
2121 echo "I don't know where '$file' is, and my life depends on it." >&4
2122 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2123 exit 1
2304df62
AD
2124 ;;
2125 esac
2126done
2127echo " "
2128echo "Don't worry if any of the following aren't found..."
2129say=offhand
2130for file in $trylist; do
dfe9444c
AD
2131 eval xxx=\$$file
2132 case "$xxx" in
2133 /*|?:[\\/]*)
2134 if test -f "$xxx"; then
2135 : ok
2136 else
2137 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2138 xxx=`./loc $file $file $pth`
2139 fi
2140 ;;
2141 '') xxx=`./loc $file $file $pth`;;
2142 *) xxx=`./loc $xxx $xxx $pth`;;
2143 esac
2304df62
AD
2144 eval $file=$xxx
2145 eval _$file=$xxx
2146 case "$xxx" in
2147 /*)
2148 echo $file is in $xxx.
2149 ;;
8e07c86e
AD
2150 ?:[\\/]*)
2151 echo $file is in $xxx.
2152 ;;
2304df62
AD
2153 *)
2154 echo "I don't see $file out there, $say."
2155 say=either
2156 ;;
2157 esac
2158done
2159case "$egrep" in
1fef16b3 2160egrep)
2304df62
AD
2161 echo "Substituting grep for egrep."
2162 egrep=$grep
868439a2 2163 _egrep=$grep
2304df62
AD
2164 ;;
2165esac
8ff267be 2166case "$ln" in
1fef16b3 2167ln)
8ff267be 2168 echo "Substituting cp for ln."
2169 ln=$cp
868439a2 2170 _ln=$cp
8ff267be 2171 ;;
2172esac
2e26f1d5
JH
2173case "$make" in
2174make)
2175 case "$gmake" in
2176 gmake)
2177 echo "I can't find make or gmake, and my life depends on it." >&4
2178 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2179 exit 1
2180 ;;
2181 esac
2182 ;;
2183esac
2184case "$gmake" in
2185gmake) ;;
2186*) # We can't have osname yet.
1fef16b3
JH
2187 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2188 # Assume that gmake, if found, is definitely GNU make
2189 # and prefer it over the system make.
2190 echo "Substituting gmake for make."
2191 make=$gmake
868439a2 2192 _make=$gmake
1fef16b3
JH
2193 fi
2194 ;;
a5a94ea5 2195esac
2304df62
AD
2196case "$test" in
2197test)
2198 echo "Hopefully test is built into your sh."
2199 ;;
2200*)
73614538 2201 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2202 echo "Using the test built into your sh."
2304df62
AD
2203 test=test
2204 _test=test
2205 fi
2206 ;;
2207esac
2208case "$echo" in
2209echo)
2210 echo "Hopefully echo is built into your sh."
2211 ;;
2212'') ;;
2213*)
2214 echo " "
2215echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2216 $echo $n "hi there$c" >foo1
2217 echo $n "hi there$c" >foo2
2218 if cmp foo1 foo2 >/dev/null 2>&1; then
2219 echo "They are compatible. In fact, they may be identical."
2220 else
2221 case "$n" in
2222 '-n') n='' c='\c';;
2223 *) n='-n' c='';;
2224 esac
2225 cat <<FOO
2226They are not compatible! You are probably running ksh on a non-USG system.
2227I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2228have echo built in and we may have to run some Bourne shell scripts. That
2229means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2230
2231FOO
2232 $echo $n "The star should be here-->$c"
2233 $echo "*"
2234 fi
2235 $rm -f foo1 foo2
2236 ;;
2237esac
2238
2573c5f9
JH
2239cat <<EOS >checkcc
2240$startsh
2241EOS
2242cat <<'EOSC' >>checkcc
2243case "$cc" in
2244'') ;;
2245*) $rm -f try try.*
2246 $cat >try.c <<EOM
2247int main(int argc, char *argv[]) {
2248 return 0;
2249}
2250EOM
e4778687 2251 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2252 :
2253 else
2254 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2255 despair=yes
2256 trygcc=yes
2257 case "$cc" in
2258 *gcc*) trygcc=no ;;
2259 esac
2260 case "`$cc -v -c try.c 2>&1`" in
2261 *gcc*) trygcc=no ;;
2262 esac
2263 if $test X"$trygcc" = Xyes; then
2264 if gcc -o try -c try.c; then
2265 echo " "
2266 echo "You seem to have a working gcc, though." >&4
2267 rp="Would you like to use it?"
2268 dflt=y
2269 if $test -f myread; then
2270 . ./myread
2271 else
2272 if $test -f UU/myread; then
2273 . ./UU/myread
2274 else
2275 echo "Cannot find myread, sorry. Aborting." >&2
2276 exit 1
2277 fi
2278 fi
2279 case "$ans" in
e723fc21 2280 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2281 esac
2282 fi
2283 fi
2284 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2285 $cat >&4 <<EOM
2286You need to find a working C compiler.
2287Either (purchase and) install the C compiler supplied by your OS vendor,
2288or for a free C compiler try http://gcc.gnu.org/
2289I cannot continue any further, aborting.
2290EOM
2573c5f9
JH
2291 exit 1
2292 fi
2293 fi
2294 $rm -f try try.*
2295 ;;
2296esac
2297EOSC
2298
a0d0e21e
LW
2299: determine whether symbolic links are supported
2300echo " "
2301$touch blurfl
2302if $ln -s blurfl sym > /dev/null 2>&1 ; then
2303 echo "Symbolic links are supported." >&4
2304 lns="$ln -s"
2305else
2306 echo "Symbolic links are NOT supported." >&4
2307 lns="$ln"
2308fi
2309$rm -f blurfl sym
2310
dafca956
JH
2311: determine whether symbolic links are supported
2312echo " "
2313case "$lns" in
2314*"ln -s")
2315 echo "Checking how to test for symbolic links..." >&4
2316 $lns blurfl sym
4b661809 2317 if $test "X$issymlink" = X; then
2e2a97a6
JH
2318 case "$newsh" in
2319 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2320 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2321 esac
5d644a95
MB
2322 if test $? = 0; then
2323 issymlink="test -h"
2e2a97a6
JH
2324 else
2325 echo "Your builtin 'test -h' may be broken." >&4
2326 case "$test" in
2327 /*) ;;
2328 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2329 for p in $pth
2330 do
2331 if test -f "$p/$test"; then
2332 test="$p/$test"
2333 break
2334 fi
2335 done
2336 ;;
2337 esac
2338 case "$test" in
2339 /*)
2340 echo "Trying external '$test -h'." >&4
2341 issymlink="$test -h"
2342 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2343 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2344 issymlink=''
2345 fi
2346 ;;
2347 *) issymlink='' ;;
2348 esac
5d644a95
MB
2349 fi
2350 fi
4b661809 2351 if $test "X$issymlink" = X; then
dafca956 2352 if $test -L sym 2>/dev/null; then
5d644a95 2353 issymlink="$test -L"
2e2a97a6 2354 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2355 fi
2356 fi
4b661809 2357 if $test "X$issymlink" != X; then
5d644a95 2358 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2359 else
2360 echo "I do not know how you can test for symbolic links." >&4
2361 fi
2362 $rm -f blurfl sym
2363 ;;
2364*) echo "No symbolic links, so not testing for their testing..." >&4
2365 ;;
2366esac
2367echo " "
2368
2369
2370case "$mksymlinks" in
2371$define|true|[yY]*)
2372 case "$src" in
2373 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2374 exit 1
2375 ;;
4b661809 2376 *) case "$lns:$issymlink" in
7a800fca 2377 *"ln -s:"*"test -"?)
dafca956
JH
2378 echo "Creating the symbolic links..." >&4
2379 echo "(First creating the subdirectories...)" >&4
2380 cd ..
2381 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2382 read directory
2383 test -z "$directory" && break
2384 mkdir -p $directory
2385 done
2386 # Sanity check 1.
2387 if test ! -d t/base; then
2388 echo "Failed to create the subdirectories. Aborting." >&4
2389 exit 1
2390 fi
2391 echo "(Then creating the symlinks...)" >&4
2392 awk '{print $1}' $src/MANIFEST | while true; do
2393 read filename
2394 test -z "$filename" && break
2395 if test -f $filename; then
5d644a95 2396 if $issymlink $filename; then
dafca956
JH
2397 rm -f $filename
2398 fi
2399 fi
2400 if test -f $filename; then
2401 echo "$filename already exists, not symlinking."
2402 else
2403 ln -s $src/$filename $filename
2404 fi
2405 done
2406 # Sanity check 2.
a0d24b8a
JH
2407 if test ! -f t/base/lex.t; then
2408 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2409 exit 1
2410 fi
2411 cd UU
2412 ;;
2413 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2414 ;;
2415 esac
2416 ;;
2417 esac
2418 ;;
2419esac
2420
5440bc8e
JH
2421
2422case "$usecrosscompile" in
2423$define|true|[yY]*)
93bc48fa 2424 $echo "Cross-compiling..."
5440bc8e
JH
2425 croak=''
2426 case "$cc" in
2427 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2428 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2429 ar=$targetarch-ar
2430 # leave out ld, choosing it is more complex
2431 nm=$targetarch-nm
2432 ranlib=$targetarch-ranlib
93bc48fa 2433 $echo 'extern int foo;' > try.c
f8006fac 2434 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2435 shift
2436 if $test $# -gt 0; then
2437 incpth="$incpth $*"
f8006fac
JH
2438 incpth="`$echo $incpth|$sed 's/^ //'`"
2439 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2440 for i in $*; do
f8006fac 2441 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2442 if $test -d $j; then
2443 libpth="$libpth $j"
2444 fi
2445 done
f8006fac
JH
2446 libpth="`$echo $libpth|$sed 's/^ //'`"
2447 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2448 fi
2449 $rm -f try.c
5440bc8e
JH
2450 ;;
2451 esac
2452 case "$targetarch" in
93bc48fa
JH
2453 '') echo "Targetarch not defined." >&4; croak=y ;;
2454 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2455 esac
2456 case "$incpth" in
93bc48fa 2457 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2458 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2459 esac
2460 case "$libpth" in
93bc48fa 2461 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2462 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2463 esac
93bc48fa
JH
2464 case "$usrinc" in
2465 '') for i in $incpth; do
2466 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2467 usrinc=$i
2468 echo "Guessing usrinc $usrinc." >&4
2469 break
2470 fi
2471 done
2472 case "$usrinc" in
2473 '') echo "Usrinc not defined." >&4; croak=y ;;
2474 esac
2475 ;;
2476 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2477 esac
93bc48fa
JH
2478 case "$targethost" in
2479 '') echo "Targethost not defined." >&4; croak=y ;;
2480 *) echo "Using targethost $targethost." >&4
5440bc8e 2481 esac
93bc48fa
JH
2482 locincpth=' '
2483 loclibpth=' '
5440bc8e 2484 case "$croak" in
93bc48fa 2485 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2486 esac
2487 case "$src" in
2488 /*) run=$src/Cross/run
93c0359c 2489 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2490 to=$src/Cross/to
2491 from=$src/Cross/from
2492 ;;
93bc48fa 2493 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2494 run=$pwd/Cross/run
f8006fac 2495 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2496 to=$pwd/Cross/to
2497 from=$pwd/Cross/from
2498 ;;
2499 esac
2500 case "$targetrun" in
2501 '') targetrun=ssh ;;
2502 esac
2503 case "$targetto" in
2504 '') targetto=scp ;;
2505 esac
2506 case "$targetfrom" in
2507 '') targetfrom=scp ;;
2508 esac
2509 run=$run-$targetrun
2510 to=$to-$targetto
2511 from=$from-$targetfrom
93bc48fa
JH
2512 case "$targetdir" in
2513 '') targetdir=/tmp
2514 echo "Guessing targetdir $targetdir." >&4
2515 ;;
2516 esac
5440bc8e 2517 case "$targetuser" in
93bc48fa
JH
2518 '') targetuser=root
2519 echo "Guessing targetuser $targetuser." >&4
2520 ;;
5440bc8e
JH
2521 esac
2522 case "$targetfrom" in
2523 scp) q=-q ;;
2524 *) q='' ;;
2525 esac
2526 case "$targetrun" in
2527 ssh|rsh)
2528 cat >$run <<EOF
2529#!/bin/sh
93c0359c
JH
2530case "\$1" in
2531-cwd)
2532 shift
2533 cwd=\$1
2534 shift
2535 ;;
2536esac
2537case "\$cwd" in
2538'') cwd=$targetdir ;;
2539esac
5440bc8e
JH
2540exe=\$1
2541shift
93c0359c
JH
2542if $test ! -f \$exe.xok; then
2543 $to \$exe
2544 $touch \$exe.xok
2545fi
2546$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2547EOF
2548 ;;
93bc48fa 2549 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2550 exit 1
2551 ;;
2552 esac
93c0359c
JH
2553 case "$targetmkdir" in
2554 */Cross/mkdir)
2555 cat >$targetmkdir <<EOF
2556#!/bin/sh
2557$targetrun -l $targetuser $targethost "mkdir -p \$@"
2558EOF
f8006fac 2559 $chmod a+rx $targetmkdir
93c0359c
JH
2560 ;;
2561 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2562 exit 1
2563 ;;
2564 esac
5440bc8e
JH
2565 case "$targetto" in
2566 scp|rcp)
2567 cat >$to <<EOF
2568#!/bin/sh
2569for f in \$@
2570do
93c0359c
JH
2571 case "\$f" in
2572 /*)
2573 $targetmkdir \`dirname \$f\`
2574 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2575 ;;
2576 *)
2577 $targetmkdir $targetdir/\`dirname \$f\`
2578 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2579 ;;
2580 esac
5440bc8e
JH
2581done
2582exit 0
2583EOF
2584 ;;
2585 cp) cat >$to <<EOF
2586#!/bin/sh
93c0359c
JH
2587for f in \$@
2588do
2589 case "\$f" in
2590 /*)
2591 $mkdir -p $targetdir/\`dirname \$f\`
2592 $cp \$f $targetdir/\$f || exit 1
2593 ;;
2594 *)
2595 $targetmkdir $targetdir/\`dirname \$f\`
2596 $cp \$f $targetdir/\$f || exit 1
2597 ;;
2598 esac
2599done
2600exit 0
5440bc8e
JH
2601EOF
2602 ;;
93bc48fa 2603 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2604 exit 1
2605 ;;
2606 esac
2607 case "$targetfrom" in
2608 scp|rcp)
2609 cat >$from <<EOF
2610#!/bin/sh
2611for f in \$@
2612do
93c0359c 2613 $rm -f \$f
5440bc8e
JH
2614 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2615done
2616exit 0
2617EOF
2618 ;;
2619 cp) cat >$from <<EOF
2620#!/bin/sh
2621for f in \$@
2622do
93c0359c 2623 $rm -f \$f
5440bc8e
JH
2624 cp $targetdir/\$f . || exit 1
2625done
2626exit 0
2627EOF
2628 ;;
93bc48fa 2629 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2630 exit 1
2631 ;;
2632 esac
93bc48fa
JH
2633 if $test ! -f $run; then
2634 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2635 else
f8006fac 2636 $chmod a+rx $run
5440bc8e 2637 fi
93bc48fa
JH
2638 if $test ! -f $to; then
2639 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2640 else
f8006fac 2641 $chmod a+rx $to
5440bc8e 2642 fi
93bc48fa
JH
2643 if $test ! -f $from; then
2644 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2645 else
f8006fac 2646 $chmod a+rx $from
5440bc8e 2647 fi
93bc48fa 2648 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2649 exit 1
2650 fi
2651 cat >&4 <<EOF
f8006fac
JH
2652Using '$run' for remote execution,
2653and '$from' and '$to'
93bc48fa 2654for remote file transfer.
5440bc8e
JH
2655EOF
2656 ;;
2657*) run=''
2658 to=:
2659 from=:
2660 usecrosscompile='undef'
2661 targetarch=''
2662 ;;
2663esac
2664
ecfc5424
AD
2665: see whether [:lower:] and [:upper:] are supported character classes
2666echo " "
ecfc5424
AD
2667case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2668ABYZ)
2669 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2670 up='[:upper:]'
2671 low='[:lower:]'
2672 ;;
28e8609d
JH
2673*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2674 # (0xc9 and 0xd1), therefore that is a nice testing point.
2675 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2676 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2677 ij) up='[A-Z]'
2678 low='[a-z]'
2679 ;;
2680 esac
2681 fi
2682 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2683 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2684 ij) up='A-Z'
2685 low='a-z'
2686 ;;
2687 esac
2688 fi
2689 if test "X$up" = X -o "X$low" = X; then
2690 case "`echo IJ | od -x 2>/dev/null`" in
2691 *C9D1*|*c9d1*)
2692 echo "Hey, this might be EBCDIC." >&4
2693 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2694 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2695 ij) up='[A-IJ-RS-Z]'
2696 low='[a-ij-rs-z]'
2697 ;;
2698 esac
2699 fi
2700 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2701 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2702 ij) up='A-IJ-RS-Z'
2703 low='a-ij-rs-z'
2704 ;;
2705 esac
2706 fi
2707 ;;
2708 esac
2709 fi
2710esac
3eaeeeae 2711case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2712ij)
2713 echo "Using $up and $low to convert case." >&4
2714 ;;
ecfc5424 2715*)
28e8609d
JH
2716 echo "I don't know how to translate letters from upper to lower case." >&4
2717 echo "Your tr is not acting any way I know of." >&4
2718 exit 1
2719 ;;
ecfc5424
AD
2720esac
2721: set up the translation script tr, must be called with ./tr of course
2722cat >tr <<EOSC
2723$startsh
2724case "\$1\$2" in
2725'[A-Z][a-z]') exec $tr '$up' '$low';;
2726'[a-z][A-Z]') exec $tr '$low' '$up';;
2727esac
2728exec $tr "\$@"
2729EOSC
2730chmod +x tr
2731$eunicefix tr
2732
2304df62
AD
2733: Try to determine whether config.sh was made on this system
2734case "$config_sh" in
2735'')
43999f95
JH
2736myuname=`$uname -a 2>/dev/null`
2737$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2738# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2739# because the A-Z/a-z are not consecutive.
a0d0e21e 2740myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2741 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2742newmyuname="$myuname"
2304df62 2743dflt=n
16d20bd9
AD
2744case "$knowitall" in
2745'')
2746 if test -f ../config.sh; then
2747 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2748 eval "`grep myuname= ../config.sh`"
2749 fi
2750 if test "X$myuname" = "X$newmyuname"; then
2751 dflt=y
2752 fi
2304df62 2753 fi
16d20bd9
AD
2754 ;;
2755*) dflt=y;;
2756esac
2304df62
AD
2757
2758: Get old answers from old config file if Configure was run on the
2759: same system, otherwise use the hints.
2760hint=default
2761cd ..
2762if test -f config.sh; then
16d20bd9
AD
2763 echo " "
2764 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2765 . UU/myread
2766 case "$ans" in
f83701cd
AD
2767 n*|N*) echo "OK, I'll ignore it."
2768 mv config.sh config.sh.old
2769 myuname="$newmyuname"
2770 ;;
2304df62 2771 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2772 tmp_n="$n"
2773 tmp_c="$c"
85cad39c 2774 tmp_sh="$sh"
2304df62
AD
2775 . ./config.sh
2776 cp config.sh UU
ecfc5424
AD
2777 n="$tmp_n"
2778 c="$tmp_c"
85cad39c 2779 : Older versions did not always set $sh. Catch re-use of such
2780 : an old config.sh.
2781 case "$sh" in
2782 '') sh="$tmp_sh" ;;
2783 esac
2304df62
AD
2784 hint=previous
2785 ;;
2786 esac
2787fi
2573c5f9 2788. ./UU/checkcc
2304df62
AD
2789if test ! -f config.sh; then
2790 $cat <<EOM
2791
4e2a5f63
AD
2792First time through, eh? I have some defaults handy for some systems
2793that need some extra help getting the Configure answers right:
2304df62
AD
2794
2795EOM
dfe9444c 2796 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2797 dflt=''
2798 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2799 : tests or hints, please send them to perlbug@perl.org
2304df62 2800 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2801 $test -f /irix && osname=irix
85e6fe83
LW
2802 $test -f /xenix && osname=sco_xenix
2803 $test -f /dynix && osname=dynix
2804 $test -f /dnix && osname=dnix
5f05dabc 2805 $test -f /lynx.os && osname=lynxos
2806 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2807 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2808 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2809 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2810 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2811 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2812 $test -d /usr/apollo/bin && osname=apollo
2813 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2814 $test -d /usr/include/minix && osname=minix
d54344fc 2815 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2816 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2817 osname=machten
4633a7c4 2818 if $test -x /sbin/version; then
dfe9444c 2819 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2820 $sed -e 's/[A-Za-z]$//'`
2821 elif $test -x /usr/etc/version; then
dfe9444c 2822 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2823 $sed -e 's/[A-Za-z]$//'`
2824 else
2825 osvers="$2.$3"
2826 fi
2827 fi
aaacdc8b
GS
2828
2829 $test -f /sys/posix.dll &&
2830 $test -f /usr/bin/what &&
2831 set X `/usr/bin/what /sys/posix.dll` &&
2832 $test "$3" = UWIN &&
2833 osname=uwin &&
2834 osvers="$5"
2835
2304df62
AD
2836 if $test -f $uname; then
2837 set X $myuname
2838 shift
2839
2304df62 2840 case "$5" in
85e6fe83 2841 fps*) osname=fps ;;
2304df62
AD
2842 mips*)
2843 case "$4" in
85e6fe83
LW
2844 umips) osname=umips ;;
2845 *) osname=mips ;;
2304df62 2846 esac;;
85e6fe83
LW
2847 [23]100) osname=mips ;;
2848 next*) osname=next ;;
ecfc5424 2849 i386*)
c6912327
JH
2850 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2851 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2852 osname='sco'
2853 osvers=$tmp
2854 elif $test -f /etc/kconfig; then
ecfc5424 2855 osname=isc
bd628c73 2856 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2857 osvers=4
2858 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2859 osvers=3
2304df62 2860 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2861 osvers=2
ecfc5424
AD
2862 fi
2863 fi
2000072c 2864 tmp=''
ecfc5424 2865 ;;
c4f23d77
AD
2866 pc*)
2867 if test -n "$DJGPP"; then
2868 osname=dos
2869 osvers=djgpp
2870 fi
2871 ;;
2304df62
AD
2872 esac
2873
2874 case "$1" in
a0d0e21e
LW
2875 aix) osname=aix
2876 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2877 case "$tmp" in
1aef975c 2878 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2879 '<3240'|'<>3240') osvers=3.2.0 ;;
2880 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2881 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2882 *) osvers=$tmp;;
a0d0e21e
LW
2883 esac
2884 ;;
aaacdc8b
GS
2885 bsd386) osname=bsd386
2886 osvers=`$uname -r`
2887 ;;
2888 cygwin*) osname=cygwin
2889 osvers="$3"
2890 ;;
23f87696
SZ
2891 *dc.osx) osname=dcosx
2892 osvers="$3"
2893 ;;
a0d0e21e
LW
2894 dnix) osname=dnix
2895 osvers="$3"
2896 ;;
2897 domainos) osname=apollo
2898 osvers="$3"
2899 ;;
2900 dgux) osname=dgux
2901 osvers="$3"
2902 ;;
760ac839 2903 dynixptx*) osname=dynixptx
e58e581d 2904 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2905 ;;
a0d0e21e
LW
2906 freebsd) osname=freebsd
2907 osvers="$3" ;;
2908 genix) osname=genix ;;
2909 hp*) osname=hpux
bfb7748a 2910 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2911 ;;
a78b0d02 2912 irix*) osname=irix
a0d0e21e
LW
2913 case "$3" in
2914 4*) osvers=4 ;;
2915 5*) osvers=5 ;;
ecfc5424 2916 *) osvers="$3" ;;
a0d0e21e
LW
2917 esac
2918 ;;
2919 linux) osname=linux
2920 case "$3" in
a0d0e21e
LW
2921 *) osvers="$3" ;;
2922 esac
2923 ;;
28e8609d
JH
2924 MiNT) osname=mint
2925 ;;
2926 netbsd*) osname=netbsd
ecfc5424
AD
2927 osvers="$3"
2928 ;;
4e81affe
MM
2929 news-os) osvers="$3"
2930 case "$3" in
2931 4*) osname=newsos4 ;;
2932 *) osname=newsos ;;
2933 esac
2934 ;;
aaacdc8b 2935 next*) osname=next ;;
28bb1e2c 2936 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2937 POSIX-BC | posix-bc ) osname=posix-bc
2938 osvers="$3"
a0d0e21e 2939 ;;
ae3afa4e
TH
2940 powerux | power_ux | powermax_os | powermaxos | \
2941 powerunix | power_unix) osname=powerux
2942 osvers="$3"
2943 ;;
aaacdc8b
GS
2944 qnx) osname=qnx
2945 osvers="$4"
2946 ;;
a0d0e21e
LW
2947 solaris) osname=solaris
2948 case "$3" in
2949 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2950 *) osvers="$3" ;;
a0d0e21e
LW
2951 esac
2952 ;;
85e6fe83
LW
2953 sunos) osname=sunos
2954 case "$3" in
85e6fe83
LW
2955 5*) osname=solaris
2956 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2957 *) osvers="$3" ;;
2304df62
AD
2958 esac
2959 ;;
a0d0e21e 2960 titanos) osname=titanos
85e6fe83 2961 case "$3" in
a0d0e21e
LW
2962 1*) osvers=1 ;;
2963 2*) osvers=2 ;;
2964 3*) osvers=3 ;;
2965 4*) osvers=4 ;;
ecfc5424 2966 *) osvers="$3" ;;
2304df62
AD
2967 esac
2968 ;;
85e6fe83 2969 ultrix) osname=ultrix
ecfc5424 2970 osvers="$3"
2304df62 2971 ;;
28757baa 2972 osf1|mls+) case "$5" in
fed7345c
AD
2973 alpha)
2974 osname=dec_osf
2aa76180
JH
2975 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2976 case "$osvers" in
2977 [1-9].[0-9]*) ;;
2978 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2979 esac
ecfc5424
AD
2980 ;;
2981 hp*) osname=hp_osf1 ;;
2982 mips) osname=mips_osf1 ;;
85e6fe83
LW
2983 esac
2984 ;;
0337d152
BG
2985 unixware) osname=svr5
2986 osvers="$4"
2987 ;;
3c728e00 2988 uts) osname=uts
a0d0e21e
LW
2989 osvers="$3"
2990 ;;
3c728e00
JH
2991 vos) osvers="$3"
2992 ;;
85e6fe83 2993 $2) case "$osname" in
2304df62 2994 *isc*) ;;
a0d0e21e 2995 *freebsd*) ;;
5f05dabc 2996 svr*)
a0d0e21e
LW
2997 : svr4.x or possibly later
2998 case "svr$3" in
2999 ${osname}*)
3000 osname=svr$3
3001 osvers=$4
3002 ;;
3003 esac
3004 case "$osname" in
3005 svr4.0)
3006 : Check for ESIX
3007 if test -f /stand/boot ; then
3008 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3009 if test -n "$INITPROG" -a -f "$INITPROG"; then
3010 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3011 if test -n "$isesix"; then
a0d0e21e
LW
3012 osname=esix4
3013 fi
3014 fi
3015 fi
3016 ;;
3017 esac
3018 ;;
2304df62 3019 *) if test -f /etc/systemid; then
a0d0e21e
LW
3020 osname=sco
3021 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3022 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3023 osvers=$1.$2.$3
c4f23d77 3024 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3025 osvers=$1.$2
c4f23d77 3026 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3027 osvers=$1
2304df62 3028 fi
a0d0e21e
LW
3029 else
3030 case "$osname" in
3031 '') : Still unknown. Probably a generic Sys V.
3032 osname="sysv"
3033 osvers="$3"
3034 ;;
3035 esac
2304df62
AD
3036 fi
3037 ;;
3038 esac
3039 ;;
a0d0e21e
LW
3040 *) case "$osname" in
3041 '') : Still unknown. Probably a generic BSD.
3042 osname="$1"
3043 osvers="$3"
3044 ;;
3045 esac
3046 ;;
2304df62
AD
3047 esac
3048 else
dfe9444c
AD
3049 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3050 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3051 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3052 osname=news_os
2304df62 3053 fi
dfe9444c 3054 $rm -f UU/kernel.what
8e07c86e
AD
3055 elif test -d c:/.; then
3056 set X $myuname
3057 osname=os2
3058 osvers="$5"
2304df62
AD
3059 fi
3060 fi
85e6fe83 3061
5440bc8e
JH
3062 case "$targetarch" in
3063 '') ;;
3064 *) hostarch=$osname
3065 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3066 osvers=''
3067 ;;
3068 esac
3069
a0d0e21e
LW
3070 : Now look for a hint file osname_osvers, unless one has been
3071 : specified already.
3072 case "$hintfile" in
3073 ''|' ')
1e127011 3074 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3075 : Also try without trailing minor version numbers.
1e127011
DD
3076 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3077 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3078 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3079 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3080 case "$file" in
3081 '') dflt=none ;;
3082 *) case "$osvers" in
3083 '') dflt=$file
3084 ;;
dfe9444c 3085 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3086 dflt=$file
dfe9444c 3087 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3088 dflt=$xfile
dfe9444c 3089 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3090 dflt=$xxfile
dfe9444c 3091 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3092 dflt=$xxxfile
dfe9444c 3093 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3094 dflt=$xxxxfile
dfe9444c 3095 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3096 dflt="${osname}"
3097 else
3098 dflt=none
3099 fi
3100 ;;
3101 esac
85e6fe83
LW
3102 ;;
3103 esac
4e2a5f63
AD
3104 if $test -f Policy.sh ; then
3105 case "$dflt" in
3106 *Policy*) ;;
3107 none) dflt="Policy" ;;
3108 *) dflt="Policy $dflt" ;;
3109 esac
3110 fi
85e6fe83 3111 ;;
a0d0e21e 3112 *)
ecfc5424 3113 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3114 ;;
2304df62 3115 esac
1aef975c 3116
4e2a5f63
AD
3117 if $test -f Policy.sh ; then
3118 $cat <<EOM
3119
3120There's also a Policy hint file available, which should make the
3121site-specific (policy) questions easier to answer.
3122EOM
3123
3124 fi
3125
2304df62
AD
3126 $cat <<EOM
3127
3128You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3129A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3130is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3131
3132EOM
4e2a5f63 3133
2304df62 3134 rp="Which of these apply, if any?"
dfe9444c 3135 . UU/myread
85e6fe83
LW
3136 tans=$ans
3137 for file in $tans; do
4e2a5f63
AD
3138 if $test X$file = XPolicy -a -f Policy.sh; then
3139 . Policy.sh
3140 $cat Policy.sh >> UU/config.sh
3141 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3142 . $src/hints/$file.sh
3143 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3144 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3145 : nothing
3146 else
85e6fe83
LW
3147 : Give one chance to correct a possible typo.
3148 echo "$file.sh does not exist"
3149 dflt=$file
3150 rp="hint to use instead?"
dfe9444c 3151 . UU/myread
85e6fe83 3152 for file in $ans; do
dfe9444c
AD
3153 if $test -f "$src/hints/$file.sh"; then
3154 . $src/hints/$file.sh
3155 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3156 elif $test X$ans = X -o X$ans = Xnone ; then
3157 : nothing
3158 else
3159 echo "$file.sh does not exist -- ignored."
3160 fi
3161 done
2304df62
AD
3162 fi
3163 done
85e6fe83 3164
2304df62 3165 hint=recommended
85e6fe83 3166 : Remember our hint file for later.
dfe9444c 3167 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3168 hintfile="$file"
85e6fe83 3169 else
a0d0e21e 3170 hintfile=''
85e6fe83 3171 fi
2304df62
AD
3172fi
3173cd UU
3174;;
3175*)
3176 echo " "
3177 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3178 tmp_n="$n"
3179 tmp_c="$c"
2304df62
AD
3180 cd ..
3181 cp $config_sh config.sh 2>/dev/null
a78b0d02 3182 chmod +w config.sh
2304df62
AD
3183 . ./config.sh
3184 cd UU
3185 cp ../config.sh .
ecfc5424
AD
3186 n="$tmp_n"
3187 c="$tmp_c"
2304df62
AD
3188 hint=previous
3189 ;;
3190esac
1aef975c 3191test "$override" && . ./optdef.sh
2304df62
AD
3192
3193: Restore computed paths
3194for file in $loclist $trylist; do
3195 eval $file="\$_$file"
3196done
3197
85e6fe83 3198cat << EOM
a0d0e21e 3199
85e6fe83 3200Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3201The default value is probably right if the name rings a bell. Otherwise,
3202since spelling matters for me, either accept the default or answer "none"
3203to leave it blank.
a0d0e21e 3204
85e6fe83 3205EOM
85e6fe83 3206case "$osname" in
a0d0e21e 3207 ''|' ')
85e6fe83 3208 case "$hintfile" in
a0d0e21e 3209 ''|' '|none) dflt=none ;;
ecfc5424 3210 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3211 esac
3212 ;;
3213 *) dflt="$osname" ;;
3214esac
3215rp="Operating system name?"
3216. ./myread
3217case "$ans" in
ecfc5424
AD
3218none) osname='' ;;
3219*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3220esac
8ff267be 3221echo " "
3222case "$osvers" in
3223 ''|' ')
3224 case "$hintfile" in
3225 ''|' '|none) dflt=none ;;
3226 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3227 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3228 case "$dflt" in
3229 ''|' ') dflt=none ;;
3230 esac
3231 ;;
3232 esac
3233 ;;
3234 *) dflt="$osvers" ;;
3235esac
3236rp="Operating system version?"
3237. ./myread
3238case "$ans" in
3239none) osvers='' ;;
3240*) osvers="$ans" ;;
3241esac
3242
02e93a22
JH
3243
3244. ./posthint.sh
3245
2304df62 3246: who configured the system
59b83a6f 3247cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3248cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3249case "$cf_by" in
3250"")
8ff267be 3251 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3252 case "$cf_by" in
3253 "") cf_by=unknown ;;
8ff267be 3254 esac ;;
3255esac
2304df62 3256
b4eb6b3d
JH
3257: set up the script used to warn in case of inconsistency
3258cat <<EOS >whoa
3259$startsh
3260EOS
3261cat <<'EOSC' >>whoa
3262dflt=y
3263echo " "
3264echo "*** WHOA THERE!!! ***" >&4
3265echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3266rp=" Keep the $hint value?"
3267. ./myread
3268case "$ans" in
3269y) td=$was; tu=$was;;
3270esac
3271EOSC
3272
3273: function used to set $1 to $val
3274setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3275case "$val$was" in
3276$define$undef) . ./whoa; eval "$var=\$td";;
3277$undef$define) . ./whoa; eval "$var=\$tu";;
3278*) eval "$var=$val";;
3279esac'
3280
3281case "$usethreads" in
3282$define|true|[yY]*) dflt='y';;
3283*) dflt='n';;
3284esac
3285cat <<EOM
3286
3287Perl can be built to take advantage of threads on some systems.
3288To do so, Configure can be run with -Dusethreads.
3289
3290Note that threading is a highly experimental feature, and
3291some known race conditions still remain. If you choose to try
3292it, be very sure to not actually deploy it for production
3293purposes. README.threads has more details, and is required
3294reading if you enable threads.
3295
3296If this doesn't make any sense to you, just accept the default '$dflt'.
3297EOM
3298rp='Build a threading Perl?'
3299. ./myread
3300case "$ans" in
3301y|Y) val="$define" ;;
3302*) val="$undef" ;;
3303esac
3304set usethreads
3305eval $setvar
3306
3307case "$usethreads" in
3308$define)
3309 $cat <<EOM
3310
3311As of 5.5.640, Perl has two different internal threading implementations,
3312the 5.005 version (5005threads) and an interpreter-based version
3313(ithreads) that has one interpreter per thread. Both are very
3314experimental. This arrangement exists to help developers work out
3315which one is better.
3316
3317If you're a casual user, you probably don't want interpreter-threads
1a060de3
JH
3318at this time. But if you do, the 'threads' module allows their use,
3319and the 'Thread' module offers an interface to both 5005threads and
3320ithreads (whichever has been configured).
b4eb6b3d
JH
3321EOM
3322 : Default to ithreads unless overridden on command line or with
3323 : old config.sh
3324 dflt='y'
3325 case "$use5005threads" in
3326 $define|true|[yY]*) dflt='n';;
3327 esac
3328 case "$useithreads" in
3329 $undef|false|[nN]*) dflt='n';;
3330 esac
3331 rp='Use interpreter-based ithreads?'
3332 . ./myread
3333 case "$ans" in
3334 y|Y) val="$define" ;;
3335 *) val="$undef" ;;
3336 esac
3337 set useithreads
3338 eval $setvar
3339 : Now set use5005threads to the opposite value.
3340 case "$useithreads" in
3341 $define) val="$undef" ;;
3342 *) val="$define" ;;
3343 esac
3344 set use5005threads
3345 eval $setvar
3346 ;;
3347*)
3348 useithreads="$undef"
3349 use5005threads="$undef"
3350 ;;
3351esac
3352
c915ce7f
JH
3353case "$useithreads$use5005threads" in
3354"$define$define")
3355 $cat >&4 <<EOM
3356
3357You cannot have both the ithreads and the 5.005 threads enabled
3358at the same time. Disabling the 5.005 threads since they are
3359much less stable than the ithreads.
3360
3361EOM
3362 use5005threads="$undef"
3363 ;;
3364esac
3365
b4eb6b3d
JH
3366case "$d_oldpthreads" in
3367'') : Configure tests would be welcome here. For now, assume undef.
3368 val="$undef" ;;
3369*) val="$d_oldpthreads" ;;
3370esac
3371set d_oldpthreads
3372eval $setvar
3373
3374
3375case "$usethreads" in
3376"$define"|true|[yY]*)
3377: Look for a hint-file generated 'call-back-unit'. If the
3378: user has specified that a threading perl is to be built,
3379: we may need to set or change some other defaults.
3380 if $test -f usethreads.cbu; then
3381 echo "Your platform has some specific hints for threaded builds, using them..."
3382 . ./usethreads.cbu
3383 else
3384 $cat <<EOM
3385(Your platform doesn't have any specific hints for threaded builds.
3386 Assuming POSIX threads, then.)
3387EOM
3388 fi
3389 ;;
3390esac
3391
3392cat <<EOM
3393
3394Perl can be built so that multiple Perl interpreters can coexist
3395within the same Perl executable.
3396EOM
3397
3398case "$useithreads" in
3399$define)
3400 cat <<EOM
3401This multiple interpreter support is required for interpreter-based threads.
3402EOM
3403 val="$define"
3404 ;;
3405*) case "$usemultiplicity" in
3406 $define|true|[yY]*) dflt='y';;
3407 *) dflt='n';;
3408 esac
3409 echo " "
3410 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3411 rp='Build Perl for multiplicity?'
3412 . ./myread
3413 case "$ans" in
3414 y|Y) val="$define" ;;
3415 *) val="$undef" ;;
3416 esac
3417 ;;
3418esac
3419set usemultiplicity
3420eval $setvar
3421
96056487
JH
3422
3423case "$usemorebits" in
3424"$define"|true|[yY]*)
3425 use64bitint="$define"
3426 uselongdouble="$define"
3427 usemorebits="$define"
3428 ;;
3429*) usemorebits="$undef"
3430 ;;
3431esac
3432
e5e20432
JH
3433: make some quick guesses about what we are up against
3434echo " "
3435$echo $n "Hmm... $c"
3436echo exit 1 >bsd
3437echo exit 1 >usg
3438echo exit 1 >v7
3439echo exit 1 >osf1
3440echo exit 1 >eunice
3441echo exit 1 >xenix
3442echo exit 1 >venix
3443echo exit 1 >os2
3444d_bsd="$undef"
3445$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3446if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3447then
3448 echo "Looks kind of like an OSF/1 system, but we'll see..."
3449 echo exit 0 >osf1
381aa1ff 3450elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3451 xxx=`./loc addbib blurfl $pth`
3452 if $test -f $xxx; then
3453 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3454 echo exit 0 >bsd
3455 echo exit 0 >usg
3456 else
3457 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3458 echo "Looks kind of like an extended USG system, but we'll see..."
3459 else
3460 echo "Looks kind of like a USG system, but we'll see..."
3461 fi
3462 echo exit 0 >usg
3463 fi
3464elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3465 echo "Looks kind of like a BSD system, but we'll see..."
3466 d_bsd="$define"
3467 echo exit 0 >bsd
3468else
3469 echo "Looks kind of like a Version 7 system, but we'll see..."
3470 echo exit 0 >v7
3471fi
3472case "$eunicefix" in
3473*unixtovms*)
3474 $cat <<'EOI'
3475There is, however, a strange, musty smell in the air that reminds me of
3476something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3477EOI
3478 echo exit 0 >eunice
3479 d_eunice="$define"
3480: it so happens the Eunice I know will not run shell scripts in Unix format
3481 ;;
3482*)
3483 echo " "
3484 echo "Congratulations. You aren't running Eunice."
3485 d_eunice="$undef"
3486 ;;
3487esac
3488: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3489: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3490: semicolon as a patch separator
e5e20432
JH
3491case "$p_" in
3492:) ;;
3493*)
3494 $cat <<'EOI'
3495I have the feeling something is not exactly right, however...don't tell me...
3496lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3497(Or you may be running DOS with DJGPP.)
e5e20432
JH
3498EOI
3499 echo exit 0 >os2
3500 ;;
3501esac
3502if test -f /xenix; then
3503 echo "Actually, this looks more like a XENIX system..."
3504 echo exit 0 >xenix
3505 d_xenix="$define"
3506else
3507 echo " "
3508 echo "It's not Xenix..."
3509 d_xenix="$undef"
3510fi
3511chmod +x xenix
3512$eunicefix xenix
3513if test -f /venix; then
3514 echo "Actually, this looks more like a VENIX system..."
3515 echo exit 0 >venix
3516else
3517 echo " "
3518 if ./xenix; then
3519 : null
3520 else
3521 echo "Nor is it Venix..."
3522 fi
3523fi
3524chmod +x bsd usg v7 osf1 eunice xenix venix os2
3525$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3526$rm -f foo
3527
5869b1f1
JH
3528case "$cc" in
3529'') dflt=cc;;
3530*) dflt="$cc";;
3531esac
3532rp="Use which C compiler?"
3533. ./myread
3534cc="$ans"
e5e20432
JH
3535: Look for a hint-file generated 'call-back-unit'. Now that the
3536: user has specified the compiler, we may need to set or change some
3537: other defaults.
3538if $test -f cc.cbu; then
3539 . ./cc.cbu
3540fi
2573c5f9 3541. ./checkcc
8a27cf78 3542
e5e20432
JH
3543echo " "
3544echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3545$cat >try.c <<EOM
e5e20432
JH
3546#include <stdio.h>
3547int main() {
3548#ifdef __GNUC__
3549#ifdef __VERSION__
3550 printf("%s\n", __VERSION__);
3551#else
3552 printf("%s\n", "1");
3553#endif
3554#endif
3555 exit(0);
3556}
3557EOM
5440bc8e
JH
3558if $cc -o try $ccflags $ldflags try.c; then
3559 gccversion=`$run ./try`
e5e20432
JH
3560 case "$gccversion" in
3561 '') echo "You are not using GNU cc." ;;
fc68435e 3562 *) echo "You are using GNU cc $gccversion."
e723fc21 3563 ccname=gcc
fc68435e 3564 ;;
e5e20432
JH
3565 esac
3566else
3567 echo " "
3568 echo "*** WHOA THERE!!! ***" >&4
3569 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3570 case "$knowitall" in
3571 '')
3572 echo " You'd better start hunting for one and let me know about it." >&4
3573 exit 1
3574 ;;
3575 esac
3576fi
5440bc8e 3577$rm -f try try.*
e5e20432
JH
3578case "$gccversion" in
35791*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3580esac
5b463ca7
KS
3581case "$gccversion" in
3582'') gccosandvers='' ;;
10b4ebb5
JH
3583*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3584 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3585 gccshortvers=''
5b463ca7 3586 case "$gccosandvers" in
02903077
JH
3587 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3588 $osname$osvers) ;; # looking good
5b463ca7
KS
3589 $osname*) cat <<EOM >&4
3590
3591*** WHOA THERE!!! ***
3592
3593 Your gcc has not been compiled for the exact release of
3594 your operating system ($gccosandvers versus $osname$osvers).
3595
3596 In general it is a good idea to keep gcc synchronized with
3597 the operating system because otherwise serious problems
3598 may ensue when trying to compile software, like Perl.
3599
3600 I'm trying to be optimistic here, though, and will continue.
3601 If later during the configuration and build icky compilation
02903077
JH
3602 problems appear (headerfile conflicts being the most common
3603 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3604 your operating system release.
3605
3606EOM
3607 ;;
81575342 3608 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3609 esac
3610 ;;
3611esac
e723fc21
JH
3612case "$ccname" in
3613'') ccname="$cc" ;;
3614esac
e5e20432 3615
640374d0 3616
bd9b35c9
JH
3617: decide how portable to be. Allow command line overrides.
3618case "$d_portable" in
3619"$undef") ;;
3620*) d_portable="$define" ;;
104d25b7 3621esac
85ab1d1d 3622
bd9b35c9
JH
3623: set up shell script to do ~ expansion
3624cat >filexp <<EOSS
3625$startsh
3626: expand filename
3627case "\$1" in
3628 ~/*|~)
3629 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3630 ;;
3631 ~*)
3632 if $test -f /bin/csh; then
3633 /bin/csh -f -c "glob \$1"
3634 failed=\$?
3635 echo ""
3636 exit \$failed
e5e20432 3637 else
bd9b35c9
JH
3638 name=\`$expr x\$1 : '..\([^/]*\)'\`
3639 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3640 if $test ! -d "\$dir"; then
3641 me=\`basename \$0\`
3642 echo "\$me: can't locate home directory for: \$name" >&2
3643 exit 1
3644 fi
3645 case "\$1" in
3646 */*)
3647 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3648 ;;
3649 *)
3650 echo \$dir
e5e20432
JH
3651 ;;
3652 esac
3653 fi
b691c02f 3654 ;;
4633a7c4 3655*)
bd9b35c9 3656 echo \$1
2304df62
AD
3657 ;;
3658esac
4633a7c4
LW
3659EOSS
3660chmod +x filexp
3661$eunicefix filexp
2304df62
AD
3662
3663: now set up to get a file name
28757baa 3664cat <<EOS >getfile
3665$startsh
3666EOS
3667cat <<'EOSC' >>getfile
2304df62
AD
3668tilde=''
3669fullpath=''
3670already=''
3671skip=''
3672none_ok=''
3673exp_file=''
a0d0e21e 3674nopath_ok=''
2304df62
AD
3675orig_rp="$rp"
3676orig_dflt="$dflt"
b233458b
JH
3677case "$gfpth" in
3678'') gfpth='.' ;;
3679esac
2304df62
AD
3680
3681case "$fn" in
ecfc5424 3682*\(*)
381aa1ff 3683 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3684 fn=`echo $fn | sed 's/(.*)//'`
3685 ;;
3686esac
3687
3688case "$fn" in
a0d0e21e
LW
3689*:*)
3690 loc_file=`expr $fn : '.*:\(.*\)'`
3691 fn=`expr $fn : '\(.*\):.*'`
3692 ;;
3693esac
3694
3695case "$fn" in
2304df62
AD
3696*~*) tilde=true;;
3697esac
3698case "$fn" in
3699*/*) fullpath=true;;
3700esac
3701case "$fn" in
3702*+*) skip=true;;
3703esac
3704case "$fn" in
3705*n*) none_ok=true;;
3706esac
3707case "$fn" in
3708*e*) exp_file=true;;
3709esac
a0d0e21e
LW
3710case "$fn" in
3711*p*) nopath_ok=true;;
3712esac
2304df62
AD
3713
3714case "$fn" in
3715*f*) type='File';;
3716*d*) type='Directory';;
a0d0e21e 3717*l*) type='Locate';;
2304df62
AD
3718esac
3719
3720what="$type"
3721case "$what" in
3722Locate) what='File';;
3723esac
3724
3725case "$exp_file" in
3726'')
3727 case "$d_portable" in
3728 "$define") ;;
3729 *) exp_file=true;;
3730 esac
3731 ;;
3732esac
3733
3734cd ..
3735while test "$type"; do
3736 redo=''
3737 rp="$orig_rp"
3738 dflt="$orig_dflt"
3739 case "$tilde" in
3740 true) rp="$rp (~name ok)";;
3741 esac
3742 . UU/myread
ecfc5424
AD
3743 if test -f UU/getfile.ok && \
3744 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3745 then
3746 value="$ans"
3747 ansexp="$ans"
3748 break
3749 fi
2304df62
AD
3750 case "$ans" in
3751 none)
3752 value=''
3753 ansexp=''
3754 case "$none_ok" in
3755 true) type='';;
3756 esac
3757 ;;
3758 *)
3759 case "$tilde" in
3760 '') value="$ans"
3761 ansexp="$ans";;
3762 *)
3763 value=`UU/filexp $ans`
3764 case $? in
3765 0)
3766 if test "$ans" != "$value"; then
ecfc5424 3767 echo "(That expands to $value on this system.)"
2304df62
AD
3768 fi
3769 ;;
3770 *) value="$ans";;
3771 esac
3772 ansexp="$value"
3773 case "$exp_file" in
3774 '') value="$ans";;
3775 esac
3776 ;;
3777 esac
3778 case "$fullpath" in
3779 true)
3780 case "$ansexp" in
3781 /*) value="$ansexp" ;;
23da6c43 3782 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3783 *)
3784 redo=true
3785 case "$already" in
3786 true)
3787 echo "I shall only accept a full path name, as in /bin/ls." >&4
3788 echo "Use a ! shell escape if you wish to check pathnames." >&4
3789 ;;
3790 *)
3791 echo "Please give a full path name, starting with slash." >&4
3792 case "$tilde" in
3793 true)
3794 echo "Note that using ~name is ok provided it expands well." >&4
3795 already=true
3796 ;;
3797 esac
3798 esac
3799 ;;
3800 esac
3801 ;;
3802 esac
3803 case "$redo" in
3804 '')
3805 case "$type" in
3806 File)
b233458b
JH
3807 for fp in $gfpth; do
3808 if test "X$fp" = X.; then
3809 pf="$ansexp"
3810 else
3811 pf="$fp/$ansexp"
3812 fi
3813 if test -f "$pf"; then
3814 type=''
3815 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3816 then
3817 echo "($value is not a plain file, but that's ok.)"
3818 type=''
3819 fi
3820 if test X"$type" = X; then
3821 value="$pf"
3822 break
3823 fi
3824 done
2304df62
AD
3825 ;;
3826 Directory)
b233458b
JH
3827 for fp in $gfpth; do
3828 if test "X$fp" = X.; then
f78bfc9c
JH
3829 dir="$ans"
3830 direxp="$ansexp"
b233458b 3831 else
dd858076 3832 dir="$fp/$ansexp"
f78bfc9c 3833 direxp="$fp/$ansexp"
b233458b 3834 fi
f78bfc9c 3835 if test -d "$direxp"; then
b233458b 3836 type=''
f78bfc9c 3837 value="$dir"
b233458b
JH
3838 break
3839 fi
3840 done
2304df62
AD
3841 ;;
3842 Locate)
40000a8c 3843 if test -d "$ansexp"; then
a0d0e21e
LW
3844 echo "(Looking for $loc_file in directory $value.)"
3845 value="$value/$loc_file"
40000a8c 3846 ansexp="$ansexp/$loc_file"
2304df62 3847 fi
40000a8c 3848 if test -f "$ansexp"; then
2304df62
AD
3849 type=''
3850 fi
a0d0e21e
LW
3851 case "$nopath_ok" in
3852 true) case "$value" in
3853 */*) ;;
3854 *) echo "Assuming $value will be in people's path."
3855 type=''
3856 ;;
3857 esac
3858 ;;
3859 esac
2304df62
AD
3860 ;;
3861 esac
3862
3863 case "$skip" in
3864 true) type='';
3865 esac
3866
3867 case "$type" in
3868 '') ;;
3869 *)
3870 if test "$fastread" = yes; then
3871 dflt=y
3872 else
3873 dflt=n
3874 fi
3875 rp="$what $value doesn't exist. Use that name anyway?"
3876 . UU/myread
3877 dflt=''
3878 case "$ans" in
3879 y*) type='';;
3880 *) echo " ";;
3881 esac
3882 ;;
3883 esac
3884 ;;
3885 esac
3886 ;;
3887 esac
3888done
3889cd UU
3890ans="$value"
3891rp="$orig_rp"
3892dflt="$orig_dflt"
ecfc5424 3893rm -f getfile.ok
b233458b 3894test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3895EOSC
3896
bd9b35c9
JH
3897: What should the include directory be ?
3898echo " "
3899$echo $n "Hmm... $c"
3900dflt='/usr/include'
3901incpath=''
3902mips_type=''
3903if $test -f /bin/mips && /bin/mips; then
3904 echo "Looks like a MIPS system..."
3905 $cat >usr.c <<'EOCP'
3906#ifdef SYSTYPE_BSD43
3907/bsd43
3908#endif
3909EOCP
8a27cf78 3910 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3911 dflt='/bsd43/usr/include'
3912 incpath='/bsd43'
3913 mips_type='BSD 4.3'
3914 else
3915 mips_type='System V'
3916 fi
3917 $rm -f usr.c usr.out
3918 echo "and you're compiling with the $mips_type compiler and libraries."
3919 xxx_prompt=y
3920 echo "exit 0" >mips
3921else
3922 echo "Doesn't look like a MIPS system."
3923 xxx_prompt=n
3924 echo "exit 1" >mips
3925fi
3926chmod +x mips
3927$eunicefix mips
3928case "$usrinc" in
3929'') ;;
3930*) dflt="$usrinc";;
3931esac
3932case "$xxx_prompt" in
3933y) fn=d/
3934 echo " "
3935 rp='Where are the include files you want to use?'
3936 . ./getfile
3937 usrinc="$ans"
8e07c86e 3938 ;;
bd9b35c9 3939*) usrinc="$dflt"
8e07c86e
AD
3940 ;;
3941esac
2304df62 3942
96056487
JH
3943: see how we invoke the C preprocessor
3944echo " "
3945echo "Now, how can we feed standard input to your C preprocessor..." >&4
3946cat <<'EOT' >testcpp.c
3947#define ABC abc
3948#define XYZ xyz
3949ABC.XYZ
3950EOT
3951cd ..
3952if test ! -f cppstdin; then
3953 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3954 # AIX cc -E doesn't show the absolute headerfile
3955 # locations but we'll cheat by using the -M flag.
3956 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
3957 else
3958 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3959 fi
3960else
3961 echo "Keeping your $hint cppstdin wrapper."
3962fi
3963chmod 755 cppstdin
3964wrapper=`pwd`/cppstdin
3965ok='false'
3966cd UU
3967
3968if $test "X$cppstdin" != "X" && \
3969 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3970 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3971then
3972 echo "You used to use $cppstdin $cppminus so we'll use that again."
3973 case "$cpprun" in
3974 '') echo "But let's see if we can live without a wrapper..." ;;
3975 *)
3976 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3977 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3978 then
3979 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3980 ok='true'
3981 else
3982 echo "(However, $cpprun $cpplast does not work, let's see...)"
3983 fi
3984 ;;
3985 esac
3986else
3987 case "$cppstdin" in
3988 '') ;;
3989 *)
3990 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3991 ;;
3992 esac
3993fi
3994
3995if $ok; then
3996 : nothing
3997elif echo 'Maybe "'"$cc"' -E" will work...'; \
3998 $cc -E <testcpp.c >testcpp.out 2>&1; \
3999 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4000 echo "Yup, it does."
4001 x_cpp="$cc -E"
4002 x_minus='';
4003elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4004 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4005 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4006 echo "Yup, it does."
4007 x_cpp="$cc -E"
4008 x_minus='-';
4009elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4010 $cc -P <testcpp.c >testcpp.out 2>&1; \
4011 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4012 echo "Yipee, that works!"
4013 x_cpp="$cc -P"
4014 x_minus='';
4015elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4016 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4017 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4018 echo "At long last!"
4019 x_cpp="$cc -P"
4020 x_minus='-';
4021elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4022 $cpp <testcpp.c >testcpp.out 2>&1; \
4023 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4024 echo "It works!"
4025 x_cpp="$cpp"
4026 x_minus='';
4027elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4028 $cpp - <testcpp.c >testcpp.out 2>&1; \
4029 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4030 echo "Hooray, it works! I was beginning to wonder."
4031 x_cpp="$cpp"
4032 x_minus='-';
4033elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4034 $wrapper <testcpp.c >testcpp.out 2>&1; \
4035 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4036 x_cpp="$wrapper"
4037 x_minus=''
4038 echo "Eureka!"
4039else
4040 dflt=''
4041 rp="No dice. I can't find a C preprocessor. Name one:"
4042 . ./myread
4043 x_cpp="$ans"
4044 x_minus=''
4045 $x_cpp <testcpp.c >testcpp.out 2>&1
4046 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4047 echo "OK, that will do." >&4
4048 else