This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.000 patch.0f: [enable metaconfig (PL48) users to regenerate Configure]
[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
17# comp.sources.misc so you may fetch it yourself from your nearest
18# archive site. Check with Archie if you don't know where that can be.)
19#
20
a0d0e21e 21# $Id: Head.U,v 3.0.1.5 1994/08/29 16:03:44 ram Exp $
2304df62 22#
a0d0e21e 23# Generated on Tue Oct 11 22:49:31 EDT 1994 [metaconfig 3.0 PL35]
2304df62
AD
24
25cat >/tmp/c1$$ <<EOF
26ARGGGHHHH!!!!!
27
28SCO csh still thinks true is false. Write to SCO today and tell them that next
29year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34[End of diatribe. We now return you to your regularly scheduled programming...]
35EOF
36cat >/tmp/c2$$ <<EOF
37
38OOPS! You naughty creature! You didn't run Configure with sh!
39I will attempt to remedy the situation by running sh for you...
40EOF
41
42true || cat /tmp/c1$$ /tmp/c2$$
43true || exec sh $0 $argv:q
44
45(exit $?0) || cat /tmp/c2$$
46(exit $?0) || exec sh $0 $argv:q
47rm -f /tmp/c1$$ /tmp/c2$$
48
a0d0e21e
LW
49: compute my invocation name
50me=$0
51case "$0" in
52*/*)
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54 test "$me" || me=$0
55 ;;
56esac
57
58
59: Proper PATH setting
60paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
61paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin'
62paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
63paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin'
64paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib'
65paths=$paths:'/sbin /usr/sbin /usr/libexec'
66
67for p in $paths
68do
69 case ":$PATH:" in
70 *:$p:*) ;;
71 *) test -d $p && PATH=$PATH:$p ;;
72 esac
73done
74
75PATH=.:$PATH
2304df62
AD
76export PATH
77
a0d0e21e 78: Sanity checks
2304df62 79if test ! -t 0; then
a0d0e21e 80 echo "Say 'sh $me', not 'sh <$me'"
2304df62
AD
81 exit 1
82fi
83
84: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
85if test -f /hp-ux -a -f /bin/ksh; then
86 if (PATH=.; alias -x) >/dev/null 2>&1; then
87 : already under /bin/ksh
88 else
89 cat <<'EOM'
90(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
91EOM
92 exec /bin/ksh $0 "$@"
93 fi
94else
95 : Warn them if they use ksh on other systems
96 (PATH=.; alias -x) >/dev/null 2>&1 && \
a0d0e21e
LW
97 cat <<EOM
98(I see you are using the Korn shell. Some ksh's blow up on $me,
2304df62
AD
99especially on exotic machines. If yours does, try the Bourne shell instead.)
100EOM
101fi
102
103: Configure runs within the UU subdirectory
104test -d UU || mkdir UU
105cd UU && rm -f *
106
a0d0e21e 107dynamic_ext=''
2304df62 108extensions=''
a0d0e21e
LW
109known_extensions=''
110static_ext=''
111useposix=''
2304df62
AD
112d_eunice=''
113d_xenix=''
114eunicefix=''
115Mcc=''
116awk=''
117bash=''
118bison=''
119byacc=''
120cat=''
121chgrp=''
122chmod=''
123chown=''
124compress=''
125cp=''
126cpio=''
127cpp=''
128csh=''
129date=''
130echo=''
131egrep=''
132emacs=''
133expr=''
134find=''
135flex=''
136gcc=''
137grep=''
138inews=''
139ksh=''
140less=''
141line=''
142lint=''
143ln=''
144lp=''
145lpr=''
146ls=''
147mail=''
148mailx=''
149make=''
150mkdir=''
151more=''
152mv=''
153nroff=''
154perl=''
155pg=''
156pmake=''
157pr=''
158rm=''
159rmail=''
160sed=''
161sendmail=''
162sh=''
163shar=''
164sleep=''
165smail=''
166sort=''
167submit=''
168tail=''
169tar=''
170tbl=''
171test=''
172touch=''
173tr=''
174troff=''
175uname=''
176uniq=''
177uuname=''
178vi=''
179zcat=''
a0d0e21e 180libswanted=''
2304df62
AD
181hint=''
182myuname=''
85e6fe83
LW
183osname=''
184osvers=''
2304df62
AD
185Author=''
186Date=''
187Header=''
188Id=''
189Locker=''
190Log=''
191RCSfile=''
192Revision=''
193Source=''
194State=''
195afs=''
a0d0e21e
LW
196alignbytes=''
197archlib=''
198archlibexp=''
199archname=''
200d_archlib=''
201installarchlib=''
2304df62
AD
202bin=''
203binexp=''
204installbin=''
205byteorder=''
206cc=''
207gccversion=''
208ccflags=''
209cppflags=''
210ldflags=''
211lkflags=''
212optimize=''
213cf_by=''
214cf_time=''
215contains=''
a0d0e21e 216cpp_stuff=''
2304df62
AD
217cpplast=''
218cppminus=''
219cpprun=''
220cppstdin=''
221d_access=''
a0d0e21e
LW
222d_alarm=''
223d_attrib=''
2304df62
AD
224d_bcmp=''
225d_bcopy=''
226d_bzero=''
227d_casti32=''
228castflags=''
229d_castneg=''
230d_charsprf=''
a0d0e21e
LW
231d_chown=''
232d_chroot=''
2304df62 233d_chsize=''
a0d0e21e
LW
234d_closedir=''
235d_void_closedir=''
2304df62
AD
236d_const=''
237cryptlib=''
238d_crypt=''
239d_csh=''
a0d0e21e
LW
240d_cuserid=''
241d_dbl_dig=''
242d_difftime=''
243d_dlerror=''
244d_dlopen=''
245d_dlsymun=''
2304df62 246d_dosuid=''
a0d0e21e
LW
247d_suidsafe=''
248d_drem=''
2304df62
AD
249d_dup2=''
250d_fchmod=''
251d_fchown=''
252d_fcntl=''
a0d0e21e
LW
253d_fd_macros=''
254d_fd_set=''
255d_fds_bits=''
256d_fgetpos=''
2304df62
AD
257d_flexfnam=''
258d_flock=''
a0d0e21e
LW
259d_fmod=''
260d_fork=''
261d_fsetpos=''
262d_Gconvert=''
2304df62
AD
263d_getgrps=''
264d_gethent=''
265aphostname=''
266d_gethname=''
267d_phostname=''
268d_uname=''
a0d0e21e 269d_getlogin=''
2304df62
AD
270d_getpgrp2=''
271d_getpgrp=''
a0d0e21e 272d_getppid=''
2304df62 273d_getprior=''
a0d0e21e 274d_group=''
2304df62
AD
275d_htonl=''
276d_isascii=''
277d_killpg=''
278d_link=''
a0d0e21e
LW
279d_linuxstd=''
280d_locconv=''
281d_lockf=''
2304df62 282d_lstat=''
a0d0e21e
LW
283d_mblen=''
284d_mbstowcs=''
285d_mbtowc=''
2304df62
AD
286d_memcmp=''
287d_memcpy=''
288d_memmove=''
289d_memset=''
290d_mkdir=''
a0d0e21e
LW
291d_mkfifo=''
292d_mktime=''
2304df62
AD
293d_msg=''
294d_msgctl=''
295d_msgget=''
296d_msgrcv=''
297d_msgsnd=''
a0d0e21e 298d_nice=''
2304df62 299d_open3=''
a0d0e21e
LW
300d_passwd=''
301d_fpathconf=''
302d_pathconf=''
303d_pause=''
304d_pipe=''
2304df62
AD
305d_portable=''
306d_readdir=''
85e6fe83
LW
307d_rewinddir=''
308d_seekdir=''
309d_telldir=''
a0d0e21e 310d_readlink=''
2304df62
AD
311d_rename=''
312d_rmdir=''
313d_safebcpy=''
314d_safemcpy=''
315d_select=''
316d_sem=''
317d_semctl=''
318d_semget=''
319d_semop=''
320d_setegid=''
321d_seteuid=''
a0d0e21e 322d_setlinebuf=''
2304df62
AD
323d_setlocale=''
324d_setpgid=''
325d_setpgrp2=''
326d_bsdpgrp=''
327d_setpgrp=''
328d_setprior=''
329d_setregid=''
330d_setresgid=''
331d_setresuid=''
332d_setreuid=''
333d_setrgid=''
334d_setruid=''
335d_setsid=''
336d_shm=''
337d_shmat=''
a0d0e21e
LW
338d_shmatprototype=''
339shmattype=''
2304df62
AD
340d_shmctl=''
341d_shmdt=''
342d_shmget=''
343d_oldsock=''
344d_socket=''
345d_sockpair=''
346sockethdr=''
347socketlib=''
348d_statblks=''
349d_stdstdio=''
350d_index=''
351d_strchr=''
a0d0e21e 352d_strcoll=''
2304df62
AD
353d_strctcpy=''
354d_strerrm=''
355d_strerror=''
356d_sysernlst=''
357d_syserrlst=''
a0d0e21e 358d_strxfrm=''
2304df62
AD
359d_symlink=''
360d_syscall=''
a0d0e21e 361d_sysconf=''
2304df62 362d_system=''
a0d0e21e
LW
363d_tcgetpgrp=''
364d_tcsetpgrp=''
85e6fe83
LW
365d_time=''
366timetype=''
2304df62
AD
367clocktype=''
368d_times=''
369d_truncate=''
a0d0e21e
LW
370d_tzname=''
371d_umask=''
2304df62 372d_vfork=''
a0d0e21e 373usevfork=''
2304df62
AD
374d_voidsig=''
375signal_t=''
376d_volatile=''
377d_charvspr=''
378d_vprintf=''
379d_wait4=''
380d_waitpid=''
a0d0e21e
LW
381d_wcstombs=''
382d_wctomb=''
383dlext=''
85e6fe83
LW
384cccdlflags=''
385ccdlflags=''
2304df62 386dlsrc=''
85e6fe83 387lddlflags=''
2304df62 388usedl=''
a0d0e21e 389fpostype=''
2304df62
AD
390gidtype=''
391groupstype=''
392h_fcntl=''
393h_sysfile=''
a0d0e21e 394i_db=''
2304df62
AD
395i_dbm=''
396d_dirnamlen=''
a0d0e21e 397direntrytype=''
2304df62 398i_dirent=''
a0d0e21e 399i_dld=''
2304df62
AD
400i_dlfcn=''
401i_fcntl=''
a0d0e21e 402i_float=''
2304df62
AD
403i_gdbm=''
404i_grp=''
a0d0e21e
LW
405i_limits=''
406i_malloc=''
407i_math=''
85e6fe83 408i_memory=''
2304df62 409i_ndbm=''
85e6fe83 410i_neterrno=''
2304df62
AD
411i_niin=''
412i_sysin=''
413d_pwage=''
414d_pwchange=''
415d_pwclass=''
416d_pwcomment=''
417d_pwexpire=''
418d_pwquota=''
419i_pwd=''
2304df62 420i_stddef=''
a0d0e21e 421i_stdlib=''
2304df62
AD
422i_string=''
423strings=''
424i_sysdir=''
425i_sysfile=''
426d_voidtty=''
427i_bsdioctl=''
a0d0e21e 428i_sysfilio=''
2304df62
AD
429i_sysioctl=''
430i_syssockio=''
431i_sysndir=''
a0d0e21e 432i_sysparam=''
2304df62 433i_sysselct=''
a0d0e21e 434i_systimes=''
2304df62
AD
435i_sgtty=''
436i_termio=''
437i_termios=''
438i_systime=''
439i_systimek=''
440i_time=''
441timeincl=''
85e6fe83 442i_unistd=''
2304df62 443i_utime=''
a0d0e21e 444i_stdarg=''
2304df62
AD
445i_varargs=''
446i_varhdr=''
447i_vfork=''
448intsize=''
2304df62 449libc=''
a0d0e21e 450glibpth=''
2304df62
AD
451libpth=''
452plibpth=''
453xlibpth=''
454libs=''
85e6fe83
LW
455lns=''
456lseektype=''
457d_mymalloc=''
2304df62
AD
458mallocobj=''
459mallocsrc=''
460malloctype=''
461usemymalloc=''
462installmansrc=''
463manext=''
464mansrc=''
465mansrcexp=''
466huge=''
467large=''
468medium=''
469models=''
470small=''
471split=''
a0d0e21e 472modetype=''
2304df62
AD
473mydomain=''
474myhostname=''
475phostname=''
476c=''
477n=''
478groupcat=''
479hostcat=''
480passcat=''
85e6fe83
LW
481orderlib=''
482ranlib=''
2304df62
AD
483package=''
484spackage=''
a0d0e21e 485prefix=''
2304df62
AD
486installprivlib=''
487privlib=''
488privlibexp=''
489prototype=''
490randbits=''
491installscript=''
492scriptdir=''
493scriptdirexp=''
a0d0e21e 494selecttype=''
2304df62 495sig_name=''
a0d0e21e
LW
496sizetype=''
497so=''
2304df62
AD
498sharpbang=''
499shsharp=''
500spitshell=''
a0d0e21e 501ssizetype=''
2304df62
AD
502startsh=''
503stdchar=''
504sysman=''
505uidtype=''
506nm_opt=''
507runnm=''
508usenm=''
509incpath=''
510mips=''
511mips_type=''
512usrinc=''
513defvoidused=''
514voidflags=''
515yacc=''
516yaccflags=''
517CONFIG=''
518
519: script used to extract .SH files with variable substitutions
520cat >extract <<'EOS'
521CONFIG=true
522echo "Doing variable substitutions on .SH files..."
523if test -f MANIFEST; then
a0d0e21e
LW
524 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
525 : Pick up possible extension manifests.
526 for dir in ext/* ; do
527 if test -f $dir/MANIFEST; then
528 xxx=`awk '{print $1}' < $dir/MANIFEST |
529 sed -n "/\.SH$/ s@^@$dir/@p"`
530 shlist="$shlist $xxx"
531 fi
532 done
533 set x $shlist
2304df62
AD
534else
535 echo "(Looking for .SH files under the current directory.)"
536 set x `find . -name "*.SH" -print`
537fi
538shift
539case $# in
5400) set x *.SH; shift;;
541esac
542if test ! -f $1; then
543 shift
544fi
545for file in $*; do
546 case "$file" in
547 */*)
548 dir=`expr X$file : 'X\(.*\)/'`
549 file=`expr X$file : 'X.*/\(.*\)'`
550 (cd $dir && . ./$file)
551 ;;
552 *)
553 . ./$file
554 ;;
555 esac
556done
557if test -f config_h.SH; then
558 if test ! -f config.h; then
559 : oops, they left it out of MANIFEST, probably, so do it anyway.
560 . ./config_h.SH
561 fi
562fi
563EOS
564
565: produce awk script to parse command line options
566cat >options.awk <<'EOF'
567BEGIN {
a0d0e21e 568 optstr = "deEf:hrsSD:U:V"; # getopt-style specification
2304df62
AD
569
570 len = length(optstr);
571 for (i = 1; i <= len; i++) {
572 c = substr(optstr, i, 1);
573 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
574 if (a == ":") {
575 arg[c] = 1;
576 i++;
577 }
578 opt[c] = 1;
579 }
580}
581{
582 expect = 0;
583 str = $0;
584 if (substr(str, 1, 1) != "-") {
585 printf("'%s'\n", str);
586 next;
587 }
588 len = length($0);
589 for (i = 2; i <= len; i++) {
590 c = substr(str, i, 1);
591 if (!opt[c]) {
592 printf("-%s\n", substr(str, i));
593 next;
594 }
595 printf("-%s\n", c);
596 if (arg[c]) {
597 if (i < len)
598 printf("'%s'\n", substr(str, i + 1));
599 else
600 expect = 1;
601 next;
602 }
603 }
604}
605END {
606 if (expect)
607 print "?";
608}
609EOF
610
611: process the command line options
612set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
613eval "set $*"
614shift
615rm -f options.awk
616
617: set up default values
618fastread=''
619reuseval=false
620config_sh=''
621alldone=''
622error=''
623silent=''
624extractsh=''
a0d0e21e 625optdef='optdef.sh'
2304df62
AD
626
627: option parsing
628while test $# -gt 0; do
629 case "$1" in
630 -d) shift; fastread=yes;;
631 -e) shift; alldone=cont;;
632 -f)
633 shift
634 cd ..
635 if test -r "$1"; then
636 config_sh="$1"
637 else
a0d0e21e 638 echo "$me: cannot read config file $1." >&2
2304df62
AD
639 error=true
640 fi
641 cd UU
642 shift;;
643 -h) shift; error=true;;
644 -r) shift; reuseval=true;;
645 -s) shift; silent=true;;
646 -E) shift; alldone=exit;;
647 -S) shift; extractsh=true;;
a0d0e21e
LW
648 -D)
649 shift
650 case "$1" in
651 *=)
652 echo "$me: use '-U symbol=', not '-D symbol='." >&2
653 echo "$me: ignoring -D $1" >&2
654 ;;
655 *=*) echo "$1" >> $optdef;;
656 *) echo "$1='define'" >> $optdef;;
657 esac
658 shift
659 ;;
660 -U)
661 shift
662 case "$1" in
663 *=) echo "$1" >> $optdef;;
664 *=*)
665 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
666 echo "$me: ignoring -U $1" >&2
667 ;;
668 *) echo "$1='undef'" >> $optdef;;
669 esac
670 shift
671 ;;
672 -V) echo "$me generated by metaconfig 3.0 PL35." >&2
2304df62
AD
673 exit 0;;
674 --) break;;
a0d0e21e 675 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
676 *) break;;
677 esac
678done
679
680case "$error" in
681true)
682 cat >&2 <<EOM
a0d0e21e
LW
683Usage: $me [-dehrESV] [-f config.sh] [-D symbol] [-D symbol=value]
684 [-U symbol] [-U symbol=]
2304df62
AD
685 -d : use defaults for all answers.
686 -e : go on without questioning past the production of config.sh.
687 -f : specify an alternate default configuration file.
688 -h : print this help message and exit (with an error status).
689 -r : reuse C symbols value if possible (skips costly nm extraction).
690 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
691 -D : define symbol to have some value:
692 -D symbol symbol gets the value 'define'
693 -D symbol=value symbol gets the value 'value'
2304df62
AD
694 -E : stop at the end of questions, after having produced config.sh.
695 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
696 -U : undefine symbol:
697 -U symbol symbol gets the value 'undef'
698 -U symbol= symbol gets completely empty
2304df62
AD
699 -V : print version number and exit (with a zero status).
700EOM
701 exit 1
702 ;;
703esac
704
705exec 4>&1
706case "$silent" in
707true) exec 1>/dev/null;;
708esac
709
a0d0e21e
LW
710: run the defines and the undefines, if any
711touch $optdef
712. ./$optdef
713rm -f $optdef
714
2304df62
AD
715case "$extractsh" in
716true)
717 case "$config_sh" in
718 '') config_sh='config.sh'; config='./config.sh';;
719 /*) config="$config_sh";;
720 *) config="./$config_sh";;
721 esac
722 echo " "
723 echo "Fetching answers from $config_sh..."
724 cd ..
725 . $config
726 echo " "
727 . ./UU/extract
728 rm -rf UU
729 echo "Done."
730 exit 0
731 ;;
732esac
733
734: set package name
85e6fe83 735package=perl5
2304df62
AD
736
737: Eunice requires " " instead of "", can you believe it
738echo " "
739: Here we go...
740echo "Beginning of configuration questions for $package."
741
742define='define'
743undef='undef'
744smallmach='pdp11 i8086 z8000 i80286 iAPX286'
745rmlist=''
746
747trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
748
749: We must find out about Eunice early
750eunicefix=':'
751if test -f /etc/unixtovms; then
752 eunicefix=/etc/unixtovms
753fi
754if test -f /etc/unixtovms.exe; then
755 eunicefix=/etc/unixtovms.exe
756fi
757
758: list of known cpp symbols
a0d0e21e
LW
759al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CRAY DGUX DOLPHIN DPX2"
760al="$al GO32 HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
761al="$al MIPSEB MIPSEL MSDOS MTXINU MVS"
762al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
763al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
764al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
765al="$al PWB R3000 SVR3 SVR4"
766al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV"
767al="$al UTEK UTS UTek UnicomPBB UnicomPBD Utek VMS"
768al="$al _AIX _AIX32 _AM29000 _COFF _CRAY _EPI _IBMR2"
769al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
770al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _R3000"
771al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
772al="$al _SYSTYPE_SYSV _SYSV3 _UNICOS"
773al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
774al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
775al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
776al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
777al="$al __Next__ __OSF1__ __PARAGON__ __PWB __STDC__"
778al="$al ____386BSD____ __alpha __alpha__ __amiga"
779al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
780al="$al __host_mips__"
781al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
782al="$al __hp9000s500 __hp9000s700 __hp9000s800"
783al="$al __hppa __hpux __i286 __i286__ __i386 __i386__"
784al="$al __i486 __i486__ __i860 __i860__"
785al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
786al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
787al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
788al="$al __mc88100 __mc88100__ __mips __mips__"
789al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
790al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
791al="$al __unix __unix__ __vax __vax__"
792al="$al _host_mips _mips _unix"
793al="$al a29k aegis alliant am29000 amiga ansi"
794al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bull"
795al="$al convex cray ctix encore gcos gimpel"
796al="$al hcx host_mips hp200 hp300 hp700 hp800"
797al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
798al="$al hp9000s700 hp9000s800 hp9k8 hpux"
799al="$al i186 i286 i386 i486 i8086"
800al="$al i80960 i860 iAPX286 ibm interdata is68k"
801al="$al linux luna luna88k m68k m88100 m88k"
802al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
803al="$al mc68040 mc68060 mc68k mc68k32 mc700"
804al="$al mc88000 mc88100 merlin mert mips mvs n16"
805al="$al ncl_el ncl_mr"
806al="$al news1500 news1700 news1800 news1900 news3700"
807al="$al news700 news800 news900 ns16000 ns32000"
808al="$al ns32016 ns32332 ns32k nsc32000 os osf"
809al="$al parisc pc532 pdp11 plexus posix pyr"
810al="$al riscix riscos sequent sgi sinix sony sony_news"
811al="$al sonyrisc sparc sparclite spectrum stratos"
812al="$al sun sun3 sun386 svr4 sysV68 sysV88"
813al="$al tower tower32 tower32_200 tower32_600 tower32_700"
814al="$al tower32_800 tower32_850 tss u3b u3b2 u3b20 u3b200"
815al="$al u3b5 ultrix unix unixpc unos vax venix vms"
816al="$al xenix z8000"
2304df62
AD
817
818i_whoami=''
2304df62
AD
819: change the next line if compiling for Xenix/286 on Xenix/386
820xlibpth='/usr/lib/386 /lib/386'
821
822: general looking path for locating libraries
a0d0e21e
LW
823glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
824glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
825glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
2304df62
AD
826
827: Private path used by Configure to find libraries. Its value
a0d0e21e 828: is prepended to libpth. This variable takes care of special
2304df62
AD
829: machines, like the mips. Usually, it should be empty.
830plibpth=''
831
2304df62
AD
832: full support for void wanted by default
833defvoidused=15
834
a0d0e21e
LW
835: set useposix=false in your hint file to disable the POSIX extension.
836useposix=true
837gccversion=''
838: no include file wanted by default
839inclwanted=''
840
841groupstype=''
842: default library list
843libswanted=''
844: List of libraries we want.
845libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
846libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
847libswanted="$libswanted ucb bsd BSD PW x"
848: We want to search /usr/shlib before most other libraries.
849: This is only used by ext/util/extliblist
850glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
851glibpth="/usr/shlib $glibpth"
852: Do not use vfork unless overridden by a hint file.
853usevfork=false
854: We can look for titanos too.
855al="$al ardent titan"
2304df62
AD
856
857: Some greps do not return status, grrr.
858echo "grimblepritz" >grimble
859if grep blurfldyick grimble >/dev/null 2>&1 ; then
860 contains=contains
861elif grep grimblepritz grimble >/dev/null 2>&1 ; then
862 contains=grep
863else
864 contains=contains
865fi
866rm -f grimble
867: the following should work in any shell
868case "$contains" in
869contains*)
870 echo " "
871 echo "AGH! Grep doesn't return a status. Attempting remedial action."
872 cat >contains <<'EOSS'
873grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
874EOSS
875chmod +x contains
876esac
877
878: first determine how to suppress newline on echo command
879echo " "
880echo "Checking echo to see how to suppress newlines..."
881(echo "hi there\c" ; echo " ") >.echotmp
882if $contains c .echotmp >/dev/null 2>&1 ; then
883 echo "...using -n."
884 n='-n'
885 c=''
886else
887 cat <<'EOM'
888...using \c
889EOM
890 n=''
891 c='\c'
892fi
893echo $n "The star should be here-->$c"
894echo '*'
895rm -f .echotmp
896
897: Now test for existence of everything in MANIFEST
898echo " "
899if test -f ../MANIFEST; then
900 echo "First let's make sure your kit is complete. Checking..." >&4
901 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
902 rm -f missing
903 for filelist in x??; do
904 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
905 done
906 if test -s missing; then
907 cat missing >&4
908 cat >&4 <<'EOM'
909
910THIS PACKAGE SEEMS TO BE INCOMPLETE.
911
912You have the option of continuing the configuration process, despite the
913distinct possibility that your kit is damaged, by typing 'y'es. If you
914do, don't blame me if something goes wrong. I advise you to type 'n'o
915and contact the author (lwall@netlabs.com).
916
917EOM
918 echo $n "Continue? [n] $c" >&4
919 read ans
920 case "$ans" in
921 y*)
922 echo "Continuing..." >&4
923 rm -f missing
924 ;;
925 *)
926 echo "ABORTING..." >&4
927 kill $$
928 ;;
929 esac
930 else
931 echo "Looks good..." >&4
932 fi
933else
934 echo "There is no MANIFEST file. I hope your kit is complete !"
935fi
936rm -f missing x??
937
938: compute the number of columns on the terminal for proper question formatting
939case "$COLUMNS" in
940'') COLUMNS='80';;
941esac
942
943: set up the echo used in my read
944myecho="case \"\$xxxm\" in
945'') echo $n \"\$rp $c\" >&4;;
946*) case \"\$rp\" in
947 '') echo $n \"[\$xxxm] $c\";;
948 *)
949 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
950 echo \"\$rp\" >&4
951 echo $n \"[\$xxxm] $c\" >&4
952 else
953 echo $n \"\$rp [\$xxxm] $c\" >&4
954 fi
955 ;;
956 esac;;
957esac"
958
959: now set up to do reads with possible shell escape and default assignment
960cat <<EOSC >myread
961xxxm=\$dflt
962$myecho
963ans='!'
964case "\$fastread" in
965yes) case "\$dflt" in
966 '') ;;
967 *) ans='';
968 case "\$silent-\$rp" in
969 true-) ;;
970 *) echo " " >&4;;
971 esac;;
972 esac;;
973*) case "\$silent" in
974 true) case "\$rp" in
975 '') ans='';;
976 esac;;
977 esac;;
978esac
979while expr "X\$ans" : "X!" >/dev/null; do
980 read answ
981 set x \$xxxm
982 shift
983 aok=''; eval "ans=\"\$answ\"" && aok=y
984 case "\$answ" in
985 "\$ans")
986 case "\$ans" in
987 "!")
988 sh 1>&4
989 echo " "
990 $myecho
991 ;;
992 !*)
993 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
994 shift
995 sh 1>&4 -c "\$*"
996 echo " "
997 $myecho
998 ;;
999 esac;;
1000 *)
1001 case "\$aok" in
1002 y)
1003 echo "*** Substitution done -- please confirm."
1004 xxxm="\$ans"
1005 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1006 xxxm="\$ans"
1007 ans=!
1008 ;;
1009 *)
1010 echo "*** Error -- try again."
1011 ans=!
1012 ;;
1013 esac
1014 $myecho
1015 ;;
1016 esac
1017 case "\$ans\$xxxm\$nostick" in
1018 '')
1019 ans=!
1020 $myecho
1021 ;;
1022 esac
1023done
1024case "\$ans" in
1025'') ans="\$xxxm";;
1026esac
1027EOSC
1028
1029: create .config dir to save info across Configure sessions
1030test -d ../.config || mkdir ../.config
1031cat >../.config/README <<EOF
1032This directory created by Configure to save information that should
1033persist across sessions.
1034
1035You may safely delete it if you wish.
1036EOF
1037
1038: general instructions
1039needman=true
1040firsttime=true
1041user=`( (logname) 2>/dev/null || whoami) 2>&1`
1042if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1043 firsttime=false
1044 echo " "
1045 rp='Would you like to see the instructions?'
1046 dflt=n
1047 . ./myread
1048 case "$ans" in
1049 [yY]*) ;;
1050 *) needman=false;;
1051 esac
1052fi
1053if $needman; then
1054 cat <<EOH
1055
1056This installation shell script will examine your system and ask you questions
a0d0e21e 1057to determine how the perl5 package should be installed. If you get
2304df62
AD
1058stuck on a question, you may use a ! shell escape to start a subshell or
1059execute a command. Many of the questions will have default answers in square
1060brackets; typing carriage return will give you the default.
1061
1062On some of the questions which ask for file or directory names you are allowed
1063to use the ~name construct to specify the login directory belonging to "name",
1064even if you don't have a shell which knows about that. Questions where this is
1065allowed will be marked "(~name ok)".
1066
1067EOH
1068 rp=''
1069 dflt='Type carriage return to continue'
1070 . ./myread
1071 cat <<'EOH'
1072
1073The prompter used in this script allows you to use shell variables and
1074backticks in your answers. You may use $1, $2, etc... to refer to the words
1075in the default answer, as if the default line was a set of arguments given to a
1076script shell. This means you may also use $* to repeat the whole default line,
1077so you do not have to re-type everything to add something to the default.
1078
1079Everytime there is a substitution, you will have to confirm. If there is an
1080error (e.g. an unmatched backtick), the default answer will remain unchanged
1081and you will be prompted again.
1082
1083If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1084the questions and use the computed defaults (or the previous answers if there
1085was already a config.sh file). Type 'Configure -h' for a list of options.
1086
1087EOH
1088 . ./myread
1089 cat <<EOH
1090
1091Much effort has been expended to ensure that this shell script will run on any
1092Unix system. If despite that it blows up on yours, your best bet is to edit
1093Configure and run it again. Also, let me (lwall@netlabs.com)
1094know how I blew it. If you can't run Configure for some reason, you'll have to
1095generate a config.sh file by hand.
1096
1097This installation script affects things in two ways:
1098
10991) it may do direct variable substitutions on some of the files included
1100 in this kit.
11012) it builds a config.h file for inclusion in C programs. You may edit
1102 any of these files as the need arises after running this script.
1103
1104If you make a mistake on a question, there is no easy way to back up to it
1105currently. The easiest thing to do is to edit config.sh and rerun all the SH
1106files. Configure will offer to let you do this before it runs the SH files.
1107
1108EOH
1109 dflt='Type carriage return to continue'
1110 . ./myread
1111 case "$firsttime" in
1112 true) echo $user >>../.config/instruct;;
1113 esac
1114fi
1115
1116: see if sh knows # comments
1117echo " "
1118echo "Checking your sh to see if it knows about # comments..." >&4
1119if sh -c '#' >/dev/null 2>&1 ; then
1120 echo "Your sh handles # comments correctly."
1121 shsharp=true
1122 spitshell=cat
1123 echo " "
1124 echo "Okay, let's see if #! works on this system..."
a0d0e21e
LW
1125 xcat=/bin/cat
1126 test -r $xcat || xcat=/usr/bin/cat
1127 echo "#!$xcat" >try
2304df62
AD
1128 $eunicefix try
1129 chmod +x try
1130 ./try > today
1131 if test -s today; then
1132 echo "It does."
1133 sharpbang='#!'
1134 else
a0d0e21e 1135 echo "#! $xcat" > try
2304df62
AD
1136 $eunicefix try
1137 chmod +x try
1138 ./try > today
1139 if test -s today; then
1140 echo "It does."
1141 sharpbang='#! '
1142 else
1143 echo "It's just a comment."
1144 sharpbang=': use '
1145 fi
1146 fi
1147else
1148 echo "Your sh doesn't grok # comments--I will strip them later on."
1149 shsharp=false
a0d0e21e 1150 cd ..
2304df62
AD
1151 echo "exec grep -v '^[ ]*#'" >spitshell
1152 chmod +x spitshell
1153 $eunicefix spitshell
1154 spitshell=`pwd`/spitshell
a0d0e21e 1155 cd UU
2304df62
AD
1156 echo "I presume that if # doesn't work, #! won't work either!"
1157 sharpbang=': use '
1158fi
1159rm -f try today
1160
1161: figure out how to guarantee sh startup
1162echo " "
1163echo "Checking out how to guarantee sh startup..." >&4
1164case "$SYSTYPE" in
1165*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1166*) startsh=$sharpbang'/bin/sh';;
1167esac
1168echo "Let's see if '$startsh' works..."
1169cat >try <<EOSS
1170$startsh
1171set abc
1172test "$?abc" != 1
1173EOSS
1174
1175chmod +x try
1176$eunicefix try
1177if ./try; then
1178 echo "Yup, it does."
1179else
1180echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1181fi
1182rm -f try
1183
1184: find out where common programs are
1185echo " "
1186echo "Locating common programs..." >&4
1187cat <<EOSC >loc
1188$startsh
1189case \$# in
11900) exit 1;;
1191esac
1192thing=\$1
1193shift
1194dflt=\$1
1195shift
1196for dir in \$*; do
1197 case "\$thing" in
1198 .)
1199 if test -d \$dir/\$thing; then
1200 echo \$dir
1201 exit 0
1202 fi
1203 ;;
1204 *)
a0d0e21e
LW
1205 for thisthing in \$dir/\$thing; do
1206 : Just loop through to pick last element
1207 done
1208 if test -f \$thisthing; then
1209 echo \$thisthing
2304df62
AD
1210 exit 0
1211 elif test -f \$dir/\$thing.exe; then
1212 : on Eunice apparently
1213 echo \$dir/\$thing
1214 exit 0
1215 fi
1216 ;;
1217 esac
1218done
1219echo \$dflt
1220exit 1
1221EOSC
1222chmod +x loc
1223$eunicefix loc
1224loclist="
1225awk
1226cat
1227cp
1228echo
1229expr
a0d0e21e 1230find
2304df62 1231grep
85e6fe83 1232ln
a0d0e21e 1233ls
2304df62 1234mkdir
2304df62
AD
1235rm
1236sed
1237sort
85e6fe83 1238touch
2304df62
AD
1239tr
1240uniq
1241"
1242trylist="
1243Mcc
1244bison
1245byacc
1246cpp
1247csh
1248date
1249egrep
2304df62
AD
1250line
1251nroff
1252perl
1253test
1254uname
1255"
1256pth=`echo $PATH | sed -e 's/:/ /g'`
1257pth="$pth /lib /usr/lib"
1258for file in $loclist; do
1259 xxx=`./loc $file $file $pth`
1260 eval $file=$xxx
1261 eval _$file=$xxx
1262 case "$xxx" in
1263 /*)
1264 echo $file is in $xxx.
1265 ;;
1266 *)
1267 echo "I don't know where $file is. I hope it's in everyone's PATH."
1268 ;;
1269 esac
1270done
1271echo " "
1272echo "Don't worry if any of the following aren't found..."
1273say=offhand
1274for file in $trylist; do
1275 xxx=`./loc $file $file $pth`
1276 eval $file=$xxx
1277 eval _$file=$xxx
1278 case "$xxx" in
1279 /*)
1280 echo $file is in $xxx.
1281 ;;
1282 *)
1283 echo "I don't see $file out there, $say."
1284 say=either
1285 ;;
1286 esac
1287done
1288case "$egrep" in
1289egrep)
1290 echo "Substituting grep for egrep."
1291 egrep=$grep
1292 ;;
1293esac
1294case "$test" in
1295test)
1296 echo "Hopefully test is built into your sh."
1297 ;;
1298*)
1299 if sh -c "PATH= test true" >/dev/null 2>&1; then
1300 echo "Using the test built into your sh."
1301 test=test
1302 _test=test
1303 fi
1304 ;;
1305esac
1306case "$echo" in
1307echo)
1308 echo "Hopefully echo is built into your sh."
1309 ;;
1310'') ;;
1311*)
1312 echo " "
1313echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1314 $echo $n "hi there$c" >foo1
1315 echo $n "hi there$c" >foo2
1316 if cmp foo1 foo2 >/dev/null 2>&1; then
1317 echo "They are compatible. In fact, they may be identical."
1318 else
1319 case "$n" in
1320 '-n') n='' c='\c';;
1321 *) n='-n' c='';;
1322 esac
1323 cat <<FOO
1324They are not compatible! You are probably running ksh on a non-USG system.
1325I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1326have echo built in and we may have to run some Bourne shell scripts. That
1327means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1328
1329FOO
1330 $echo $n "The star should be here-->$c"
1331 $echo "*"
1332 fi
1333 $rm -f foo1 foo2
1334 ;;
1335esac
1336
a0d0e21e
LW
1337: determine whether symbolic links are supported
1338echo " "
1339$touch blurfl
1340if $ln -s blurfl sym > /dev/null 2>&1 ; then
1341 echo "Symbolic links are supported." >&4
1342 lns="$ln -s"
1343else
1344 echo "Symbolic links are NOT supported." >&4
1345 lns="$ln"
1346fi
1347$rm -f blurfl sym
1348
2304df62
AD
1349: Try to determine whether config.sh was made on this system
1350case "$config_sh" in
1351'')
1352myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1353myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2304df62
AD
1354 tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1355dflt=n
a0d0e21e 1356if test -f ../config.sh; then
2304df62
AD
1357 oldmyuname=''
1358 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1359 eval "old`grep myuname= ../config.sh`"
1360 fi
1361 if test "X$myuname" = "X$oldmyuname"; then
1362 dflt=y
1363 fi
1364fi
1365
1366: Get old answers from old config file if Configure was run on the
1367: same system, otherwise use the hints.
1368hint=default
1369cd ..
1370if test -f config.sh; then
1371 echo " "
1372 rp="I see a config.sh file. Shall I use it to set the defaults?"
1373 . UU/myread
1374 case "$ans" in
1375 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1376 *) echo "Fetching default answers from your old config.sh file..." >&4
1377 tmp="$n"
1378 tans="$c"
1379 . ./config.sh
1380 cp config.sh UU
1381 n="$tmp"
1382 c="$tans"
1383 hint=previous
1384 ;;
1385 esac
1386fi
1387if test ! -f config.sh; then
1388 $cat <<EOM
1389
1390First time through, eh? I have some defaults handy for the following systems:
1391
1392EOM
1393 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1394 dflt=''
1395 : Half the following guesses are probably wrong... If you have better
1396 : tests or hints, please send them to lwall@netlabs.com
1397 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1398 $test -f /irix && osname=irix
85e6fe83
LW
1399 $test -f /xenix && osname=sco_xenix
1400 $test -f /dynix && osname=dynix
1401 $test -f /dnix && osname=dnix
a0d0e21e 1402 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1403 $test -f /bin/mips && /bin/mips && osname=mips
a0d0e21e
LW
1404 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1405 $test -d /usr/apollo/bin && osname=apollo
1406 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1407 $test -d /usr/include/minix && osname=minix
2304df62
AD
1408 if $test -f $uname; then
1409 set X $myuname
1410 shift
1411
2304df62 1412 case "$5" in
85e6fe83 1413 fps*) osname=fps ;;
2304df62
AD
1414 mips*)
1415 case "$4" in
85e6fe83
LW
1416 umips) osname=umips ;;
1417 *) osname=mips ;;
2304df62 1418 esac;;
85e6fe83
LW
1419 [23]100) osname=mips ;;
1420 next*) osname=next ;;
1421 news*) osname=news ;;
2304df62 1422 i386*) if $test -f /etc/kconfig; then
85e6fe83 1423 osname=isc
a0d0e21e
LW
1424 if test "$lns" = "ln -s"; then
1425 osvers=4
1426 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1427 osvers=3
2304df62 1428 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1429 osvers=2
2304df62 1430 fi
2304df62
AD
1431 fi
1432 ;;
1433 esac
1434
1435 case "$1" in
a0d0e21e
LW
1436 aix) osname=aix
1437 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1438 case "$tmp" in
1439 'not found') osvers=3.2.0 ;;
1440 '<3240'|'<>3240') osvers=3.2.0 ;;
1441 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1442 '=3250'|'>3250') osvers=3.2.5 ;;
1443 *) osvers='' ;;
1444 esac
1445 ;;
1446 dnix) osname=dnix
1447 osvers="$3"
1448 ;;
1449 domainos) osname=apollo
1450 osvers="$3"
1451 ;;
1452 dgux) osname=dgux
1453 osvers="$3"
1454 ;;
1455 freebsd) osname=freebsd
1456 osvers="$3" ;;
1457 genix) osname=genix ;;
1458 hp*) osname=hpux
1459 case "$3" in
1460 *.08.*) osvers=9 ;;
1461 *.09.*) osvers=9 ;;
1462 *.10.*) osvers=10 ;;
1463 esac
1464 ;;
1465 irix) osname=irix
1466 case "$3" in
1467 4*) osvers=4 ;;
1468 5*) osvers=5 ;;
1469 esac
1470 ;;
1471 linux) osname=linux
1472 case "$3" in
1473 1*) osvers=1 ;;
1474 *) osvers="$3" ;;
1475 esac
1476 ;;
1477 netbsd*) osname=netbsd
1478 osvers="$3"
1479 ;;
1480 bsd386) osname=bsd386
1481 osvers=`$uname -r`
1482 ;;
1483 next*) osname=next ;;
1484 solaris) osname=solaris
1485 case "$3" in
1486 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1487 esac
1488 ;;
85e6fe83
LW
1489 sunos) osname=sunos
1490 case "$3" in
85e6fe83
LW
1491 5*) osname=solaris
1492 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1493 *) osvers="$3" ;;
2304df62
AD
1494 esac
1495 ;;
a0d0e21e 1496 titanos) osname=titanos
85e6fe83 1497 case "$3" in
a0d0e21e
LW
1498 1*) osvers=1 ;;
1499 2*) osvers=2 ;;
1500 3*) osvers=3 ;;
1501 4*) osvers=4 ;;
2304df62
AD
1502 esac
1503 ;;
85e6fe83
LW
1504 ultrix) osname=ultrix
1505 case "$3" in
1506 1*) osvers=1 ;;
1507 2*) osvers=2 ;;
1508 3*) osvers=3 ;;
1509 4*) osvers=4 ;;
2304df62
AD
1510 esac
1511 ;;
85e6fe83
LW
1512 osf1) case "$5" in
1513 alpha) osname=dec_osf
1514 case "$3" in
1515 [vt]1\.*) osvers=1 ;;
1516 [vt]2\.*) osvers=2 ;;
1517 [vt]3\.*) osvers=3 ;;
1518 esac
1519 ;;
1520 hp*) osname=hp_osf1 ;; # TR
1521 mips) osname=mips_osf1 ;; # TR
a0d0e21e 1522 # TR = Technology Releases: unsupported
85e6fe83
LW
1523 esac
1524 ;;
a0d0e21e
LW
1525 uts) osname=uts
1526 osvers="$3"
1527 ;;
85e6fe83 1528 $2) case "$osname" in
2304df62 1529 *isc*) ;;
a0d0e21e
LW
1530 *freebsd*) ;;
1531 svr*)
1532 : svr4.x or possibly later
1533 case "svr$3" in
1534 ${osname}*)
1535 osname=svr$3
1536 osvers=$4
1537 ;;
1538 esac
1539 case "$osname" in
1540 svr4.0)
1541 : Check for ESIX
1542 if test -f /stand/boot ; then
1543 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1544 if test -n $INITPROG -a -f $INITPROG; then
1545 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1546 if test -n $isesix; then
1547 osname=esix4
1548 fi
1549 fi
1550 fi
1551 ;;
1552 esac
1553 ;;
2304df62 1554 *) if test -f /etc/systemid; then
a0d0e21e
LW
1555 osname=sco
1556 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1557 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1558 osvers=$1.$2.$3
2304df62 1559 elif $test -f sco_$1_$2.sh; then
85e6fe83 1560 osvers=$1.$2
2304df62 1561 elif $test -f sco_$1.sh; then
85e6fe83 1562 osvers=$1
2304df62 1563 fi
a0d0e21e
LW
1564 else
1565 case "$osname" in
1566 '') : Still unknown. Probably a generic Sys V.
1567 osname="sysv"
1568 osvers="$3"
1569 ;;
1570 esac
2304df62
AD
1571 fi
1572 ;;
1573 esac
1574 ;;
a0d0e21e
LW
1575 *) case "$osname" in
1576 '') : Still unknown. Probably a generic BSD.
1577 osname="$1"
1578 osvers="$3"
1579 ;;
1580 esac
1581 ;;
2304df62
AD
1582 esac
1583 else
1584 if test -f /vmunix -a -f news_os.sh; then
1585 (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1586 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1587 osname=news_os
2304df62
AD
1588 fi
1589 $rm -f ../UU/kernel.what
1590 fi
1591 fi
85e6fe83 1592
a0d0e21e
LW
1593 : Now look for a hint file osname_osvers, unless one has been
1594 : specified already.
1595 case "$hintfile" in
1596 ''|' ')
1597 file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'`
1598 : Also try without trailing minor version numbers.
1599 xfile=`echo $file | sed -e 's@_[^_]*$@@'`
1600 xxfile=`echo $xfile | sed -e 's@_[^_]*$@@'`
1601 xxxfile=`echo $xxfile | sed -e 's@_[^_]*$@@'`
1602 xxxxfile=`echo $xxxfile | sed -e 's@_[^_]*$@@'`
1603 case "$file" in
1604 '') dflt=none ;;
1605 *) case "$osvers" in
1606 '') dflt=$file
1607 ;;
1608 *) if $test -f $file.sh ; then
1609 dflt=$file
1610 elif $test -f $xfile.sh ; then
1611 dflt=$xfile
1612 elif $test -f $xxfile.sh ; then
1613 dflt=$xxfile
1614 elif $test -f $xxxfile.sh ; then
1615 dflt=$xxxfile
1616 elif $test -f $xxxxfile.sh ; then
1617 dflt=$xxxxfile
1618 elif $test -f "${osname}.sh" ; then
1619 dflt="${osname}"
1620 else
1621 dflt=none
1622 fi
1623 ;;
1624 esac
85e6fe83
LW
1625 ;;
1626 esac
1627 ;;
a0d0e21e
LW
1628 *)
1629 dflt=`echo $hintfile | sed 's/\.sh$//'`
1630 ;;
2304df62 1631 esac
85e6fe83 1632
2304df62
AD
1633 $cat <<EOM
1634
1635You may give one or more space-separated answers, or "none" if appropriate.
1636If your OS version has no hints, DO NOT give a wrong version -- say "none".
1637
1638EOM
1639 rp="Which of these apply, if any?"
1640 . ../UU/myread
85e6fe83
LW
1641 tans=$ans
1642 for file in $tans; do
2304df62
AD
1643 if $test -f $file.sh; then
1644 . ./$file.sh
1645 $cat $file.sh >> ../UU/config.sh
85e6fe83 1646 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1647 : nothing
1648 else
85e6fe83
LW
1649 : Give one chance to correct a possible typo.
1650 echo "$file.sh does not exist"
1651 dflt=$file
1652 rp="hint to use instead?"
1653 . ../UU/myread
1654 for file in $ans; do
1655 if $test -f "$file.sh"; then
1656 . ./$file.sh
1657 $cat $file.sh >> ../UU/config.sh
1658 elif $test X$ans = X -o X$ans = Xnone ; then
1659 : nothing
1660 else
1661 echo "$file.sh does not exist -- ignored."
1662 fi
1663 done
2304df62
AD
1664 fi
1665 done
85e6fe83 1666
2304df62 1667 hint=recommended
85e6fe83
LW
1668 : Remember our hint file for later.
1669 if $test -f "$file.sh" ; then
a0d0e21e 1670 hintfile="$file"
85e6fe83 1671 else
a0d0e21e 1672 hintfile=''
85e6fe83
LW
1673 fi
1674
2304df62
AD
1675 cd ..
1676fi
1677cd UU
1678;;
1679*)
1680 echo " "
1681 echo "Fetching default answers from $config_sh..." >&4
1682 tmp="$n"
1683 tans="$c"
1684 cd ..
1685 cp $config_sh config.sh 2>/dev/null
1686 . ./config.sh
1687 cd UU
1688 cp ../config.sh .
1689 n="$tmp"
1690 c="$tans"
1691 hint=previous
1692 ;;
1693esac
1694
1695: Restore computed paths
1696for file in $loclist $trylist; do
1697 eval $file="\$_$file"
1698done
1699
85e6fe83 1700cat << EOM
a0d0e21e 1701
85e6fe83
LW
1702Configure uses the operating system name and version to set some defaults.
1703Say "none" to leave it blank.
a0d0e21e 1704
85e6fe83
LW
1705EOM
1706
1707case "$osname" in
a0d0e21e 1708 ''|' ')
85e6fe83 1709 case "$hintfile" in
a0d0e21e 1710 ''|' '|none) dflt=none ;;
85e6fe83
LW
1711 *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1712 esac
1713 ;;
1714 *) dflt="$osname" ;;
1715esac
1716rp="Operating system name?"
1717. ./myread
1718case "$ans" in
1719 none) osname='' ;;
1720 *) osname="$ans" ;;
1721esac
2304df62
AD
1722: who configured the system
1723cf_time=`$date 2>&1`
a0d0e21e
LW
1724(logname > .temp) >/dev/null 2>&1
1725$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1726$test -s .temp || echo unknown > .temp
1727cf_by=`$cat .temp`
1728$rm -f .temp
2304df62
AD
1729
1730: determine where manual pages are on this system
1731echo " "
1732case "$sysman" in
1733'')
a0d0e21e 1734 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2304df62
AD
1735 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1736 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1737 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
a0d0e21e
LW
1738 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1739 sysman=`./loc . /usr/man/man1 $syspath`
2304df62
AD
1740 ;;
1741esac
1742if $test -d "$sysman"; then
1743 echo "System manual is in $sysman." >&4
1744else
1745 echo "Could not find manual pages in source form." >&4
1746fi
1747
1748: see what memory models we can support
1749case "$models" in
1750'')
1751 $cat >pdp11.c <<'EOP'
1752main() {
1753#ifdef pdp11
1754 exit(0);
1755#else
1756 exit(1);
1757#endif
1758}
1759EOP
1760 cc -o pdp11 pdp11.c >/dev/null 2>&1
1761 if ./pdp11 2>/dev/null; then
1762 dflt='unsplit split'
1763 else
1764 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1765 case "$tans" in
1766 X) dflt='none';;
1767 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1768 dflt='small'
1769 else
1770 dflt=''
1771 fi
1772 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1773 dflt="$dflt medium"
1774 fi
1775 if $test -d /lib/large || $test -d /usr/lib/large; then
1776 dflt="$dflt large"
1777 fi
1778 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1779 dflt="$dflt huge"
1780 fi
1781 esac
1782 fi;;
1783*) dflt="$models";;
1784esac
1785$cat <<EOM
1786
1787Some systems have different model sizes. On most systems they are called
1788small, medium, large, and huge. On the PDP11 they are called unsplit and
1789split. If your system doesn't support different memory models, say "none".
1790If you wish to force everything to one memory model, say "none" here and
1791put the appropriate flags later when it asks you for other cc and ld flags.
1792Venix systems may wish to put "none" and let the compiler figure things out.
1793(In the following question multiple model names should be space separated.)
1794
1795EOM
1796rp="Which memory models are supported?"
1797. ./myread
1798models="$ans"
1799
1800case "$models" in
1801none)
1802 small=''
1803 medium=''
1804 large=''
1805 huge=''
1806 unsplit=''
1807 split=''
1808 ;;
1809*split)
1810 case "$split" in
1811 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1812 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1813 dflt='-i'
1814 else
1815 dflt='none'
1816 fi;;
1817 *) dflt="$split";;
1818 esac
1819 rp="What flag indicates separate I and D space?"
1820 . ./myread
1821 tans="$ans"
1822 case "$tans" in
1823 none) tans='';;
1824 esac
1825 split="$tans"
1826 unsplit='';;
1827*large*|*small*|*medium*|*huge*)
1828 case "$models" in
1829 *large*)
1830 case "$large" in
1831 '') dflt='-Ml';;
1832 *) dflt="$large";;
1833 esac
1834 rp="What flag indicates large model?"
1835 . ./myread
1836 tans="$ans"
1837 case "$tans" in
1838 none) tans='';
1839 esac
1840 large="$tans";;
1841 *) large='';;
1842 esac
1843 case "$models" in
1844 *huge*) case "$huge" in
1845 '') dflt='-Mh';;
1846 *) dflt="$huge";;
1847 esac
1848 rp="What flag indicates huge model?"
1849 . ./myread
1850 tans="$ans"
1851 case "$tans" in
1852 none) tans='';
1853 esac
1854 huge="$tans";;
1855 *) huge="$large";;
1856 esac
1857 case "$models" in
1858 *medium*) case "$medium" in
1859 '') dflt='-Mm';;
1860 *) dflt="$medium";;
1861 esac
1862 rp="What flag indicates medium model?"
1863 . ./myread
1864 tans="$ans"
1865 case "$tans" in
1866 none) tans='';
1867 esac
1868 medium="$tans";;
1869 *) medium="$large";;
1870 esac
1871 case "$models" in
1872 *small*) case "$small" in
1873 '') dflt='none';;
1874 *) dflt="$small";;
1875 esac
1876 rp="What flag indicates small model?"
1877 . ./myread
1878 tans="$ans"
1879 case "$tans" in
1880 none) tans='';
1881 esac
1882 small="$tans";;
1883 *) small='';;
1884 esac
1885 ;;
1886*)
1887 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1888 ;;
1889esac
1890
1891: make some quick guesses about what we are up against
1892echo " "
1893$echo $n "Hmm... $c"
1894echo exit 1 >bsd
1895echo exit 1 >usg
1896echo exit 1 >v7
1897echo exit 1 >osf1
1898echo exit 1 >eunice
1899echo exit 1 >xenix
1900echo exit 1 >venix
2304df62
AD
1901$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1902if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1903then
1904 echo "Looks kind of like an OSF/1 system, but we'll see..."
1905 echo exit 0 >osf1
1906elif test `echo abc | tr a-z A-Z` = Abc ; then
1907 xxx=`./loc addbib blurfl $pth`
1908 if $test -f $xxx; then
1909 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1910 echo exit 0 >bsd
1911 echo exit 0 >usg
1912 else
1913 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1914 echo "Looks kind of like an extended USG system, but we'll see..."
1915 else
1916 echo "Looks kind of like a USG system, but we'll see..."
1917 fi
1918 echo exit 0 >usg
1919 fi
1920elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1921 echo "Looks kind of like a BSD system, but we'll see..."
2304df62
AD
1922 echo exit 0 >bsd
1923else
1924 echo "Looks kind of like a Version 7 system, but we'll see..."
1925 echo exit 0 >v7
1926fi
1927case "$eunicefix" in
1928*unixtovms*)
1929 $cat <<'EOI'
1930There is, however, a strange, musty smell in the air that reminds me of
1931something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1932EOI
1933 echo exit 0 >eunice
1934 d_eunice="$define"
1935: it so happens the Eunice I know will not run shell scripts in Unix format
1936 ;;
1937*)
1938 echo " "
1939 echo "Congratulations. You aren't running Eunice."
1940 d_eunice="$undef"
1941 ;;
1942esac
1943if test -f /xenix; then
1944 echo "Actually, this looks more like a XENIX system..."
1945 echo exit 0 >xenix
1946 d_xenix="$define"
1947else
1948 echo " "
1949 echo "It's not Xenix..."
1950 d_xenix="$undef"
1951fi
1952chmod +x xenix
1953$eunicefix xenix
1954if test -f /venix; then
1955 echo "Actually, this looks more like a VENIX system..."
1956 echo exit 0 >venix
1957else
1958 echo " "
1959 if xenix; then
1960 : null
1961 else
1962 echo "Nor is it Venix..."
1963 fi
1964fi
1965chmod +x bsd usg v7 osf1 eunice xenix venix
1966$eunicefix bsd usg v7 osf1 eunice xenix venix
1967$rm -f foo
1968
1969: see if we need a special compiler
1970echo " "
1971if usg; then
1972 case "$cc" in
1973 '') case "$Mcc" in
1974 /*) dflt='Mcc';;
1975 *) case "$large" in
1976 -M*) dflt='cc';;
1977 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
1978 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
1979 dflt='cc'
1980 else
1981 dflt='cc -M'
1982 fi
1983 else
1984 dflt='cc'
1985 fi;;
1986 esac;;
1987 esac;;
1988 *) dflt="$cc";;
1989 esac
1990 $cat <<'EOM'
1991On some systems the default C compiler will not resolve multiple global
1992references that happen to have the same name. On some such systems the "Mcc"
1993command may be used to force these to be resolved. On other systems a "cc -M"
1994command is required. (Note that the -M flag on other systems indicates a
1995memory model to use!) If you have the Gnu C compiler, you might wish to use
1996that instead.
1997
1998EOM
1999 rp="What command will force resolution on this system?"
2000 . ./myread
2001 cc="$ans"
2002else
2003 case "$cc" in
2004 '') dflt=cc;;
2005 *) dflt="$cc";;
2006 esac
2007 rp="Use which C compiler?"
2008 . ./myread
2009 cc="$ans"
2010fi
a0d0e21e 2011echo "Checking if you are using GNU cc ..." >&4
2304df62
AD
2012$cat >gccvers.c <<EOM
2013#include <stdio.h>
a0d0e21e 2014int main() {
2304df62 2015#ifdef __GNUC__
a0d0e21e
LW
2016#ifdef __VERSION__
2017printf("%s\n", __VERSION__);
2304df62 2018#else
a0d0e21e 2019printf("%s\n", "1");
2304df62 2020#endif
a0d0e21e
LW
2021#endif
2022return 0;
2304df62
AD
2023}
2024EOM
a0d0e21e
LW
2025if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2026 gccversion=`./gccvers`
2027 case "$gccversion" in
2028 '') echo "You are not using GNU cc." ;;
2029 *) echo "You are using GNU cc $gccversion." ;;
2030 esac
2031else
2032 echo "I can't compile the test program. I'll assume it's not GNU cc."
2033fi
2034$rm -f gccvers*
2035case "$gccversion" in
20361*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2304df62 2037esac
a0d0e21e 2038
2304df62
AD
2039: decide how portable to be
2040case "$d_portable" in
2041"$define") dflt=y;;
2042*) dflt=n;;
2043esac
2044$cat <<'EOH'
2045
2046I can set things up so that your shell scripts and binaries are more portable,
2047at what may be a noticable cost in performance. In particular, if you
2048ask to be portable, the following happens:
2049
2050 1) Shell scripts will rely on the PATH variable rather than using
2051 the paths derived above.
2052 2) ~username interpretations will be done at run time rather than
2053 by Configure.
2054
2055EOH
2056rp="Do you expect to run these scripts and binaries on multiple machines?"
2057. ./myread
2058case "$ans" in
2059 y*) d_portable="$define"
2060 for file in $loclist $trylist; do
2061 eval $file="\$file"
2062 done
2063 ;;
2064 *) d_portable="$undef" ;;
2065esac
2066
2067: set up shell script to do ~ expansion
2068cat >filexp <<EOSS
2069$startsh
2070: expand filename
2071case "\$1" in
2072 ~/*|~)
2073 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2074 ;;
2075 ~*)
2076 if $test -f /bin/csh; then
2077 /bin/csh -f -c "glob \$1"
a0d0e21e 2078 failed=\$?
2304df62
AD
2079 echo ""
2080 exit \$failed
2081 else
2082 name=\`$expr x\$1 : '..\([^/]*\)'\`
2083 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2084 if $test ! -d "\$dir"; then
2085 me=\`basename \$0\`
2086 echo "\$me: can't locate home directory for: \$name" >&2
2087 exit 1
2088 fi
2089 case "\$1" in
2090 */*)
2091 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2092 ;;
2093 *)
2094 echo \$dir
2095 ;;
2096 esac
2097 fi
2098 ;;
2099*)
2100 echo \$1
2101 ;;
2102esac
2103EOSS
2104chmod +x filexp
2105$eunicefix filexp
2106
2107: now set up to get a file name
2108cat <<'EOSC' >getfile
2109tilde=''
2110fullpath=''
2111already=''
2112skip=''
2113none_ok=''
2114exp_file=''
a0d0e21e 2115nopath_ok=''
2304df62
AD
2116orig_rp="$rp"
2117orig_dflt="$dflt"
2118
2119case "$fn" in
a0d0e21e
LW
2120*:*)
2121 loc_file=`expr $fn : '.*:\(.*\)'`
2122 fn=`expr $fn : '\(.*\):.*'`
2123 ;;
2124esac
2125
2126case "$fn" in
2304df62
AD
2127*~*) tilde=true;;
2128esac
2129case "$fn" in
2130*/*) fullpath=true;;
2131esac
2132case "$fn" in
2133*+*) skip=true;;
2134esac
2135case "$fn" in
2136*n*) none_ok=true;;
2137esac
2138case "$fn" in
2139*e*) exp_file=true;;
2140esac
a0d0e21e
LW
2141case "$fn" in
2142*p*) nopath_ok=true;;
2143esac
2304df62
AD
2144
2145case "$fn" in
2146*f*) type='File';;
2147*d*) type='Directory';;
a0d0e21e 2148*l*) type='Locate';;
2304df62
AD
2149esac
2150
2151what="$type"
2152case "$what" in
2153Locate) what='File';;
2154esac
2155
2156case "$exp_file" in
2157'')
2158 case "$d_portable" in
2159 "$define") ;;
2160 *) exp_file=true;;
2161 esac
2162 ;;
2163esac
2164
2165cd ..
2166while test "$type"; do
2167 redo=''
2168 rp="$orig_rp"
2169 dflt="$orig_dflt"
2170 case "$tilde" in
2171 true) rp="$rp (~name ok)";;
2172 esac
2173 . UU/myread
2174 case "$ans" in
2175 none)
2176 value=''
2177 ansexp=''
2178 case "$none_ok" in
2179 true) type='';;
2180 esac
2181 ;;
2182 *)
2183 case "$tilde" in
2184 '') value="$ans"
2185 ansexp="$ans";;
2186 *)
2187 value=`UU/filexp $ans`
2188 case $? in
2189 0)
2190 if test "$ans" != "$value"; then
2191 echo "(That is $value on this particular system.)"
2192 fi
2193 ;;
2194 *) value="$ans";;
2195 esac
2196 ansexp="$value"
2197 case "$exp_file" in
2198 '') value="$ans";;
2199 esac
2200 ;;
2201 esac
2202 case "$fullpath" in
2203 true)
2204 case "$ansexp" in
2205 /*) value="$ansexp" ;;
2206 *)
2207 redo=true
2208 case "$already" in
2209 true)
2210 echo "I shall only accept a full path name, as in /bin/ls." >&4
2211 echo "Use a ! shell escape if you wish to check pathnames." >&4
2212 ;;
2213 *)
2214 echo "Please give a full path name, starting with slash." >&4
2215 case "$tilde" in
2216 true)
2217 echo "Note that using ~name is ok provided it expands well." >&4
2218 already=true
2219 ;;
2220 esac
2221 esac
2222 ;;
2223 esac
2224 ;;
2225 esac
2226 case "$redo" in
2227 '')
2228 case "$type" in
2229 File)
2230 if test -f "$ansexp"; then
2231 type=''
2232 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2233 then
2234 echo "($value is not a plain file, but that's ok.)"
2235 type=''
2236 fi
2237 ;;
2238 Directory)
2239 if test -d "$ansexp"; then
2240 type=''
2241 fi
2242 ;;
2243 Locate)
2244 if test -d "$value"; then
a0d0e21e
LW
2245 echo "(Looking for $loc_file in directory $value.)"
2246 value="$value/$loc_file"
2304df62
AD
2247 fi
2248 if test -f "$value"; then
2249 type=''
2250 fi
a0d0e21e
LW
2251 case "$nopath_ok" in
2252 true) case "$value" in
2253 */*) ;;
2254 *) echo "Assuming $value will be in people's path."
2255 type=''
2256 ;;
2257 esac
2258 ;;
2259 esac
2304df62
AD
2260 ;;
2261 esac
2262
2263 case "$skip" in
2264 true) type='';
2265 esac
2266
2267 case "$type" in
2268 '') ;;
2269 *)
2270 if test "$fastread" = yes; then
2271 dflt=y
2272 else
2273 dflt=n
2274 fi
2275 rp="$what $value doesn't exist. Use that name anyway?"
2276 . UU/myread
2277 dflt=''
2278 case "$ans" in
2279 y*) type='';;
2280 *) echo " ";;
2281 esac
2282 ;;
2283 esac
2284 ;;
2285 esac
2286 ;;
2287 esac
2288done
2289cd UU
2290ans="$value"
2291rp="$orig_rp"
2292dflt="$orig_dflt"
2293EOSC
2294
2295: What should the include directory be ?
2296echo " "
2297$echo $n "Hmm... $c"
a0d0e21e 2298dflt='/usr/include'
2304df62
AD
2299incpath=''
2300mips_type=''
2301if $test -f /bin/mips && /bin/mips; then
2302 echo "Looks like a MIPS system..."
2303 $cat >usr.c <<'EOCP'
2304#ifdef SYSTYPE_BSD43
2305/bsd43
2306#endif
2307EOCP
2308 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2309 dflt='/bsd43/usr/include'
2310 incpath='/bsd43'
2311 mips_type='BSD 4.3'
2312 else
2313 mips_type='System V'
2314 fi
2315 $rm -f usr.c usr.out
2316 echo "and you're compiling with the $mips_type compiler and libraries."
2317else
2318 echo "Doesn't look like a MIPS system."
2319 echo "exit 1" >mips
2320 chmod +x mips
2321 $eunicefix mips
2322fi
2323echo " "
a0d0e21e
LW
2324case "$usrinc" in
2325'') ;;
2326*) dflt="$usrinc";;
2327esac
2304df62
AD
2328fn=d/
2329rp='Where are the include files you want to use?'
2330. ./getfile
2331usrinc="$ans"
2332
a0d0e21e
LW
2333: see how we invoke the C preprocessor
2334echo " "
2335echo "Now, how can we feed standard input to your C preprocessor..." >&4
2336cat <<'EOT' >testcpp.c
2337#define ABC abc
2338#define XYZ xyz
2339ABC.XYZ
2340EOT
2341cd ..
2342echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2343chmod 755 cppstdin
2344wrapper=`pwd`/cppstdin
2345ok='false'
2346cd UU
2304df62 2347
a0d0e21e
LW
2348if $test "X$cppstdin" != "X" && \
2349 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2350 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2351then
2352 echo "You used to use $cppstdin $cppminus so we'll use that again."
2353 case "$cpprun" in
2354 '') echo "But let's see if we can live without a wrapper..." ;;
2355 *)
2356 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2357 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2304df62 2358 then
a0d0e21e
LW
2359 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2360 ok='true'
2361 else
2362 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62
AD
2363 fi
2364 ;;
2365 esac
2304df62 2366else
a0d0e21e
LW
2367 case "$cppstdin" in
2368 '') ;;
2369 *)
2370 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2371 ;;
2372 esac
2304df62 2373fi
2304df62 2374
a0d0e21e
LW
2375if $ok; then
2376 : nothing
2377elif echo 'Maybe "'"$cc"' -E" will work...'; \
2378 $cc -E <testcpp.c >testcpp.out 2>&1; \
2379 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2380 echo "Yup, it does."
2381 x_cpp="$cc -E"
2382 x_minus='';
2383elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2384 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2385 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2386 echo "Yup, it does."
2387 x_cpp="$cc -E"
2388 x_minus='-';
2389elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2390 $cc -P <testcpp.c >testcpp.out 2>&1; \
2391 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2392 echo "Yipee, that works!"
2393 x_cpp="$cc -P"
2394 x_minus='';
2395elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2396 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2397 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2398 echo "At long last!"
2399 x_cpp="$cc -P"
2400 x_minus='-';
2401elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2402 $cpp <testcpp.c >testcpp.out 2>&1; \
2403 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2404 echo "It works!"
2405 x_cpp="$cpp"
2406 x_minus='';
2407elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2408 $cpp - <testcpp.c >testcpp.out 2>&1; \
2409 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2410 echo "Hooray, it works! I was beginning to wonder."
2411 x_cpp="$cpp"
2412 x_minus='-';
2413elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2414 $wrapper <testcpp.c >testcpp.out 2>&1; \
2415 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2416 x_cpp="$wrapper"
2417 x_minus=''
2418 echo "Eureka!"
2419else
2420 dflt=''
2421 rp="No dice. I can't find a C preprocessor. Name one:"
2422 . ./myread
2423 x_cpp="$ans"
2424 x_minus=''
2425 $x_cpp <testcpp.c >testcpp.out 2>&1
2426 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2427 echo "OK, that will do." >&4
2428 else
2429echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2430 exit 1
2431 fi
2432fi
2433
2434case "$ok" in
2435false)
2436 cppstdin="$x_cpp"
2437 cppminus="$x_minus"
2438 cpprun="$x_cpp"
2439 cpplast="$x_minus"
2440 set X $x_cpp
2441 shift
2442 case "$1" in
2443 "$cpp")
2444 echo "Perhaps can we force $cc -E using a wrapper..."
2445 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2446 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2447 then
2448 echo "Yup, we can."
2449 cppstdin="$wrapper"
2450 cppminus='';
2451 else
2452 echo "Nope, we'll have to live without it..."
2453 fi
2454 ;;
2455 esac
2456 case "$cpprun" in
2457 "$wrapper")
2458 cpprun=''
2459 cpplast=''
2460 ;;
2461 esac
2462 ;;
2463esac
2464
2465case "$cppstdin" in
2466"$wrapper") ;;
2467*) $rm -f $wrapper;;
2468esac
2469$rm -f testcpp.c testcpp.out
2470
2471: determine optimize, if desired, or use for debug flag also
2472case "$optimize" in
2473' ') dflt='none';;
2474'') dflt='-O';;
2475*) dflt="$optimize";;
2476esac
2477$cat <<EOH
2478
2479Some C compilers have problems with their optimizers, by default, $package
2480compiles with the -O flag to use the optimizer. Alternately, you might want
2481to use the symbolic debugger, which uses the -g flag (on traditional Unix
2482systems). Either flag can be specified here. To use neither flag, specify
2483the word "none".
2484
2485EOH
2486rp="What optimizer/debugger flag should be used?"
2487. ./myread
2488optimize="$ans"
2489case "$optimize" in
2490'none') optimize=" ";;
2491esac
2492
2493dflt=''
2494case "$ccflags" in
2495'')
2496 case "$gccversion" in
2497 1*) dflt='-fpcc-struct-return' ;;
2498 esac
2499 case "$optimize" in
2500 *-g*) dflt="$dflt -DDEBUGGING";;
2501 esac
2502 case "$gccversion" in
2503 2*) if test -d /etc/conf/kconfig.d &&
2504 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2505 then
2506 dflt="$dflt -posix"
2507 fi
2508 ;;
2509 esac
2510 ;;
2511esac
2512
2513case "$mips_type" in
2514*BSD*) ;;
2515'') ;;
2516*) inclwanted="$inclwanted $usrinc/bsd";;
2517esac
2518for thisincl in $inclwanted; do
2519 if $test -d $thisincl; then
2520 if $test x$thisincl != x$usrinc; then
2521 case "$dflt" in
2522 *$thisincl*);;
2523 *) dflt="$dflt -I$thisincl";;
2524 esac
2525 fi
2526 fi
2527done
2528
2529inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2530 xxx=true;
2531elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2532 xxx=true;
2533else
2534 xxx=false;
2535fi;
2536if $xxx; then
2537 case "$dflt" in
2538 *$2*);;
2539 *) dflt="$dflt -D$2";;
2540 esac;
2541fi'
2542
2543if ./osf1; then
2544 set signal.h __LANGUAGE_C__; eval $inctest
2545else
2546 set signal.h LANGUAGE_C; eval $inctest
2547fi
2548set signal.h NO_PROTOTYPE; eval $inctest
2549set signal.h _NO_PROTO; eval $inctest
2550
2551case "$dflt" in
2552'') dflt=none;;
2304df62 2553esac
85e6fe83
LW
2554case "$ccflags" in
2555'') ;;
2556*) dflt="$ccflags";;
2557esac
2304df62
AD
2558$cat <<EOH
2559
2560Your C compiler may want other flags. For this question you should include
2561-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2562but you should NOT include libraries or ld flags like -lwhatever. If you
2563want $package to honor its debug switch, you should include -DDEBUGGING here.
a0d0e21e
LW
2564Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2565-DHIDEMYMALLOC or -DCRIPPLED_CC.
2566
2304df62
AD
2567To use no flags, specify the word "none".
2568
2304df62
AD
2569EOH
2570set X $dflt
2571shift
2572dflt=${1+"$@"}
2573rp="Any additional cc flags?"
2574. ./myread
2575case "$ans" in
2576none) ccflags='';;
2577*) ccflags="$ans";;
2578esac
2579
2580: the following weeds options from ccflags that are of no interest to cpp
2581cppflags="$ccflags"
a0d0e21e
LW
2582case "$gccversion" in
25831*) cppflags="$cppflags -D__GNUC__"
2304df62
AD
2584esac
2585case "$mips_type" in
2586'');;
2587*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2588esac
2589case "$cppflags" in
2590'');;
a0d0e21e
LW
2591*)
2592 echo " "
2593 echo "Let me guess what the preprocessor flags are..." >&4
2594 set X $cppflags
2595 shift
2304df62 2596 cppflags=''
a0d0e21e
LW
2597 $cat >cpp.c <<'EOM'
2598#define BLURFL foo
2599
2600BLURFL xx LFRULB
2601EOM
2602 previous=''
2603 for flag in $*
2304df62 2604 do
a0d0e21e
LW
2605 case "$flag" in
2606 -*) ftry="$flag";;
2607 *) ftry="$previous $flag";;
2304df62 2608 esac
a0d0e21e
LW
2609 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2610 >cpp1.out 2>/dev/null && \
2611 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2612 >cpp2.out 2>/dev/null && \
2613 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2614 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2615 then
2616 cppflags="$cppflags $ftry"
2617 previous=''
2618 else
2619 previous="$flag"
2620 fi
2304df62 2621 done
a0d0e21e
LW
2622 set X $cppflags
2623 shift
2624 cppflags=${1+"$@"}
2304df62 2625 case "$cppflags" in
a0d0e21e 2626 *-*) echo "They appear to be: $cppflags";;
2304df62 2627 esac
a0d0e21e 2628 $rm -f cpp.c cpp?.out
2304df62
AD
2629 ;;
2630esac
2631
2632: flags used in final linking phase
2633case "$ldflags" in
2634'') if venix; then
2635 dflt='-i -z'
2636 else
a0d0e21e 2637 dflt=''
2304df62 2638 fi
a0d0e21e
LW
2639 case "$ccflags" in
2640 *-posix*) dflt="$dflt -posix" ;;
2641 esac
2642 case "$dflt" in
2643 '') dflt='none' ;;
2644 esac
2304df62
AD
2645 ;;
2646*) dflt="$ldflags";;
2647esac
2648echo " "
2649rp="Any additional ld flags (NOT including libraries)?"
2650. ./myread
2651case "$ans" in
2652none) ldflags='';;
2653*) ldflags="$ans";;
2654esac
2655rmlist="$rmlist pdp11"
2656
2304df62
AD
2657: Set private lib path
2658case "$plibpth" in
2659'') if mips; then
2660 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2661 fi;;
2662esac
a0d0e21e
LW
2663case "$libpth" in
2664' ') dlist='';;
2665'') dlist="$plibpth $glibpth";;
2666*) dlist="$libpth";;
2667esac
2668
2669: Now check and see which directories actually exist, avoiding duplicates
2670libpth=''
2671for xxx in $dlist
2304df62 2672do
a0d0e21e
LW
2673 if $test -d $xxx; then
2674 case " $libpth " in
2675 *" $xxx "*) ;;
2676 *) libpth="$libpth $xxx";;
2677 esac
2304df62
AD
2678 fi
2679done
a0d0e21e 2680$cat <<'EOM'
2304df62 2681
a0d0e21e
LW
2682Some systems have incompatible or broken versions of libraries. Among
2683the directories listed in the question below, please remove any you
2684know not to be holding relevant libraries, and add any that are needed.
2685Say "none" for none.
2686
2687EOM
2688case "$libpth" in
2689'') dflt='none';;
2690*)
2691 set X $libpth
2692 shift
2693 dflt=${1+"$@"}
2694 ;;
2695esac
2304df62
AD
2696rp="Directories to use for library searches?"
2697. ./myread
2698case "$ans" in
2699none) libpth=' ';;
2700*) libpth="$ans";;
2701esac
a0d0e21e
LW
2702
2703: compute shared library extension
2704case "$so" in
2705'')
2706 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2707 dflt='sl'
2708 else
2709 dflt='so'
2710 fi
2711 ;;
2712*) dflt="$so";;
2713esac
2714$cat << EOM
2715
2716On some systems, shared libraries may be available. Answer 'none' if
2717you want to suppress searching of shared libraries.
2718EOM
2719rp='What is the file extension used for shared libraries?'
2720. ./myread
2721so="$ans"
2722
2304df62
AD
2723: Looking for optional libraries
2724echo " "
2725echo "Checking for optional libraries..." >&4
2726case "$libs" in
2727' '|'') dflt='';;
2728*) dflt="$libs";;
2729esac
2730case "$libswanted" in
2731'') libswanted='c_s';;
2732esac
2733for thislib in $libswanted; do
a0d0e21e
LW
2734
2735 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2736 echo "Found -l$thislib (shared)."
2737 case " $dflt " in
2738 *"-l$thislib "*);;
2739 *) dflt="$dflt -l$thislib";;
2740 esac
2741 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2742 echo "Found -l$thislib (shared)."
2743 case " $dflt " in
2744 *"-l$thislib "*);;
2745 *) dflt="$dflt -l$thislib";;
2746 esac
2747 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2304df62 2748 echo "Found -l$thislib."
a0d0e21e
LW
2749 case " $dflt " in
2750 *"-l$thislib "*);;
2304df62
AD
2751 *) dflt="$dflt -l$thislib";;
2752 esac
a0d0e21e
LW
2753 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2754 echo "Found -l${thislib}_s."
2755 case " $dflt " in
2756 *"-l$thislib "*);;
2757 *) dflt="$dflt -l${thislib}_s";;
2304df62 2758 esac
a0d0e21e
LW
2759 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2760 echo "Found -l$thislib."
2761 case " $dflt " in
2762 *"-l$thislib "*);;
2304df62
AD
2763 *) dflt="$dflt -l$thislib";;
2764 esac
2765 else
a0d0e21e 2766 echo "No -l$thislib."
2304df62
AD
2767 fi
2768done
2769set X $dflt
2770shift
2771dflt="$*"
2772case "$libs" in
2773'') dflt="$dflt";;
2774*) dflt="$libs";;
2775esac
2776case "$dflt" in
2777' '|'') dflt='none';;
2778esac
2779
2780$cat <<EOM
2781
2782Some versions of Unix support shared libraries, which make executables smaller
2783but make load time slightly longer.
2784
2785On some systems, mostly newer Unix System V's, the shared library is included
2786by putting the option "-lc_s" as the last thing on the cc command line when
2787linking. Other systems use shared libraries by default. There may be other
2788libraries needed to compile $package on your machine as well. If your system
2789needs the "-lc_s" option, include it here. Include any other special libraries
2790here as well. Say "none" for none.
2791EOM
2792
2793echo " "
2794rp="Any additional libraries?"
2795. ./myread
2796case "$ans" in
2797none) libs=' ';;
2798*) libs="$ans";;
2799esac
2800
2801: see if nm is to be used to determine whether a symbol is defined or not
2802case "$usenm" in
2803'')
2804 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2805 if $test $dflt -gt 20; then
2806 dflt=y
2807 else
2808 dflt=n
2809 fi
2810 ;;
2811*)
2812 case "$usenm" in
2813 true) dflt=y;;
2814 *) dflt=n;;
2815 esac
2816 ;;
2817esac
2818$cat <<EOM
2819
2820I can use 'nm' to extract the symbols from your C libraries. This is a time
2821consuming task which may generate huge output on the disk (up to 3 megabytes)
2822but that should make the symbols extraction faster. The alternative is to skip
2823the 'nm' extraction part and to compile a small test program instead to
2824determine whether each symbol is present. If you have a fast C compiler and/or
2825if your 'nm' output cannot be parsed, this may be the best solution.
2826
2827EOM
2828rp='Shall I use nm to extract C symbols from the libraries?'
2829. ./myread
2830case "$ans" in
2831n|N) usenm=false;;
2832*) usenm=true;;
2833esac
2834
2835runnm=$usenm
2836case "$reuseval" in
2837true) runnm=false;;
2838esac
2839
2840: nm options which may be necessary
2841case "$nm_opt" in
2842'') if $test -f /mach_boot; then
2843 nm_opt=''
2844 elif $test -d /usr/ccs/lib; then
2845 nm_opt='-p'
2846 elif $test -f /dgux; then
2847 nm_opt='-p'
2848 else
2849 nm_opt=''
2850 fi;;
2851esac
2852
2853case "$runnm" in
2854true)
2855: get list of predefined functions in a handy place
2856echo " "
2857case "$libc" in
2858'') libc=unknown
2859 case "$libs" in
2860 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2861 esac
2862 ;;
2863esac
2304df62
AD
2864libnames='';
2865case "$libs" in
2866'') ;;
2867*) for thislib in $libs; do
2868 case "$thislib" in
a0d0e21e
LW
2869 -lc|-lc_s)
2870 : Handle C library specially below.
2871 ;;
2304df62 2872 -l*)
a0d0e21e
LW
2873 thislib=`echo X$thislib | $sed -e 's/^X//' -e 's/^-l//'`
2874 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
2875 :
2876 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
2877 :
2878 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
2879 :
2880 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
2881 :
2882 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
2883 :
2884 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
2885 :
2886 else
2887 try=''
2304df62
AD
2888 fi
2889 libnames="$libnames $try"
2890 ;;
2891 *) libnames="$libnames $thislib" ;;
2892 esac
2893 done
2894 ;;
2895esac
2896xxx=normal
2897case "$libc" in
2898unknown)
a0d0e21e
LW
2899 set /usr/ccs/lib/libc.$so
2900 $test -r $1 || set /usr/lib/libc.$so
2901 $test -r $1 || set /usr/shlib/libc.$so
2902 $test -r $1 || set /usr/lib/libc.$so.[0-9]*
2903 $test -r $1 || set /lib/libc.$so
2304df62
AD
2904 $test -r $1 || set /lib/libsys_s.a
2905 eval set \$$#
2906 ;;
2907*)
2908 set blurfl
2909 ;;
2910esac
2911if $test -r "$1"; then
2912 echo "Your (shared) C library seems to be in $1."
2913 libc="$1"
2914elif $test -r /lib/libc && $test -r /lib/clib; then
2915 echo "Your C library seems to be in both /lib/clib and /lib/libc."
2916 xxx=apollo
2917 libc='/lib/clib /lib/libc'
2918 if $test -r /lib/syslib; then
2919 echo "(Your math library is in /lib/syslib.)"
2920 libc="$libc /lib/syslib"
2921 fi
2922elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2923 echo "Your C library seems to be in $libc, as you said before."
2924elif $test -r $incpath/usr/lib/libc.a; then
2925 libc=$incpath/usr/lib/libc.a;
2926 echo "Your C library seems to be in $libc. That's fine."
2927elif $test -r /lib/libc.a; then
2928 libc=/lib/libc.a;
2929 echo "Your C library seems to be in $libc. You're normal."
2930else
2931 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
2932 :
2933 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
2934 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
2935 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
2936 :
2937 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2938 :
2939 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2940 :
2941 else
2942 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
2943 fi
2944 if $test -r "$tans"; then
2945 echo "Your C library seems to be in $tans, of all places."
2946 libc=$tans
2947 else
2948 libc='blurfl'
2949 fi
2950fi
2951if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2952 dflt="$libc"
2953 cat <<EOM
2954
2955If the guess above is wrong (which it might be if you're using a strange
2956compiler, or your machine supports multiple models), you can override it here.
2957
2958EOM
2959else
2960 dflt=''
2961 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
2962 cat >&4 <<EOM
2963I can't seem to find your C library. I've looked in the following places:
2964
2965EOM
2966 $sed 's/^/ /' libpath
2967 cat <<EOM
2968
2969None of these seems to contain your C library. I need to get its name...
2970
2971EOM
2972fi
2973fn=f
2974rp='Where is your C library?'
2975. ./getfile
2976libc="$ans"
2977
2978echo " "
2979echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
2980set X `cat libnames`
2981shift
2982xxx=files
2983case $# in 1) xxx=file; esac
2984echo "Extracting names from the following $xxx for later perusal:" >&4
2985echo " "
2986$sed 's/^/ /' libnames >&4
2987echo " "
2988$echo $n "This may take a while...$c" >&4
2304df62
AD
2989nm $nm_opt $* 2>/dev/null >libc.tmp
2990$echo $n ".$c"
2991$grep fprintf libc.tmp > libc.ptf
2992xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
2993xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
a0d0e21e 2994if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\
2304df62
AD
2995 eval $xscan;\
2996 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2997 eval $xrun
2998elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
2999 eval $xscan;\
3000 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3001 eval $xrun
3002elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3003 eval $xscan;\
3004 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3005 eval $xrun
3006elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3007 eval $xscan;\
3008 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3009 eval $xrun
3010elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3011 eval $xscan;\
3012 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3013 eval $xrun
3014elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3015 eval $xscan;\
3016 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3017 eval $xrun
3018elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3019 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
3020 eval $xscan;\
3021 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3022 eval $xrun
3023elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3024 eval $xscan;\
3025 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3026 eval $xrun
3027elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3028 eval $xscan;\
3029 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3030 eval $xrun
a0d0e21e
LW
3031elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3032 eval $xscan;\
3033 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3034 eval $xrun
2304df62
AD
3035else
3036 nm -p $* 2>/dev/null >libc.tmp
3037 com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
3038 eval "<libc.tmp $com >libc.list"
3039 if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3040 nm_opt='-p'
3041 echo "done" >&4
3042 else
3043 echo " "
3044 echo "nm didn't seem to work right. Trying ar instead..." >&4
3045 com=''
3046 if ar t $libc > libc.tmp; then
3047 for thisname in $libnames; do
3048 ar t $thisname >>libc.tmp
3049 done
3050 $sed -e 's/\.o$//' < libc.tmp > libc.list
3051 echo "Ok." >&4
3052 else
3053 echo "ar didn't seem to work right." >&4
3054 echo "Maybe this is a Cray...trying bld instead..." >&4
3055 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
3056 for thisname in $libnames; do
3057 bld t $libnames | \
3058 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3059 ar t $thisname >>libc.tmp
3060 done
3061 echo "Ok." >&4
3062 else
3063 echo "That didn't work either. Giving up." >&4
3064 exit 1
3065 fi
3066 fi
3067 fi
3068fi
3069nm_extract="$com"
3070if $test -f /lib/syscalls.exp; then
3071 echo " "
3072 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3073 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3074fi
3075;;
3076esac
3077$rm -f libnames libpath
3078
3079: is a C symbol defined?
3080csym='tlook=$1;
3081case "$3" in
3082-v) tf=libc.tmp; tc=""; tdc="";;
3083-a) tf=libc.tmp; tc="[0]"; tdc=[];;
3084*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3085esac;
3086tx=yes;
3087case "$reuseval-$4" in
3088true-) ;;
3089true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3090esac;
3091case "$tx" in
3092yes)
3093 case "$runnm" in
3094 true)
3095 if $contains $tlook $tf >/dev/null 2>&1;
3096 then tval=true;
3097 else tval=false;
3098 fi;;
3099 *)
3100 echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
3101 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3102 then tval=true;
3103 else tval=false;
3104 fi;
3105 $rm -f t t.c;;
3106 esac;;
3107*)
3108 case "$tval" in
3109 $define) tval=true;;
3110 *) tval=false;;
3111 esac;;
3112esac;
3113eval "$2=$tval"'
3114
3115: set up the script used to warn in case of inconsistency
3116cat <<'EOSC' >whoa
3117dflt=y
3118echo " "
3119echo "*** WHOA THERE!!! ***" >&4
3120echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3121rp=" Keep the $hint value?"
3122. ./myread
3123case "$ans" in
3124y) td=$was; tu=$was;;
3125esac
3126EOSC
3127
3128: define an is-in-libc? function
3129inlibc='echo " "; td=$define; tu=$undef;
3130sym=$1; var=$2; eval "was=\$$2";
3131tx=yes;
3132case "$reuseval$was" in
3133true) ;;
3134true*) tx=no;;
3135esac;
3136case "$tx" in
3137yes)
3138 set $sym tres -f;
3139 eval $csym;
3140 case "$tres" in
3141 true)
3142 echo "$sym() found." >&4;
3143 case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
3144 *)
3145 echo "$sym() NOT found." >&4;
3146 case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
3147 esac;;
3148*)
3149 case "$was" in
3150 $define) echo "$sym() found." >&4;;
3151 *) echo "$sym() NOT found." >&4;;
3152 esac;;
3153esac'
3154
a0d0e21e
LW
3155: see if gconvert exists
3156set gconvert d_gconvert
3157eval $inlibc
2304df62 3158
a0d0e21e
LW
3159case "$d_gconvert" in
3160$define)
3161 d_Gconvert="gconvert((x),(n),(t),(b))"
3162 ;;
3163*)
3164 : Maybe we can emulate it with gcvt.
3165 set gcvt d_gcvt
3166 eval $inlibc
2304df62 3167
a0d0e21e
LW
3168 case "$d_gcvt" in
3169 $define)
3170 : Test whether gcvt drops a trailing decimal point
3171 cat >try.c <<'EOP'
3172main() {
3173char buf[64];
3174gcvt(1.0, 8, buf);
3175if (buf[0] != '1' || buf[1] != '\0')
3176 return 1;
3177gcvt(0.0, 8, buf);
3178if (buf[0] != '0' || buf[1] != '\0')
3179 return 1;
3180gcvt(-1.0, 8, buf);
3181if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3182 return 1;
3183return 0;
3184}
3185EOP
3186 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3187 if ./try; then
3188 echo "Good, your gcvt() drops a trailing decimal point."
3189 d_Gconvert="gcvt((x),(n),(b))"
3190 else
3191 echo "But your gcvt() keeps a trailing decimal point".
3192 d_Gconvert=''
3193 fi
2304df62 3194 else
a0d0e21e
LW
3195 echo "Hmm. I can't compile the gcvt test program."
3196 d_Gconvert=''
2304df62 3197 fi
a0d0e21e 3198 $rm -f try.c try
2304df62
AD
3199 ;;
3200 esac
a0d0e21e
LW
3201 case "$d_Gconvert" in
3202 '')
3203 echo "I'll use sprintf instead." >&4
3204 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
2304df62
AD
3205 ;;
3206 esac
2304df62
AD
3207esac
3208
a0d0e21e
LW
3209: Initialize h_fcntl
3210h_fcntl=false
3211
3212: Initialize h_sysfile
3213h_sysfile=false
2304df62
AD
3214
3215: determine filename position in cpp output
3216echo " "
3217echo "Computing filename position in cpp output for #include directives..." >&4
3218echo '#include <stdio.h>' > foo.c
3219$cat >fieldn <<EOF
3220$startsh
a0d0e21e 3221$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
2304df62
AD
3222$grep '^[ ]*#.*stdio\.h' | \
3223while read cline; do
3224 pos=1
3225 set \$cline
3226 while $test \$# -gt 0; do
3227 if $test -r \`echo \$1 | $tr -d '"'\`; then
3228 echo "\$pos"
3229 exit 0
3230 fi
3231 shift
3232 pos=\`expr \$pos + 1\`
3233 done
3234done
3235EOF
3236chmod +x fieldn
3237fieldn=`./fieldn`
3238$rm -f foo.c fieldn
3239case $fieldn in
3240'') pos='???';;
32411) pos=first;;
32422) pos=second;;
32433) pos=third;;
3244*) pos="${fieldn}th";;
3245esac
3246echo "Your cpp writes the filename in the $pos field of the line."
3247
3248: locate header file
3249$cat >findhdr <<EOF
3250$startsh
3251wanted=\$1
3252name=''
3253if test -f $usrinc/\$wanted; then
3254 echo "$usrinc/\$wanted"
3255 exit 0
3256fi
3257awkprg='{ print \$$fieldn }'
3258echo "#include <\$wanted>" > foo\$\$.c
3259$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3260$grep "^[ ]*#.*\$wanted" | \
3261while read cline; do
3262 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3263 case "\$name" in
3264 */\$wanted) echo "\$name"; exit 0;;
3265 *) name='';;
3266 esac;
3267done;
3268$rm -f foo\$\$.c;
3269case "\$name" in
3270'') exit 1;;
3271esac
3272EOF
3273chmod +x findhdr
3274
3275: access call always available on UNIX
3276set access d_access
3277eval $inlibc
3278
3279: locate the flags for 'access()'
3280case "$d_access" in
3281"$define")
3282 echo " "
3283 $cat >access.c <<'EOCP'
3284#include <sys/types.h>
3285#ifdef I_FCNTL
3286#include <fcntl.h>
3287#endif
3288#ifdef I_SYS_FILE
3289#include <sys/file.h>
3290#endif
3291#ifdef I_UNISTD
3292#include <unistd.h>
3293#endif
3294main() {
3295 exit(R_OK);
3296}
3297EOCP
3298 : check sys/file.h first, no particular reason here
3299 if $test `./findhdr sys/file.h` && \
3300 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3301 h_sysfile=true;
3302 echo "<sys/file.h> defines the *_OK access constants." >&4
3303 elif $test `./findhdr fcntl.h` && \
3304 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3305 h_fcntl=true;
3306 echo "<fcntl.h> defines the *_OK access constants." >&4
85e6fe83
LW
3307 elif $test `./findhdr unistd.h` && \
3308 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3309 echo "<unistd.h> defines the *_OK access constants." >&4
2304df62
AD
3310 else
3311 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3312 fi
3313 ;;
3314esac
3315$rm -f access*
3316
a0d0e21e
LW
3317: see if alarm exists
3318set alarm d_alarm
2304df62
AD
3319eval $inlibc
3320
a0d0e21e
LW
3321: is AFS running?
3322echo " "
3323if test -d /afs; then
3324 echo "AFS may be running... I'll be extra cautious then..." >&4
3325 afs=true
3326else
3327 echo "AFS does not seem to be running..." >&4
3328 afs=false
3329fi
2304df62 3330
a0d0e21e
LW
3331: determine root of directory hierarchy where package will be installed.
3332case "$prefix" in
3333'')
3334 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3335 ;;
3336*)
3337 dflt="$prefix"
3338 ;;
3339esac
3340$cat <<EOM
2304df62 3341
a0d0e21e
LW
3342By default, $package will be installed in $dflt/bin, manual
3343pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3344all installation directories. Typically set to /usr/local, but you
3345may choose /usr if you wish to install $package among your system
3346binaries. If you wish to have binaries under /bin but manual pages
3347under /usr/local/man, that's ok: you will be prompted separately
3348for each of the installation directories, the prefix being only used
3349to set defaults.
3350
3351EOM
3352fn=d~
3353rp='Installation prefix to use?'
3354. ./getfile
3355prefix="$ans"
3356
3357: determine where private executables go
3358case "$privlib" in
2304df62 3359'')
a0d0e21e
LW
3360 dflt=$prefix/lib/$package
3361 ;;
3362*) dflt="$privlib"
3363 ;;
3364esac
3365$cat <<EOM
3366
3367There are some auxiliary files for $package that need to be put into a
3368private library directory that is accessible by everyone.
3369
3370EOM
3371fn=d~+
3372rp='Pathname where private library files will reside?'
3373. ./getfile
3374privlib="$ans"
3375privlibexp="$ansexp"
3376if $afs; then
3377 $cat <<EOM
3378
3379Since you are running AFS, I need to distinguish the directory in which
3380private files reside from the directory in which they are installed (and from
3381which they are presumably copied to the former directory by occult means).
3382
3383EOM
3384 case "$installprivlib" in
3385 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3386 *) dflt="$installprivlib";;
3387 esac
3388 fn=de~
3389 rp='Where will private files be installed?'
3390 . ./getfile
3391 installprivlib="$ans"
3392else
3393 installprivlib="$privlibexp"
3394fi
3395
3396: determine where public architecture dependent libraries go
3397case "$archname" in
3398'') tpath=`echo $PATH | sed -e 's/:/ /g'`
3399 xxx=`./loc arch blurfl $tpath`
3400 if test -f "$xxx"; then
3401 tarchname=`arch`
3402 archname="${tarchname}-${osname}"
2304df62 3403 else
a0d0e21e 3404 archname="$osname"
2304df62
AD
3405 fi
3406 ;;
2304df62 3407esac
a0d0e21e
LW
3408case "$privlib" in
3409'') dflt=`./loc . "." $prefix/lib /usr/local/lib /usr/lib /lib`;;
3410*) dflt="$privlib/$archname";;
3411esac
3412fn=d~
3413cat <<EOM
3414
3415$package contains architecture-dependent library files. If you are
3416sharing libraries in a heterogeneous environment, you might store
3417these files in a separate location. Otherwise, you can just include
3418them with the rest of the public library files.
3419
3420EOM
3421rp='Where do you want to put the public architecture-dependent libraries?'
3422. ./getfile
3423archlib="$ans"
3424archlibexp="$ansexp"
3425
3426if $afs; then
3427 $cat <<EOM
3428
3429Since you are running AFS, I need to distinguish the directory in which
3430private files reside from the directory in which they are installed (and from
3431which they are presumably copied to the former directory by occult means).
3432
3433EOM
3434 case "$installarchlib" in
3435 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3436 *) dflt="$installarchlib";;
3437 esac
3438 fn=de~
3439 rp='Where will architecture-dependent library files be installed?'
3440 . ./getfile
3441 installarchlib="$ans"
3442else
3443 installarchlib="$archlibexp"
3444fi
3445if $test X"$archlib" = X"$privlib"; then
3446 d_archlib="$undef"
3447else
3448 d_archlib="$define"
3449fi
3450
2304df62
AD
3451
3452: function used to set $1 to $val
3453setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3454case "$val$was" in
3455$define$undef) . whoa; eval "$var=\$td";;
3456$undef$define) . whoa; eval "$var=\$tu";;
3457*) eval "$var=$val";;
3458esac'
3459
a0d0e21e 3460: Look for GNUC style attribute checking
2304df62 3461echo " "
a0d0e21e
LW
3462echo "Checking whether your compiler can handle __attribute__ ..." >&4
3463$cat >attrib.c <<'EOCP'
3464void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
3465EOCP
3466if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3467 if $contains 'warning' attrib.out >/dev/null 2>&1; then
3468 echo "Your C compiler doesn't fully support __attribute__. ."
3469 val="$undef"
3470 else
3471 echo "Your C compiler supports __attribute__. ."
3472 val="$define"
3473 fi
3474else
3475 echo "Your C compiler doesn't seem to understand __attribute__. ."
3476 val="$undef"
3477fi
3478set d_attrib
3479eval $setvar
3480$rm -f attrib*
3481
3482: see if bcmp exists
3483set bcmp d_bcmp
3484eval $inlibc
3485
3486: see if bcopy exists
3487set bcopy d_bcopy
3488eval $inlibc
3489
3490: see if setpgrp exists
3491set setpgrp d_setpgrp
3492eval $inlibc
3493
3494: see which flavor of setpgrp is in use
3495case "$d_setpgrp" in
3496"$define")
3497 echo " "
3498 $cat >set.c <<EOP
3499main()
3500{
3501 if (getuid() == 0) {
3502 printf("(I see you are running Configure as super-user...)\n");
3503 setuid(1);
3504 }
3505 if (-1 == setpgrp(1, 1))
3506 exit(1);
3507 exit(0);
3508}
3509EOP
3510 if $cc $ccflags -o set $ldflags set.c $libs >/dev/null 2>&1; then
3511 ./set 2>/dev/null
3512 case $? in
3513 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3514 val="$undef";;
3515 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3516 val="$define";;
3517 esac
3518 else
3519 if usg; then
3520 xxx="USG one, i.e. you use setpgrp()."
3521 val="$undef"
3522 else
3523 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3524 val="$define"
3525 fi
3526 echo "Assuming your setpgrp is a $xxx" >&4
3527 fi
3528 ;;
3529*) val="$undef";;
3530esac
3531set d_bsdpgrp
3532eval $setvar
3533$rm -f set set.c
3534
3535: see if bzero exists
3536set bzero d_bzero
3537eval $inlibc
3538
3539: check for length of integer
3540echo " "
3541case "$intsize" in
3542'')
3543 echo "Checking to see how big your integers are..." >&4
3544 $cat >try.c <<'EOCP'
3545#include <stdio.h>
3546main()
3547{
3548 printf("%d\n", sizeof(int));
3549}
3550EOCP
3551 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3552 dflt=`./try`
3553 else
3554 dflt='4'
3555 echo "(I can't seem to compile the test program. Guessing...)"
3556 fi
3557 ;;
3558*)
3559 dflt="$intsize"
3560 ;;
3561esac
3562rp="What is the size of an integer (in bytes)?"
3563. ./myread
3564intsize="$ans"
3565$rm -f try.c try
3566
3567: check for ability to cast large floats to 32-bit ints.
3568echo " "
3569echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3570if $test "$intsize" -eq 4; then
3571 xxx=int
3572else
3573 xxx=long
3574fi
3575$cat >try.c <<EOCP
2304df62
AD
3576#include <sys/types.h>
3577#include <signal.h>
3578blech() { exit(3); }
3579main()
3580{
a0d0e21e 3581 $xxx i32;
2304df62
AD
3582 double f;
3583 int result = 0;
3584 signal(SIGFPE, blech);
3585
3586 f = (double) 0x7fffffff;
3587 f = 10 * f;
a0d0e21e 3588 i32 = ($xxx) f;
2304df62 3589
a0d0e21e 3590 if (i32 != ($xxx) f)
2304df62
AD
3591 result |= 1;
3592 exit(result);
3593}
3594EOCP
3595if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3596 ./try
3597 yyy=$?
3598else
a0d0e21e 3599 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3600 yyy=1
3601fi
3602case "$yyy" in
36030) val="$define"
3604 echo "Yup, it can."
3605 ;;
3606*) val="$undef"
3607 echo "Nope, it can't."
3608 ;;
3609esac
3610set d_casti32
3611eval $setvar
85e6fe83 3612$rm -f try try.*
a0d0e21e 3613
2304df62
AD
3614: check for ability to cast negative floats to unsigned
3615echo " "
3616echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
3617$cat >try.c <<'EOCP'
3618#include <signal.h>
3619blech() { exit(3); }
3620main()
3621{
3622 double f = -123;
3623 unsigned long along;
3624 unsigned int aint;
3625 unsigned short ashort;
3626 int result = 0;
3627
3628 signal(SIGFPE, blech);
3629 along = (unsigned long)f;
3630 aint = (unsigned int)f;
3631 ashort = (unsigned short)f;
3632 if (along != (unsigned long)-123)
3633 result |= 1;
3634 if (aint != (unsigned int)-123)
3635 result |= 1;
3636 if (ashort != (unsigned short)-123)
3637 result |= 1;
3638 f = (double)0x40000000;
3639 f = f + f;
3640 along = 0;
3641 along = (unsigned long)f;
3642 if (along != 0x80000000)
3643 result |= 2;
3644 f -= 1.;
3645 along = 0;
3646 along = (unsigned long)f;
3647 if (along != 0x7fffffff)
3648 result |= 1;
3649 f += 2.;
3650 along = 0;
3651 along = (unsigned long)f;
3652 if (along != 0x80000001)
3653 result |= 2;
3654 exit(result);
3655
3656}
3657EOCP
3658if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3659 ./try
3660 castflags=$?
3661else
3662 castflags=3
3663fi
3664case "$castflags" in
36650) val="$define"
3666 echo "Yup, it can."
3667 ;;
3668*) val="$undef"
3669 echo "Nope, it can't."
3670 ;;
3671esac
3672set d_castneg
3673eval $setvar
3674$rm -f try.*
3675
3676: see if sprintf is declared as int or pointer to char
3677echo " "
3678$cat >ucbsprf.c <<'EOF'
3679main()
3680{
3681 int sprintf();
3682 char buf[10];
3683 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
3684}
3685EOF
3686if $cc ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
3687 echo "Your sprintf() returns (int)." >&4
3688 val="$undef"
3689else
3690 echo "Your sprintf() returns (char*)." >&4
3691 val="$define"
3692fi
3693set d_charsprf
3694eval $setvar
3695$rm -f ucbsprf*
3696
3697: see if vprintf exists
3698echo " "
3699if set vprintf val -f d_vprintf; eval $csym; $val; then
3700 echo 'vprintf() found.' >&4
3701 val="$define"
3702 $cat >vprintf.c <<'EOF'
3703#include <varargs.h>
3704
3705main() { xxx("foo"); }
3706
3707xxx(va_alist)
3708va_dcl
3709{
3710 va_list args;
3711 char buf[10];
3712
3713 va_start(args);
3714 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
3715}
3716EOF
3717 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
3718 echo "Your vsprintf() returns (int)." >&4
3719 val2="$undef"
3720 else
3721 echo "Your vsprintf() returns (char*)." >&4
3722 val2="$define"
3723 fi
3724else
3725 echo 'vprintf() NOT found.' >&4
3726 val="$undef"
3727 val2="$undef"
3728fi
3729set d_vprintf
3730eval $setvar
3731val=$val2
3732set d_charvspr
3733eval $setvar
3734
a0d0e21e
LW
3735: see if chown exists
3736set chown d_chown
3737eval $inlibc
3738
3739: see if chroot exists
3740set chroot d_chroot
3741eval $inlibc
3742
2304df62
AD
3743: see if chsize exists
3744set chsize d_chsize
3745eval $inlibc
3746
3747: check for const keyword
3748echo " "
3749echo 'Checking to see if your C compiler knows about "const"...' >&4
3750$cat >const.c <<'EOCP'
3751typedef struct spug { int drokk; } spug;
3752main()
3753{
3754 const char *foo;
3755 const spug y;
3756}
3757EOCP
3758if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
3759 val="$define"
3760 echo "Yup, it does."
3761else
3762 val="$undef"
3763 echo "Nope, it doesn't."
3764fi
3765set d_const
3766eval $setvar
3767
3768: see if crypt exists
3769echo " "
3770if set crypt val -f d_crypt; eval $csym; $val; then
3771 echo 'crypt() found.' >&4
3772 val="$define"
3773 cryptlib=''
3774else
3775 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
3776 if $test -z "$cryptlib"; then
3777 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
3778 else
3779 cryptlib=-lcrypt
3780 fi
3781 if $test -z "$cryptlib"; then
3782 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
3783 else
3784 cryptlib=-lcrypt
3785 fi
3786 if $test -z "$cryptlib"; then
3787 cryptlib=`./loc libcrypt.a "" $libpth`
3788 else
3789 cryptlib=-lcrypt
3790 fi
3791 if $test -z "$cryptlib"; then
3792 echo 'crypt() NOT found.' >&4
3793 val="$undef"
3794 else
3795 val="$define"
3796 fi
3797fi
3798set d_crypt
3799eval $setvar
3800
3801: get csh whereabouts
3802case "$csh" in
3803'csh') val="$undef" ;;
3804*) val="$define" ;;
3805esac
3806set d_csh
3807eval $setvar
3808
a0d0e21e
LW
3809: see if cuserid exists
3810set cuserid d_cuserid
2304df62
AD
3811eval $inlibc
3812
85e6fe83
LW
3813: define an alternate in-header-list? function
3814inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3815cont=true; xxf="echo \"<\$1> found.\" >&4";
3816case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3817*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3818esac;
3819case $# in 4) instead=instead;; *) instead="at last";; esac;
3820while $test "$cont"; do
3821 xxx=`./findhdr $1`
3822 var=$2; eval "was=\$$2";
3823 if $test "$xxx" && $test -r "$xxx";
3824 then eval $xxf;
3825 eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
3826 cont="";
3827 else eval $xxnf;
3828 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
3829 set $yyy; shift; shift; yyy=$@;
3830 case $# in 0) cont="";;
3831 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3832 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3833 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3834 xxnf="echo \"there is no <\$1>, ...\" >&4";;
3835 esac;
3836done;
3837while $test "$yyy";
3838do set $yyy; var=$2; eval "was=\$$2";
3839 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
3840 set $yyy; shift; shift; yyy=$@;
3841done'
3842
a0d0e21e
LW
3843: see if this is a limits.h system
3844set limits.h i_limits
85e6fe83
LW
3845eval $inhdr
3846
a0d0e21e
LW
3847: see if this is a float.h system
3848set float.h i_float
3849eval $inhdr
3850
3851: See if number of significant digits in a double precision number is known
3852echo " "
3853$cat >dbl_dig.c <<EOM
3854#$i_limits I_LIMITS
3855#$i_float I_FLOAT
3856#ifdef I_LIMITS
3857#include <limits.h>
85e6fe83 3858#endif
a0d0e21e
LW
3859#ifdef I_FLOAT
3860#include <float.h>
3861#endif
3862#ifdef DBL_DIG
3863printf("Contains DBL_DIG");
85e6fe83 3864#endif
85e6fe83 3865EOM
a0d0e21e
LW
3866$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
3867if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
3868 echo "DBL_DIG found." >&4
3869 val="$define"
2304df62 3870else
a0d0e21e
LW
3871 echo "DBL_DIG NOT found." >&4
3872 val="$undef"
2304df62 3873fi
a0d0e21e
LW
3874$rm -f dbl_dig.?
3875set d_dbl_dig
2304df62 3876eval $setvar
2304df62 3877
a0d0e21e
LW
3878: see if difftime exists
3879set difftime d_difftime
2304df62
AD
3880eval $inlibc
3881
a0d0e21e
LW
3882: see if this is a dirent system
3883echo " "
3884if xinc=`./findhdr dirent.h`; $test "$xinc"; then
3885 val="$define"
3886 echo "<dirent.h> found." >&4
3887else
3888 val="$undef"
3889 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
3890 echo "<sys/dir.h> found." >&4
3891 echo " "
3892 else
3893 xinc=`./findhdr sys/ndir.h`
3894 fi
3895 echo "<dirent.h> NOT found." >&4
3896fi
3897set i_dirent
3898eval $setvar
3899
3900: Look for type of directory structure.
3901echo " "
3902$cppstdin $cppflags $cppminus < "$xinc" > try.c
3903
3904case "$direntrytype" in
3905''|' ')
3906 case "$i_dirent" in
3907 $define) guess1='struct dirent' ;;
3908 *) guess1='struct direct' ;;
3909 esac
3910 ;;
3911*) guess1="$direntrytype"
3912 ;;
3913esac
3914
3915case "$guess1" in
3916'struct dirent') guess2='struct direct' ;;
3917*) guess2='struct dirent' ;;
3918esac
3919
3920if $contains "$guess1" try.c >/dev/null 2>&1; then
3921 direntrytype="$guess1"
3922 echo "Your directory entries are $direntrytype." >&4
3923elif $contains "$guess2" try.c >/dev/null 2>&1; then
3924 direntrytype="$guess2"
3925 echo "Your directory entries seem to be $direntrytype." >&4
3926else
3927 echo "I don't recognize your system's directory entries." >&4
3928 rp="What type is used for directory entries on this system?"
3929 dflt="$guess1"
3930 . ./myread
3931 direntrytype="$ans"
3932fi
3933$rm -f try.c
3934
3935
3936: see if the directory entry stores field length
3937echo " "
3938if $contains 'd_namlen' $xinc >/dev/null 2>&1; then
3939 echo "Good, your directory entry keeps length information in d_namlen." >&4
3940 val="$define"
3941else
3942 echo "Your directory entry does not know about the d_namlen field." >&4
3943 val="$undef"
3944fi
3945set d_dirnamlen
3946eval $setvar
3947
3948: see if dlerror exists
3949set dlerror d_dlerror
3950eval $inlibc
3951
3952: see if dld is available
3953set dld.h i_dld
3954eval $inhdr
3955
3956: see if dlopen exists
3957set dlopen d_dlopen
3958eval $inlibc
3959
3960: determine which dynamic loading, if any, to compile in
3961echo " "
3962dldir="ext/DynaLoader"
3963case "$usedl" in
3964$define|y|true)
3965 dflt='y'
3966 usedl="$define"
3967 ;;
3968$undef|n|false)
3969 dflt='n'
3970 usedl="$undef"
3971 ;;
3972*)
3973 dflt='n'
3974 case "$d_dlopen" in
3975 define) dflt='y' ;;
3976 esac
3977 case "$i_dld" in
3978 define) dflt='y' ;;
3979 esac
3980 : Does a dl_xxx.xs file exist for this operating system
3981 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
3982 ;;
3983esac
3984rp="Do you wish to use dynamic loading?"
3985. ./myread
3986usedl="$ans"
3987case "$ans" in
3988y*) usedl="$define"
3989 case "$dlsrc" in
3990 '')
3991 if $test -f ../$dldir/dl_${osname}.xs ; then
3992 dflt="$dldir/dl_${osname}.xs"
3993 elif $test "$d_dlopen" = "$define" ; then
3994 dflt="$dldir/dl_dlopen.xs"
3995 elif $test "$i_dld" = "$define" ; then
3996 dflt="$dldir/dl_dld.xs"
3997 else
3998 dflt=''
3999 fi
4000 ;;
4001 *) dflt="$dldir/$dlsrc"
4002 ;;
4003 esac
4004 echo "The following dynamic loading files are available:"
4005 : Can not go over to $dldir because getfile has path hard-coded in.
4006 cd ..; ls -C $dldir/dl*.xs; cd UU
4007 rp="Source file to use for dynamic loading"
4008 fn="fne~"
4009 . ./getfile
4010 usedl="$define"
4011 : emulate basename
4012 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4013 $cat << EOM
4014
4015Some systems may require passing special flags to $cc -c to
4016compile modules that will be used to create a shared library.
4017To use no flags, say "none".
4018
4019EOM
4020 case "$cccdlflags" in
4021 ''|' ') case "$osname" in
4022 hpux) dflt='+z' ;;
4023 next) dflt='none' ;;
4024 sunos)
4025 case "$cc" in
4026 *gcc*) dflt='-fpic' ;;
4027 *) dflt='-pic' ;;
4028 esac
4029 ;;
4030 solaris)
4031 case "$cc" in
4032 *gcc*) dflt='-fpic' ;;
4033 *) dflt='-K pic' ;;
4034 esac
4035 ;;
4036 *) dflt='none' ;;
4037 esac
4038 ;;
4039 *) dflt="$cccdlflags" ;;
4040 esac
4041 rp="Any special flags to pass to $cc -c to compile shared library modules?"
4042 . ./myread
4043 case "$ans" in
4044 none) cccdlflags='' ;;
4045 *) cccdlflags="$ans" ;;
4046 esac
4047
4048 cat << 'EOM'
4049
4050Some systems may require passing special flags to ld to create a shared
4051library. If your ld flags include -L/local/path options to locate libraries
4052outside your loader's normal search path, you may need to specify those
4053-L options here as well.
4054To use no flags, say "none".
4055
4056EOM
4057 case "$lddlflags" in
4058 ''|' ') case "$osname" in
4059 hpux) dflt='-b' ;;
4060 next) dflt='none' ;;
4061 solaris) dflt='-G' ;;
4062 sunos) dflt='none' ;;
4063 *) dflt='none' ;;
4064 esac
4065 ;;
4066 *) dflt="$lddlflags" ;;
4067 esac
4068 rp="Any special flags to pass to ld to create a shared library?"
4069 . ./myread
4070 case "$ans" in
4071 none) lddlflags='' ;;
4072 *) lddlflags="$ans" ;;
4073 esac
4074
4075 cat <<EOM
4076
4077Some systems may require passing special flags to $cc to indicate that
4078the resulting executable will use dynamic linking. To use no flags,
4079say "none".
4080
4081EOM
4082 case "$ccdlflags" in
4083 ''|' ')
4084 case "$osname" in
4085 hpux) dflt='none' ;;
4086 next) dflt='none' ;;
4087 sunos) dflt='none' ;;
4088 *) dflt='none' ;;
4089 esac
4090 ;;
4091 *) dflt="$ccdlflags"
4092 ;;
4093 esac
4094 rp="Any special flags to pass to $cc to use dynamic loading?"
4095 . ./myread
4096 case "$ans" in
4097 none) ccdlflags='' ;;
4098 *) ccdlflags="$ans" ;;
4099 esac
4100 ;;
4101*) usedl="$undef"
4102 dlsrc='dl_none.xs'
4103 lddlflags=''
4104 ccdlflags=''
4105 ;;
4106esac
4107
4108: see if dlfcn is available
4109set dlfcn.h i_dlfcn
4110eval $inhdr
4111
4112case "$usedl" in
4113$define|y|true)
4114 $cat << EOM
4115
4116On a few systems, the dynamically loaded modules that perl generates and uses
4117will need a different extension then shared libs. The default will probably
4118be appropriate.
4119
4120EOM
4121 case "$dlext" in
4122 '') dflt="$so" ;;
4123 *) dflt="$dlext" ;;
4124 esac
4125 rp='What is the extension of dynamically loaded modules'
4126 . ./myread
4127 dlext="$ans"
4128 ;;
4129*)
4130 dlext="none"
4131 ;;
4132esac
4133
4134: Check if dlsym need a leading underscore
4135echo " "
4136val="$undef"
4137
4138case "$dlsrc" in
4139dl_dlopen.xs)
4140 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
4141 $cat >dyna.c <<'EOM'
4142fred () { }
4143EOM
4144
4145$cat >fred.c<<EOM
4146
4147#include <stdio.h>
4148#$i_dlfcn I_DLFCN
4149#ifdef I_DLFCN
4150#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
4151#else
4152#include <sys/types.h>
4153#include <nlist.h>
4154#include <link.h>
4155#endif
4156
4157extern int fred() ;
4158
4159main()
4160{
4161 void * handle ;
4162 void * symbol ;
4163#ifndef RTLD_LAZY
4164 int mode = 1 ;
4165#else
4166 int mode = RTLD_LAZY ;
4167#endif
4168 handle = dlopen("./dyna.$dlext", mode) ;
4169 if (handle == NULL) {
4170 printf ("1\n") ;
4171 exit(0);
4172 }
4173 symbol = dlsym(handle, "fred") ;
4174 if (symbol == NULL) {
4175 /* try putting a leading underscore */
4176 symbol = dlsym(handle, "_fred") ;
4177 if (symbol == NULL) {
4178 printf ("2\n") ;
4179 exit(0);
4180 }
4181 printf ("3\n") ;
4182 }
4183 else
4184 printf ("4\n") ;
4185 exit(0);
4186}
4187EOM
4188 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
4189 ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 &&
4190 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
4191 xxx=`./fred`
4192 case $xxx in
4193 1) echo "Test program failed using dlopen." >&4
4194 echo "Perhaps you should not use dynamic loading." >&4;;
4195 2) echo "Test program failed using dlsym." >&4
4196 echo "Perhaps you should not use dynamic loading." >&4;;
4197 3) echo "dlsym needs a leading underscore" >&4
4198 val="$define" ;;
4199 4) echo "dlsym doesn't need a leading underscore." >&4;;
4200 esac
4201 else
4202 echo "I can't compile and run the test program." >&4
4203 fi
4204 ;;
4205esac
4206
4207$rm -f fred fred.? dyna.$dlext dyna.?
4208
4209set d_dlsymun
4210eval $setvar
4211
4212: see if setuid scripts can be secure
4213cat <<EOM
4214
4215Some kernels have a bug that prevents setuid #! scripts from being
4216secure. Some sites have disabled setuid #! scripts because of this.
4217
4218First let's decide if your kernel supports secure setuid #! scripts.
4219(If setuid #! scripts would be secure but have been disabled anyway,
4220don't say that they are secure if asked.)
4221
4222EOM
4223
4224val="$undef"
4225if $test -d /dev/fd; then
4226 echo "#!$ls" >reflect
4227 chmod +x,u+s reflect
4228 ./reflect >flect 2>&1
4229 if $contains "/dev/fd" flect >/dev/null; then
4230 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4231 val="$define"
4232 else
4233 $cat <<EOM
4234If you are not sure if they are secure, I can check but I'll need a
4235username and password different from the one you are using right now.
4236If you don't have such a username or don't want me to test, simply
4237enter 'none'.
4238
4239EOM
4240 rp='Other username to test security of setuid scripts with?'
4241 dflt='none'
4242 . ./myread
4243 case "$ans" in
4244 n|none)
4245 case "$d_suidsafe" in
4246 '') echo "I'll assume setuid scripts are *not* secure." >&4
4247 dflt=n;;
4248 "$undef")
4249 echo "Well, the $hint value is *not* secure." >&4
4250 dflt=n;;
4251 *) echo "Well, the $hint value *is* secure." >&4
4252 dflt=y;;
4253 esac
4254 ;;
4255 *) $rm -f reflect flect
4256 echo "#!$ls" >reflect
4257 chmod +x,u+s reflect
4258 echo >flect
4259 chmod a+w flect
4260 echo '"su" will (probably) prompt you for '"$ans's password."
4261 su $ans -c './reflect >flect'
4262 if $contains "/dev/fd" flect >/dev/null; then
4263 echo "Okay, it looks like setuid scripts are secure." >&4
4264 dflt=y
4265 else
4266 echo "I don't think setuid scripts are secure." >&4
4267 dflt=n
4268 fi
4269 ;;
4270 esac
4271 rp='Does your kernel have *secure* setuid scripts?'
4272 . ./myread
4273 case "$ans" in
4274 [yY]*) val="$define";;
4275 *) val="$undef";;
4276 esac
4277 fi
4278else
4279 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4280 val="$undef"
4281fi
4282set d_suidsafe
4283eval $setvar
4284
4285$rm -f reflect flect
4286
4287: now see if they want to do setuid emulation
4288cat <<EOM
4289
4290Some systems have disabled setuid scripts, especially systems where
4291setuid scripts cannot be secure. On systems where setuid scripts have
4292been disabled, the setuid/setgid bits on scripts are currently
4293useless. It is possible for $package to detect those bits and emulate
4294setuid/setgid in a secure fashion. This emulation will only work if
4295setuid scripts have been disabled in your kernel.
4296
4297EOM
4298val="$undef"
4299case "$d_suidsafe" in
4300"$define")
4301 val="$undef"
4302 echo "No need to emulate SUID scripts since they are secure here." >& 4
4303 ;;
4304*)
4305 case "$d_dosuid" in
4306 "$define") dflt=y ;;
4307 *) dflt=n ;;
4308 esac
4309 rp="Do you want to do setuid/setgid emulation?"
4310 . ./myread
4311 case "$ans" in
4312 [yY]*) val="$define";;
4313 *) val="$undef";;
4314 esac
4315 ;;
4316esac
4317set d_dosuid
4318eval $setvar
4319
4320: see if drem exists
4321set drem d_drem
4322eval $inlibc
4323
4324: see if dup2 exists
4325set dup2 d_dup2
4326eval $inlibc
4327
4328: see if fchmod exists
4329set fchmod d_fchmod
4330eval $inlibc
4331
4332: see if fchown exists
4333set fchown d_fchown
4334eval $inlibc
4335
4336: see if this is an fcntl system
4337set fcntl d_fcntl
4338eval $inlibc
4339
4340: see if fgetpos exists
4341set fgetpos d_fgetpos
4342eval $inlibc
4343
4344: see if we can have long filenames
4345echo " "
4346rmlist="$rmlist /tmp/cf$$"
4347$test -d /tmp/cf$$ || mkdir /tmp/cf$$
4348first=123456789abcdef
4349second=/tmp/cf$$/$first
4350$rm -f $first $second
4351if (echo hi >$first) 2>/dev/null; then
4352 if $test -f 123456789abcde; then
4353 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
4354 val="$undef"
4355 else
4356 if (echo hi >$second) 2>/dev/null; then
4357 if $test -f /tmp/cf$$/123456789abcde; then
4358 $cat <<'EOM'
4359That's peculiar... You can have filenames longer than 14 characters, but only
4360on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
4361I shall consider your system cannot support long filenames at all.
4362EOM
4363 val="$undef"
4364 else
4365 echo 'You can have filenames longer than 14 characters.' >&4
4366 val="$define"
4367 fi
4368 else
4369 $cat <<'EOM'
4370How confusing! Some of your filesystems are sane enough to allow filenames
4371longer than 14 characters but some others like /tmp can't even think about them.
4372So, for now on, I shall assume your kernel does not allow them at all.
4373EOM
4374 val="$undef"
4375 fi
4376 fi
4377else
4378 $cat <<'EOM'
4379You can't have filenames longer than 14 chars. You can't even think about them!
4380EOM
4381 val="$undef"
4382fi
4383set d_flexfnam
4384eval $setvar
4385$rm -rf /tmp/cf$$ 123456789abcde*
4386
4387: see if flock exists
4388set flock d_flock
4389eval $inlibc
4390
4391: see if fmod exists
4392set fmod d_fmod
4393eval $inlibc
4394
4395: see if fork exists
4396set fork d_fork
4397eval $inlibc
4398
4399: see if pathconf exists
4400set pathconf d_pathconf
4401eval $inlibc