# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Tue Dec 11 08:22:11 EET 2001 [metaconfig 3.0 PL70]
+# Generated on Thu Feb 21 08:33:08 EET 2002 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
paths="$paths /sbin /usr/sbin /usr/libexec"
+paths="$paths /system/gnu_library/bin"
for p in $paths
do
test -d UU || mkdir UU
cd UU && rm -f ./*
+
ccname=''
ccversion=''
ccsymbols=''
expr=''
find=''
flex=''
+gmake=''
grep=''
gzip=''
inews=''
eunicefix=/etc/unixtovms.exe
fi
+: Set executable suffix now -- needed before hints available
+: maybe Stratus VOS
+if test -f "/system/gnu_library/bin/ar.pm"; then
+ _exe=".pm"
+fi
+: maybe dos djgpp
+if test -n "$DJGPP"; then
+ _exe=".exe"
+fi
+: maybe os/2
+if test -d c:/. ; then
+ _exe=".exe"
+fi
+
i_whoami=''
ccname=''
ccversion=''
: set useopcode=false in your hint file to disable the Opcode extension.
useopcode=true
: Trailing extension. Override this in a hint file, if needed.
-_exe=''
: Extra object files, if any, needed on this platform.
archobjs=''
archname=''
if test -f "$xxx"; then
sh="$xxx";
break
+ elif test "X$_exe" != X -a -f "$xxx$_exe"; then
+ sh="$xxx";
+ break
elif test -f "$xxx.exe"; then
sh="$xxx";
break
shsharp=true
spitshell=cat
xcat=/bin/cat
- test -f $xcat || xcat=/usr/bin/cat
+ test -f $xcat$_exe || xcat=/usr/bin/cat
+ if test ! -f $xcat$_exe; then
+ for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ if test -f $p/cat$_exe; then
+ xcat=$p/cat
+ break
+ fi
+ done
+ if test ! -f $xcat$_exe; then
+ echo "Can't find cat anywhere!"
+ exit 1
+ fi
+ fi
echo "#!$xcat" >sharp
$eunicefix sharp
chmod +x sharp
set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
else
echo "(Looking for .SH files under the source directory.)"
- set x `(cd $src; find . -name "*.SH" -print)`
+ set x `(cd "$src"; find . -name "*.SH" -print)`
fi
shift
case $# in
-0) set x `(cd $src; echo *.SH)`; shift;;
+0) set x `(cd "$src"; echo *.SH)`; shift;;
esac
-if test ! -f $src/$1; then
+if test ! -f "$src/$1"; then
shift
fi
mkdir_p='
*/*)
dir=`expr X$file : 'X\(.*\)/'`
file=`expr X$file : 'X.*/\(.*\)'`
- (cd $dir && . ./$file)
+ (cd "$dir" && . ./$file)
;;
*)
. ./$file
dir=`expr X$file : 'X\(.*\)/'`
file=`expr X$file : 'X.*/\(.*\)'`
(set x $dir; shift; eval $mkdir_p)
- sh <$src/$dir/$file
+ sh <"$src/$dir/$file"
;;
*)
- sh <$src/$file
+ sh <"$src/$file"
;;
esac
;;
esac
done
-if test -f $src/config_h.SH; then
+if test -f "$src/config_h.SH"; then
if test ! -f config.h; then
: oops, they left it out of MANIFEST, probably, so do it anyway.
- . $src/config_h.SH
+ . "$src/config_h.SH"
fi
fi
EOS
: Now test for existence of everything in MANIFEST
echo " "
-if test -f $rsrc/MANIFEST; then
+if test -f "$rsrc/MANIFEST"; then
echo "First let's make sure your kit is complete. Checking..." >&4
- awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
+ awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | split
rm -f missing
tmppwd=`pwd`
for filelist in x??; do
- (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
+ (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
done
if test -s missing; then
cat missing >&4
if test -f \$thisthing; then
echo \$thisthing
exit 0
+ elif test "X$_exe" != X -a -f \$thisthing$_exe; then
+ echo \$thisthing
+ exit 0
elif test -f \$dir/\$thing.exe; then
if test -n "$DJGPP"; then
echo \$dir/\$thing.exe
expr
grep
ls
-make
mkdir
rm
sed
csh
date
egrep
+gmake
gzip
less
ln
+make
more
nm
nroff
'') xxx=`./loc $file $file $pth`;;
*) xxx=`./loc $xxx $xxx $pth`;;
esac
- eval $file=$xxx
+ eval $file=$xxx$_exe
eval _$file=$xxx
case "$xxx" in
/*)
'') xxx=`./loc $file $file $pth`;;
*) xxx=`./loc $xxx $xxx $pth`;;
esac
- eval $file=$xxx
+ eval $file=$xxx$_exe
eval _$file=$xxx
case "$xxx" in
/*)
egrep)
echo "Substituting grep for egrep."
egrep=$grep
+ _egrep=$grep
;;
esac
case "$ln" in
ln)
echo "Substituting cp for ln."
ln=$cp
+ _ln=$cp
+ ;;
+esac
+case "$make" in
+make)
+ case "$gmake" in
+ gmake)
+ echo "I can't find make or gmake, and my life depends on it." >&4
+ echo "Go find a public domain implementation or fix your PATH setting!" >&4
+ exit 1
+ ;;
+ esac
+ ;;
+esac
+case "$gmake" in
+gmake) ;;
+*) # We can't have osname yet.
+ if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
+ # Assume that gmake, if found, is definitely GNU make
+ # and prefer it over the system make.
+ echo "Substituting gmake for make."
+ make=$gmake
+ _make=$gmake
+ fi
;;
esac
case "$test" in
;;
esac
-cat <<EOS >checkcc
+cat <<EOS >trygcc
$startsh
EOS
-cat <<'EOSC' >>checkcc
+cat <<'EOSC' >>trygcc
case "$cc" in
'') ;;
*) $rm -f try try.*
esac
fi
fi
+ fi
+ $rm -f try try.*
+ ;;
+esac
+EOSC
+
+cat <<EOS >checkcc
+$startsh
+EOS
+cat <<'EOSC' >>checkcc
+case "$cc" in
+'') ;;
+*) $rm -f try try.*
+ $cat >try.c <<EOM
+int main(int argc, char *argv[]) {
+ return 0;
+}
+EOM
+ if $cc -o try $ccflags $ldflags try.c; then
+ :
+ else
if $test X"$despair" = Xyes; then
- $cat >&4 <<EOM
+ echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
+ fi
+ $cat >&4 <<EOM
You need to find a working C compiler.
Either (purchase and) install the C compiler supplied by your OS vendor,
or for a free C compiler try http://gcc.gnu.org/
I cannot continue any further, aborting.
EOM
- exit 1
- fi
+ exit 1
fi
$rm -f try try.*
;;
: determine whether symbolic links are supported
echo " "
case "$lns" in
-*"ln -s")
+*"ln"*" -s")
echo "Checking how to test for symbolic links..." >&4
$lns blurfl sym
if $test "X$issymlink" = X; then
echo "Trying external '$test -h'." >&4
issymlink="$test -h"
if $test ! -h sym >/dev/null 2>&1; then
- echo "External '$test -h' is broken, too." >& 4
+ echo "External '$test -h' is broken, too." >&4
issymlink=''
fi
;;
exit 1
;;
*) case "$lns:$issymlink" in
- *"ln -s:"*"test -"?)
+ *"ln"*" -s:"*"test -"?)
echo "Creating the symbolic links..." >&4
echo "(First creating the subdirectories...)" >&4
cd ..
$test -d /usr/apollo/bin && osname=apollo
$test -f /etc/saf/_sactab && osname=svr4
$test -d /usr/include/minix && osname=minix
+ $test -f /system/gnu_library/bin/ar.pm && osname=vos
if $test -d /MachTen -o -d /MachTen_Folder; then
osname=machten
if $test -x /sbin/version; then
unixware) osname=svr5
osvers="$4"
;;
- uts) osname=uts
+ uts) osname=uts
osvers="$3"
;;
+ vos) osvers="$3"
+ ;;
$2) case "$osname" in
*isc*) ;;
*freebsd*) ;;
rp="Use which C compiler?"
. ./myread
cc="$ans"
+
+: See if they have not cc but they do have gcc
+. ./trygcc
: Look for a hint-file generated 'call-back-unit'. Now that the
: user has specified the compiler, we may need to set or change some
: other defaults.
: or the new name.
case "$_exe" in
'') case "$exe_ext" in
- '') ;;
+ '') ;;
*) _exe="$exe_ext" ;;
esac
;;
for thisdir in $libspath; do
xxx=''
if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
- xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
+ xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
$test -f "$xxx" && eval $libscheck
$test -f "$xxx" && libstyle=shared
fi
: determine filename position in cpp output
echo " "
echo "Computing filename position in cpp output for #include directives..." >&4
+case "$osname" in
+vos) testaccess=-e ;;
+*) testaccess=-r ;;
+esac
echo '#include <stdio.h>' > foo.c
$cat >fieldn <<EOF
$startsh
pos=1
set \$cline
while $test \$# -gt 0; do
- if $test -r \`echo \$1 | $tr -d '"'\`; then
+ if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
echo "\$pos"
exit 0
fi
esac
echo "Your cpp writes the filename in the $pos field of the line."
+case "$osname" in
+vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
+*) cppfilter='' ;;
+esac
: locate header file
$cat >findhdr <<EOF
$startsh
awkprg='{ print \$$fieldn }'
echo "#include <\$wanted>" > foo\$\$.c
$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
-$grep "^[ ]*#.*\$wanted" | \
+$cppfilter $grep "^[ ]*#.*\$wanted" | \
while read cline; do
name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
case "\$name" in
set sqrtl d_sqrtl
eval $inlibc
-case "$ccflags" in
-*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define|true|[yY]*) dflt='y';;
-*) dflt='n';;
-esac
-cat <<EOM
-
-Perl can be built to take advantage of long doubles which
-(if available) may give more accuracy and range for floating point numbers.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Try to use long doubles if available?'
-. ./myread
-case "$ans" in
-y|Y) val="$define" ;;
-*) val="$undef" ;;
-esac
-set uselongdouble
-eval $setvar
-
-case "$uselongdouble" in
-true|[yY]*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define)
-: Look for a hint-file generated 'call-back-unit'. If the
-: user has specified that long doubles should be used,
-: we may need to set or change some other defaults.
- if $test -f uselongdouble.cbu; then
- echo "Your platform has some specific hints for long doubles, using them..."
- . ./uselongdouble.cbu
- else
- $cat <<EOM
-(Your platform doesn't have any specific hints for long doubles.)
-EOM
- fi
- ;;
-esac
-
-case "$uselongdouble:$d_sqrtl" in
-$define:$undef)
- $cat <<EOM >&4
-
-*** You requested the use of long doubles but you do not seem to have
-*** the mathematic functions for long doubles. I'm disabling the use
-*** of long doubles.
-
-EOM
- uselongdouble=$undef
- ;;
-esac
-
: check for length of double
echo " "
case "$doublesize" in
esac
$rm -f try.* try
+echo " "
+
+if $test X"$d_longdbl" = X"$define"; then
+
+echo "Checking how to print long doubles..." >&4
+
+if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ double d = 123.456;
+ printf("%.3f\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
+ sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
+ echo "We will use %f."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3Lf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+ sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
+ echo "We will use %Lf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3llf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+ sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
+ echo "We will use %llf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3lf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
+ sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
+ echo "We will use %lf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ echo "Cannot figure out how to print long doubles." >&4
+else
+ sSCNfldbl=$sPRIfldbl # expect consistency
+fi
+
+$rm -f try try.*
+
+fi # d_longdbl
+
+case "$sPRIfldbl" in
+'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
+ d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
+ d_SCNfldbl="$undef";
+ ;;
+*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
+ d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
+ d_SCNfldbl="$define";
+ ;;
+esac
+
+: see if modfl exists
+set modfl d_modfl
+eval $inlibc
+
+d_modfl_pow32_bug="$undef"
+
+case "$d_longdbl$d_modfl" in
+$define$define)
+ $cat <<EOM
+Checking to see whether your modfl() is okay for large values...
+EOM
+$cat >try.c <<EOCP
+#include <math.h>
+#include <stdio.h>
+int main() {
+ long double nv = 4294967303.15;
+ long double v, w;
+ v = modfl(nv, &w);
+#ifdef __GLIBC__
+ printf("glibc");
+#endif
+ printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
+ return 0;
+}
+EOCP
+ case "$osname:$gccversion" in
+ aix:) saveccflags="$ccflags"
+ ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+ esac
+ set try
+ if eval $compile; then
+ foo=`$run ./try`
+ case "$foo" in
+ *" 4294967303.150000 1.150000 4294967302.000000")
+ echo >&4 "Your modfl() is broken for large values."
+ d_modfl_pow32_bug="$define"
+ case "$foo" in
+ glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
+ ;;
+ esac
+ ;;
+ *" 4294967303.150000 0.150000 4294967303.000000")
+ echo >&4 "Your modfl() seems okay for large values."
+ ;;
+ *) echo >&4 "I don't understand your modfl() at all."
+ d_modfl="$undef"
+ ;;
+ esac
+ $rm -f try.* try core core.try.*
+ else
+ echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
+ d_modfl="$undef"
+ fi
+ case "$osname:$gccversion" in
+ aix:) ccflags="$saveccflags" ;; # restore
+ esac
+ ;;
+esac
+
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define|true|[yY]*) dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Perl can be built to take advantage of long doubles which
+(if available) may give more accuracy and range for floating point numbers.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Try to use long doubles if available?'
+. ./myread
+case "$ans" in
+y|Y) val="$define" ;;
+*) val="$undef" ;;
+esac
+set uselongdouble
+eval $setvar
+
+case "$uselongdouble" in
+true|[yY]*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define)
+: Look for a hint-file generated 'call-back-unit'. If the
+: user has specified that long doubles should be used,
+: we may need to set or change some other defaults.
+ if $test -f uselongdouble.cbu; then
+ echo "Your platform has some specific hints for long doubles, using them..."
+ . ./uselongdouble.cbu
+ else
+ $cat <<EOM
+(Your platform doesn't have any specific hints for long doubles.)
+EOM
+ fi
+ ;;
+esac
+
+message=X
+case "$uselongdouble:$d_sqrtl:$d_modfl" in
+$define:$define:$define)
+ : You have both
+ ;;
+$define:$define:$undef)
+ message="I could not find modfl"
+ ;;
+$define:$undef:$define)
+ message="I could not find sqrtl"
+ ;;
+$define:$undef:$undef)
+ message="I found neither sqrtl nor modfl"
+ ;;
+esac
+
+if $test "$message" != X; then
+ $cat <<EOM >&4
+
+*** You requested the use of long doubles but you do not seem to have
+*** the mathematic functions for long doubles.
+*** ($message)
+*** I'm disabling the use of long doubles.
+
+EOM
+
+ uselongdouble=$undef
+fi
+
case "$useperlio" in
$define|true|[yY]*|'') dflt='y';;
*) dflt='n';;
case "$d_suidsafe" in
"$define")
val="$undef"
- echo "No need to emulate SUID scripts since they are secure here." >& 4
+ echo "No need to emulate SUID scripts since they are secure here." >&4
;;
*)
$cat <<EOM
esac
echo "The following dynamic loading files are available:"
: Can not go over to $dldir because getfile has path hard-coded in.
- tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
+ tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
rp="Source file to use for dynamic loading"
fn="fne"
gfpth="$src"
linux*) # ld won't link with a bare -lperl otherwise.
dflt=libperl.$so
;;
- cygwin*) # include version
- dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
+ cygwin*) # ld links against an importlib
+ dflt=libperl$lib_ext
;;
*) # Try to guess based on whether libc has major.minor.
case "$libc" in
freebsd|netbsd)
xxx="-Wl,-R$shrpdir"
;;
- linux|irix*|dec_osf)
+ bsdos|linux|irix*|dec_osf)
xxx="-Wl,-rpath,$shrpdir"
;;
next)
esac
: see if we have to deal with yellow pages, now NIS.
-if $test -d /usr/etc/yp || $test -d /etc/yp; then
+if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
if $test -f /usr/etc/nibindd; then
echo " "
echo "I'm fairly confident you're on a NeXT."
fi
fi
fi
+case "$myhostname" in
+'') myhostname=noname ;;
+esac
: you do not want to know about this
set $myhostname
myhostname=$1
esac
case "$dflt" in
.) echo "(Lost all hope -- silly guess then)"
- dflt='.uucp'
+ dflt='.nonet'
;;
esac
$rm -f hosts
: figure best path for perl in scripts
case "$perlpath" in
'')
- perlpath="$binexp/perl"
+ case "$versiononly" in
+ "$define") perlpath="$binexp/perl$version";;
+ *) perlpath="$binexp/perl";;
+ esac
case "$startperl" in
*!*) ;;
*)
installvendorbin="$vendorbinexp"
fi
-: see if qgcvt exists
-set qgcvt d_qgcvt
-eval $inlibc
-
-echo " "
-
-if $test X"$d_longdbl" = X"$define"; then
-
-echo "Checking how to print long doubles..." >&4
-
-if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- double d = 123.456;
- printf("%.3f\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
- sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
- echo "We will use %f."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3Lf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
- sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
- echo "We will use %Lf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3llf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
- sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
- echo "We will use %llf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3lf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
- sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
- echo "We will use %lf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- echo "Cannot figure out how to print long doubles." >&4
-else
- sSCNfldbl=$sPRIfldbl # expect consistency
-fi
-
-$rm -f try try.*
+: see if qgcvt exists
+set qgcvt d_qgcvt
+eval $inlibc
-fi # d_longdbl
+: Check how to convert floats to strings.
-case "$sPRIfldbl" in
-'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
- d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
- d_SCNfldbl="$undef";
- ;;
-*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
- d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
- d_SCNfldbl="$define";
- ;;
-esac
+if test "X$d_Gconvert" = X; then
-: Check how to convert floats to strings.
echo " "
echo "Checking for an efficient way to convert floats to strings."
echo " " > try.c
#define DOUBLETYPE long double
#endif
#ifdef TRY_sprintf
-#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
+#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#ifdef HAS_PRIgldbl
#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
#else
+#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
+#endif
+#else
#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
#endif
char *myname = "sprintf";
Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
checkit("0.1", buf);
+ Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
+ checkit("0.01", buf);
+
+ Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
+ checkit("0.001", buf);
+
+ Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
+ checkit("0.0001", buf);
+
+ Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
+ if (strlen(buf) > 5)
+ checkit("9e-005", buf); /* for Microsoft ?? */
+ else
+ checkit("9e-05", buf);
+
Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
checkit("1", buf);
Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
checkit("123.456", buf);
- /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
- Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
- if (strlen(buf) > 5)
- checkit("1e+030", buf); /* for Microsoft */
- else
- checkit("1e+30", buf);
+ /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
+ Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
+ if (strlen(buf) > 5)
+ checkit("1e+030", buf); /* for Microsoft */
+ else
+ checkit("1e+30", buf);
exit(0);
}
EOP
-case "$d_Gconvert" in
-gconvert*) xxx_list='gconvert gcvt sprintf' ;;
-gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-sprintf*) xxx_list='sprintf gconvert gcvt' ;;
-*) xxx_list='gconvert gcvt sprintf' ;;
-esac
-
-case "$d_longdbl$uselongdouble$d_PRIgldbl" in
-"$define$define$define")
- # for long doubles prefer first qgcvt, then sprintf
- xxx_list="`echo $xxx_list|sed s/sprintf//`"
- xxx_list="sprintf $xxx_list"
- case "$d_qgcvt" in
- "$define") xxx_list="qgcvt $xxx_list" ;;
- esac
+: first add preferred functions to our list
+xxx_list=""
+for xxx_convert in $gconvert_preference; do
+ case $xxx_convert in
+ gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
+ *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
+ esac
+done
+: then add any others
+for xxx_convert in gconvert gcvt sprintf; do
+ case "$xxx_list" in
+ *$xxx_convert*) ;;
+ *) xxx_list="$xxx_list $xxx_convert" ;;
+ esac
+done
+
+case "$d_longdbl$uselongdouble" in
+"$define$define")
+ : again, add prefered functions to our list first
+ xxx_ld_list=""
+ for xxx_convert in $gconvert_ld_preference; do
+ case $xxx_convert in
+ qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+ *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
+ esac
+ done
+ : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
+ for xxx_convert in qgcvt sprintf $xxx_list; do
+ case "$xxx_ld_list" in
+ $xxx_convert*|*" $xxx_convert"*) ;;
+ *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+ esac
+ done
+ : if sprintf cannot do long doubles, move it to the end
+ if test "$d_PRIgldbl" != "$define"; then
+ xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
+ fi
+ : if no qgcvt, remove it
+ if test "$d_qgcvt" != "$define"; then
+ xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
+ fi
+ : use the ld_list
+ xxx_list="$xxx_ld_list"
;;
esac
break;
else
echo "...But $xxx_convert didn't work as I expected."
+ xxx_convert=''
fi
else
echo "$xxx_convert NOT found." >&4
fi
done
-
+
+if test X$xxx_convert = X; then
+ echo "*** WHOA THERE!!! ***" >&4
+ echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
+ xxx_convert=sprintf
+fi
+
case "$xxx_convert" in
gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
"$define$define$define")
d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
+ "$define$define$undef")
+ d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
*) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
esac
;;
esac
+fi
+
: see if _fwalk exists
set fwalk d__fwalk
eval $inlibc
sockethdr="-I/usr/netinclude"
;;
esac
- echo "Found Berkeley sockets interface in lib$net." >& 4
+ echo "Found Berkeley sockets interface in lib$net." >&4
if $contains setsockopt libc.list >/dev/null 2>&1; then
d_oldsock="$undef"
else
echo " "
-echo "Checking the availability of certain socket constants..." >& 4
+echo "Checking the availability of certain socket constants..." >&4
for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
$cat >try.c <<EOF
: see if crypt exists
echo " "
-if set crypt val -f d_crypt; eval $csym; $val; then
- echo 'crypt() found.' >&4
- val="$define"
- cryptlib=''
-else
- cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
- if $test -z "$cryptlib"; then
- cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
- else
- cryptlib=-lcrypt
- fi
- if $test -z "$cryptlib"; then
- cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
- else
- cryptlib=-lcrypt
- fi
- if $test -z "$cryptlib"; then
- cryptlib=`./loc libcrypt$_a "" $libpth`
- else
- cryptlib=-lcrypt
- fi
- if $test -z "$cryptlib"; then
- echo 'crypt() NOT found.' >&4
- val="$undef"
- else
+set crypt d_crypt
+eval $inlibc
+case "$d_crypt" in
+$define) cryptlib='' ;;
+*) if set crypt val -f d_crypt; eval $csym; $val; then
+ echo 'crypt() found.' >&4
val="$define"
+ cryptlib=''
+ else
+ cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
+ if $test -z "$cryptlib"; then
+ cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
+ else
+ cryptlib=-lcrypt
+ fi
+ if $test -z "$cryptlib"; then
+ cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
+ else
+ cryptlib=-lcrypt
+ fi
+ if $test -z "$cryptlib"; then
+ cryptlib=`./loc libcrypt$_a "" $libpth`
+ else
+ cryptlib=-lcrypt
+ fi
+ if $test -z "$cryptlib"; then
+ echo 'crypt() NOT found.' >&4
+ val="$undef"
+ else
+ val="$define"
+ fi
fi
-fi
-set d_crypt
-eval $setvar
+ set d_crypt
+ eval $setvar
+ ;;
+esac
: get csh whereabouts
case "$csh" in
;;
esac
-$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
+$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
set d_dlsymun
eval $setvar
*) strings=`./findhdr string.h`;;
esac
+: see if this is a sys/file.h system
+val=''
+set sys/file.h val
+eval $inhdr
+
+: do we need to include sys/file.h ?
+case "$val" in
+"$define")
+ echo " "
+ if $h_sysfile; then
+ val="$define"
+ echo "We'll be including <sys/file.h>." >&4
+ else
+ val="$undef"
+ echo "We won't be including <sys/file.h>." >&4
+ fi
+ ;;
+*)
+ h_sysfile=false
+ ;;
+esac
+set i_sysfile
+eval $setvar
+
+: see if fcntl.h is there
+val=''
+set fcntl.h val
+eval $inhdr
+
+: see if we can include fcntl.h
+case "$val" in
+"$define")
+ echo " "
+ if $h_fcntl; then
+ val="$define"
+ echo "We'll be including <fcntl.h>." >&4
+ else
+ val="$undef"
+ if $h_sysfile; then
+ echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
+ else
+ echo "We won't be including <fcntl.h>." >&4
+ fi
+ fi
+ ;;
+*)
+ h_fcntl=false
+ val="$undef"
+ ;;
+esac
+set i_fcntl
+eval $setvar
+
: check for non-blocking I/O stuff
case "$h_sysfile" in
true) echo "#include <sys/file.h>" > head.c;;
case "$o_nonblock" in
'')
$cat head.c > try.c
- $cat >>try.c <<'EOCP'
+ $cat >>try.c <<EOCP
#include <stdio.h>
#include <stdlib.h>
+#$i_fcntl I_FCNTL
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
int main() {
#ifdef O_NONBLOCK
printf("O_NONBLOCK\n");
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#$i_fcntl I_FCNTL
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
#define MY_O_NONBLOCK $o_nonblock
#ifndef errno /* XXX need better Configure test */
extern int errno;
ret = read(pd[0], buf, 1); /* Should read EOF */
alarm(0);
sprintf(string, "%d\n", ret);
- write(3, string, strlen(string));
+ write(4, string, strlen(string));
exit(0);
}
set try
if eval $compile_ok; then
echo "$startsh" >mtry
- echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
+ echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
chmod +x mtry
./mtry >/dev/null 2>&1
case $? in
set flock d_flock
eval $inlibc
-: see if this is a sys/file.h system
-val=''
-set sys/file.h val
-eval $inhdr
-
-: do we need to include sys/file.h ?
-case "$val" in
-"$define")
- echo " "
- if $h_sysfile; then
- val="$define"
- echo "We'll be including <sys/file.h>." >&4
- else
- val="$undef"
- echo "We won't be including <sys/file.h>." >&4
- fi
- ;;
-*)
- h_sysfile=false
- ;;
-esac
-set i_sysfile
-eval $setvar
-
: see if prototype for flock is available
echo " "
set d_flockproto flock $i_sysfile sys/file.h
-: see if modfl exists
-set modfl d_modfl
-eval $inlibc
-
-d_modfl_pow32_bug="$undef"
-
-case "$d_longdbl$d_modfl" in
-$define$define)
- $cat <<EOM
-Checking to see whether your modfl() is okay for large values...
-EOM
-$cat >try.c <<EOCP
-#include <math.h>
-#include <stdio.h>
-int main() {
- long double nv = 4294967303.15;
- long double v, w;
- v = modfl(nv, &w);
-#ifdef __GLIBC__
- printf("glibc");
-#endif
- printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
- return 0;
-}
-EOCP
- case "$osname:$gccversion" in
- aix:) saveccflags="$ccflags"
- ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
- esac
- set try
- if eval $compile; then
- foo=`$run ./try`
- case "$foo" in
- *" 4294967303.150000 1.150000 4294967302.000000")
- echo >&4 "Your modfl() is broken for large values."
- d_modfl_pow32_bug="$define"
- case "$foo" in
- glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
- ;;
- esac
- ;;
- *" 4294967303.150000 0.150000 4294967303.000000")
- echo >&4 "Your modfl() seems okay for large values."
- ;;
- *) echo >&4 "I don't understand your modfl() at all."
- d_modfl="$undef"
- ;;
- esac
- $rm -f try.* try core core.try.*
- else
- echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
- d_modfl="$undef"
- fi
- case "$osname:$gccversion" in
- aix:) ccflags="$saveccflags" ;; # restore
- esac
- ;;
-esac
-
: see if mprotect exists
set mprotect d_mprotect
eval $inlibc
Checking to see whether you can access character data unalignedly...
EOM
-$cat >try.c <<EOCP
+case "$d_u32align" in
+'') $cat >try.c <<EOCP
#include <stdio.h>
#define U32 $u32type
-#define BYTEORDER $byteorder
+#define BYTEORDER 0x$byteorder
+#define U8 $u8type
+#include <signal.h>
+#ifdef SIGBUS
+$signal_t bletch(s) int s; { exit(4); }
+#endif
int main() {
#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
- U8 buf[] = "\0\0\0\1\0\0\0\0";
+ U8 buf[8];
U32 *up;
int i;
fflush(stdout);
+#ifdef SIGBUS
+ signal(SIGBUS, bletch);
+#endif
+
+ buf[0] = 0;
+ buf[1] = 0;
+ buf[2] = 0;
+ buf[3] = 1;
+ buf[5] = 0;
+ buf[6] = 0;
+ buf[7] = 0;
+ buf[8] = 1;
+
for (i = 0; i < 4; i++) {
up = (U32*)(buf + i);
if (! ((*up == 1 << (8*i)) || /* big-endian */
EOCP
set try
if eval $compile_ok; then
- echo "(Testing for character data alignment may dump core.)" >&4
+ echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
$run ./try 2>&1 >/dev/null
case "$?" in
0) cat >&4 <<EOM
d_u32align="$define"
;;
esac
- $rm -f core core.try.* try.core
else
rp='Can you access character data at unaligned addresses?'
dflt='n'
*) d_u32align="$define" ;;
esac
fi
+$rm -f core core.try.* try.core
+;;
+esac
: see if ualarm exists
set ualarm d_ualarm
fi
case "$ivdformat" in
-'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
+'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
exit 1
;;
esac
set signal
if eval $compile_ok; then
- $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+ $run ./signal$_exe | $sort -n -k 2 | $uniq | $awk -f signal.awk >signal.lst
else
echo "(I can't seem be able to compile the whole test program)" >&4
echo "(I'll try it in little pieces.)" >&4
done
if $test -s signal.ls1; then
$cat signal.nsg signal.ls1 |
- $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+ $sort -n | $uniq | $awk -f signal.awk >signal.lst
fi
fi
esac
echo " "
comp='yacc'
-if $test -f "$byacc"; then
+if $test -f "$byacc$_exe"; then
dflt="$byacc"
comp="byacc or $comp"
fi
-if $test -f "$bison"; then
+if $test -f "$bison$_exe"; then
comp="$comp or bison -y"
fi
rp="Which compiler compiler ($comp) shall I use?"
;;
esac
-: see if fcntl.h is there
-val=''
-set fcntl.h val
-eval $inhdr
-
-: see if we can include fcntl.h
-case "$val" in
-"$define")
- echo " "
- if $h_fcntl; then
- val="$define"
- echo "We'll be including <fcntl.h>." >&4
- else
- val="$undef"
- if $h_sysfile; then
- echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
- else
- echo "We won't be including <fcntl.h>." >&4
- fi
- fi
- ;;
-*)
- h_fcntl=false
- val="$undef"
- ;;
-esac
-set i_fcntl
-eval $setvar
-
: see if this is a fp.h system
set fp.h i_fp
eval $inhdr
: see if ndbm.h is available
set ndbm.h t_ndbm
eval $inhdr
+
+case "$t_ndbm" in
+$undef)
+ # Some Linux distributions such as RedHat 7.1 put the
+ # ndbm.h header in /usr/include/gdbm/ndbm.h.
+ if $test -f /usr/include/gdbm/ndbm.h; then
+ echo '<gdbm/ndbm.h> found.'
+ ccflags="$ccflags -I/usr/include/gdbm"
+ cppflags="$cppflags -I/usr/include/gdbm"
+ t_ndbm=$define
+ fi
+ ;;
+esac
+
case "$t_ndbm" in
$define)
: see if dbm_open exists
else
if $test -d $xxx -a $# -lt 10; then
set $1$xxx/ $*;
- cd $xxx;
+ cd "$xxx";
eval $find_extensions;
cd ..;
shift;
esac;
done'
tdir=`pwd`
-cd $rsrc/ext
+cd "$rsrc/ext"
set X
shift
eval $find_extensions
set X $known_extensions
shift
known_extensions="$*"
-cd $tdir
+cd "$tdir"
: Now see which are supported on this system.
avail_ext=''
gidsize='$gidsize'
gidtype='$gidtype'
glibpth='$glibpth'
+gmake='$gmake'
grep='$grep'
groupcat='$groupcat'
groupstype='$groupstype'
exec 1>&4
pwd=`pwd`
. ./UU/extract
-cd $pwd
+cd "$pwd"
if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
dflt=y