Sun 15 Apr 2012 06:41:54 AM UTC, original submission:
I'm using clang to compile gnustep. However, gnustep-make is failing to detect that clang supports native objective-c exceptions (this is causing me a world of pain in other libraries) when the non-fragile abi flag is enabled. It works correctly when the non-fragile abi flag is not specified.
I've discovered this is because of a failure in the conftest used to detect native objective-c exceptions. When it attempts to compile it, it fails with the following error (config.log attached for reference):
CC=clang
./configure
==>
configure:5752: checking whether the compiler supports native ObjC exceptions
configure:5780: clang -c -fexceptions -fobjc-exceptions conftest.c >&5
clang: warning: argument unused during compilation: '-fobjc-exceptions'
conftest.c:11:1: error: expected identifier or '('
@interface Test { id isa; } @end
^
1 error generated.
configure:5780: $? = 1
<===
It must have something to do with the redefinition of CFLAGS in the non-fragile if/fi block, as the "-x objective-c" flag is not getting to the compiler for this conftest.
I suspect its related to the following code in configure.ac:
=====
AC_MSG_CHECKING(whether we should use the nonfragile ABI)
if test x"$USE_NONFRAGILE_ABI" = x"yes"; then
# What we want to do: set USE_NONFRAGILE_ABI to yes if we can compile
# something with -fobjc-nonfragile-abi.
CFLAGS_nonfragile="$CFLAGS"
CFLAGS="$CFLAGS -fobjc-nonfragile-abi"
AC_COMPILE_IFELSE([[
/* Note that we never execute this code so it does not really matter
what it is. We are testing that the compiler accepts the
'-fobjc-nonfragile-abi' flag. */
int
main()
{
#ifndef __has_feature
#define __has_feature(x) 0
#endif
return __has_feature(objc_nonfragile_abi) ? 0 : 1;
}
]], USE_NONFRAGILE_ABI=yes, USE_NONFRAGILE_ABI=no)
AC_MSG_RESULT($USE_NONFRAGILE_ABI)
CFLAGS="$CFLAGS_no_nonfragile"
if test x$USE_NONFRAGILE_ABI = xno; then
AC_MSG_NOTICE([The nonfragile ABI was requested, but the compiler])
AC_MSG_NOTICE([doesn't support it.])
AC_MSG_ERROR([compiler doesn't support nonfragile ABI])
fi
else
AC_MSG_RESULT(not requested by user)
fi
AC_SUBST(USE_NONFRAGILE_ABI)
======
Notice how we define CFLAGS_nonfragile, but we then set:
CFLAGS=$CFLAGS_no_nonfragile
I think this is causing the problem. I was able to fix it by changing that line to read:
CFLAGS="$CFLAGS_nonfragile"
I don't know why there is a reference to a CFLAGS_no_nonfragile; the configure script aborts if the non-fragile ABI is requested but not supported.
Can anyone else shed light on this?
|