mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-08 21:17:49 +03:00
build: allow building with newer glibc-headers and -O0
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.
This commit is contained in:
parent
4b310b03e9
commit
8d9a9ca521
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user