Expand cmake inline detection.

Check for __inline in addition to inline. The latter version is
preferred.

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

Change-Id: I473f29374315c904ddd4f058313b50e8883f1b03
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index e404853..04673dd 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -105,11 +105,8 @@
 endif ()
 
 # Test compiler support.
-aom_check_source_compiles("inline_check" "static inline void function(void) {}"
-                          HAVE_INLINE)
-if (HAVE_INLINE EQUAL 1)
-  set(INLINE "inline")
-endif ()
+aom_get_inline("INLINE")
+
 # TODO(tomfinegan): aom_ports_check is legacy; HAVE_AOM_PORTS is not used
 # anywhere in the aom sources. To be removed after parity with the legacy
 # build system stops being important.
diff --git a/build/cmake/compiler_tests.cmake b/build/cmake/compiler_tests.cmake
index 88b16ef..26d3394 100644
--- a/build/cmake/compiler_tests.cmake
+++ b/build/cmake/compiler_tests.cmake
@@ -103,3 +103,23 @@
     set(${result_var} 0 PARENT_SCOPE)
   endif ()
 endfunction ()
+
+# When inline support is detected for the current compiler the supported
+# inlining keyword is written to $result in caller scope.
+function (aom_get_inline result)
+  aom_check_source_compiles("inline_check_1"
+                            "static inline void function(void) {}"
+                            HAVE_INLINE_1)
+  if (HAVE_INLINE_1 EQUAL 1)
+    set(${result} "inline" PARENT_SCOPE)
+    return()
+  endif ()
+
+  # Check __inline.
+  aom_check_source_compiles("inline_check_2"
+                            "static __inline void function(void) {}"
+                            HAVE_INLINE_2)
+  if (HAVE_INLINE_2 EQUAL 1)
+    set(${result} "__inline" PARENT_SCOPE)
+  endif ()
+endfunction ()