diff options
author | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2012-09-11 22:50:13 +0300 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2012-09-14 18:47:27 +0200 |
commit | 4c148e5f74f764bccbe8b519494addb4aa0d79d0 (patch) | |
tree | 06b255232e1018817a2d918f7e55ff69ae46ee91 /libvncserver | |
parent | 8f1ef3d66cb846ed003b9f88bc56ef3b4859953e (diff) | |
download | libtdevnc-4c148e5f74f764bccbe8b519494addb4aa0d79d0.tar.gz libtdevnc-4c148e5f74f764bccbe8b519494addb4aa0d79d0.zip |
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.
Diffstat (limited to 'libvncserver')
-rw-r--r-- | libvncserver/httpd.c | 5 | ||||
-rw-r--r-- | libvncserver/rfbserver.c | 2 | ||||
-rw-r--r-- | libvncserver/sockets.c | 6 | ||||
-rw-r--r-- | libvncserver/websockets.c | 1 |
4 files changed, 12 insertions, 2 deletions
diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c index ed91e46..792a52b 100644 --- a/libvncserver/httpd.c +++ b/libvncserver/httpd.c @@ -23,6 +23,11 @@ * USA. */ +#ifdef __STRICT_ANSI__ +#define _BSD_SOURCE +#define _POSIX_SOURCE +#endif + #include <rfb/rfb.h> #include <ctype.h> diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index cc398f2..ad64ac1 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -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> diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index 2345248..ddd8450 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -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> diff --git a/libvncserver/websockets.c b/libvncserver/websockets.c index f7e3d04..043e6cb 100644 --- a/libvncserver/websockets.c +++ b/libvncserver/websockets.c @@ -28,7 +28,6 @@ #ifdef __STRICT_ANSI__ #define _BSD_SOURCE -#define _POSIX_SOURCE #endif #include <rfb/rfb.h> |