From acd2f1e59bd22197b63eb5ae4ac0d621a0b8cce0 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Fri, 2 Mar 2018 10:02:46 -0700 Subject: [PATCH] msvcrt: Compile but show an error if Bessel functions aren't available. Signed-off-by: Alex Henrie Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- configure | 8 +++++++- configure.ac | 8 +++++++- dlls/msvcrt/math.c | 36 +++++++++++++++++++++++++++++++++--- include/config.h.in | 18 ++++++++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/configure b/configure index fdcdfd72112..397677e361b 100755 --- a/configure +++ b/configure @@ -17649,6 +17649,9 @@ for ac_func in \ exp2f \ expm1 \ expm1f \ + j0 \ + j1 \ + jn \ lgamma \ lgammaf \ llrint \ @@ -17673,7 +17676,10 @@ for ac_func in \ round \ roundf \ trunc \ - truncf + truncf \ + y0 \ + y1 \ + yn do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 43fdb0c7383..cfc2080c162 100644 --- a/configure.ac +++ b/configure.ac @@ -2698,6 +2698,9 @@ AC_CHECK_FUNCS(\ exp2f \ expm1 \ expm1f \ + j0 \ + j1 \ + jn \ lgamma \ lgammaf \ llrint \ @@ -2722,7 +2725,10 @@ AC_CHECK_FUNCS(\ round \ roundf \ trunc \ - truncf + truncf \ + y0 \ + y1 \ + yn ) LIBS="$ac_save_LIBS" diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 9b480117fcc..a3af78a7985 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1412,7 +1412,12 @@ INT CDECL MSVCRT__isnan(double num) double CDECL MSVCRT__j0(double num) { /* FIXME: errno handling */ +#ifdef HAVE_J0 return j0(num); +#else + FIXME("not implemented\n"); + return 0; +#endif } /********************************************************************* @@ -1421,7 +1426,12 @@ double CDECL MSVCRT__j0(double num) double CDECL MSVCRT__j1(double num) { /* FIXME: errno handling */ +#ifdef HAVE_J1 return j1(num); +#else + FIXME("not implemented\n"); + return 0; +#endif } /********************************************************************* @@ -1430,7 +1440,12 @@ double CDECL MSVCRT__j1(double num) double CDECL MSVCRT__jn(int n, double num) { /* FIXME: errno handling */ +#ifdef HAVE_JN return jn(n, num); +#else + FIXME("not implemented\n"); + return 0; +#endif } /********************************************************************* @@ -1440,12 +1455,17 @@ double CDECL MSVCRT__y0(double num) { double retval; if (!isfinite(num)) *MSVCRT__errno() = MSVCRT_EDOM; +#ifdef HAVE_Y0 retval = y0(num); if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) { *MSVCRT__errno() = MSVCRT_EDOM; - retval = sqrt(-1); + retval = NAN; } +#else + FIXME("not implemented\n"); + retval = 0; +#endif return retval; } @@ -1456,12 +1476,17 @@ double CDECL MSVCRT__y1(double num) { double retval; if (!isfinite(num)) *MSVCRT__errno() = MSVCRT_EDOM; +#ifdef HAVE_Y1 retval = y1(num); if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) { *MSVCRT__errno() = MSVCRT_EDOM; - retval = sqrt(-1); + retval = NAN; } +#else + FIXME("not implemented\n"); + retval = 0; +#endif return retval; } @@ -1472,12 +1497,17 @@ double CDECL MSVCRT__yn(int order, double num) { double retval; if (!isfinite(num)) *MSVCRT__errno() = MSVCRT_EDOM; +#ifdef HAVE_YN retval = yn(order,num); if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) { *MSVCRT__errno() = MSVCRT_EDOM; - retval = sqrt(-1); + retval = NAN; } +#else + FIXME("not implemented\n"); + retval = 0; +#endif return retval; } diff --git a/include/config.h.in b/include/config.h.in index 353c1463881..3346b01958f 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -342,6 +342,15 @@ /* Define to 1 if you have the `isnanf' function. */ #undef HAVE_ISNANF +/* Define to 1 if you have the `j0' function. */ +#undef HAVE_J0 + +/* Define to 1 if you have the `j1' function. */ +#undef HAVE_J1 + +/* Define to 1 if you have the `jn' function. */ +#undef HAVE_JN + /* Define to 1 if you have the header file. */ #undef HAVE_JPEGLIB_H @@ -1365,6 +1374,15 @@ /* Define if Xrandr has the XRRGetScreenResources function */ #undef HAVE_XRRGETSCREENRESOURCES +/* Define to 1 if you have the `y0' function. */ +#undef HAVE_Y0 + +/* Define to 1 if you have the `y1' function. */ +#undef HAVE_Y1 + +/* Define to 1 if you have the `yn' function. */ +#undef HAVE_YN + /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_ZLIB