perl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
db_prefixtype='int'
else
db_prefixtype='size_t'
fi
else
db_prefixtype='size_t'
: XXX Maybe we should just give up here.
$cat try.out >&4
echo "Help: I can't seem to compile the db test program." >&4
echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
fi
$rm_try
echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
;;
*) db_prefixtype='size_t'
;;
esac
: Include . in @INC
$cat <<EOM
Historically Perl has provided a final fallback of the current working
directory '.' when searching for a library. This, however, can lead to
problems when a Perl program which loads optional modules is called from
a shared directory. This can lead to executing unexpected code.
EOM
# When changing to exclude by default:
case "$default_inc_excludes_dot" in
$undef|false|[nN]*) dflt="n" ;;
*) dflt="y" ;;
esac
# To turn exclude off by default:
#case "$default_inc_excludes_dot" in
# $define|true|[yY]*) dflt="y" ;;
# *) dflt="n" ;;
#esac
rp='Exclude '.' from @INC by default? '
. ./myread
case "$ans" in
[nN]|undef) default_inc_excludes_dot="$undef" ;;
*) default_inc_excludes_dot="$define" ;;
esac
: Check what kind of inf/nan your system has
$echo "Checking the kind of infinities and nans you have..." >&4
$echo "(The following tests may crash. That's okay.)" >&4
$cat >try.c <<EOP
#define DOUBLESIZE $doublesize
#$d_longdbl HAS_LONG_DOUBLE
#ifdef HAS_LONG_DOUBLE
#define LONG_DOUBLESIZE $longdblsize
#define LONG_DOUBLEKIND $longdblkind
#endif
#include <math.h>
#include <string.h>
#include <stdio.h>
/* Note that whether the sign bit is on or off
* for NaN depends on the CPU/FPU, and possibly
* can be affected by the build toolchain.
*
* For example for older MIPS and HP-PA 2.0 the quiet NaN is:
* 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
* 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
* (respectively) as opposed to the more usual
* 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
*
* Pre-IEEE-754 floating point format do not even have inf/nan support
* at all. They might have a "max" value (DBL_MAX), which may be deadly
* to even mention, causing immediate SIGFPE or equivalent: this is
* the case with VAX floating point, for example.
*/
static void bytes(void *v, unsigned int n) {
unsigned char *p = (unsigned char *)v;
int i;
for (i = 0; i < n; i++) {
printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
}
}
int main(int argc, char *argv[]) {
/* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
* because some compilers are 'smart' and not only warn but refuse to
* compile such 'illegal' values. */
double dinf = exp(1e9);
double dnan = sqrt(-1.0);
#ifdef HAS_LONG_DOUBLE
long double ldinf = (long double)exp(1e9);
long double ldnan = (long double)sqrt(-1.0);
# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
/* the 80-bit long doubles might have garbage in their excess bytes */
memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
# endif
#endif
if (argc == 2) {
switch (argv[1][0]) {
case '1': bytes(&dinf, sizeof(dinf)); break;
case '2': bytes(&dnan, sizeof(dnan)); break;
#ifdef HAS_LONG_DOUBLE
case '3': bytes(&ldinf, sizeof(ldinf)); break;
case '4': bytes(&ldnan, sizeof(ldnan)); break;
#endif
}
}
return 0;
}
EOP
set try
if eval $compile; then
doubleinfbytes=`$run ./try 1`
doublenanbytes=`$run ./try 2`
case "$d_longdbl" in
$define)
longdblinfbytes=`$run ./try 3`
longdblnanbytes=`$run ./try 4`
;;
esac
else
# Defaults in case the above test program failed.
case "$doublekind" in
1) # IEEE 754 32-bit LE
doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.501 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )