[virt-tools-list] [PATCH virt-viewer 01/25] build: allow building with newer glibc-headers and -O0
Daniel P. Berrange
berrange at redhat.com
Mon Jul 23 13:54:20 UTC 2012
On Tue, Jul 17, 2012 at 09:24:43PM +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"
ACK
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the virt-tools-list
mailing list