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