diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-11-09 16:42:18 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-11-09 16:46:48 -0500 |
commit | 2c8c6e363a5568f6272db9fa5c5a121936d6b9ed (patch) | |
tree | 7453428246bbdc9f283ebbe0225710f0d000b30b /hints/freebsd.sh | |
parent | 3baa0581042942aae9615e055ff2f1ac123840db (diff) | |
download | perl-2c8c6e363a5568f6272db9fa5c5a121936d6b9ed.tar.gz |
FreeBSD may not have the C99 long double math interfaces.
(This sanity logic could migrated to Configure)
Diffstat (limited to 'hints/freebsd.sh')
-rw-r--r-- | hints/freebsd.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/hints/freebsd.sh b/hints/freebsd.sh index a67c0bbb18..673dc4bade 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -309,3 +309,36 @@ esac # Meanwhile, the following workaround should be safe on all versions # of FreeBSD. d_printf_format_null='undef' + +$cat > UU/uselongdouble.cbu <<'EOCBU' +# This script UU/uselongdouble.cbu will get 'called-back' by Configure +# after it has prompted the user for whether to use long doubles. + +# Some FreeBSD releases apparently don't really have the C99 long double +# versions of math functions. If this seems to be the case, disable +# uselongdouble. +# +# XXX This sanity check logic could be move to Configure. +case "$uselongdouble" in +define) + echo "Checking if your long double math functions work right..." >&4 + cat > ldblm$$.c <<EOF +#include <math.h> +#include <stdio.h> +int main() { + printf("%Lg\n", sqrtl(logl(expl(1.0L))+powl(2.0L, 3.0L))+cosl(sinl(1.0L))); +} +EOF + $cc -o ldblm$$ ldblm$$.c -lm + case `test -x ldblm$$ && ./ldblm$$` in + 4) echo "Your long double math functions are working correctly." >&4 ;; + *) + echo "Your long double math functions are broken, disabling uselongdouble." >&4 + uselongdouble=$undef + ;; + esac + rm -f ldblm$$.c ldblm$$ + ;; +esac + +EOCBU |