From c228e23b055f54d29f2df839cf76a2660917b9f6 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 22 May 2013 18:03:19 +0300 Subject: [PATCH] configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar macros to expose the largest extent of functionality supported by the underlying system. This is required since these macros are often limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually on some systems hide declarations which are not part of the X/Open spec. Since this goes into config.h rather than the command line, ensure all source is consistently including config.h before anything else, including system libraries. This doesn't need to be guarded by a HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org modular transition. Signed-off-by: Daniel Stone [pq: rebased and converted more files] --- clients/window.c | 4 +--- configure.ac | 2 ++ shared/cairo-util.c | 2 +- shared/config-parser.c | 3 ++- shared/image-loader.c | 2 +- shared/matrix.c | 2 ++ shared/option-parser.c | 2 ++ shared/os-compatibility.c | 2 +- src/animation.c | 2 ++ src/bindings.c | 2 ++ src/clipboard.c | 2 +- src/cms-helper.c | 4 +--- src/cms-static.c | 5 +---- src/compositor-drm.c | 6 +----- src/compositor-fbdev.c | 2 +- src/compositor-headless.c | 4 +--- src/compositor-rdp.c | 4 +--- src/compositor-rpi.c | 4 +--- src/compositor-wayland.c | 5 +---- src/compositor-x11.c | 4 +--- src/compositor.c | 2 -- src/evdev-touchpad.c | 2 ++ src/evdev.c | 2 ++ src/filter.c | 2 ++ src/gl-renderer.c | 2 +- src/gl-renderer.h | 7 +++---- src/launcher-util.c | 2 ++ src/libbacklight.c | 2 +- src/log.c | 2 ++ src/noop-renderer.c | 2 +- src/pixman-renderer.c | 2 +- src/rpi-renderer.c | 4 ++-- src/screenshooter.c | 2 ++ src/shell.c | 2 ++ src/tablet-shell.c | 2 ++ src/text-backend.c | 2 ++ src/tty.c | 2 ++ src/udev-seat.c | 2 ++ src/weston-launch.c | 2 -- src/xwayland/launcher.c | 2 +- src/xwayland/selection.c | 2 +- src/xwayland/window-manager.c | 2 +- src/zoom.c | 2 ++ 43 files changed, 62 insertions(+), 54 deletions(-) diff --git a/clients/window.c b/clients/window.c index e0d658a4..c13d2070 100644 --- a/clients/window.c +++ b/clients/window.c @@ -21,9 +21,7 @@ * OF THIS SOFTWARE. */ -#define _GNU_SOURCE - -#include "../config.h" +#include "config.h" #include #include diff --git a/configure.ac b/configure.ac index 8d36915e..b6252218 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,8 @@ AC_SUBST([WESTON_VERSION], [weston_version]) AC_CONFIG_HEADERS([config.h]) +AC_USE_SYSTEM_EXTENSIONS + AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests]) AM_SILENT_RULES([yes]) diff --git a/shared/cairo-util.c b/shared/cairo-util.c index 8b41f413..c3a966a3 100644 --- a/shared/cairo-util.c +++ b/shared/cairo-util.c @@ -21,7 +21,7 @@ * OF THIS SOFTWARE. */ -#include "../config.h" +#include "config.h" #include #include diff --git a/shared/config-parser.c b/shared/config-parser.c index 1d88eed0..0ff96eeb 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -20,7 +20,8 @@ * OF THIS SOFTWARE. */ -#define _GNU_SOURCE /* for stchrnul() */ +#include "config.h" + #include #include #include diff --git a/shared/image-loader.c b/shared/image-loader.c index 9f65dead..35dadd3d 100644 --- a/shared/image-loader.c +++ b/shared/image-loader.c @@ -21,7 +21,7 @@ * OF THIS SOFTWARE. */ -#include "../config.h" +#include "config.h" #include #include diff --git a/shared/matrix.c b/shared/matrix.c index 3ff4089a..4f0b6b79 100644 --- a/shared/matrix.c +++ b/shared/matrix.c @@ -21,6 +21,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/shared/option-parser.c b/shared/option-parser.c index a7e497ff..c00349a8 100644 --- a/shared/option-parser.c +++ b/shared/option-parser.c @@ -20,6 +20,8 @@ * OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c index 21d4d029..4f96dd4c 100644 --- a/shared/os-compatibility.c +++ b/shared/os-compatibility.c @@ -20,7 +20,7 @@ * OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/animation.c b/src/animation.c index e947d723..b9d0f8ab 100644 --- a/src/animation.c +++ b/src/animation.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/bindings.c b/src/bindings.c index e548ff13..558208ce 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include "compositor.h" diff --git a/src/clipboard.c b/src/clipboard.c index 11edc712..eb0b2309 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/cms-helper.c b/src/cms-helper.c index 2c7b57f0..c063c773 100644 --- a/src/cms-helper.c +++ b/src/cms-helper.c @@ -20,9 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #include #include diff --git a/src/cms-static.c b/src/cms-static.c index 53f2f84a..8a36ed9b 100644 --- a/src/cms-static.c +++ b/src/cms-static.c @@ -20,11 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" -#define _GNU_SOURCE #include #include diff --git a/src/compositor-drm.c b/src/compositor-drm.c index beb6ba56..76d08102 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -21,11 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c index 352969ff..9c3d17e0 100644 --- a/src/compositor-fbdev.c +++ b/src/compositor-fbdev.c @@ -23,7 +23,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/compositor-headless.c b/src/compositor-headless.c index c9194d0c..dd332422 100644 --- a/src/compositor-headless.c +++ b/src/compositor-headless.c @@ -21,9 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #include #include diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c index 93c3c161..1a973d2e 100644 --- a/src/compositor-rdp.c +++ b/src/compositor-rdp.c @@ -20,9 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #include #include diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c index b4dc9962..af62b30f 100644 --- a/src/compositor-rpi.c +++ b/src/compositor-rpi.c @@ -22,7 +22,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include @@ -35,8 +35,6 @@ #include -#include "config.h" - #ifdef HAVE_BCM_HOST # include #else diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 9489161e..f3a98a87 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -20,12 +20,9 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #include -#define _GNU_SOURCE #include #include #include diff --git a/src/compositor-x11.c b/src/compositor-x11.c index f17edb4a..5a0bcf0d 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -22,9 +22,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #include #include diff --git a/src/compositor.c b/src/compositor.c index 37fce0a5..099600dd 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -22,8 +22,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE - #include "config.h" #include diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index 4f9bb033..a21ae0b2 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/evdev.c b/src/evdev.c index 9289b1cd..122a2d9b 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/filter.c b/src/filter.c index 91e588d2..a55ebf27 100644 --- a/src/filter.c +++ b/src/filter.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/gl-renderer.c b/src/gl-renderer.c index 4b449d13..d783a0ba 100644 --- a/src/gl-renderer.c +++ b/src/gl-renderer.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/gl-renderer.h b/src/gl-renderer.h index a2e86909..4919a1ea 100644 --- a/src/gl-renderer.h +++ b/src/gl-renderer.h @@ -20,10 +20,9 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "compositor.h" +#include "config.h" + +#include "compositor.h" #ifdef ENABLE_EGL diff --git a/src/launcher-util.c b/src/launcher-util.c index 9196e4f3..6f6ee116 100644 --- a/src/launcher-util.c +++ b/src/launcher-util.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/libbacklight.c b/src/libbacklight.c index 98a20beb..b3acc63f 100644 --- a/src/libbacklight.c +++ b/src/libbacklight.c @@ -29,7 +29,7 @@ * Tiago Vignatti */ -#define _GNU_SOURCE +#include "config.h" #include "libbacklight.h" #include diff --git a/src/log.c b/src/log.c index e5430d68..1c05e25a 100644 --- a/src/log.c +++ b/src/log.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/noop-renderer.c b/src/noop-renderer.c index a0b16797..c0765f26 100644 --- a/src/noop-renderer.c +++ b/src/noop-renderer.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c index 2c423908..0bae1a48 100644 --- a/src/pixman-renderer.c +++ b/src/pixman-renderer.c @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c index e429d2ef..c3611854 100644 --- a/src/rpi-renderer.c +++ b/src/rpi-renderer.c @@ -20,12 +20,12 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include -#include "config.h" - #ifdef HAVE_BCM_HOST # include #else diff --git a/src/screenshooter.c b/src/screenshooter.c index 83ad1922..3a4f6c23 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/shell.c b/src/shell.c index ebeef55f..3d10eef6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -21,6 +21,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/tablet-shell.c b/src/tablet-shell.c index cae8acfd..91fbaede 100644 --- a/src/tablet-shell.c +++ b/src/tablet-shell.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/text-backend.c b/src/text-backend.c index c6d8e9e6..3d365278 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -21,6 +21,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/tty.c b/src/tty.c index 05e5e20f..2324f6c3 100644 --- a/src/tty.c +++ b/src/tty.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/udev-seat.c b/src/udev-seat.c index 927bb7a4..a8790b3f 100644 --- a/src/udev-seat.c +++ b/src/udev-seat.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include diff --git a/src/weston-launch.c b/src/weston-launch.c index ad774762..de4e7058 100644 --- a/src/weston-launch.c +++ b/src/weston-launch.c @@ -20,8 +20,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE - #include "config.h" #include diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c index 664cf6ca..a8ad4780 100644 --- a/src/xwayland/launcher.c +++ b/src/xwayland/launcher.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/xwayland/selection.c b/src/xwayland/selection.c index 69665b73..66cb5fea 100644 --- a/src/xwayland/selection.c +++ b/src/xwayland/selection.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c index b4b0a83a..366f2e04 100644 --- a/src/xwayland/window-manager.c +++ b/src/xwayland/window-manager.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE +#include "config.h" #include #include diff --git a/src/zoom.c b/src/zoom.c index ccc5d492..292aed6c 100644 --- a/src/zoom.c +++ b/src/zoom.c @@ -20,6 +20,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" + #include #include "compositor.h"