Tune the definitions needed when building with -ansi.

The current definitions were mostly useful to glibc and followed its
feature_test_macros(3) documentation.

However, this means other platforms still had problems when building with
strict compilation flags. _BSD_SOURCE, for example, is only recognized by
glibc, and other platforms sometimes need _XOPEN_SOURCE instead, or even the
removal of some definitions (such as the outdate _POSIX_SOURCE one).

_POSIX_SOURCE also had to be conditionally defined in some places, as what
it enables or disables during compilation varies across systems.
pull/1/head
Raphael Kubo da Costa 12 years ago committed by Christian Beier
parent 8f1ef3d66c
commit 4c148e5f74

@ -24,6 +24,7 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#define _XOPEN_SOURCE 600
#endif
#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
#include <sys/types.h>

@ -26,6 +26,7 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#define _XOPEN_SOURCE 600
#endif
#ifndef WIN32
#include <unistd.h>

@ -24,6 +24,11 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#ifdef __linux__
/* Setting this on other systems hides definitions such as INADDR_LOOPBACK.
* The check should be for __GLIBC__ in fact. */
# define _POSIX_SOURCE
#endif
#endif
#include <unistd.h>
#include <errno.h>

@ -23,6 +23,11 @@
* USA.
*/
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#endif
#include <rfb/rfb.h>
#include <ctype.h>

@ -28,6 +28,8 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#define _XOPEN_SOURCE 600
#endif
#include <string.h>
#include <rfb/rfb.h>

@ -43,7 +43,11 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#ifdef __linux__
/* Setting this on other systems hides definitions such as INADDR_LOOPBACK.
* The check should be for __GLIBC__ in fact. */
# define _POSIX_SOURCE
#endif
#endif
#include <rfb/rfb.h>

@ -28,7 +28,6 @@
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE
#endif
#include <rfb/rfb.h>

Loading…
Cancel
Save