+
+
+
printf "%s\n" "$ax_cv_cc_clang" >&6; }
if test "x$ax_cv_cc_clang" = "xyes"; then
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler accepts --unwindlib" >&5
+printf %s "checking if the compiler accepts --unwindlib... " >&6; }
+if test ${ax_cv_cc_unwindlib_arg+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ CFLAGS_SAVED=$CFLAGS
+ CFLAGS="$CFLAGS -Werror --unwindlib=libunwind"
+
+ if test "$cross_compiling" = yes
+then :
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+ int main(int argc, char **argv) {
+ return 0;
+ }
+
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"
+then :
+ ax_cv_cc_unwindlib_arg=yes
+else $as_nop
+ ax_cv_cc_unwindlib_arg=no
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+ CFLAGS="$CFLAGS_SAVED"
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cc_unwindlib_arg" >&5
+printf "%s\n" "$ax_cv_cc_unwindlib_arg" >&6; }
+
clang_path="$CC"
- LDFLAGS="$LDFLAGS --rtlib=compiler-rt --unwindlib=libunwind"
+
+ LDFLAGS="$LDFLAGS --rtlib=compiler-rt"
+
+ if test "x$ax_cv_cc_unwindlib_arg" = "xyes"; then
+ LDFLAGS="$LDFLAGS --unwindlib=libunwind"
+ fi
else
clang_path=""
dnl #
AX_CC_IS_CLANG
if test "x$ax_cv_cc_clang" = "xyes"; then
+ AX_CC_UNWINDLIB_ARG
AC_SUBST(clang_path, "$CC")
+
dnl # Needed for builtins to function correctly (https://bugs.gentoo.org/702344)
- LDFLAGS="$LDFLAGS --rtlib=compiler-rt --unwindlib=libunwind"
+ LDFLAGS="$LDFLAGS --rtlib=compiler-rt"
+
+ if test "x$ax_cv_cc_unwindlib_arg" = "xyes"; then
+ LDFLAGS="$LDFLAGS --unwindlib=libunwind"
+ fi
else
AC_SUBST(clang_path, "")
fi
])
])
+dnl #
+dnl # clang and gcc originally used different flags to specify c11 support
+dnl #
+AC_DEFUN([AX_CC_UNWINDLIB_ARG],[
+ AC_CACHE_CHECK([if the compiler accepts --unwindlib], [ax_cv_cc_unwindlib_arg],[
+ CFLAGS_SAVED=$CFLAGS
+ CFLAGS="$CFLAGS -Werror --unwindlib=libunwind"
+
+ AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [
+ int main(int argc, char **argv) {
+ return 0;
+ }
+ ])
+ ],
+ [ax_cv_cc_unwindlib_arg=yes],
+ [ax_cv_cc_unwindlib_arg=no]
+ )
+
+ CFLAGS="$CFLAGS_SAVED"
+ ])
+])
+
+
dnl #
dnl # Check if we have the _Generic construct
dnl #