[PATCH weston 16/18] configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS

Kristian Høgsberg hoegsberg at gmail.com
Tue Jun 4 22:17:45 PDT 2013


On Wed, May 22, 2013 at 06:03:19PM +0300, ppaalanen at gmail.com wrote:
> From: Daniel Stone <daniel at fooishbar.org>
> 
> 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.

Makes sense, applied.

Kristian

> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> 
> [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 3f54111..28df2ca 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 <stdint.h>
>  #include <stdio.h>
> diff --git a/configure.ac b/configure.ac
> index 323bd87..68a54e7 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 8b41f41..c3a966a 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 <stdint.h>
>  #include <stdlib.h>
> diff --git a/shared/config-parser.c b/shared/config-parser.c
> index 652da1f..a49e29e 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 <string.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> diff --git a/shared/image-loader.c b/shared/image-loader.c
> index 9f65dea..35dadd3 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 <stdlib.h>
>  #include <stdio.h>
> diff --git a/shared/matrix.c b/shared/matrix.c
> index 3ff4089..4f0b6b7 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 <float.h>
>  #include <string.h>
>  #include <stdlib.h>
> diff --git a/shared/option-parser.c b/shared/option-parser.c
> index a7e497f..c00349a 100644
> --- a/shared/option-parser.c
> +++ b/shared/option-parser.c
> @@ -20,6 +20,8 @@
>   * OF THIS SOFTWARE.
>   */
>  
> +#include "config.h"
> +
>  #include <stdlib.h>
>  #include <stdint.h>
>  #include <stdio.h>
> diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c
> index 21d4d02..4f96dd4 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 <sys/types.h>
>  #include <sys/socket.h>
> diff --git a/src/animation.c b/src/animation.c
> index 7dd3683..80b200e 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 <stdlib.h>
>  #include <string.h>
>  #include <stdio.h>
> diff --git a/src/bindings.c b/src/bindings.c
> index e560b61..8022f55 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 <stdlib.h>
>  
>  #include "compositor.h"
> diff --git a/src/clipboard.c b/src/clipboard.c
> index 11edc71..eb0b230 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 <stdlib.h>
>  #include <string.h>
> diff --git a/src/cms-helper.c b/src/cms-helper.c
> index 2c7b57f..c063c77 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 <config.h>
> -#endif
> +#include "config.h"
>  
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/src/cms-static.c b/src/cms-static.c
> index 94fea99..be2004a 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 <config.h>
> -#endif
> +#include "config.h"
>  
> -#define _GNU_SOURCE
>  #include <stdlib.h>
>  #include <string.h>
>  
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 35019e0..7340a1b 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 <config.h>
> -#endif
> -
> -#define _GNU_SOURCE
> +#include "config.h"
>  
>  #include <errno.h>
>  #include <stdlib.h>
> diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
> index 21028a5..7b092d3 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 <errno.h>
>  #include <stdlib.h>
> diff --git a/src/compositor-headless.c b/src/compositor-headless.c
> index 0df0f7d..6115ecd 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 <config.h>
> -#endif
> +#include "config.h"
>  
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
> index 0dae963..0293486 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 <config.h>
> -#endif
> +#include "config.h"
>  
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
> index 64ef0ff..f1f920b 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 <errno.h>
>  #include <stdlib.h>
> @@ -35,8 +35,6 @@
>  
>  #include <libudev.h>
>  
> -#include "config.h"
> -
>  #ifdef HAVE_BCM_HOST
>  #  include <bcm_host.h>
>  #else
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index 4112401..3368ee1 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 <config.h>
> -#endif
> +#include "config.h"
>  
>  #include <stddef.h>
> -#define _GNU_SOURCE
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/src/compositor-x11.c b/src/compositor-x11.c
> index ea0d4b9..07ca824 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 <config.h>
> -#endif
> +#include "config.h"
>  
>  #include <assert.h>
>  #include <stddef.h>
> diff --git a/src/compositor.c b/src/compositor.c
> index aa5baaf..4654d83 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 <fcntl.h>
> diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
> index 4f9bb03..a21ae0b 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 <stdlib.h>
>  #include <math.h>
>  #include <string.h>
> diff --git a/src/evdev.c b/src/evdev.c
> index 9289b1c..122a2d9 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 <stdlib.h>
>  #include <string.h>
>  #include <linux/input.h>
> diff --git a/src/filter.c b/src/filter.c
> index 91e588d..a55ebf2 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 <stdlib.h>
>  #include <stdint.h>
>  #include <limits.h>
> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
> index 4915b90..ff7920c 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 <GLES2/gl2.h>
>  #include <GLES2/gl2ext.h>
> diff --git a/src/gl-renderer.h b/src/gl-renderer.h
> index a2e8690..4919a1e 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 <config.h>
> -#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 9196e4f..6f6ee11 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 <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/src/libbacklight.c b/src/libbacklight.c
> index 98a20be..b3acc63 100644
> --- a/src/libbacklight.c
> +++ b/src/libbacklight.c
> @@ -29,7 +29,7 @@
>   *    Tiago Vignatti <vignatti at freedesktop.org>
>   */
>  
> -#define _GNU_SOURCE
> +#include "config.h"
>  
>  #include "libbacklight.h"
>  #include <stdio.h>
> diff --git a/src/log.c b/src/log.c
> index e5430d6..1c05e25 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 <stdio.h>
>  #include <stdarg.h>
>  #include <stdlib.h>
> diff --git a/src/noop-renderer.c b/src/noop-renderer.c
> index a0b1679..c0765f2 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 <stdlib.h>
>  
> diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
> index 36563c6..b036135 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 <errno.h>
>  #include <stdlib.h>
> diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
> index e429d2e..c361185 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 <stdlib.h>
>  #include <assert.h>
>  #include <string.h>
>  
> -#include "config.h"
> -
>  #ifdef HAVE_BCM_HOST
>  #  include <bcm_host.h>
>  #else
> diff --git a/src/screenshooter.c b/src/screenshooter.c
> index dde052f..ee2585b 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 <stdlib.h>
>  #include <stdio.h>
>  #include <string.h>
> diff --git a/src/shell.c b/src/shell.c
> index e0d579a..e46c30f 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -22,6 +22,8 @@
>   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> +#include "config.h"
> +
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <stdbool.h>
> diff --git a/src/tablet-shell.c b/src/tablet-shell.c
> index cae8acf..91fbaed 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 <sys/wait.h>
>  #include <unistd.h>
>  #include <stdlib.h>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index 3d1670b..67cacf6 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 <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> diff --git a/src/tty.c b/src/tty.c
> index 05e5e20..2324f6c 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 <termios.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> diff --git a/src/udev-seat.c b/src/udev-seat.c
> index 7e62429..05b8163 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 <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index 42b2506..bd621a0 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 <stdio.h>
> diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c
> index 664cf6c..a8ad478 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 <stdlib.h>
>  #include <stdio.h>
> diff --git a/src/xwayland/selection.c b/src/xwayland/selection.c
> index 69665b7..66cb5fe 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 <stdlib.h>
>  #include <string.h>
> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index b4b0a83..366f2e0 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 <stdlib.h>
>  #include <stdio.h>
> diff --git a/src/zoom.c b/src/zoom.c
> index ccc5d49..292aed6 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 <stdlib.h>
>  
>  #include "compositor.h"
> -- 
> 1.8.1.5
> 


More information about the wayland-devel mailing list