Implement D-Bus method generation from Objective-C runtime introspection data

(no methods get yet exposed on the bus, though). Fix a couple of bugs.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@35410 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2012-08-16 08:21:59 +00:00
parent e1541679bb
commit 0d7353ce76
16 changed files with 600 additions and 41 deletions

View File

@ -1,3 +1,34 @@
2012-08-16 Niels Grewe <niels.grewe@halbordnung.de>
* configure.ac: Temporarily enable -Wno-deprecated-declarations
for clang; check whether we need to include objc/encoding.h.
* configure: Regenerate.
* Headers/DKNotificationCenter.h: Add deprecation notices for
methods using features that are going away. (New API still
missing).
* Source/config.h.in: Add macro for objc/encoding.h check.
* Source/DKArgument.h
* Source/DKArgument.m:
Add convenience method for generating arguments from
Objective-C type encodings.
* Source/DKBoxingUtils.h
* Source/DKBoxingUtils.m:
Implement conversion from selectors to method names; fix type
mapping for id (it was incorrectly mapped to
DBUS_TYPE_OBJECT_PATH, but should be mapped to
DBUS_TYPE_VARIANT).
* Source/DKMethod.h
* Source/DKMethod.m:
Implement generation of methods from runtime introspection
data.
* Source/DKMethodReturn.m: Change method order.
* Source/DKObjectPathNode.m: Fix memory leak.
* Source/DKOutgoingProxy.m: Add some method stubs.
* Source/DKPort.m: Fix bug where the root object was lead to
believe that it was its own child.
* Test/TestDKMethod.m: Add tests for selector mangling and
method generation from runtime data structures.
2012-05-24 Niels Grewe <niels.grewe@halbordnung.de>
* Source/GNUmakefile: Add DKMethodReturn.m

View File

@ -186,6 +186,8 @@
* terminated by <code>nil</code>. If you want to match the first argument,
* specify that particular match as the first one and set <var>firstIndex</var>
* to <code>0</code>.
*
* NOTE: This method will be deprecated once a replacement is available.
*/
- (void)addObserver: (id)observer
selector: (SEL)notifySelector
@ -257,6 +259,8 @@
* Removes all observation activities matching the arguments specified.
* The match is inclusive. Every observation for a more specific rule will also
* be removed.
*
* NOTE: This method will be deprecated once a replacement is available.
*/
- (void)removeObserver: (id)observer
signal: (NSString*)signalName

View File

@ -59,6 +59,26 @@ extern NSString *kDKArgumentDirectionOut;
name: (NSString*)name
parent: (id)parent;
/**
* Initializes the argument with the first Objective-C type code appearing in
* <var>objCType</var>. This is a convenience method that works for some, but
* not all types and does not examine the contents of structs or arrays.
* Unsupported types are:
* <list>
* <item><code>#</code> (class)</item>
* <item><code>:</code> (selector)</item>
* <item><code>^</code> (pointer)</item>
* <item><code>?</code> (unknown or function pointer)</item>
* <item><code>%</code> (atom)</item>
* <item><code>()</code> (union)</item>
* <item><code>!</code> (vector)</item>
* <item><code>j</code> (complex number)</item>
* </list>
*/
- (id)initWithObjCType: (const char*)objCType
name: (NSString*)_name
parent: (id)_parent;
/**
* Return whether the argument is a complex one that is made up by further
* types.

View File

@ -421,7 +421,7 @@ DKDBusTypeForUnboxingObject(id object)
return self;
}
/* Public initializer, see publich header for documentation. */
/* Public initializer, see public header for documentation. */
- (id)initWithDBusSignature: (const char*)DBusTypeString
name: (NSString*)_name
parent: (id)_parent
@ -441,6 +441,22 @@ DKDBusTypeForUnboxingObject(id object)
}
/* Public initializer, see public header for documentation. */
- (id)initWithObjCType: (const char*)objCType
name: (NSString*)_name
parent: (id)_parent
{
if (NULL == objCType)
{
return nil;
}
char theType[2];
theType[0] =(char)DKDBusTypeForObjCType(objCType);
theType[1] = '\0';
return [self initWithDBusSignature: theType
name: _name
parent: _parent];
}
- (void)setObjCEquivalent: (Class)class
{

View File

@ -112,3 +112,13 @@ DKObjCTypeFitsIntoDBusType(const char* code, int type);
*/
BOOL
DKObjCTypeFitsIntoObjCType(const char* code, const char* otherCode);
/**
* Eliminates all occurrences of a colon (':') in a selector name and
* uppercases the following character in order to obtain a D-Bus method name
* from an Objective-C selector.
*
* Example: ``setObject:forKey:'' becomes ``setObjectForKey''.
*/
NSString*
DKMethodNameFromSelector(SEL aSelector);

View File

@ -27,11 +27,14 @@
#import "config.h"
#import <Foundation/NSValue.h>
#import <Foundation/NSException.h>
#import <Foundation/NSFileHandle.h>
#import <Foundation/NSValue.h>
#import <GNUstepBase/Unicode.h>
#include <dbus/dbus.h>
#include <wctype.h>
Class
DKBuiltinObjCClassForDBusType(int type)
{
@ -103,7 +106,7 @@ DKDBusTypeForObjCType(const char* code)
case _C_CHARPTR:
return DBUS_TYPE_STRING;
case _C_ID:
return DBUS_TYPE_OBJECT_PATH;
return DBUS_TYPE_VARIANT;
case _C_ARY_B:
return DBUS_TYPE_ARRAY;
case _C_STRUCT_B:
@ -523,3 +526,64 @@ DKObjCTypeFitsIntoObjCType(const char *sourceType, const char *targetType)
return _DKObjCTypeFitsIntoObjCType(sourceType, targetType);
}
NSString*
DKMethodNameFromSelector(SEL selector)
{
NSString *selName = nil;
NSUInteger length;
BOOL charsOnStack;
unichar stackChars[64];
unichar *heapChars = NULL;
if (0 == selector)
{
return nil;
}
selName = NSStringFromSelector(selector);
length = [selName length];
charsOnStack = (length <= 64);
// 64 characters on the stack should be large enough most of the time.
if (NO == charsOnStack)
{
heapChars = malloc(length * sizeof(unichar));
}
else
{
heapChars = &stackChars[0];
}
NS_DURING
{
[selName getCharacters: heapChars range: NSMakeRange(0,length)];
for (int i = 0; i < (length - 1); i++)
{
if(':' == heapChars[i])
{
// Advance the buffer, uppercase the next character
i++;
if (iswlower(heapChars[i]))
{
heapChars[i] = uni_toupper(heapChars[i]);
}
}
}
selName = [NSString stringWithCharacters: heapChars length: length];
}
NS_HANDLER
{
if (NO == charsOnStack)
{
free(heapChars);
}
[localException raise];
}
NS_ENDHANDLER
if (NO == charsOnStack)
{
free(heapChars);
}
return [selName stringByReplacingOccurrencesOfString: @":" withString: @""];
}

View File

@ -23,7 +23,14 @@
*/
#import "DKIntrospectionNode.h"
#define INCLUDE_RUNTIME_H
#include "config.h"
#undef INCLUDE_RUNTIME_H
#include <dbus/dbus.h>
@class NSString, NSMutableArray, NSMethodSignature, DKArgument;
enum
@ -44,6 +51,29 @@ enum
NSMutableArray *outArgs;
}
/**
* Returns a method corresponding to the given Objective-C method description.
* Method descriptions are provided by protocol introspection data.
*/
+ (id)methodWithObjCMethodDescription: (const struct objc_method_description*)desc;
/**
* Returns a D-Bus method for the selector specified. The type information needs
* to be supplied using some other mechanism (e.g. NSObject's
* -methodSignatureForSelector:).
*/
+ (id)methodWithObjCSelector: (SEL)selector
types: (const char*)types;
#ifdef GNUSTEP
/**
* Returns a D-Bus method for the selector specified. The selector must include
* type information so that the method can be constructed. Typed selectors are
* only available for the GCC and GNUstep runtimes.
*/
+ (id)methodWithTypedObjCSelector: (SEL)selector;
#endif
/**
* Returns the Objective-C type string the method corresponds to. Use doBox to
* indicate whether the boxed signature is requested.

View File

@ -37,12 +37,124 @@
#import "DKProxy+Private.h"
/* GCC libobjc has the encodings stuff in runtime.h */
#if HAVE_OBJC_ENCODING_H
#include <objc/encoding.h>
#endif
#include <dbus/dbus.h>
#include <stdint.h>
#include <string.h>
@implementation DKMethod
+ (id)methodWithObjCSelector: (SEL)theSel
types: (const char*)types
{
NSString *methodName;
BOOL qualifier = YES;
DKMethod *theMethod = nil;
DKArgument *returnArg = nil;
// Sanity check: We cannot build methods without names or without types.
if ((0 == theSel) || ((NULL == types) || ('\0' == types)))
{
return nil;
}
methodName = DKMethodNameFromSelector(theSel);
theMethod = [[[DKMethod alloc] initWithName: methodName
parent: nil] autorelease];
// Record the proper selector string:
[theMethod setAnnotationValue: [NSString stringWithUTF8String: sel_getName(theSel)]
forKey: @"org.gnustep.objc.selector"];
// Get type qualifiers for the return value:
while(qualifier)
{
switch (*types)
{
case 'V':
[theMethod setAnnotationValue: @"true"
forKey: @"org.freedesktop.DBus.Method.NoReply"];
//No break here, we fall through to the types++
case 'O':
case 'o':
case 'n':
case 'N':
case 'r':
case 'R':
types++;
break;
default:
qualifier = NO;
break;
}
}
if ('v' != *types)
{
returnArg = [[[DKArgument alloc] initWithObjCType: types
name: nil
parent: theMethod] autorelease];
if (nil == returnArg)
{
NSWarnMLog(@"Could not construct D-Bus method from `%s'", sel_getName(theSel));
return nil;
}
[theMethod addArgument: returnArg
direction: kDKArgumentDirectionOut];
}
// Skip return, self and _cmd:
types = objc_skip_argspec(types);
types = objc_skip_argspec(types);
types = objc_skip_argspec(types);
while ('\0' != *types)
{
DKArgument *theArg = nil;
types = objc_skip_type_qualifiers(types);
theArg = [[DKArgument alloc] initWithObjCType: types
name: nil
parent: theMethod];
if (nil == theArg)
{
NSWarnMLog(@"Could not construct D-Bus method from `%s'", sel_getName(theSel));
return nil;
}
[theMethod addArgument: theArg
direction: kDKArgumentDirectionIn];
[theArg release];
types = objc_skip_argspec(types);
}
return theMethod;
}
#ifdef GNUSTEP
+(id)methodWithTypedObjCSelector: (SEL)aSelector
{
if (0 == aSelector)
{
return nil;
}
return [self methodWithObjCSelector: aSelector
types: sel_getType_np(aSelector)];
}
#endif
+ (id)methodWithObjCMethodDescription: (const struct objc_method_description*)desc
{
if (NULL == desc)
{
return nil;
}
return [self methodWithObjCSelector: desc->name
types: desc->types];
}
- (id) initWithName: (NSString*)aName
parent: (id)aParent
{

View File

@ -35,6 +35,25 @@
#include <dbus/dbus.h>
@implementation DKMethodReturn
- (void)deserializeArguments
{
DBusMessageIter iter;
dbus_message_iter_init_append(original, &iter);
NSDebugMLog(@"Deserializing arguments from method call");
NS_DURING
{
[method unmarshallFromIterator: &iter
intoInvocation: invocation
messageType: DBUS_MESSAGE_TYPE_METHOD_CALL];
}
NS_HANDLER
{
NSWarnMLog(@"Could not unmarshall arguments from D-Bus message. Exception raised: %@", localException);
[localException raise];
}
NS_ENDHANDLER
}
- (id) initAsReplyToDBusMessage: (DBusMessage*)aMsg
forProxy: (id<DKExportableObjectPathNode>)aProxy
@ -95,25 +114,6 @@
sendOutright: NO];
}
- (void)deserializeArguments
{
DBusMessageIter iter;
dbus_message_iter_init_append(original, &iter);
NSDebugMLog(@"Deserializing arguments from method call");
NS_DURING
{
[method unmarshallFromIterator: &iter
intoInvocation: invocation
messageType: DBUS_MESSAGE_TYPE_METHOD_CALL];
}
NS_HANDLER
{
NSWarnMLog(@"Could not unmarshall arguments from D-Bus message. Exception raised: %@", localException);
[localException raise];
}
NS_ENDHANDLER
}
- (void)serialize
{

View File

@ -384,7 +384,7 @@
return nil;
}
// We always need the introspectable interface:
[self setInterfaces: [NSDictionary dictionaryWithObject: [_DKInterfaceIntrospectable copy]
[self setInterfaces: [NSDictionary dictionaryWithObject: [[_DKInterfaceIntrospectable copy] autorelease]
forKey: [_DKInterfaceIntrospectable name]]];
return self;
}
@ -418,4 +418,9 @@
{
//NoOp, we are a root.
}
- (BOOL)_isLocal
{
return YES;
}
@end

View File

@ -234,4 +234,34 @@
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
- (void)_installClassPermittedMessages
{
// Introspects the Obj-C class of the object
}
- (void)DBusBuildMethodCache
{
/* [condition lock];
if (WILL_BUILD_CACHE == state)
{
[condition unlock];
}
else
{
[condition unlock];
}
*/
}
- (NSXMLNode*)XMLNodeIncludingCompleteIntrospection: (BOOL)includeIntrospection
forChildren: (BOOL)includeChildIntrospection
absolute: (BOOL)absolutePath
{
//TODO: Implement
return nil;
}
@end

View File

@ -670,7 +670,6 @@ static DBusObjectPathVTable _DKDefaultObjectPathVTable;
forObjectAtLeaf: (id)object
{
NSUInteger count = [nodes count];
id<DKExportableObjectPathNode> lastNode = nil;
id<DKExportableObjectPathNode> thisNode = nil;
for (NSUInteger i = 0; i < count; i++)
@ -704,7 +703,11 @@ static DBusObjectPathVTable _DKDefaultObjectPathVTable;
parent: lastNode];
}
thisNode = proxy;
[lastNode _addChildNode: proxy];
// Special case for the root, so it doesn't end up being its own child.
if (proxy != lastNode)
{
[lastNode _addChildNode: proxy];
}
[objectPathMap setObject: proxy
forKey: [proxy _path]];

View File

@ -37,3 +37,7 @@
#ifdef INCLUDE_RUNTIME_H
# include <@OBJC_RUNTIME_H@>
#endif
#ifndef HAVE_OBJC_ENCODING_H
# define HAVE_OBJC_ENCODING_H @HAVE_OBJC_ENCODING_H@
#endif

View File

@ -24,14 +24,33 @@
#import <Foundation/NSNull.h>
#import <UnitKit/UnitKit.h>
#import "../Source/DKArgument.h"
#import "../Source/DKMethod.h"
#import "../Source/DKInterface.h"
#import "../Source/DKProxy+Private.h"
#import "../Source/DKBoxingUtils.h"
#include <string.h>
@interface TestDKMethod: NSObject <UKTest>
@end
@interface FooTestObject: NSObject
- (char*)doSomeFooThingWith: (NSString*)string;
- (oneway void)neverWaitAbout: (id)someThing;
@end
@implementation FooTestObject
- (char*)doSomeFooThingWith: (NSString*)string
{
return "foo";
}
- (oneway void)neverWaitAbout: (id)someThing
{
return;
}
@end
@implementation TestDKMethod
+ (void)initialize
{
@ -114,4 +133,21 @@
UKObjectsEqual(@"s", [[(NSXMLElement*)[n childAtIndex: 0] attributeForName: @"type"] stringValue]);
UKObjectsEqual(@"out", [[(NSXMLElement*)[n childAtIndex: 0] attributeForName: @"direction"] stringValue]);
}
- (void)testSelectorMangling
{
UKObjectsEqual(@"setObjectForKey",
DKMethodNameFromSelector(@selector(setObject:forKey:)));
}
- (void)testMethodFromSelector
{
DKMethod *m = [DKMethod methodWithTypedObjCSelector:
method_getName(class_getInstanceMethod([FooTestObject class], @selector(doSomeFooThingWith:)))];
UKNotNil(m);
UKIntsEqual(DBUS_TYPE_VARIANT, [[m DKArgumentAtIndex: 0] DBusType]);
UKIntsEqual(DBUS_TYPE_STRING, [[m DKArgumentAtIndex: -1] DBusType]);
UKObjectsEqual(@"doSomeFooThingWith:", [m annotationValueForKey: @"org.gnustep.objc.selector"]);
}
@end

195
configure vendored
View File

@ -834,6 +834,7 @@ DBUS_LIBS
WARN_FLAGS
ATOMIC_CFLAGS
OBJCPP
HAVE_OBJC_ENCODING_H
OBJC_RUNTIME_H
MORE_LIBS
LIBOBJS
@ -3674,13 +3675,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:3677: $ac_compile\"" >&5)
(eval echo "\"\$as_me:3678: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:3680: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:3681: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:3683: output\"" >&5)
(eval echo "\"\$as_me:3684: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -4902,7 +4903,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4905 "configure"' > conftest.$ac_ext
echo '#line 4906 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6860,11 +6861,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6863: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6864: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6867: \$? = $ac_status" >&5
echo "$as_me:6868: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7199,11 +7200,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7202: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7203: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7206: \$? = $ac_status" >&5
echo "$as_me:7207: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7304,11 +7305,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7307: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7308: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7311: \$? = $ac_status" >&5
echo "$as_me:7312: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -7359,11 +7360,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7362: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7363: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7366: \$? = $ac_status" >&5
echo "$as_me:7367: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -10308,7 +10309,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10311 "configure"
#line 10312 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10404,7 +10405,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10407 "configure"
#line 10408 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12470,6 +12471,77 @@ else
WARN_FLAGS="-Wall"
fi
{ echo "$as_me:$LINENO: checking whether the compiler supports -Wno-deprecated-declarations" >&5
echo $ECHO_N "checking whether the compiler supports -Wno-deprecated-declarations... $ECHO_C" >&6; }
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_objc_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
HAS_W_NO_DEPRECATED_DECL=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
HAS_W_NO_DEPRECATED_DECL=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$saved_CFLAGS"
{ echo "$as_me:$LINENO: result: $HAS_W_NO_DEPRECATED_DECL" >&5
echo "${ECHO_T}$HAS_W_NO_DEPRECATED_DECL" >&6; }
if test x"$HAS_W_NO_DEPRECATED_DECL" = x"yes"; then
WARN_FLAGS="$WARN_FLAGS -Wno-deprecated-declarations"
fi
@ -13092,6 +13164,98 @@ echo "$as_me: error: \"could not find runtime.h. DBusKit requires gnustep-base >
fi
for ac_header in objc/encoding.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef HAVE_OBJC_RUNTIME_H
#include <objc/runtime.h>
#else
# ifdef HAVE_OBJECTIVEC2_RUNTIME_H
# include <ObjectiveC2/runtime.h>
# endif
#endif
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_objc_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
have_objc_encoding_h=yes
else
have_objc_encoding_h=no
fi
done
if test "$have_objc_encoding_h" = "yes"; then
HAVE_OBJC_ENCODING_H=1
else
HAVE_OBJC_ENCODING_H=0
fi
CFLAGS="$saved_CFLAGS"
CPPFLAGS="$saved_CPPFLAGS"
@ -14070,13 +14234,14 @@ DBUS_LIBS!$DBUS_LIBS$ac_delim
WARN_FLAGS!$WARN_FLAGS$ac_delim
ATOMIC_CFLAGS!$ATOMIC_CFLAGS$ac_delim
OBJCPP!$OBJCPP$ac_delim
HAVE_OBJC_ENCODING_H!$HAVE_OBJC_ENCODING_H$ac_delim
OBJC_RUNTIME_H!$OBJC_RUNTIME_H$ac_delim
MORE_LIBS!$MORE_LIBS$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 93; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -103,6 +103,18 @@ else
WARN_FLAGS="-Wall"
fi
AC_MSG_CHECKING(whether the compiler supports -Wno-deprecated-declarations)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],HAS_W_NO_DEPRECATED_DECL=yes,HAS_W_NO_DEPRECATED_DECL=no)
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($HAS_W_NO_DEPRECATED_DECL)
if test x"$HAS_W_NO_DEPRECATED_DECL" = x"yes"; then
WARN_FLAGS="$WARN_FLAGS -Wno-deprecated-declarations"
fi
AC_SUBST(WARN_FLAGS)
AC_SUBST(ATOMIC_CFLAGS)
@ -137,6 +149,23 @@ else
fi
fi
AC_CHECK_HEADERS([objc/encoding.h], [have_objc_encoding_h=yes], [have_objc_encoding_h=no],
[#ifdef HAVE_OBJC_RUNTIME_H
#include <objc/runtime.h>
#else
# ifdef HAVE_OBJECTIVEC2_RUNTIME_H
# include <ObjectiveC2/runtime.h>
# endif
#endif
])
if test "$have_objc_encoding_h" = "yes"; then
HAVE_OBJC_ENCODING_H=1
else
HAVE_OBJC_ENCODING_H=0
fi
AC_SUBST(HAVE_OBJC_ENCODING_H)
AC_SUBST(OBJC_RUNTIME_H)
AC_SUBST(OBJC)
CFLAGS="$saved_CFLAGS"