Enforce C++11 in build configuration

The build configuration currently does not specify a C++ standard to
target, relying on the compiler default.  This might be C++03, C++11, or
C++14, depending on compiler and version.  We want to make sure
everybody is coding to the same standard.

MSVC doesn't support explicitly setting the standard to C++11.  But
newish versions default to C++14 which should compile C++11 code, and
the build tests will prevent MSVC users accidentally submitting C++14
code.

Also, change all instances of M_PI to the internally-defined PI.  M_PI
is non-standard and disappears from some build environments with this
change of C++ standard.  Also remove the target-specific C++11 flags
used for dump_obc and libwebm.

BUG=aomedia:2209

Change-Id: Ifb6c3dc1427e5148f93fd4727872ab1641d2ad29
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eecfbb4..f409892 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -381,7 +381,6 @@
 
 if(ENABLE_TOOLS)
   if(CONFIG_AV1_DECODER)
-    require_cxx_flag_nomsvc("-std=c++11" NO)
     add_executable(dump_obu "${AOM_GEN_SRC_DIR}/usage_exit.cc"
                    "${AOM_ROOT}/tools/dump_obu.cc"
                    "${AOM_ROOT}/tools/obu_parser.cc"
@@ -392,10 +391,6 @@
     list(APPEND AOM_TOOL_TARGETS dump_obu)
     list(APPEND AOM_APP_TARGETS dump_obu)
 
-    if(NOT MSVC)
-      target_compile_options(dump_obu PUBLIC -std=c++11)
-    endif()
-
     # Maintain a separate variable listing only the examples to facilitate
     # installation of example programs into an tools sub directory of
     # $AOM_DIST_DIR/bin when building the dist target.
@@ -467,8 +462,6 @@
   endif()
 
   if(CONFIG_WEBM_IO)
-    require_cxx_flag_nomsvc("-std=c++11" NO)
-
     add_library(webm OBJECT ${AOM_LIBWEBM_SOURCES})
     include_directories("${AOM_ROOT}/third_party/libwebm")
     target_compile_definitions(webm PRIVATE __STDC_CONSTANT_MACROS)
@@ -476,7 +469,6 @@
 
     if(NOT MSVC)
       target_compile_options(webm PRIVATE -Wno-shadow)
-      target_compile_options(webm PUBLIC -std=c++11)
     endif()
 
     # Add to existing targets.
diff --git a/aom_dsp/txfm_common.h b/aom_dsp/txfm_common.h
index f982428..f13d690 100644
--- a/aom_dsp/txfm_common.h
+++ b/aom_dsp/txfm_common.h
@@ -39,7 +39,7 @@
 // Constants:
 //  for (int i = 1; i< 32; ++i)
 //    printf("static const int cospi_%d_64 = %.0f;\n", i,
-//           round(16384 * cos(i*M_PI/64)));
+//           round(16384 * cos(i*PI/64)));
 // Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
 static const tran_high_t cospi_1_64 = 16364;
 static const tran_high_t cospi_2_64 = 16305;
diff --git a/av1/common/av1_txfm.c b/av1/common/av1_txfm.c
index bb70eab..4fbb756 100644
--- a/av1/common/av1_txfm.c
+++ b/av1/common/av1_txfm.c
@@ -13,7 +13,7 @@
 
 #include "av1/common/av1_txfm.h"
 
-// av1_cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
+// av1_cospi_arr[i][j] = (int)round(cos(PI*j/128) * (1<<(cos_bit_min+i)));
 const int32_t av1_cospi_arr_data[7][64] = {
   { 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
     972,  964,  955,  946,  936,  926,  915,  903,  891,  878, 865, 851, 837,
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index ce299b0..8b2a2af 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -256,6 +256,7 @@
   endif()
 else()
   require_c_flag("-std=c99" YES)
+  require_cxx_flag_nomsvc("-std=c++11" YES)
   add_compiler_flag_if_supported("-Wall")
   add_compiler_flag_if_supported("-Wdisabled-optimization")
   add_compiler_flag_if_supported("-Wextra")
diff --git a/test/av1_fwd_txfm1d_test.cc b/test/av1_fwd_txfm1d_test.cc
index db81d56..863cb39 100644
--- a/test/av1_fwd_txfm1d_test.cc
+++ b/test/av1_fwd_txfm1d_test.cc
@@ -56,7 +56,7 @@
   for (int i = 0; i < 7; i++) {
     for (int j = 0; j < 64; j++) {
       EXPECT_EQ(av1_cospi_arr_data[i][j],
-                (int32_t)round(cos(M_PI * j / 128) * (1 << (cos_bit_min + i))));
+                (int32_t)round(cos(PI * j / 128) * (1 << (cos_bit_min + i))));
     }
   }
 }
diff --git a/test/av1_txfm_test.cc b/test/av1_txfm_test.cc
index d5b0ce3..abbc475 100644
--- a/test/av1_txfm_test.cc
+++ b/test/av1_txfm_test.cc
@@ -94,7 +94,7 @@
 double invSqrt2 = 1 / pow(2, 0.5);
 
 double dct_matrix(double n, double k, int size) {
-  return cos(M_PI * (2 * n + 1) * k / (2 * size));
+  return cos(PI * (2 * n + 1) * k / (2 * size));
 }
 
 void reference_dct_1d(const double *in, double *out, int size) {
@@ -179,7 +179,7 @@
   for (int k = 0; k < size; ++k) {
     out[k] = 0;
     for (int n = 0; n < size; ++n) {
-      out[k] += in[n] * sin(M_PI * (2 * n + 1) * (2 * k + 1) / (4 * size));
+      out[k] += in[n] * sin(PI * (2 * n + 1) * (2 * k + 1) / (4 * size));
     }
   }
 }