diff --git a/compat/sincos.c b/compat/sincos.c new file mode 100644 index 0000000000000000000000000000000000000000..e01698dbaa7e2c1e46d9dc9eca6552be9c689581 --- /dev/null +++ b/compat/sincos.c @@ -0,0 +1,37 @@ +/***************************************************************************** + * sincos.c: GNU sincos() & sincosf() replacements + ***************************************************************************** + * Copyright © 2016 Rémi Denis-Courmont + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <math.h> + +void sincos(double r, double *restrict sr, double *restrict cr) +{ + *sr = sin(r); + *cr = cos(r); +} + +void sincosf(float r, float *restrict sr, float *restrict cr) +{ + *sr = sinf(r); + *cr = cosf(r); +} diff --git a/configure.ac b/configure.ac index c8900d216540816224e872bef46fbcc93d83ca41..0f5994e39296bfbebe7e675f483cdf68b24af3bf 100644 --- a/configure.ac +++ b/configure.ac @@ -751,6 +751,11 @@ AC_CHECK_LIB(m,lrintf, [ AC_CHECK_LIB(m,nanf, AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function]) ) +AC_CHECK_LIB(m,sincos, [ + AC_DEFINE(HAVE_SINCOS, 1, [Define to 1 if you have the sincos function.]) +], [ + AC_LIBOBJ([sincos]) +]) dnl Check for dynamic plugins LIBDL="" diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h index 7b7e6194463f9a56df9ed93766c53790ca6d4a17..a3fc6f31502c8568c9189ca4c85efc840d1b6799 100644 --- a/include/vlc_fixups.h +++ b/include/vlc_fixups.h @@ -481,6 +481,11 @@ void freeaddrinfo (struct addrinfo *res); #define nanf(tagp) NAN #endif +#ifndef HAVE_SINCOS +void sincos(double, double *, double *); +void sincosf(float, float *, float *); +#endif + #ifndef HAVE_REALPATH char *realpath(const char * restrict pathname, char * restrict resolved_path); #endif