From 8039e03777b9db1d90fecfaf413945c45560b727 Mon Sep 17 00:00:00 2001 From: Julien Lerouge Date: Mon, 26 Oct 2009 19:58:44 +0000 Subject: [PATCH] Add an autoconf test to check for optional compiler flags like -Wno-missing-field-initializers or -Wno-variadic-macros. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85147 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.config.in | 6 ++++++ autoconf/configure.ac | 6 ++++++ autoconf/m4/cxx_flag_check.m4 | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 autoconf/m4/cxx_flag_check.m4 diff --git a/Makefile.config.in b/Makefile.config.in index fc84c0bcb1b..90f1d22a54f 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -320,3 +320,9 @@ ENABLE_LLVMC_DYNAMIC = 0 # support (via the -load option). ENABLE_LLVMC_DYNAMIC_PLUGINS = 1 #@ENABLE_LLVMC_DYNAMIC_PLUGINS@ + +# Optional flags supported by the compiler +# -Wno-missing-field-initializers +NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@ +# -Wno-variadic-macros +NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@ diff --git a/autoconf/configure.ac b/autoconf/configure.ac index b9ad6bb494f..794326dd850 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -943,6 +943,12 @@ fi dnl Tool compatibility is okay if we make it here. AC_MSG_RESULT([ok]) +dnl Check optional compiler flags. +AC_MSG_CHECKING([optional compiler flags]) +CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros]) +CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers]) +AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS]) + dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 5: Check for libraries diff --git a/autoconf/m4/cxx_flag_check.m4 b/autoconf/m4/cxx_flag_check.m4 new file mode 100644 index 00000000000..ab09f2af5cf --- /dev/null +++ b/autoconf/m4/cxx_flag_check.m4 @@ -0,0 +1,2 @@ +AC_DEFUN([CXX_FLAG_CHECK], + [AC_SUBST($1, `$CXX $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])