gtk/gtkcolorsel.h won't compile with -ansi under Solaris




After having patched ltmain.sh (thanks to Frederic Devernay who
reported the libtool bug on the gimp-developer list), I was finally
able to configure and compile gtk-0.99.7 (+patches) under Solaris
2.5.1.

Everything compiles and runs fine with the default options, but if you
configure gtk with "--enable-ansi", the file gtk/gtkcolorsel.c does
not compile.  This is because it uses "M_PI", and this constant is not
defined if the file is compiled in ANSI mode.  Specifically, the file
/usr/include/math.h contains the following:

  #if defined(__EXTENSIONS__) || __STDC__ - 0 == 0 && \
          !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
[...]
  #define M_PI            3.14159265358979323846
[...]
  #endif  /* defined(__EXTENSIONS__) || __STDC__ - 0 == 0 && ... */

The easiest way to avoid this problem is probably to add
  #define _XOPEN_SOURCE
in gtk/gtkcolorsel.c before it includes <math.h>.  But maybe there is
a more elegant solution?

-Raphael



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]