mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Check for -Wno-unused-but-set-variable gcc support
Gcc versions 4.3.2 and earlier do not support the compiler flag -Wno-unused-but-set-variable. This can lead to build failures on older Linux platforms such as Debian Lenny. Since this is an optional build argument this changes add a new autoconf check for the option. If it is supported by the installed version of gcc then it is used otherwise it is omited. See commit's12c1acde76and79713039a2for the reason the -Wno-unused-but-set-variable options was originally added.
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ DEFAULT_INCLUDES = -include ${top_builddir}/zfs_config.h
|
||||
|
||||
AM_LIBTOOLFLAGS = --silent
|
||||
AM_CFLAGS = -Wall -Wstrict-prototypes
|
||||
AM_CFLAGS += -fno-strict-aliasing -Wno-unused-but-set-variable ${DEBUG_CFLAGS}
|
||||
AM_CFLAGS += -fno-strict-aliasing ${NO_UNUSED_BUT_SET_VARIABLE} ${DEBUG_CFLAGS}
|
||||
AM_CFLAGS += -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT
|
||||
AM_CFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64
|
||||
AM_CFLAGS += -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\"
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||
|
||||
dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
|
||||
dnl # compiler options are added by the kernel build system.
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-unused-but-set-variable"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS $NO_UNUSED_BUT_SET_VARIABLE"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\""
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
dnl #
|
||||
dnl # Check if gcc supports -Wno-unused-but-set-variable option.
|
||||
dnl #
|
||||
dnl # We actually invoke gcc with the -Wunused-but-set-variable option
|
||||
dnl # and infer the 'no-' version does or doesn't exist based upon
|
||||
dnl # the results. This is required because when checking any of
|
||||
dnl # no- prefixed options gcc always returns success.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_NO_UNUSED_BUT_SET_VARIABLE], [
|
||||
AC_MSG_CHECKING([for -Wno-unused-but-set-variable support])
|
||||
|
||||
saved_flags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wunused-but-set-variable"
|
||||
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM( [], []),
|
||||
[
|
||||
NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
NO_UNUSED_BUT_SET_VARIABLE=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([NO_UNUSED_BUT_SET_VARIABLE])
|
||||
])
|
||||
@@ -9,5 +9,6 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
ZFS_AC_CONFIG_USER_LIBBLKID
|
||||
ZFS_AC_CONFIG_USER_LIBSELINUX
|
||||
ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
|
||||
ZFS_AC_CONFIG_USER_NO_UNUSED_BUT_SET_VARIABLE
|
||||
ZFS_AC_CONFIG_USER_STACK_GUARD
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user