bugGNUstep - Bugs: bug #11188, configure check for...

Group
 
 

bug #11188: configure check for __objc_msg_forward (checking "for forwarding callback in runtime") should be rewritten

Submitter:  None
Submitted:  Thu 02 Dec 2004 02:35:16 AM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  fedor
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 13 Dec 2004 04:42:23 AM UTC, comment #3: 

OK, I cleaned up configure to avoid using the wrong flags with C programs (and the right ones with ObjC). Try it now.

Adam Fedor <fedor>
Group administrator
Fri 10 Dec 2004 11:59:45 AM UTC, comment #2: 

nearly perfect, except for the fact that configure does not know how to handle ObjC files correctly (for instance by creating 'conftest.m' instead of 'conftest.c'

So:
 
./configure CC='/opt/local/bin/gcc'

for base still (core.20041209.tar.bz2) fails on (Open)Darwin(/x86) like this:

configure:13838: checking "for forwarding callback in runtime"
configure:13844: /opt/local/bin/gcc -c -g -O2  -fgnu-runtime -I/opt/local/GNUstep/System/Library/Headers conftest.c >&5
cc1: warning: command line option "-fgnu-runtime" is valid for ObjC/ObjC++ but not for C
In file included from conftest.c:1:
./config/config.forward.m: In function 'main':
./config/config.forward.m:5: error: '__objc_msg_forward1' undeclared (first use in this function)
./config/config.forward.m:5: error: (Each undeclared identifier is reported only once
./config/config.forward.m:5: error: for each function it appears in.)
./config/config.forward.m:5: error: 'SEL' undeclared (first use in this function)
./config/config.forward.m:5: error: called object 'IMP(<erroneous-expression>)' is not a function
./config/config.forward.m:5: error: '__objc_msg_forward' undeclared (first use in this function)
configure:13850: $? = 1
configure: failed program was:
| #include "./config/config.forward.m"
configure:13873: result: no
configure:13880: checking "FFI library usage"
configure:14004: result: none
configure:14025: error: Incomplete support for ffi functionality.

A workaround for this was to use:

./configure CC='/opt/local/bin/gcc -x objective-c'

which resulted in:

checking "for forwarding callback in runtime"... yes
checking "FFI library usage"... ffcall

what is correct in my case (OpenDarwin/x86 has no support for libffi because the ABI is constantly changing)

regards, Lars

Anonymous
Wed 08 Dec 2004 04:25:49 PM UTC, comment #1: 

Fixed.

2004-12-07  Adam Fedor  <fedor@gnu.org>

  • configure.ac: Test for objc forwarding by compiling a program.
  • config/config.forward.m: New file.

(Fixes bug #11188).

Adam Fedor <fedor>
Group administrator
Thu 02 Dec 2004 02:35:16 AM UTC, original submission:  

checking "for forwarding callback in runtime" currently checks if "__objc_msg_forward" is present in the preprocessed file from gcc (by invoking gcc with -E):

starting at line 13843:

have_forward_hook=yes
echo "$as_me:$LINENO: checking \"for forwarding callback in runtime\"" >&5
echo $ECHO_N "checking \"for forwarding callback in runtime\"... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <objc/objc-api.h>

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "__objc_msg_forward" >/dev/null 2>&1; then
  echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; have_forward_hook=no
fi
rm -f conftest*

in line 13856 there is a grep for  "__objc_msg_forward". If that is present it is assumed that forwarding callback in runtime is working.

there are some problems with that way of doing this.

At first, as andrew pinski pointed out it is in no way guarantied that forwarding callback works if grep find a occurrence of "__objc_msg_forward".
there could also be a variable named that way in the code.

Second and more important is that -E and -fgnu-runtime don't work together in the upcoming version 4.0 of gcc (and this is hard to fix according to pinskia at gcc dot gnu dot org):

cc1: warning: command line option "-fgnu-runtime" is valid for ObjC/ObjC++ but not for C

See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18772

because of that pinskia also proposed a better (and more robust) check for that feature:

try to compile:

#include <objc/objc-api.h>
...
IMP (*__objc_msg_forward1)(SEL) = __objc_msg_forward;
...

for questions please mail to
lars dot sonchocky-helldorf at hamburg dot de
and/or
pinskia at gcc dot gnu dot org

regards, Lars

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-12-08 fedor StatusNone Fixed
    Assigned toNone fedor
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-02a9.
Corresponding source code