[gtk-vnc] build: allow building with newer glibc-headers and -O0



commit 2bba4f41800ba4b5583af9a897fde30d47061396
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed Jun 13 14:48:19 2012 +0200

    build: allow building with newer glibc-headers and -O0
    
    Commit log and autoconf snippet written by Eric Blake for libvirt.
    
    glibc 2.15 (on Fedora 17) coupled with explicit disabling of
    optimization during development dies a painful death:
    
    In file included from /usr/include/limits.h:27:0,
                     from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169,.
                     from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7,
                     from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34,
                     from util/bitmap.c:26:
    /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
    cc1: all warnings being treated as errors
    
    Work around this by only conditionally defining _FORTIFY_SOURCE,
    in the case where glibc can actually use it.  The trick is using
    AH_VERBATIM instead of AC_DEFINE.
    
    * m4/gtk-vnc-warnings.m4 (LIBOSINFO_COMPILE_WARNINGS): Squelch
    _FORTIFY_SOURCE when needed to avoid glibc #warnings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678014

 m4/gtk-vnc-warnings.m4 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/m4/gtk-vnc-warnings.m4 b/m4/gtk-vnc-warnings.m4
index b383cad..9a94fff 100644
--- a/m4/gtk-vnc-warnings.m4
+++ b/m4/gtk-vnc-warnings.m4
@@ -71,8 +71,13 @@ AC_DEFUN([GTK_VNC_COMPILE_WARNINGS],[
     gl_WARN_ADD([-Wframe-larger-than=4096])
 
     # Use improved glibc headers
-    AC_DEFINE([_FORTIFY_SOURCE], [2],
-      [enable compile-time and run-time bounds-checking, and some warnings])
+    AH_VERBATIM([FORTIFY_SOURCE],
+    [/* Enable compile-time and run-time bounds-checking, and some warnings,
+        without upsetting newer glibc. */
+     #if defined __OPTIMIZE__ && __OPTIMIZE__
+     # define _FORTIFY_SOURCE 2
+     #endif
+    ])
 
     # Extra special flags
     dnl -fstack-protector stuff passes gl_WARN_ADD with gcc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]