Hook up SDL_acos and SDL_asin properly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d15fb2..7455ab8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -473,8 +473,8 @@ if(LIBC)
malloc calloc realloc free qsort abs memset memcpy memmove memcmp
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
- _stricmp _strnicmp sscanf atan atan2 ceil copysign cos cosf fabs
- floor log pow scalbn sin sinf sqrt)
+ _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
+ cosf fabs floor log pow scalbn sin sinf sqrt)
string(TOUPPER ${_FN} _UPPER)
set(HAVE_${_UPPER} 1)
endforeach()
diff --git a/configure b/configure
index 0e10125..bd2c5d2 100755
--- a/configure
+++ b/configure
@@ -16628,7 +16628,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then :
LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
fi
- for ac_func in atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
+ for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.in b/configure.in
index 8d116a5..7c3a1b1 100644
--- a/configure.in
+++ b/configure.in
@@ -271,7 +271,7 @@ if test x$enable_libc = xyes; then
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)
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
- AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
+ AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
AC_CHECK_FUNCS(iconv)
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 27e5f73..08237a8 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -130,6 +130,8 @@
#cmakedefine HAVE_M_PI 1
#cmakedefine HAVE_ATAN 1
#cmakedefine HAVE_ATAN2 1
+#cmakedefine HAVE_ACOS 1
+#cmakedefine HAVE_ASIN 1
#cmakedefine HAVE_CEIL 1
#cmakedefine HAVE_COPYSIGN 1
#cmakedefine HAVE_COS 1
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 574d9ae..536b297 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -133,6 +133,8 @@
#undef HAVE_M_PI
#undef HAVE_ATAN
#undef HAVE_ATAN2
+#undef HAVE_ACOS
+#undef HAVE_ASIN
#undef HAVE_CEIL
#undef HAVE_COPYSIGN
#undef HAVE_COS
diff --git a/include/SDL_config_android.h b/include/SDL_config_android.h
index 0826415..489b9ff 100644
--- a/include/SDL_config_android.h
+++ b/include/SDL_config_android.h
@@ -87,6 +87,8 @@
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
+#define HAVE_ACOS 1
+#define HAVE_ASIN 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h
index ade2966..ae8a12b 100644
--- a/include/SDL_config_iphoneos.h
+++ b/include/SDL_config_iphoneos.h
@@ -85,6 +85,8 @@
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
+#define HAVE_ACOS 1
+#define HAVE_ASIN 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h
index 9f2f76e..7825e70 100644
--- a/include/SDL_config_macosx.h
+++ b/include/SDL_config_macosx.h
@@ -104,6 +104,8 @@
#define HAVE_SYSCTLBYNAME 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
+#define HAVE_ACOS 1
+#define HAVE_ASIN 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
diff --git a/include/SDL_config_psp.h b/include/SDL_config_psp.h
index 31ac2b2..989f7d8 100644
--- a/include/SDL_config_psp.h
+++ b/include/SDL_config_psp.h
@@ -85,6 +85,8 @@
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
+#define HAVE_ACOS 1
+#define HAVE_ASIN 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index 6bde3f8..aa2f984 100644
--- a/include/SDL_config_windows.h
+++ b/include/SDL_config_windows.h
@@ -118,6 +118,8 @@ typedef unsigned int uintptr_t;
#define HAVE__STRNICMP 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
+#define HAVE_ACOS 1
+#define HAVE_ASIN 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_COSF 1
diff --git a/src/libm/s_atan.c b/src/libm/s_atan.c
index 2f24b29..970ea4d 100644
--- a/src/libm/s_atan.c
+++ b/src/libm/s_atan.c
@@ -113,28 +113,3 @@ double atan(double x)
}
libm_hidden_def(atan)
-double SDL_acos(double val)
-{
- double result;
- if (val == -1.0) {
- result = M_PI;
- } else {
- result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
- if (result < 0.0)
- {
- result += M_PI;
- }
- }
- return result;
-}
-
-double SDL_asin(double val)
-{
- double result;
- if (val == -1.0) {
- result = -(M_PI / 2.0);
- } else {
- result = (M_PI / 2.0) - SDL_acos(val);
- }
- return result;
-}
diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c
index aa57d41..2cb31cb 100644
--- a/src/stdlib/SDL_stdlib.c
+++ b/src/stdlib/SDL_stdlib.c
@@ -47,6 +47,42 @@ SDL_atan2(double x, double y)
}
double
+SDL_acos(double val)
+{
+#if defined(HAVE_ACOS)
+ return acos(val);
+#else
+ double result;
+ if (val == -1.0) {
+ result = M_PI;
+ } else {
+ result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
+ if (result < 0.0)
+ {
+ result += M_PI;
+ }
+ }
+ return result;
+#endif
+}
+
+double
+SDL_asin(double val)
+{
+#if defined(HAVE_ASIN)
+ return asin(val);
+#else
+ double result;
+ if (val == -1.0) {
+ result = -(M_PI / 2.0);
+ } else {
+ result = (M_PI / 2.0) - SDL_acos(val);
+ }
+ return result;
+#endif
+}
+
+double
SDL_ceil(double x)
{
#ifdef HAVE_CEIL