Skip to content

Commit

Permalink
add yet another exception for FreeBSD's lack of C99 compliance
Browse files Browse the repository at this point in the history
update Windows config.h


git-svn-id: https://svn.r-project.org/R/trunk@59358 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed May 17, 2012
1 parent 6051f99 commit e2557f2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
15 changes: 8 additions & 7 deletions configure
Expand Up @@ -26737,12 +26737,13 @@ _ACEOF
## C99 functions:
## not all C99 runtimes are complete,
## but we have substitutes for expm1 hypot log1p and (internally) nearbyint[l]
## FreeBSD 10 still lacks log1pl
## FreeBSD 8.2 lacks log2
## FreeBSD 7.3 lacks nearbyintl/rintl (nearbyint appeared in 5.2)
## Apparently rint was once broken on HP-UX: undefine HAVE_RINT for such platforms
## Cygwin and FreeBSD lack powl
## Cygwin has rintl but not nearbyintl
for ac_func in expm1 hypot log1p log2 log10 nearbyint nearbyintl powl rint rintl
for ac_func in expm1 hypot log1p log1pl log2 log10 nearbyint nearbyintl powl rint rintl
do
as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
Expand Down Expand Up @@ -35931,11 +35932,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:35934: $lt_compile\"" >&5)
(eval echo "\"\$as_me:35935: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:35938: \$? = $ac_status" >&5
echo "$as_me:35939: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
Expand Down Expand Up @@ -36030,11 +36031,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:36033: $lt_compile\"" >&5)
(eval echo "\"\$as_me:36034: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:36037: \$? = $ac_status" >&5
echo "$as_me:36038: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
Expand Down Expand Up @@ -36082,11 +36083,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:36085: $lt_compile\"" >&5)
(eval echo "\"\$as_me:36086: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:36089: \$? = $ac_status" >&5
echo "$as_me:36090: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Expand Up @@ -1764,12 +1764,13 @@ AC_CHECK_DECLS([alloca], , ,
## C99 functions:
## not all C99 runtimes are complete,
## but we have substitutes for expm1 hypot log1p and (internally) nearbyint[l]
## FreeBSD 10 still lacks log1pl
## FreeBSD 8.2 lacks log2
## FreeBSD 7.3 lacks nearbyintl/rintl (nearbyint appeared in 5.2)
## Apparently rint was once broken on HP-UX: undefine HAVE_RINT for such platforms
## Cygwin and FreeBSD lack powl
## Cygwin has rintl but not nearbyintl
R_CHECK_FUNCS([expm1 hypot log1p log2 log10 nearbyint nearbyintl powl rint rintl], [#include <math.h>])
R_CHECK_FUNCS([expm1 hypot log1p log1pl log2 log10 nearbyint nearbyintl powl rint rintl], [#include <math.h>])
## va_copy is C99: required as from R 2.13.0
R_CHECK_FUNCS([va_copy], [#include <stdarg.h>])
if test "${ac_cv_have_decl_va_copy}" = "no"; then
Expand Down
24 changes: 21 additions & 3 deletions src/gnuwin32/fixed/h/config.h
Expand Up @@ -414,6 +414,9 @@
/* Define to 1 if you have the `readline' library (-lreadline). */
/* #undef HAVE_LIBREADLINE */

/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT

/* Define to 1 if you have the `termcap' library (-ltermcap). */
/* #undef HAVE_LIBTERMCAP */

Expand All @@ -438,6 +441,9 @@
/* Define to 1 if you have the `log1p' function. */
#define HAVE_LOG1P 1

/* Define to 1 if you have the `log1pl' function. */
#define HAVE_LOG1PL 1

/* Define to 1 if you have the `log2' function. */
#define HAVE_LOG2 1

Expand Down Expand Up @@ -586,6 +592,15 @@
/* Define to 1 if you have the `rl_completion_matches' function. */
/* #undef HAVE_RL_COMPLETION_MATCHES */

/* Define to 1 if you have the `sched_getaffinity' function. */
#undef HAVE_SCHED_GETAFFINITY

/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H

/* Define to 1 if you have the `sched_setaffinity' function. */
#undef HAVE_SCHED_SETAFFINITY

/* Define to 1 if you have the `setenv' function. */
/* #undef HAVE_SETENV */

Expand Down Expand Up @@ -885,6 +900,9 @@
/* Name of package */
#define PACKAGE "R"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "https://bugs.r-project.org"

/* Define to the full name of this package. */
#define PACKAGE_NAME "R"

Expand Down Expand Up @@ -936,9 +954,9 @@

/* Define this to be the canonical name (cpu-vendor-os) of your system. */
#ifdef WIN64
#define R_PLATFORM "x86_64-pc-mingw32"
#define R_PLATFORM "x86_64-w64-mingw32"
#else
#define R_PLATFORM "i386-pc-mingw32"
#define R_PLATFORM "i386-w64-mingw32"
#endif

/* Define this to be printing command on your system. */
Expand All @@ -951,7 +969,7 @@
#define R_SOCKLEN_T int

/* Define this to be the name of the vendor of your system. */
#define R_VENDOR "pc"
#define R_VENDOR "w64"

/* Define this to be the extension used for shared objects on your system. */
#define SHLIB_EXT ".dll"
Expand Down
3 changes: 3 additions & 0 deletions src/include/config.h.in
Expand Up @@ -438,6 +438,9 @@
/* Define to 1 if you have the `log1p' function. */
#undef HAVE_LOG1P

/* Define to 1 if you have the `log1pl' function. */
#undef HAVE_LOG1PL

/* Define to 1 if you have the `log2' function. */
#undef HAVE_LOG2

Expand Down
13 changes: 9 additions & 4 deletions src/nmath/pnbeta.c
Expand Up @@ -85,14 +85,19 @@ pnbeta2(double x, double o_x, double a, double b, double ncp,
/* o_x == 1 - x but maybe more accurate */
int lower_tail, int log_p)
{
long double ans= pnbeta_raw(x, o_x, a,b, ncp);
long double ans = pnbeta_raw(x, o_x, a,b, ncp);

/* return R_DT_val(ans), but we want to warn about cancellation here */
if(lower_tail) return (double) (log_p ? logl(ans) : ans);
if (lower_tail) return (double) (log_p ? logl(ans) : ans);
else {
if(ans > 1 - 1e-10) ML_ERROR(ME_PRECISION, "pnbeta");
if (ans > 1. - 1e-10) ML_ERROR(ME_PRECISION, "pnbeta");
if (ans > 1.0) ans = 1.0; /* Precaution */
return (double) (log_p ? log1pl(-ans) : (1 - ans));
#ifdef HAVE_LOG1PL
return (double) (log_p ? log1pl(-ans) : (1. - ans));
#else
/* include standalone case */
return (double) (log_p ? log1p((double)-ans) : (1. - ans));
#endif
}
}

Expand Down

0 comments on commit e2557f2

Please sign in to comment.