[virt-tools-list] [PATCH virt-viewer 01/19] build: allow building with newer glibc-headers and -O0
Christophe Fergeau
cfergeau at redhat.com
Tue Jul 17 08:32:37 UTC 2012
Looks good, ACK
Christophe
On Mon, Jul 16, 2012 at 06:57:36PM +0200, Marc-André Lureau wrote:
> Fix copied from libvirt, commit by Eric Blake.
>
> glibc 2.15 (on Fedora 17) coupled with explicit disabling of
> optimization during development dies a painful death:
>
> /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
>
> 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.
> ---
> acinclude.m4 | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 73b5a7b..0c308bc 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -19,7 +19,7 @@ AC_DEFUN([VIRT_VIEWER_COMPILE_WARNINGS],[
>
> warnCFLAGS=
>
> - try_compiler_flags="-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables"
> + try_compiler_flags="-fexceptions -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables"
>
> case "$enable_compile_warnings" in
> no)
> @@ -44,6 +44,13 @@ AC_DEFUN([VIRT_VIEWER_COMPILE_WARNINGS],[
> ;;
> esac
>
> + AH_VERBATIM([FORTIFY_SOURCE],
> + [/* Enable compile-time and run-time bounds-checking, and some warnings. */
> + #if defined __OPTIMIZE__ && __OPTIMIZE__
> + # define _FORTIFY_SOURCE 2
> + #endif
> + ])
> +
> compiler_flags=
> for option in $try_compiler_flags; do
> SAVE_CFLAGS="$CFLAGS"
> --
> 1.7.10.4
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20120717/f5dd4c40/attachment.sig>
More information about the virt-tools-list
mailing list