Skip to content
  • Christophe Fergeau's avatar
    Make sure config.h is included first in all .c files · b7c9343b
    Christophe Fergeau authored
    This is recommended by autoconf documentation
    http://nondot.org/sabre/Mirrored/autoconf-2.12/autoconf_3.html#SEC15
    and some #defines in config.h can change what happens in system headers,
    so config.h has to be included first.
    
    The only file which does not get this treatment is
    gtk/spice-client-gtk-module.c as this breaks the build on gtk+2:
    
    CC       SpiceClientGtk_la-spice-client-gtk-module.lo
    In file included from /usr/include/python2.7/pyconfig.h:6:0,
                     from /usr/include/python2.7/Python.h:8,
                     from /usr/include/pygtk-2.0/pygobject.h:5,
                     from spice-client-gtk-module.c:20:
    /usr/include/python2.7/pyconfig-64.h:1182:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
     #define _POSIX_C_SOURCE 200112L
     ^
    In file included from /usr/include/limits.h:25:0,
                     from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:168,
                     from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/syslimits.h:7,
                     from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:34,
                     from /usr/lib64/glib-2.0/include/glibconfig.h:11,
                     from /usr/include/glib-2.0/glib/gtypes.h:34,
                     from /usr/include/glib-2.0/glib/galloca.h:34,
                     from /usr/include/glib-2.0/glib.h:32,
                     from /usr/include/glib-2.0/gobject/gbinding.h:30,
                     from /usr/include/glib-2.0/glib-object.h:25,
                     from ./glib-compat.h:24,
                     from ../config.h:201,
                     from spice-client-gtk-module.c:18:
    /usr/include/features.h:228:0: note: this is the location of the previous definition
     #  define _POSIX_C_SOURCE 200809L
     ^
    cc1: all warnings being treated as errors
    b7c9343b