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