From 95fe636a5386f010247ee117077ee7ae0b6ad839 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 5 Apr 2013 18:08:29 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20a=20warning=20about=20=E2=80=98sincos?= =?UTF-8?q?=E2=80=99=20in=20examples/cogl-gles2-gears?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ‘sincos’ is a GNU extension. cogl-gles2-gears was using it without defining _GNU_SOURCE so it was generating some annoying warnings. This patch fixes it by making the example include config.h which will end up defining _GNU_SOURCE. In addition this patch adds a configure check for the function and provides a fallback if it's not available. https://bugzilla.gnome.org/show_bug.cgi?id=697330 Reviewed-by: Robert Bragg (cherry picked from commit eb5c92952e1882c95cfd6debc69a2c9efff096b9) --- configure.ac | 6 ++++++ examples/cogl-gles2-gears.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index a25434878..4ba85b8a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1180,6 +1180,12 @@ AC_CHECK_FUNCS([ffs]) dnl 'memmem' is a GNU extension but we have a simple fallback AC_CHECK_FUNCS([memmem]) +dnl This is used in the cogl-gles2-gears example but it is a GNU extension +save_libs="$LIBS" +LIBS="$LIBS $LIBM" +AC_CHECK_FUNCS([sincos]) +LIBS="$save_libs" + dnl ================================================================ dnl Platform values dnl ================================================================ diff --git a/examples/cogl-gles2-gears.c b/examples/cogl-gles2-gears.c index d7dd27161..c7185b676 100644 --- a/examples/cogl-gles2-gears.c +++ b/examples/cogl-gles2-gears.c @@ -35,6 +35,10 @@ * Jul 13, 2010 */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define GL_GLEXT_PROTOTYPES #include @@ -110,6 +114,15 @@ static GLfloat ProjectionMatrix[16]; /** The direction of the directional light for the scene */ static const GLfloat LightSourcePosition[4] = { 5.0, 5.0, 10.0, 1.0}; +#ifndef HAVE_SINCOS +static void +sincos (double x, double *sinx, double *cosx) +{ + *sinx = sin (x); + *cosx = cos (x); +} +#endif /* HAVE_SINCOS */ + /** * Fills a gear vertex. *