summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 35 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index de90e6a32..edb4322b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1078,7 +1078,7 @@ fi
AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
AC_MSG_CHECKING(for -Wtrampolines support)
-if $(${CC} -Wtrampolines -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wtrampolines -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
AC_MSG_RESULT(yes)
AST_TRAMPOLINES=-Wtrampolines
else
@@ -1133,16 +1133,41 @@ fi
AC_SUBST(AST_NATIVE_ARCH)
dnl Nested functions required for RAII implementation
-AC_MSG_CHECKING(for -fnested-functions)
-AC_COMPILE_IFELSE(
- dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
- [AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
- AC_MSG_RESULT(no)
- [AST_NESTED_FUNCTIONS=],
- AC_MSG_RESULT(required)
- [AST_NESTED_FUNCTIONS=-fnested-functions]
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([], [
+ #if defined(__clang__)
+ choke
+ #endif
+ ])
+ ],[
+ dnl Nested functions required for RAII implementation
+ AC_MSG_CHECKING(for gcc -fnested-functions)
+ AC_COMPILE_IFELSE(
+ dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
+ [AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
+ AC_MSG_RESULT(no)
+ [AST_NESTED_FUNCTIONS=],
+ AC_MSG_RESULT(yes)
+ [AST_NESTED_FUNCTIONS=-fnested-functions]
+ )
+ AC_SUBST(AST_NESTED_FUNCTIONS)
+ ],[
+ AC_MSG_CHECKING(for clang -fblocks)
+ if test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c - 2>&1`" = ""; then
+ [AST_CLANG_BLOCKS_LIBS=""]
+ [AST_CLANG_BLOCKS="-Wno-unknown-warning-option -fblocks"]
+ AC_MSG_RESULT(yes)
+ elif test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
+ [AST_CLANG_BLOCKS_LIBS="-lBlocksRuntime"]
+ [AST_CLANG_BLOCKS="-fblocks"]
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_ERROR("BlocksRuntime is required for clang")
+ fi
+ AC_SUBST(AST_CLANG_BLOCKS_LIBS)
+ AC_SUBST(AST_CLANG_BLOCKS)
+ ]
)
-AC_SUBST(AST_NESTED_FUNCTIONS)
dnl Check to see if rpath should be set in LDFLAGS
AC_ARG_ENABLE(rpath,