configure/cmake: force -std=c99

BUG=aomedia:111

Change-Id: I4ed7b6998023975cd2834266be9caf44e2631f2c
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index b4ad805..8fc44c2 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -31,6 +31,14 @@
     add_compiler_flag_if_supported("/WX")
   endif ()
 else ()
+  set(c99_flag "-std=c99")
+  check_c_compiler_flag(${c99_flag} C99_FLAG_SUPPORTED)
+  if (C99_FLAG_SUPPORTED)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${c99_flag}" CACHE STRING "" FORCE)
+  else ()
+    # report error
+    message(FATAL_ERROR "C99 support by the compiler is required!")
+  endif ()
   add_compiler_flag_if_supported("-Wall")
   add_compiler_flag_if_supported("-Wdeclaration-after-statement")
   add_compiler_flag_if_supported("-Wdisabled-optimization")
diff --git a/build/make/configure.sh b/build/make/configure.sh
index c2daf3c..a389057 100644
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -672,6 +672,8 @@
 }
 
 process_common_toolchain() {
+  add_cflags_only -std=c99
+
   if [ -z "$toolchain" ]; then
     gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}"