summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-04-20 19:50:36 +0100
committerRobert Bragg <robert@linux.intel.com>2012-08-06 14:27:39 +0100
commita9d19394254fdf6b4e5279e374ef04ebc44a2299 (patch)
tree8ebb8fc5948b79f20da7b6334827bfa746423629 /configure.ac
parent8dd77de00967ac332e89a7e4264c6b44f93db19e (diff)
downloadcogl-a9d19394254fdf6b4e5279e374ef04ebc44a2299.tar.gz
configure: Fix the check for _Static_assert
The check for whether the compiler supports _Static_assert didn't work properly because the AC_TRY_COMPILE function puts the source definition in its own main function. The test therefore ends up declaring a nested main function which GCC allows. If _Static_assert isn't available then it just looks like an implicit declaration of a function which only causes a warning in GCC so it would still compile. This patch changes it to use AC_COMPILE_IFELSE instead. This macro makes it possible to specify the complete source code so _Static_assert can be called from the global scope. AC_LANG_PROGRAM is used to generate the program. For extra aesthetics it now also generates a 'checking for...' message while the script is running. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 9657938c3083a782234e1e9f05ab5ae88a6bc5ab)
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 7 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index c8c78550..c0704eb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -938,16 +938,13 @@ AC_C_CONST
dnl ============================================================
dnl Compiler features
dnl ============================================================
-AC_TRY_COMPILE([],
-[
-_Static_assert (1, "");
-int
-main (int argc, char **argv)
-{
- return 0;
-}
-],
-[AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Whether _Static_assert can be used or not])])
+AC_MSG_CHECKING([for _Static_assert])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Static_assert (1, "");],
+ [(void) 0])],
+ [AC_DEFINE([HAVE_STATIC_ASSERT], [1],
+ [Whether _Static_assert can be used or not])
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
dnl ================================================================
dnl Libtool stuff.