]> git.proxmox.com Git - mirror_zfs-debian.git/blame - config/always-no-unused-but-set-variable.m4
gbp-dch: update
[mirror_zfs-debian.git] / config / always-no-unused-but-set-variable.m4
CommitLineData
8a7e1cee
BB
1dnl #
2dnl # Check if gcc supports -Wno-unused-but-set-variable option.
3dnl #
4dnl # We actually invoke gcc with the -Wunused-but-set-variable option
5dnl # and infer the 'no-' version does or doesn't exist based upon
6dnl # the results. This is required because when checking any of
7dnl # no- prefixed options gcc always returns success.
8dnl #
2e08aedb 9AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE], [
8a7e1cee
BB
10 AC_MSG_CHECKING([for -Wno-unused-but-set-variable support])
11
12 saved_flags="$CFLAGS"
13 CFLAGS="$CFLAGS -Wunused-but-set-variable"
14
ea04106b 15 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
8a7e1cee
BB
16 [
17 NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
18 AC_MSG_RESULT([yes])
19 ],
20 [
21 NO_UNUSED_BUT_SET_VARIABLE=
22 AC_MSG_RESULT([no])
23 ])
24
25 CFLAGS="$saved_flags"
26 AC_SUBST([NO_UNUSED_BUT_SET_VARIABLE])
27])