Hook up SDL_acos and SDL_asin properly.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 09 Dec 2013 15:17:20 -0500
changeset 8056abd9434c5d3e
parent 8055 3e2f230a6d62
child 8057 801d84e26f91
Hook up SDL_acos and SDL_asin properly.
CMakeLists.txt
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_android.h
include/SDL_config_iphoneos.h
include/SDL_config_macosx.h
include/SDL_config_psp.h
include/SDL_config_windows.h
src/libm/s_atan.c
src/stdlib/SDL_stdlib.c
     1.1 --- a/CMakeLists.txt	Sat Dec 07 11:19:52 2013 -0800
     1.2 +++ b/CMakeLists.txt	Mon Dec 09 15:17:20 2013 -0500
     1.3 @@ -473,8 +473,8 @@
     1.4              malloc calloc realloc free qsort abs memset memcpy memmove memcmp
     1.5              strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
     1.6              _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
     1.7 -            _stricmp _strnicmp sscanf atan atan2 ceil copysign cos cosf fabs
     1.8 -            floor log pow scalbn sin sinf sqrt)
     1.9 +            _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
    1.10 +            cosf fabs floor log pow scalbn sin sinf sqrt)
    1.11        string(TOUPPER ${_FN} _UPPER)
    1.12        set(HAVE_${_UPPER} 1)
    1.13      endforeach()
     2.1 --- a/configure	Sat Dec 07 11:19:52 2013 -0800
     2.2 +++ b/configure	Mon Dec 09 15:17:20 2013 -0500
     2.3 @@ -16628,7 +16628,7 @@
     2.4    LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
     2.5  fi
     2.6  
     2.7 -    for ac_func in atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
     2.8 +    for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
     2.9  do :
    2.10    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    2.11  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     3.1 --- a/configure.in	Sat Dec 07 11:19:52 2013 -0800
     3.2 +++ b/configure.in	Mon Dec 09 15:17:20 2013 -0500
     3.3 @@ -271,7 +271,7 @@
     3.4      AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
     3.5  
     3.6      AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
     3.7 -    AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
     3.8 +    AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
     3.9  
    3.10      AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
    3.11      AC_CHECK_FUNCS(iconv)
     4.1 --- a/include/SDL_config.h.cmake	Sat Dec 07 11:19:52 2013 -0800
     4.2 +++ b/include/SDL_config.h.cmake	Mon Dec 09 15:17:20 2013 -0500
     4.3 @@ -130,6 +130,8 @@
     4.4  #cmakedefine HAVE_M_PI 1
     4.5  #cmakedefine HAVE_ATAN 1
     4.6  #cmakedefine HAVE_ATAN2 1
     4.7 +#cmakedefine HAVE_ACOS 1
     4.8 +#cmakedefine HAVE_ASIN 1
     4.9  #cmakedefine HAVE_CEIL 1
    4.10  #cmakedefine HAVE_COPYSIGN 1
    4.11  #cmakedefine HAVE_COS 1
     5.1 --- a/include/SDL_config.h.in	Sat Dec 07 11:19:52 2013 -0800
     5.2 +++ b/include/SDL_config.h.in	Mon Dec 09 15:17:20 2013 -0500
     5.3 @@ -133,6 +133,8 @@
     5.4  #undef HAVE_M_PI
     5.5  #undef HAVE_ATAN
     5.6  #undef HAVE_ATAN2
     5.7 +#undef HAVE_ACOS
     5.8 +#undef HAVE_ASIN
     5.9  #undef HAVE_CEIL
    5.10  #undef HAVE_COPYSIGN
    5.11  #undef HAVE_COS
     6.1 --- a/include/SDL_config_android.h	Sat Dec 07 11:19:52 2013 -0800
     6.2 +++ b/include/SDL_config_android.h	Mon Dec 09 15:17:20 2013 -0500
     6.3 @@ -87,6 +87,8 @@
     6.4  #define HAVE_M_PI   1
     6.5  #define HAVE_ATAN   1
     6.6  #define HAVE_ATAN2  1
     6.7 +#define HAVE_ACOS  1
     6.8 +#define HAVE_ASIN  1
     6.9  #define HAVE_CEIL   1
    6.10  #define HAVE_COPYSIGN   1
    6.11  #define HAVE_COS    1
     7.1 --- a/include/SDL_config_iphoneos.h	Sat Dec 07 11:19:52 2013 -0800
     7.2 +++ b/include/SDL_config_iphoneos.h	Mon Dec 09 15:17:20 2013 -0500
     7.3 @@ -85,6 +85,8 @@
     7.4  #define HAVE_M_PI   1
     7.5  #define HAVE_ATAN   1
     7.6  #define HAVE_ATAN2  1
     7.7 +#define HAVE_ACOS  1
     7.8 +#define HAVE_ASIN  1
     7.9  #define HAVE_CEIL   1
    7.10  #define HAVE_COPYSIGN   1
    7.11  #define HAVE_COS    1
     8.1 --- a/include/SDL_config_macosx.h	Sat Dec 07 11:19:52 2013 -0800
     8.2 +++ b/include/SDL_config_macosx.h	Mon Dec 09 15:17:20 2013 -0500
     8.3 @@ -104,6 +104,8 @@
     8.4  #define HAVE_SYSCTLBYNAME 1
     8.5  #define HAVE_ATAN 1
     8.6  #define HAVE_ATAN2 1
     8.7 +#define HAVE_ACOS 1
     8.8 +#define HAVE_ASIN 1
     8.9  
    8.10  /* Enable various audio drivers */
    8.11  #define SDL_AUDIO_DRIVER_COREAUDIO  1
     9.1 --- a/include/SDL_config_psp.h	Sat Dec 07 11:19:52 2013 -0800
     9.2 +++ b/include/SDL_config_psp.h	Mon Dec 09 15:17:20 2013 -0500
     9.3 @@ -85,6 +85,8 @@
     9.4  #define HAVE_M_PI   1
     9.5  #define HAVE_ATAN   1
     9.6  #define HAVE_ATAN2  1
     9.7 +#define HAVE_ACOS  1
     9.8 +#define HAVE_ASIN  1
     9.9  #define HAVE_CEIL   1
    9.10  #define HAVE_COPYSIGN   1
    9.11  #define HAVE_COS    1
    10.1 --- a/include/SDL_config_windows.h	Sat Dec 07 11:19:52 2013 -0800
    10.2 +++ b/include/SDL_config_windows.h	Mon Dec 09 15:17:20 2013 -0500
    10.3 @@ -118,6 +118,8 @@
    10.4  #define HAVE__STRNICMP 1
    10.5  #define HAVE_ATAN 1
    10.6  #define HAVE_ATAN2 1
    10.7 +#define HAVE_ACOS  1
    10.8 +#define HAVE_ASIN  1
    10.9  #define HAVE_CEIL 1
   10.10  #define HAVE_COS 1
   10.11  #define HAVE_COSF 1
    11.1 --- a/src/libm/s_atan.c	Sat Dec 07 11:19:52 2013 -0800
    11.2 +++ b/src/libm/s_atan.c	Mon Dec 09 15:17:20 2013 -0500
    11.3 @@ -113,28 +113,3 @@
    11.4  }
    11.5  libm_hidden_def(atan)
    11.6  
    11.7 -double SDL_acos(double val)
    11.8 -{
    11.9 -    double result;
   11.10 -    if (val == -1.0) {
   11.11 -        result = M_PI;
   11.12 -    } else {
   11.13 -        result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
   11.14 -        if (result < 0.0)
   11.15 -        {
   11.16 -            result += M_PI;
   11.17 -        }
   11.18 -    }
   11.19 -    return result;
   11.20 -}
   11.21 -
   11.22 -double SDL_asin(double val)
   11.23 -{
   11.24 -    double result;
   11.25 -    if (val == -1.0) {
   11.26 -        result = -(M_PI / 2.0);
   11.27 -    } else {
   11.28 -        result = (M_PI / 2.0) - SDL_acos(val);
   11.29 -    }
   11.30 -    return result;
   11.31 -}
    12.1 --- a/src/stdlib/SDL_stdlib.c	Sat Dec 07 11:19:52 2013 -0800
    12.2 +++ b/src/stdlib/SDL_stdlib.c	Mon Dec 09 15:17:20 2013 -0500
    12.3 @@ -47,6 +47,42 @@
    12.4  }
    12.5  
    12.6  double
    12.7 +SDL_acos(double val)
    12.8 +{
    12.9 +#if defined(HAVE_ACOS)
   12.10 +    return acos(val);
   12.11 +#else
   12.12 +    double result;
   12.13 +    if (val == -1.0) {
   12.14 +        result = M_PI;
   12.15 +    } else {
   12.16 +        result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
   12.17 +        if (result < 0.0)
   12.18 +        {
   12.19 +            result += M_PI;
   12.20 +        }
   12.21 +    }
   12.22 +    return result;
   12.23 +#endif
   12.24 +}
   12.25 +
   12.26 +double
   12.27 +SDL_asin(double val)
   12.28 +{
   12.29 +#if defined(HAVE_ASIN)
   12.30 +    return asin(val);
   12.31 +#else
   12.32 +    double result;
   12.33 +    if (val == -1.0) {
   12.34 +        result = -(M_PI / 2.0);
   12.35 +    } else {
   12.36 +        result = (M_PI / 2.0) - SDL_acos(val);
   12.37 +    }
   12.38 +    return result;
   12.39 +#endif
   12.40 +}
   12.41 +
   12.42 +double
   12.43  SDL_ceil(double x)
   12.44  {
   12.45  #ifdef HAVE_CEIL