configure: Don't set user variables

CFLAGS is a user variable and shouldn't be set in either
configure.ac or Makefile.am because that makes it impossible to
override compiler flags at configure or make time.

AC_SUBST the default warning flags into AM_CFLAGS instead, which
is emitted before CFLAGS on the compiler command line.

Do the same thing with a mingw-specific flag as well.

Change-Id: I6ac3a3c8b7e0abf6f0e60ea239b549d68ea6d370
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3870
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
Andreas Fritiofson 2016-11-06 15:49:35 +01:00 committed by Paul Fertser
parent 1789445c82
commit ef4c139ce2
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# common flags used in openocd build
AM_CPPFLAGS = -I$(top_srcdir)/src \
AM_CFLAGS = $(GCC_WARNINGS)
AM_CPPFLAGS = $(HOST_CPPFLAGS)\
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
-I$(top_srcdir)/src/helper \
-DPKGDATADIR=\"$(pkgdatadir)\" \

View File

@ -471,7 +471,7 @@ AS_CASE([$host],
AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts])
])
CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO])
AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
@ -785,7 +785,7 @@ AS_IF([test "x${gcc_werror}" = "xyes"], [
# overide default gcc cflags
AS_IF([test "x$gcc_warnings" = "xyes"], [
CFLAGS="$CFLAGS $GCC_WARNINGS"
AC_SUBST([GCC_WARNINGS], [$GCC_WARNINGS])
])
AC_CONFIG_FILES([