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