summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>2016-10-18 13:42:44 +0200
committerDmitry V. Levin <ldv@altlinux.org>2016-12-07 15:53:13 +0000
commita3da3c32c1e82450114a48d04a2a96021a74aa61 (patch)
tree7d3eeb3e48514772529d8b257994be30556049b3 /m4
parentf91def038449dbd6d9125fd1671128a3e19ca6fb (diff)
downloadstrace-a3da3c32c1e82450114a48d04a2a96021a74aa61.tar.gz
Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD
Commit dc427d50d96b15c9a64d7e78d97ce4d194622a63 enabled a number of extra warning flags through configure.ac. The configure script will determine dynamically if CC supports these flags before adding them to WARN_CFLAGS. ioctlsort is compiled with CC_FOR_BUILD, rather than CC. Nevertheless, the flags passed to this compilation also include WARN_CFLAGS (through AM_CFLAGS). This is incorrect: in a cross-compilation use case, CC and CC_FOR_BUILD are not the same. The former is the cross-compiler, the latter is the host compiler. Both may be of different versions and support different warning flags. In particular, this posed a problem when cross-compiling with a host compiler gcc 4.1, which does not support all the new flags: /usr/bin/gcc -DHAVE_CONFIG_H -I./linux/arm -I./linux/arm -I./linux -I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2 -I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o ioctlsort0.o ./ioctlsort.c cc1: error: unrecognized command line option "-Wempty-body" cc1: error: unrecognized command line option "-Wignored-qualifiers" cc1: error: unrecognized command line option "-Wlogical-op" cc1: error: unrecognized command line option "-Wmissing-parameter-type" cc1: error: unrecognized command line option "-Wold-style-declaration" cc1: error: unrecognized command line option "-Wtype-limits" make[2]: *** [ioctlsort0.o] Error 1 * Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New variables. (ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS. (ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS. (ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS. * m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS, substitute WARN_CFLAGS_FOR_BUILD. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_prog_cc_for_build.m47
1 files changed, 7 insertions, 0 deletions
diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
index 114c9e759..9fddbf647 100644
--- a/m4/ax_prog_cc_for_build.m4
+++ b/m4/ax_prog_cc_for_build.m4
@@ -62,6 +62,7 @@ pushdef([CPP], CPP_FOR_BUILD)dnl
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
+pushdef([WARN_CFLAGS], WARN_CFLAGS_FOR_BUILD)dnl
pushdef([host], build)dnl
pushdef([host_alias], build_alias)dnl
pushdef([host_cpu], build_cpu)dnl
@@ -74,6 +75,7 @@ pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
+pushdef([gl_unknown_warnings_are_errors], gl_build_unknown_warnings_are_errors)dnl
st_SAVE_VAR([ac_c_decl_warn_flag])
st_SAVE_VAR([ac_c_preproc_warn_flag])
@@ -93,6 +95,8 @@ AC_PROG_CC
AC_PROG_CPP
AC_EXEEXT
+st_WARN_CFLAGS
+
st_RESTORE_VAR([cross_compiling])
st_RESTORE_VAR([ac_tool_prefix])
st_RESTORE_VAR([ac_link])
@@ -107,6 +111,7 @@ st_RESTORE_VAR([ac_c_decl_warn_flag])
dnl Restore the old definitions
dnl
+popdef([gl_unknown_warnings_are_errors])dnl
popdef([am_cv_CC_dependencies_compiler_type])dnl
popdef([am_cv_prog_cc_c_o])dnl
popdef([ac_cv_host_os])dnl
@@ -119,6 +124,7 @@ popdef([host_vendor])dnl
popdef([host_cpu])dnl
popdef([host_alias])dnl
popdef([host])dnl
+popdef([WARN_CFLAGS])dnl
popdef([LDFLAGS])dnl
popdef([CPPFLAGS])dnl
popdef([CFLAGS])dnl
@@ -147,4 +153,5 @@ AC_SUBST(BUILD_OBJEXT)dnl
AC_SUBST([CFLAGS_FOR_BUILD])dnl
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
+AC_SUBST([WARN_CFLAGS_FOR_BUILD])dnl
])