Make update of cmake's flags in compiler checks optional.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: Ia9b483f01cd940c16ba4ea1942b333131398cf37
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index f872b76..4631cfb 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -31,7 +31,7 @@
     add_compiler_flag_if_supported("/WX")
   endif ()
 else ()
-  require_c_flag("-std=c99")
+  require_c_flag("-std=c99" YES)
   add_compiler_flag_if_supported("-Wall")
   add_compiler_flag_if_supported("-Wdisabled-optimization")
   add_compiler_flag_if_supported("-Wextra")
diff --git a/build/cmake/compiler_flags.cmake b/build/cmake/compiler_flags.cmake
index 0c8f551..9249cbe 100644
--- a/build/cmake/compiler_flags.cmake
+++ b/build/cmake/compiler_flags.cmake
@@ -71,7 +71,7 @@
 
 # Checks C compiler for support of $c_flag and terminates generation when
 # support is not present.
-function (require_c_flag c_flag)
+function (require_c_flag c_flag update_c_flags)
   unset(C_FLAG_FOUND CACHE)
   string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
 
@@ -83,13 +83,15 @@
       message(FATAL_ERROR
               "${PROJECT_NAME} requires support for C flag: ${c_flag}.")
     endif ()
-    set(CMAKE_C_FLAGS "${c_flag} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
+    if (update_c_flags)
+      set(CMAKE_C_FLAGS "${c_flag} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
+    endif ()
   endif ()
 endfunction ()
 
 # Checks CXX compiler for support of $cxx_flag and terminates generation when
 # support is not present.
-function (require_cxx_flag cxx_flag)
+function (require_cxx_flag cxx_flag update_cxx_flags)
   unset(CXX_FLAG_FOUND CACHE)
   string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
 
@@ -101,39 +103,42 @@
       message(FATAL_ERROR
               "${PROJECT_NAME} requires support for CXX flag: ${cxx_flag}.")
     endif ()
-    set(CMAKE_CXX_FLAGS "${cxx_flag} ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
+    if (update_cxx_flags)
+      set(CMAKE_CXX_FLAGS "${cxx_flag} ${CMAKE_CXX_FLAGS}" CACHE STRING ""
+          FORCE)
+    endif ()
   endif ()
 endfunction ()
 
 # Checks for support of $flag by both the C and CXX compilers. Terminates
 # generation when support is not present in both compilers.
-function (require_flag flag)
-  require_c_flag(${flag})
-  require_cxx_flag(${flag})
+function (require_flag flag update_cmake_flags)
+  require_c_flag(${flag} ${update_cmake_flags})
+  require_cxx_flag(${flag} ${update_cmake_flags})
 endfunction ()
 
 # Checks only non-MSVC targets for support of $c_flag and terminates generation
 # when support is not present.
-function (require_c_flag_nomsvc c_flag)
+function (require_c_flag_nomsvc c_flag update_c_flags)
   if (NOT MSVC)
-    require_c_flag(${c_flag})
+    require_c_flag(${c_flag} ${update_c_flags})
   endif ()
 endfunction ()
 
 # Checks only non-MSVC targets for support of $cxx_flag and terminates
 # generation when support is not present.
-function (require_cxx_flag_nomsvc cxx_flag)
+function (require_cxx_flag_nomsvc cxx_flag update_cxx_flags)
   if (NOT MSVC)
-    require_cxx_flag(${cxx_flag})
+    require_cxx_flag(${cxx_flag} ${update_cxx_flags})
   endif ()
 endfunction ()
 
 # Checks only non-MSVC targets for support of $flag by both the C and CXX
 # compilers. Terminates generation when support is not present in both
 # compilers.
-function (require_flag_nomsvc flag)
-  require_c_flag_nomsvc(${flag})
-  require_cxx_flag_nomsvc(${flag})
+function (require_flag_nomsvc flag update_cmake_flags)
+  require_c_flag_nomsvc(${flag} ${update_cmake_flags})
+  require_cxx_flag_nomsvc(${flag} ${update_cmake_flags})
 endfunction ()
 
 # Adds $preproc_def to C compiler command line (as -D$preproc_def) if not