summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libobjc
downloadcbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2
cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog2925
-rw-r--r--libobjc/Makefile.in420
-rw-r--r--libobjc/NXConstStr.m41
-rw-r--r--libobjc/Object.m389
-rw-r--r--libobjc/Protocol.m120
-rw-r--r--libobjc/README104
-rw-r--r--libobjc/THREADS339
-rw-r--r--libobjc/accessors.m289
-rw-r--r--libobjc/acinclude.m426
-rw-r--r--libobjc/aclocal.m4204
-rw-r--r--libobjc/archive.c1656
-rw-r--r--libobjc/class.c1138
-rw-r--r--libobjc/config.h.in74
-rwxr-xr-xlibobjc/configure13747
-rw-r--r--libobjc/configure.ac287
-rw-r--r--libobjc/encoding.c1341
-rw-r--r--libobjc/error.c97
-rw-r--r--libobjc/exception.c551
-rw-r--r--libobjc/gc.c458
-rw-r--r--libobjc/hash.c295
-rw-r--r--libobjc/init.c1044
-rw-r--r--libobjc/ivars.c376
-rw-r--r--libobjc/libobjc.def171
-rw-r--r--libobjc/linking.m36
-rw-r--r--libobjc/memory.c170
-rw-r--r--libobjc/methods.c177
-rw-r--r--libobjc/nil_method.c56
-rw-r--r--libobjc/objc-foreach.c51
-rw-r--r--libobjc/objc-private/README4
-rw-r--r--libobjc/objc-private/accessors.h32
-rw-r--r--libobjc/objc-private/common.h49
-rw-r--r--libobjc/objc-private/error.h38
-rw-r--r--libobjc/objc-private/hash.h201
-rw-r--r--libobjc/objc-private/module-abi-8.h315
-rw-r--r--libobjc/objc-private/objc-list.h94
-rw-r--r--libobjc/objc-private/objc-sync.h33
-rw-r--r--libobjc/objc-private/protocols.h38
-rw-r--r--libobjc/objc-private/runtime.h79
-rw-r--r--libobjc/objc-private/sarray.h243
-rw-r--r--libobjc/objc-private/selector.h57
-rw-r--r--libobjc/objc-sync.c459
-rw-r--r--libobjc/objc/NXConstStr.h51
-rw-r--r--libobjc/objc/Object.h68
-rw-r--r--libobjc/objc/Protocol.h56
-rw-r--r--libobjc/objc/README13
-rw-r--r--libobjc/objc/deprecated/METHOD_NULL.h2
-rw-r--r--libobjc/objc/deprecated/MetaClass.h1
-rw-r--r--libobjc/objc/deprecated/Object.h84
-rw-r--r--libobjc/objc/deprecated/Protocol.h13
-rw-r--r--libobjc/objc/deprecated/README11
-rw-r--r--libobjc/objc/deprecated/STR.h2
-rw-r--r--libobjc/objc/deprecated/hash.h211
-rw-r--r--libobjc/objc/deprecated/objc-list.h155
-rw-r--r--libobjc/objc/deprecated/objc_error.h56
-rw-r--r--libobjc/objc/deprecated/objc_get_uninstalled_dtable.h2
-rw-r--r--libobjc/objc/deprecated/objc_malloc.h17
-rw-r--r--libobjc/objc/deprecated/objc_msg_sendv.h12
-rw-r--r--libobjc/objc/deprecated/objc_object_alloc.h8
-rw-r--r--libobjc/objc/deprecated/objc_unexpected_exception.h9
-rw-r--r--libobjc/objc/deprecated/objc_valloc.h2
-rw-r--r--libobjc/objc/deprecated/sarray.h240
-rw-r--r--libobjc/objc/deprecated/struct_objc_category.h21
-rw-r--r--libobjc/objc/deprecated/struct_objc_class.h56
-rw-r--r--libobjc/objc/deprecated/struct_objc_ivar.h15
-rw-r--r--libobjc/objc/deprecated/struct_objc_ivar_list.h10
-rw-r--r--libobjc/objc/deprecated/struct_objc_method.h22
-rw-r--r--libobjc/objc/deprecated/struct_objc_method_list.h9
-rw-r--r--libobjc/objc/deprecated/struct_objc_module.h24
-rw-r--r--libobjc/objc/deprecated/struct_objc_protocol.h6
-rw-r--r--libobjc/objc/deprecated/struct_objc_protocol_list.h5
-rw-r--r--libobjc/objc/deprecated/struct_objc_selector.h20
-rw-r--r--libobjc/objc/deprecated/struct_objc_static_instances.h14
-rw-r--r--libobjc/objc/deprecated/struct_objc_symtab.h26
-rw-r--r--libobjc/objc/deprecated/typedstream.h141
-rw-r--r--libobjc/objc/encoding.h117
-rw-r--r--libobjc/objc/hash.h3
-rw-r--r--libobjc/objc/message.h141
-rw-r--r--libobjc/objc/objc-api.h411
-rw-r--r--libobjc/objc/objc-decls.h46
-rw-r--r--libobjc/objc/objc-exception.h109
-rw-r--r--libobjc/objc/objc-list.h2
-rw-r--r--libobjc/objc/objc-sync.h69
-rw-r--r--libobjc/objc/objc.h169
-rw-r--r--libobjc/objc/runtime.h1153
-rw-r--r--libobjc/objc/sarray.h2
-rw-r--r--libobjc/objc/thr.h117
-rw-r--r--libobjc/objc/typedstream.h4
-rw-r--r--libobjc/objects.c130
-rw-r--r--libobjc/protocols.c557
-rw-r--r--libobjc/sarray.c523
-rw-r--r--libobjc/selector.c753
-rw-r--r--libobjc/sendmsg.c1076
-rw-r--r--libobjc/thr.c549
93 files changed, 35537 insertions, 0 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
new file mode 100644
index 000000000..b48054fd3
--- /dev/null
+++ b/libobjc/ChangeLog
@@ -0,0 +1,2925 @@
+2013-04-12 Release Manager
+
+ * GCC 4.6.4 released.
+
+2012-03-01 Release Manager
+
+ * GCC 4.6.3 released.
+
+2011-11-20 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
+2011-10-26 Release Manager
+
+ * GCC 4.6.2 released.
+
+2011-10-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Backport from mainline
+ 2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/49883
+ * init.c (__objc_exec_class): Work around a bug in clang's code
+ generation. Clang sets the class->info field to values different
+ from 0x1 or 0x2 (the only allowed values in the traditional GNU
+ Objective-C runtime ABI) to store some additional information, but
+ this breaks backwards compatibility. Wipe out all the bits in the
+ fields other than the first two upon loading a class.
+
+2011-10-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Backport from mainline
+ 2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/50002
+ * class.c (__objc_update_classes_with_methods): Iterate over meta
+ classes as well as normal classes when refreshing the method
+ implementations. This fixes replacing class methods.
+
+2011-06-27 Release Manager
+
+ * GCC 4.6.1 released.
+
+2011-05-25 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Backport from mainline
+ 2011-05-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/48177
+ * selector.c (__sel_register_typed_name): Use sel_types_match()
+ instead of strcmp() to compare selector types (Suggestion by
+ Richard Frith-Macdonald <rfm@gnu.org>).
+
+2011-03-25 Release Manager
+
+ * GCC 4.6.0 released.
+
+2011-02-28 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * selector.c (sel_getTypedSelector): Return NULL if there are
+ multiple selectors with conflicting types.
+ * objc/runtime.h (sel_getTypedSelector): Updated documentation.
+
+2011-02-28 Richard Frith-Macdonald <rfm@gnu.org>
+
+ PR libobjc/47922
+ * gc.c (class_ivar_set_gcinvisible): Use _C_GCINVISIBLE instead of
+ a hardcoded "!".
+
+2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (create_tree_of_subclasses_inherited_from): Use
+ class_superclass_of_class instead of assuming a class is
+ unresolved when it could be resolved. Tidied up assignment and
+ check.
+ (__objc_tree_insert_class): Enhanced DEBUG_PRINTF.
+ (objc_tree_insert_class): Tidied up loop; return immediately upon
+ inserting a class.
+ (__objc_exec_class): Do not set __objc_class_tree_list.
+
+2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * selector.c (sel_getTypedSelector): Return NULL if given a NULL
+ argument.
+ (sel_registerTypedName): Same.
+ (sel_registerName): Same.
+ * objc/runtime.h: Updated documentation.
+
+2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_addIvar): Updated documentation. The
+ alignment is actually the log_2 of the alignment in bytes.
+ * ivars.c (class_addIvar): Corresponding change to the
+ implementation.
+
+2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (sel_getType): Renamed to sel_getTypeEncoding to
+ be consistent with method_getTypeEncoding and
+ ivar_getTypeEncoding.
+ (sel_copyTypedSelectorList, sel_getTypedSelector): New.
+ * selector.c (sel_getType): Renamed to sel_getTypeEncoding.
+ (sel_copyTypedSelectorList, sel_getTypedSelector): New.
+ (sel_get_type): Updated call to sel_getType.
+
+2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_conformsToProtocol,
+ class_copyProtocolList): Updated documentation.
+
+2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (create_tree_of_subclasses_inherited_from): Updated
+ DEBUG_PRINTF messages.
+ (__objc_tree_insert_class): Same.
+ (__objc_send_load_using_method_list): Same.
+ (__objc_send_load): Same.
+ (__objc_exec_class): Same. In particular, do not print the module
+ name since it is no longer used.
+ * sendmsg.c (__objc_send_initialize): Added DEBUG_PRINTFs for
+ tracking +initialize calls.
+ (__objc_update_dispatch_table_for_class): Added DEBUG_PRINTFs for
+ tracking updates of dispatch tables.
+ (__objc_install_dispatch_table_for_class): Same.
+
+2010-12-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Makefile.in (libobjc$(libsuffix).la): Link with -Wc,-shared-libgcc.
+ (libobjc_gc$(libsuffix).la): Likewise.
+
+2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * sendmsg.c (class_addMethod): Return NO if the method already
+ exists in the class.
+
+2010-12-22 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (duplicate_classes): New.
+ (__objc_exec_class): Initialize duplicate_classes.
+ (__objc_create_classes_tree): Ignore classes in the
+ duplicate_classes table.
+ (__objc_call_load_callback): Same.
+ (__objc_init_class): If a duplicate class is found, add it to
+ duplicate_classes instead of aborting. Return YES if the class is
+ not a duplicate, and NO if it is.
+ * objc-private/runtime.h (__objc_init_class): Updated prototype.
+
+2010-12-22 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/objc-list.h: Reindented file. No code changes.
+ * objc-private/sarray.h: Same change.
+
+2010-12-22 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/accessors.h: Removed 'extern "C"' guards. This
+ file is never compiled with C++.
+ * objc-private/hash.h: Same change.
+ * objc-private/objc-list.h: Same change.
+ * objc-private/objc-sync.h: Same change.
+ * objc-private/protocols.h: Same change.
+ * objc-private/runtime.h: Same change.
+ * objc-private/sarray.h: Same change.
+ * objc-private/selector.h: Same change.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/18764
+ * class.c (__objc_add_class_to_hash): Return YES if the class was
+ added, and NO if it already existed.
+ * init.c (__objc_init_class): If __objc_add_class_to_hash returns
+ NO, then abort the program with an error message.
+ * objc-private/runtime.h (__objc_add_class_to_hash): Updated
+ declaration.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (_objc_load_callback): Initialize with 0.
+ (__objc_call_callback): Renamed to __objc_call_load_callback.
+ Check _objc_load_callback only once, and if it is not set, return
+ immediately.
+ (objc_send_load): Updated call to __objc_call_callback.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/16110
+ * init.c (__objc_send_message_in_list): Renamed to
+ __objc_send_load_using_method_list. Do not take an 'op' argument.
+ Register the 'load' selector if needed.
+ (__objc_send_load): Do not register the 'load' selector. Updated
+ call to __objc_send_message_in_list.
+ (__objc_create_classes_tree): Add the class of any claimed
+ category that was loaded in the module to the list of classes for
+ which we try to execute +load.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/common.h: When DEBUG is defined, include <stdio.h>.
+ Updated comments.
+ * init.c (__objc_tree_insert_class): Use %p, not %x, when printing
+ a pointer using DEBUG_PRINTF.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/45953
+ * selector.c (__sel_register_typed_name): When registering a new
+ selector with the same name as an existing one, reuse the existing
+ name string. Also updated types, casts and comments in the whole
+ function.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/module-abi-8.h (struct objc_symtab): Declare 'refs'
+ to be 'struct objc_selector *' and not 'SEL'.
+ * init.c (__objc_exec_class): Call
+ __objc_register_selectors_from_module instead of iterating over
+ each selector and calling __sel_register_typed_name for each.
+ * objc-private/selector.h: Declare
+ __objc_register_selectors_from_module instead of
+ __sel_register_typed_name.
+ * selector.c (__objc_register_selectors_from_module): New.
+ (__sel_register_typed_name): Made static.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * linking.m: Do not include objc/NXConstStr.h.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/runtime.h (DEBUG_PRINTF): Moved from here ...
+ * objc-private/common.h (DEBUG_PRINTF): To here.
+ * hash.c: Do not include objc-private/runtime.h and objc/thr.h.
+
+2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * hash.c: Tidied up comments and indentation. No code changes.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/47012
+ * accessors.m (objc_getProperty): If not atomic, do not
+ retain/autorelease the returned value.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/runtime.h (__objc_selector_max_index,
+ __objc_init_selector_tables, __objc_register_selectors_from_class,
+ __objc_register_selectors_from_list,
+ __objc_register_selectors_from_description_list): Moved to ...
+ * objc-private/selector.h: ... here.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/runtime.h (__objc_class_links_resolved): Removed.
+ (__objc_print_dtable_stats): Removed.
+ (__sel_register_typed_name): Removed.
+ * sendmsg.c (__objc_print_dtable_stats): Use 'void' as argument.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (__objc_exec_class): Call __objc_resolve_class_links (),
+ if appropriate, after loading the module.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * sendmsg.c (method_setImplementation): Do not declare.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/message.h: Updated comments.
+ * objc/runtime.h: Updated comments.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * class.c (objc_lookupClass): Renamed to objc_lookUpClass.
+ * protocols.c: Updated all calls to objc_lookupClass to call
+ objc_lookUpClass instead.
+ * sendmsg.c (objc_lookupClass): Do not declare.
+ (get_imp): Update call to objc_lookupClass to call
+ objc_lookUpClass instead.
+ * objc/runtime.h (objc_lookupClass): Renamed to objc_lookUpClass.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_ivar_set_gcinvisible): Declare.
+ * sendmsg.c (_CLS_IN_CONSTRUCTION, CLS_IS_IN_CONSTRUCTION): Do not
+ define. Updated comments.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/encoding.h: Updated comments.
+ * objc/runtime.h: Updated comments.
+ (objc_setGetUnknownClassHandler): Mark with objc_EXPORT.
+ (objc_sizeof_type): Same.
+ (objc_alignof_type): Same.
+ (objc_aligned_size): Same.
+ (objc_promoted_size): Same.
+ (objc_skip_type_qualifiers): Same.
+ (objc_skip_typespec): Same.
+ (objc_skip_offset): Same.
+ (objc_skip_argspec): Same.
+ (objc_get_type_qualifiers): Same.
+ (objc_layout_structure): Same.
+ (objc_layout_structure_next_member): Same.
+ (objc_layout_finish_structure): Same.
+ (objc_layout_structure_get_info): Same.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c: Updated comments.
+ * objc/objc-api.h: Updated comments.
+ * objc/runtime.h (_objc_load_callback): Declare.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/Object.h: Include deprecated/typedstream.h and
+ deprecated/hash.h instead of typedstream.h. Updated comments.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (OBJC_DEPRECATED_H): Added objc_msg_sendv.h.
+ * objc/deprecated/objc_msg_sendv.h: New.
+ * objc/message.h: Do not define retval_t, apply_t, arglist,
+ arglist_t, objc_msg_sendv, now in
+ objc/deprecated/objc_msg_sendv.h.
+ * objc/objc.h: Do not include message.h; include
+ objc/deprecated/objc_msg_sendv.h instead. Tidied up comments.
+ * sendmsg.c: Include objc/message.h.
+ * thr.c: Include objc/message.h.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-exception.h: Include objc-decls.h. Mark all
+ functions with objc_EXPORT.
+ * objc/objc-sync.h: Same change.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Protocol.m: Moved all methods, with the exception of -isEqual:,
+ into the 'Deprecated' category.
+ * objc/Protocol.h: Removed all methods, moved to
+ objc/deprecated/Protocol.h. Include objc/deprecated/Protocol.h.
+ * objc/deprecated/Protocol.h: New.
+ * Makefile.in (OBJC_DEPRECATED_H): Added Protocol.h.
+
+2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c: Include objc-private/selector.h. Do not declare
+ __sel_register_typed_name.
+ * objc-private/selector.h (__sel_register_typed_name): Declare.
+ * selector.c: Include objc-private/selector.h.
+
+2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * class.c: Tidied up comments and indentation. No code changes.
+ * error.c: Same.
+ * exception.c: Same.
+ * init.c: Same.
+ * ivars.c: Same.
+ * memory.c: Same.
+ * objc-foreach.c: Same.
+ * objc-sync.c: Same.
+ * objects.c: Same.
+ * protocols.c: Same.
+ * sarray.c: Same.
+ * thr.c: Same.
+
+2010-12-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c: Include objc/runtime.h and objc-private/module-abi-8.h
+ instead of objc/objc-api.h.
+ (init_check_module_version): Take a 'struct objc_module *'
+ argument instead of 'Module_t'. Use 'struct objc_module *'
+ instead of 'Module_t'.
+ (__objc_created_classes_tree): Take a 'struct objc_module *'
+ argument instead of 'Module_t'; use 'struct objc_symtab *' instead
+ of 'Symtab_t'.
+ (__objc_call_callback): Take a 'struct objc_module *' argument
+ instead of 'Module_t'; use 'struct objc_symtab *' instead of
+ 'Symtab_t' and 'struct objc_category *' instead of 'Category_t'.
+ (_objc_load_callback): Take a 'struct objc_category *' argument
+ instead of 'Category *'.
+ (class_superclass_of_class): Use objc_getClass() instead of
+ objc_lookup_class().
+ (create_tree_of_subclasses_inherited_from): Same change (also, use
+ an explicit 'if' instead of '?').
+ (objc_init_statics): Same change.
+ (objc_send_load): Same change.
+ (__objc_init_protocol): same change.
+ (__objc_send_message_in_list): Take a 'struct objc_method_list *'
+ argument instead of 'MethodList_t'. Use 'struct objc_method *'
+ instead of 'Method_t'.
+ (__objc_send_load): Use 'struct objc_method_list *' instead of
+ 'MethodList_t'. Use sel_registerName() instead of
+ sel_register_name().
+ (__objc_exec_class): Take a 'struct objc_module *' argument
+ instead of 'Module_t'. Use 'struct objc_symtab *' instead of
+ 'Symtab_t'. Use objc_getClass() instead of objc_lookup_class().
+ Use 'struct objc_category *' instead of 'Category_t'.
+
+2010-12-16 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * sendmsg.c: Include objc/runtime.h instead of objc/objc-api.h.
+ Include objc-private/module-abi-8.h and objc-private/selector.h
+ instead of objc/encoding.h.
+ (objc_msg_lookup_super): Use super->super_class instead of
+ super->class.
+ (method_get_first_argument, method_get_next_argument): Declare
+ locally.
+ (class_get_instance_method): Declare before using.
+ (objc_msg_sendv): Use 'struct objc_method' instead of 'Method'.
+ (__objc_init_dispatch_tables, __objc_send_initialize): Use
+ sel_registerName() instead of sel_register_name().
+ (__objc_forward): Use sel_getName() instead of sel_get_name().
+ (objc_get_uninstalled_dtable): Use 'void' as argument.
+ * objc-private/selector.h: New.
+
+2010-12-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/message.h (objc_super): When using the modern API, do not
+ define Super and Super_t, and always use 'super_class' for the
+ super class field.
+ (objc_msg_lookup_super): Updated prototype to use 'struct
+ objc_super *' instead of 'Super_t'.
+ * sendmsg.c (objc_msg_lookup_super): Updated prototype to use
+ 'struct objc_super *' instead of 'Super_t'.
+
+2010-12-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/message.h: Update comments, reindented code and moved
+ deprecated types and functions at the end of the file. No code
+ changes.
+
+2010-12-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * ivars.c (class_addIvar): Use the 'size' argument instead of
+ trying to calculate it using objc_sizeof_type().
+ * objc/runtime.h (class_addIvar): Updated comments.
+
+2010-12-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * sendmsg.c: Reindented some code and tidied up comments. No
+ actual code changes.
+
+2010-12-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/Object.h: Moved all the methods, with the exception of
+ -class and -isEqual:, into ...
+ * objc/deprecated/Object.h: here.
+ * Object.m: Moved all the methods, with the exception of -class
+ and -isEqual: into the 'Deprecated' category.
+
+2010-12-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objects.c (object_copy): Do not #undef as we are no longer
+ including objc/objc-api.h.
+ * selector.c: Include objc/runtime.h and
+ objc-private/module-abi-8.h. Do not include objc/objc-api.h and
+ objc/encoding.h. Updated
+ (__objc_register_selectors_from_class): Use struct
+ objc_method_list * instead of MethodList_t.
+ (__objc_register_selectors_from_list): Use Method instead of
+ Method_t.
+ (struct objc_method_description_list): Do not define here.
+ (__objc_register_instance_methods_to_class): Use struct
+ objc_method_list * instead of MethodList_t and Method instead of
+ Method_t.
+
+2010-12-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * selector.c: Reindented some code and tidied up comments. No
+ actual code changes.
+
+2010-12-13 Iain Sandoe <iains@gcc.gnu.org>
+
+ * encoding.c (_darwin_rs6000_special_round_type_align): New.
+ (darwin_rs6000_special_round_type_align): Adjust to use new routine.
+
+2010-12-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * sendmsg.c (selector_resolveClassMethod): New.
+ (selector_resolveInstanceMethod): New.
+ (__objc_resolve_class_method): New.
+ (__objc_resolve_instance_method): New.
+ (get_imp): Call __objc_resolve_class_method or
+ __objc_resolve_instance_method at the appropriate time.
+ (objc_msg_lookup): Same.
+ (class_getClassMethod): Same.
+ (class_getInstanceMethod): Same.
+ (__objc_init_dispatch_tables): Initialize
+ selector_resolveClassMethod and selector_resolveInstanceMethod.
+ * objc/runtime.h: Updated documentation of class_getClassMethod,
+ class_getInstanceMethod and class_getMethodImplementation.
+
+2010-12-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/module-abi-8.h (struct objc_symtab): Updated
+ description of sel_ref_cnt and refs.
+ * objc/deprecated/struct_objc_symtab.h (objc_symtab): Same change.
+
+2010-12-06 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ PR target/40125
+ PR lto/46695
+ * configure.ac (extra_ldflags_libobjc): Invoke ACX_LT_HOST_FLAGS.
+ * Makefile.in (lt_host_flags): Import AC_SUBST'd value.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+2010-12-03 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac (VERSION): Bump the version to 3:0:0.
+ * configure: Regenerate.
+
+2010-11-23 Richard Frith-Macdonald <rfm@gnu.org>
+
+ * sendmsg.c (get_imp): Fixed call to __objc_get_forward_imp to
+ pass nil as the receiver since we don't know the receiver at this
+ point.
+
+2010-11-18 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * ivars.c: Include stdlib.h.
+ * protocols.c: Same change.
+
+2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (OBJC_SOURCE_FILES): Added accessors.m.
+ * accessors.m: New.
+ * init.c: Include objc-private/accessors.h.
+ (__objc_exec_class): Call __objc_accessors_init.
+ * objc-private/accessors.h: New.
+
+2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/message.h: Moved initial includes outside of extern "C".
+ * objc/runtime.h: Add extern "C" for Objective-C++.
+
+2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (objc_send_load): Do not wait for NXConstantString to be
+ registered before executing +load. There is no point if
+ -fconstant-string-class=xxx is used when compiling all modules,
+ as is the case for almost all users.
+ * linking.m (__objc_linking): Do not try to forcefully link in
+ NXConstantString.
+
+2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h: Updated comments.
+ (class_addMethod): New.
+ (class_addIvar): New.
+ (class_replaceMethod): New.
+ (objc_allocateClassPair): New.
+ (objc_registerClassPair): New.
+ (objc_disposeClassPair): New.
+ * class.c (objc_allocateClassPair): New.
+ (objc_registerClassPair): New.
+ (objc_disposeClassPair): New.
+ (class_getSuperclass): Return Nil if a class is in construction.
+ * init.c (__objc_exec_class): Call __objc_init_class.
+ (__objc_init_class): New.
+ * ivars.c (class_copyIvarList): Return NULL if class is in
+ construction. Do not lock the runtime mutex.
+ (class_getInstanceVariable): Return NULL if class is in
+ construction. Do not lock the runtime mutex.
+ (class_addIvar): New.
+ * sendmsg.c (class_addMethod): New.
+ (class_replaceMethod): New.
+ * objc-private/module-abi-8.h (__CLS_SETNOTINFO): New.
+ (_CLS_IN_CONSTRUCTION): New.
+ (CLS_IS_IN_CONSTRUCTION): New.
+ (CLS_SET_IN_CONSTRUCTION): New.
+ (CLS_SET_NOT_IN_CONSTRUCTION): New.
+ * objc-private/runtime.h (__objc_init_class): New.
+
+2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * class.c (class_getSuperclass): Call __objc_resolve_class_links
+ if the class is not resolved yet.
+ * ivars.c (class_getInstanceVariable): Use class_getSuperclass.
+
+2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_getIvarLayout): New.
+ (class_getWeakIvarLayout): New.
+ (class_setIvarLayout): New.
+ (class_setWeakIvarLayout): New.
+ * ivars.c (class_getIvarLayout): New.
+ (class_getWeakIvarLayout): New.
+ (class_setIvarLayout): New.
+ (class_setWeakIvarLayout): New.
+
+2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h (class_copyPropertyList): New.
+ (class_getProperty): New.
+ (property_getAttributes): New.
+ (property_getName): New.
+ * ivars.c (class_copyPropertyList): New.
+ (class_getProperty): New.
+ (property_getAttributes): New.
+ (property_getName): New.
+
+2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/runtime.h (__objc_update_classes_with_methods): New.
+ * class.c (__objc_update_classes_with_methods): New.
+ (objc_getClassList): Do not lock the class lock.
+ * methods.c (method_exchangeImplementations): New.
+ (method_setImplementation): New.
+ * objc/runtime.h (method_setImplementation): New.
+ (method_exchangeImplementations): New.
+
+2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Protocol.m: Include objc/runtime.h and
+ objc-private/module-abi-8.h instead of objc/objc-api.h. Do not
+ repeat Protocol's instance variables.
+ (struct objc_method_description_list): Do not define here.
+ ([-conformsTo:]): Reimplemented on top of protocol_conformsTo().
+ ([descriptionForInstanceMethod:]): Use sel_isEqual() to compare
+ selectors directly instead of getting names and then using strcmp.
+ ([descriptionForClassMethod:]): Same change.
+ ([-isEqual:]): Reimplemented on top of protocol_isEqual().
+ * protocols.c (protocol_getMethodDescription): Use sel_isEqual()
+ to compare selectors directly instead of getting names and then
+ using strcmp.
+ * objc/Protocol.h: Updated comments.
+
+2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * init.c (__objc_init_protocol): New function which fixes up a
+ protocol's class pointer, registers it with the runtime, register
+ all protocol selectors and registers associated protocols too.
+ (objc_init_statics): Detect if we are initializing protocols, and
+ if so, use __objc_init_protocol instead of only fixing up the
+ class pointer.
+ (__objc_init_protocls): Use __objc_init_protocol.
+ * objc-private/module-abi-8.h: Updated comments.
+ * objc-private/runtime.h
+ (__objc_register_selectors_from_description_list): New.
+ * selector.c (__objc_register_selectors_from_description_list):
+ New. (struct objc_method_description_list): Declare.
+ * Protocol.m ([-descriptionForInstanceMethod:]): Use sel_get_name
+ when accessing the name of a method, which is now correctly a SEL.
+ ([-descriptionForClassMethod:]): Same change.
+ * protocols.c (protocol_getMethodDescription): Same change.
+ * objc/runtime.h: Updated comments.
+ (sel_registerTypedName): Fixed typo in function name.
+
+2010-10-13 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR libobjc/23214
+ * init.c (objc_init_statics): Do not skip the initialization of a
+ statics list if the first object has already been initialized; in
+ the case of Protocols, while the first one may have been
+ initialized, some others may not have been initialized yet.
+
+2010-10-13 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (OBJC_DEPRECATED_H): Added
+ objc_get_uninstalled_dtable, objc_object_alloc.h and
+ struct_objc_static_instances.h.
+
+2010-10-13 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * encoding.c (method_copyReturnType): New.
+ (method_copyArgumentType): New.
+ (method_getReturnType): New.
+ (method_getArgumentType): New.
+ * methods.c (method_getDescription): New.
+ * objc/runtime.h (method_copyReturnType): New.
+ (method_copyArgumentType): New.
+ (method_getReturnType): New.
+ (method_getArgumentType): New.
+ (method_getDescription): New.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * encoding.c: Tidied up comments.
+ (objc_skip_variable_name): New static inline function.
+ (objc_sizeof_type): Use objc_skip_variable_name instead of copying
+ the same code over and over.
+ (objc_alignof_type): Same.
+ (objc_aligned_size): Same.
+ (objc_promoted_size): Same.
+ (objc_skip_typespec): Same.
+ (objc_layout_structure_next_member): Same.
+ (objc_skip_offset): Skip a '-' before the digits (if any). Fixed
+ historical bug where objc_skip_offset would skip one byte even if
+ there is no offset: check that the first offset digit is actually
+ a digit before skipping it.
+ (objc_skip_type_qualifiers): Mark as inline.
+ (objc_skip_typespec): Mark as inline.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (C_SOURCE_FILES): Added methods.c.
+ * encoding.c (method_getNumberOfArguments): New.
+ (method_get_number_of_arguments): Call
+ method_getNumberOfArguments.
+ * ivars.c (ivar_getName): Check for NULL variable argument.
+ (ivar_getOffset): Check for NULL variable argument.
+ (ivar_getTypeEncoding): Check for NULL variable argument.
+ (class_copyIvarList): New.
+ * methods.c: New.
+ * protocols.c (class_copyProtocolList): Check for Nil class_
+ argument.
+ * sendmsg.c: Use 'struct objc_method *' instead of Method_t, and
+ 'struct objc_method_list *' instead of MethodList_t.
+ (class_getMethodImplementation): New.
+ (class_respondsToSelector): New.
+ (class_getInstanceMethod): New.
+ (class_getClassMethod): New.
+ * objc/runtime.h: Updated comments.
+ (class_copyIvarList): New.
+ (class_getInstanceMethod): New.
+ (class_getClassMethod): New.
+ (class_getMethodImplementation): New.
+ (class_respondsToSelector): New.
+ (method_getName): New.
+ (method_getImplementation): New.
+ (method_getTypeEncoding): New.
+ (class_copyMethodList): New.
+ (method_getNumberOfArguments): New.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * class.c: Include objc/runtime.h and objc-private/module-abi-8.h
+ instead of objc/objc-api.h.
+ (objc_get_unknown_class_handler): Do not define.
+ (class_isMetaClass): New.
+ (class_getSuperclass): New.
+ (class_getVersion): New.
+ (class_setVersion): New.
+ (class_getInstanceSize): New.
+ * exceptions.c: Include objc/runtime.h instead of objc/objc-api.h.
+ (is_kind_of_exception_matcher): Use objc_getSuperclass instead of
+ objc_get_super_class.
+ (get_ttype_entry): Use objc_getRequiredClass instead of
+ objc_get_class.
+ * ivars.c (class_getClassVariable): New.
+ * objects.c: Include objc/runtime.h, objc/thr.h and
+ objc-private/module-abi-8.h instead of objc/objc-api.h
+ * objc/runtime.h (class_getClassVariable): New.
+ (class_isMetaClass): New.
+ (class_getSuperclass): New.
+ (class_getVersion): New.
+ (class_setVersion): New.
+ (class_getInstanceSize): New.
+ * objc-private/module-abi-8.h (HOST_BITS_PER_LONG): New (from
+ objc/objc-api.h)
+ (__CLS_INFO): Same.
+ (__CLS_ISINFO): Same.
+ (__CLS_SETINFO): Same.
+ (CLS_ISMETA): Same.
+ (CLS_ISCLASS): Same.
+ (CLS_ISRESOLV): Same.
+ (CLS_SETRESOLV): Same.
+ (CLS_ISINITIALIZED): Same.
+ (CLS_SETINITIALIZED): Same.
+ (CLS_GETNUMBER): Same.
+ (CLS_SETNUMBER): Same.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * archive.c: Do not include objc/objc.h.
+ * class.c: Do not include objc/objc.h.
+ * encoding.c: Include objc/runtime.h, ctype.h and
+ objc-private/module-abi-8.h instead of objc/objc-api.h and
+ objc/encoding.h.
+ * error.c: Do not include objc/objc.h.
+ * gc.c: Include tconfig.h and objc/encoding.h only if
+ OBJC_WITH_GC.
+ * hash.c: Include objc/runtime.h and objc/thr.h instead of
+ objc/objc-api.h. Do not include objc/objc.h.
+ * init.c: Do not include objc/objc.h.
+ * ivars.c: Include objc/runtime.h, objc-private/module-abi-8.h and
+ objc/thr.h instead of objc/objc-api.h. Do not include
+ objc/objc.h.
+ * linking.m: Tidied comment.
+ * memory.c: Include objc/runtime.h instead of objc/objc-api.h.
+ Do not include objc/objc.h.
+ * objects.c: Do not include objc/objc.h.
+ * objc-sync.c: Include objc/runtime.h instead of objc/objc-api.h.
+ * protocols.c: Do not include objc/objc.h.
+ * sarray.c: Include objc/runtime.h instead of objc/objc-api.h. Do
+ not include objc/objc.h.
+ * selector.c: Do not include objc/objc.h.
+ * sendmsg.c: Do not include objc/objc.h.
+ * thr.c: Include objc/runtime.h instead of objc/objc-api.h.
+ Do not include objc/objc.h.
+ * objc/objc-decls.h: Reindented code.
+ * objc/runtime.h Include objc-decls.h. Updated comments.
+ (objc_malloc): New.
+ (objc_atomic_malloc): New.
+ (objc_calloc): New.
+ (objc_realloc): New.
+ (objc_free): New.
+ * objc-private/runtime.h: Updated comments.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (C_SOURCE_FILES): Added protocols.c.
+ * objc-private/protocols.h: New.
+ * protocols.c: New.
+ * init.c: Include objc-private/protocols.h.
+ (__objc_exec_class): Call __objc_protocols_init on startup.
+ (__objc_init_protocols): Call __objc_protocols_add_protocol.
+ * objc-private/runtime.h: Use (struct objc_method_list *) instead
+ of MethodList_t, and (struct objc_method *) instead of Method_t.
+ * objc/deprecated/struct_objc_class.h: Define
+ __objc_STRUCT_OBJC_CLASS_defined.
+ * objc-private/module-abi-8.h (struct
+ objc_method_description_list): New.
+ (struct objc_class): Only define if
+ __objc_STRUCT_OBJC_CLASS_defined is undefined.
+ * objc/runtime.h (class_getName): New.
+ (objc_getProtocol): New.
+ (objc_copyProtocolList): New.
+ (class_addProtocol): New.
+ (class_conformsToProtocol): New.
+ (class_copyProtocolList): New.
+ (protocol_conformsToProtocol): New.
+ (protocol_isEqual): New.
+ (protocol_getName): New.
+ (protocol_getMethodDescription): New.
+ (protocol_copyMethodDescriptionList): New.
+ (protocol_getProperty): New.
+ (protocol_copyPropertyList): New.
+ (protocol_copyProtocolList): New.
+ * class.c (class_getName): New.
+ * selector.c (sel_isEqual): New.
+
+2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * selector.c (sel_getName): Return "<null selector>" for a NULL
+ argument.
+ (sel_get_name): Return 0 for a NULL argument.
+ * objc/runtime.h (sel_getName): Updated documentation.
+
+ * objc-private/hash.h (class_hash_table): Unused declaration
+ removed.
+ (module_hash_table): Same.
+ * objc/deprecated/hash.h: Same changes.
+
+2010-10-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * class.c (objc_getClassList): New.
+ (objc_getRequiredClass): New.
+ (objc_getMetaClass): New.
+ (objc_lookupClass): New.
+ (objc_getClass): New.
+ (__objc_get_unknown_class_handler): New.
+ (objc_setGetUnknownClassHandler): New.
+ (objc_get_class): Use __objc_get_unknown_class_handler.
+ (objc_lookup_class): Call objc_getClass.
+ * objc/objc-api.h: Updated comment and copyright notice.
+ * objc/runtime.h: Updated comments.
+ (objc_getClass): New.
+ (objc_lookupClass): New.
+ (objc_getMetaClass): New.
+ (objc_getRequiredClass): New.
+ (objc_getClassList): New.
+ (objc_setGetUnknownClassHandler): New.
+ (objc_get_unknown_class_handler): New.
+ * objc-private/runtime.h: Use __objc_private_runtime_INCLUDE_GNU
+ instead of __objc_runtime_INCLUDE_GNU as include guard.
+ * objc-private/error.h (_objc_abort): Mark as noreturn.
+
+2010-10-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (C_SOURCE_FILES): Added ivars.c.
+ * ivars.c: New.
+ * objc/objc.h: Updated comments.
+ * objc/runtime.h (object_getClass): New.
+ (object_getClassName): New.
+ (object_setClass): New.
+ (class_getInstanceVariable): New.
+ (object_getIndexedIvars): New.
+ (object_getInstanceVariable): New.
+ (object_setInstanceVariable): New.
+ (object_getIvar): New.
+ (object_setIvar): New.
+ (ivar_getName): New.
+ (ivar_getOffset): New.
+ (ivar_getTypeEncoding): New.
+ * objc-private/module-abi-8.h (struct objc_class): Added.
+ * objects.c (object_getClassName): New.
+ (object_setClass): New.
+
+2010-10-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc.h: Updated comments.
+ * objc/objc-api.h: (object_copy): Added one argument; use a
+ #define to maintain backwards-compatibility. Moved
+ _objc_object_alloc, _objc_object_copy, _objc_object_dispose and
+ objc_get_uninstalled_dtable into
+ objc/deprecated/objc_get_uninstalled_dtable.h and
+ objc/deprecated/objc_object_alloc.h. Include these files.
+ * objc/deprecated/objc_get_uninstalled_dtable.h: New.
+ * objc/deprecated/objc_object_alloc.h: New.
+ * objc/runtime.h (set_getName): New.
+ (sel_getType): New.
+ (sel_getUid): New.
+ (sel_registerName): New.
+ (sel_registerTypedName): New.
+ (sel_isEqual): New.
+ (class_createInstance): New.
+ (object_copy): New.
+ (object_dispose): New.
+ * objects.c: Do not include tconfig.h. Include gc_typed.h if
+ building the garbage collection version.
+ (__objc_object_alloc): Removed.
+ (__objc_object_copy): Removed.
+ (__objc_object_dispose): Removed.
+ (class_createInstance): New from code in class_create_instance.
+ Cast second argument of GC_malloc_explicitly_typed. Use
+ objc_calloc. Do not call _objc_object_alloc.
+ (class_create_instance): Call class_createInstance.
+ (object_copy): Added extraBytes argument. Do not call
+ _objc_object_copy.
+ (object_dispose): Do not call _objc_object_dispose.
+ * memory.c (objc_free): When using garbage collection, mark the
+ argument as unused.
+ * selector.c (sel_getName): New.
+ (sel_get_name): Call sel_getName.
+ (sel_getType): New.
+ (sel_get_type): Call sel_getType.
+ (sel_registerName): New.
+ (sel_register_name): Call sel_registerName.
+ (sel_registerTypedName): New.
+ (sel_register_typed_name): Call sel_registerTypedName.
+ (sel_getUid): New.
+ (sel_get_uid): Call sel_getUid.
+
+2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-api.h: Define Method, Method_t, Category and
+ Category_t. Prevent including this file at the same time as
+ objc/runtime.h. Updated comments.
+ * objc/deprecated/struct_objc_method.h: Do not define Method,
+ Method_t.
+ * objc/deprecated/struct_objc_category.h: Do not define Category,
+ Category_t.
+ * objc-private/module-abi-8.h: New file containing a copy of all
+ the structure definitions. Not used yet.
+ * objc/encoding.h (objc_aligned_size): Removed duplicate
+ declaration. Updated comments.
+ * objc/runtime.h: Added Ivar, objc_property_t, Property, Method,
+ Category, struct objc_method_description, _C_ID and similar,
+ _C_CONST and similar and _F_CONST and similar. Added
+ objc_sizeof_type, objc_alignof_type, objc_aligned_size,
+ objc_promoted_size, objc_skip_type_qualifier, objc_skip_typespec,
+ objc_skip_offset, objc_skip_argspec, objc_get_type_qualifiers,
+ struct objc_struct_layout, objc_layout_structure,
+ objc_layout_structure_next_member, objc_layout_finish_structure,
+ objc_layout_structure_get_info. Prevent including this file at
+ the same time as objc/objc-api.h.
+
+2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (OBJC_DEPRECATED_H): Added struct_objc_category.h,
+ struct_objc_ivar.h, struct_objc_ivar_list.h, struct_objc_method.h,
+ struct_objc_method_list.h, struct_objc_module.h,
+ struct_objc_protocol_list.h, struct_objc_symtab.h.
+ * objc/deprecated/struct_objc_category.h: New.
+ * objc/deprecated/struct_objc_ivar.h: New.
+ * objc/deprecated/struct_objc_ivar_list.h: New.
+ * objc/deprecated/struct_objc_method.h: New.
+ * objc/deprecated/struct_objc_method_list.h: New.
+ * objc/deprecated/struct_objc_module.h: New.
+ * objc/deprecated/struct_objc_protocol_list.h: New.
+ * objc/deprecated/struct_objc_symtab.h: New.
+ * objc/deprecated/struct_objc_static_instances.h: New.
+ * objc/objc-api.h: Definitions of deprecated structures moved into
+ the above header fragment files in objc/deprecated/. Include the
+ files instead of definition the structures here. Updated
+ comments.
+ * objc/runtime.h: Updated comments. Do not include objc-api.h.
+ (objc_set_enumeration_mutation_handler): Renamed to
+ objc_setEnumerationMutationHandler.
+ * objc-foreach.c (objc_set_enumeration_mutation_handler): Renamed
+ to objc_setEnumerationMutationHandler.
+ * objc/objc-exception.h (objc_set_exception_matcher): Renamed to
+ objc_setExceptionMatcher.
+ (objc_set_uncaught_exception_handler): Renamed to
+ objc_setUncaughtExceptionHandler.
+ * exception.c: Same changes.
+
+2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-sync.c: Include objc-private/common.h.
+
+2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-foreach.c: Include objc-private/common.h.
+ * objc/deprecated/METHOD_NULL.h: New file.
+ * objc/objc-api.h: Include deprecated/METHOD_NULL.h instead of
+ defining METHOD_NULL here.
+ * Makefile.in (OBJC_DEPRECATED_H): Added METHOD_NULL.h.
+ * Object.m ([+instancesRespondTo:]): Use (Method_t)0 instead of
+ METHOD_NULL.
+ ([-respondsTo:]): Same change.
+ * objc/objc-api.h (method_get_imp): Converted it into a normal
+ function so that we can hide the internals of struct objc_method.
+ * sendmsg.c (method_get_imp): Implemented.
+
+2010-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-api.h (struct objc_super, Super, Super_t,
+ objc_msg_lookup_super, objc_msg_sendv, objc_msg_forward,
+ objc_msg_forward2): Declarations moved to objc/message.h. Include
+ message.h here.
+ * objc/message.h: Added such declarations; updated comments.
+
+2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Implemented fast enumeration for Objective-C.
+ * Makefile.in (C_SOURCE_FILES): Added objc-foreach.c.
+ (OBJC_H): Added runtime.h
+ * objc-foreach.c: New file.
+ * objc/runtime.h: New file.
+
+2010-09-30 Kai Tietz <kai.tietz@onevision.com>
+
+ * objc/deprecated/struct_objc_class.h: Add padding
+ to avoid warning with -Wpadded.
+
+2010-09-26 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * encoding.c (objc_sizeof_type): Added support for vector type and
+ for double long types.
+ (objc_alignof_type): Same change.
+ (objc_skip_typespec): Same change.
+ * objc/encoding.h (_C_GCINVISIBLE): Use '|' for _C_GCINVISIBLE
+ instead of '!' since '!' is already used for _C_VECTOR.
+ * objc/objc-api.h (_C_LNG_DBL): Added.
+
+2010-09-26 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * libobjc_entry.c: File removed.
+
+2010-09-26 Kai Tietz <kai.tietz@onevision.com>
+
+ * sendmsg.c (objc_msg_lookup): Remove inline.
+ (objc_get_uninstalled_dtable): Likewise.
+ * encoding.c (objc_skip_type_qualifiers): Likewise.
+ (objc_skip_offset): Likewise.
+ * archive.c (__objc_write_object): Likewise
+ (__objc_write_class):
+ (__objc_write_selector):
+ (objc_read_char):
+ (objc_read_unsigned_char):
+ (objc_read_short):
+ (objc_read_unsigned_short):
+ (objc_read_int):
+ (objc_read_long):
+ (__objc_read_nbyte_uint):
+ (objc_read_unsigned_int):
+ (objc_read_unsigned_long):
+ * objc/objc-decls.h (obc_EXPORT): Remove dllexport for DLL_EXPORT case.
+ (objc_EXPORT): Likewise.
+ * objc/message.h (objc-decls.h): Add include.
+ * objc/objc-api.h: Mark API by objc_EXPORT.
+ * libobjc.def (__objc_responds_to): Removed.
+
+2010-09-18 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * hash.c: Include objc-private/hash.h instead of objc/hash.h.
+
+ * objc/sarray.h: Moved into objc/deprecated/sarray.h;
+ objc/sarray.h replaced with a placeholder including the file from
+ the deprecated/ directory.
+ * objc-private/sarray.h: New file (private copy of sarray.h).
+ * hash.c: Include <assert.h> instead of "assert.h"
+ * sarray.c: Include <assert.h> instead of "assert.h". Include
+ objc-private/sarray.h instead of objc/sarray.h.
+ * selector.c: Include objc-private/sarray.h instead of
+ objc/sarray.h.
+ * sendmsg.c: Include <assert.h>. Include objc-private/sarray.h
+ instead of objc/sarray.h.
+ * Makefile.in (OBJC_DEPRECATED_H): Added sarray.h.
+
+2010-09-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-private/objc-list.h (list_remove_elem): Unused function
+ removed. (list_nth): Unused function removed. (list_find):
+ Unused function removed. (list_lenght): Unused function removed.
+
+2010-09-17 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/hash.h: Moved into objc/deprecated/hash.h; objc/hash.h
+ replaced with a placeholder including the file from the
+ deprecated/ directory.
+ * objc/objc-api.h: Updated includes.
+ * objc/typedstream.h: Updated includes.
+ * objc-private/hash.h: New file (private copy of hash.h).
+ * objc/objc-list.h: Moved into objc/deprecated/objc-list.h;
+ objc/objc-list.h replaced with a placeholder including the file
+ from the deprecated/ directory.
+ * objc-private/objc-list.h: New file (private copy of objc-list.h).
+ * init.c: Include objc-private/hash.h and objc-private/objc-list.h
+ instead of objc/hash.h and objc/objc-list.h.
+ * selector.c: Same change.
+ * class.c: Added include <string.h>, which used to be implicitly included
+ when hash.h was included.
+ * exception.c: Same change.
+ * objects.c: Same change.
+ * sarray.c: Same change.
+ * sendmsg.c: Same change.
+ * Makefile.in (OBJC_DEPRECATED_H): Added hash.h and objc-list.h.
+
+2010-09-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Implemented objc_sync_enter() and objc_sync_exit(), which are
+ required by @synchronized() to work.
+ * objc-sync.c: New file.
+ * objc/objc-sync.h: New file.
+ * objc-private/objc-sync.h: New file.
+ * init.c (__objc_exec_class): Call __objc_sync_init() during the
+ Objective-C runtime startup.
+ * Makefile.in: Added objc-sync.c and objc-sync.h.
+ * configure.ac: Added GCC_CHECK_TLS.
+ * acinclude.m4: Include ../config/enable.m4 and ../config/tls.m4.
+ * configure: Regenerated.
+ * config.h.in: Regenerated.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Makefile.in (%_gc.lo): New pattern rules to build the
+ garbage-collected version of the library. Removed rules for
+ specific files that are no longer needed. Standardized all rules.
+ (C_SOURCE_FILES, OBJC_SOURCE_FILES): New variables.
+ (OBJS, OBJS_GC): Compute these from C_SOURCE_FILES and
+ OBJC_SOURCE_FILES.
+ (INCLUDES): Removed the unused include -I$(srcdir)/objc.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * memory.c (objc_calloc): Fixed call to GC_malloc when building
+ with Garbage Colletion.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * memory.c: Do not include objc-private/runtime.h.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/deprecated/objc_malloc.h: New file.
+ * objc/deprecated/objc_valloc.h: New file.
+ * objc/objc-api.h: Include the files instead of defining
+ objc_valloc, _objc_malloc() and similar.
+ * Makefile.in (OBJC_DEPRECATED_H): Added objc_valloc.h and
+ objc_malloc.h.
+ * memory.c: Removed the extra layer of indirection of _objc_malloc
+ and similar.
+ (objc_calloc): Use GC_malloc in the garbage-collected
+ implementation as GC_malloc returns memory that is already freed.
+ (objc_valloc): Deprecated.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/deprecated/objc_error.h: New file.
+ * objc/objc-api.h: Include deprecated/objc_error.h instead of
+ defining objc_error and related.
+ * error.c: New file. Added _objc_abort function which replaces
+ objc_error. No change in functionality as they both print an
+ error and abort.
+ * misc.c: File removed. Code moved into memory.c and error.c.
+ * memory.c: New file.
+ * objc-private/error.h: New file.
+ * archive.c: Include objc-private/error.h and use _objc_abort
+ instead of objc_error everywhere.
+ * class.c: Same change.
+ * encoding.c: Same change.
+ * init.c: Same change, and simplified init_check_module_version.
+ * memory.c: Same change.
+ * sendmsg.c: Same change.
+ * thr.c: Same change.
+ * Makefile.in (OBJ_DEPRECATED_H): Added objc_error.h.
+ (OBJ_H): Reordered list.
+ (OBJS): Removed misc.lo, added memory.lo and error.lo.
+ (OBJS_GC): Removed misc_gc.lo, added memory_gc.lo and error_gc.lo.
+ (misc_gc.lo): Rule removed.
+ (error_gc.lo): Rule added.
+ (memory_gc.lo): Rule added.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc.h (__GNU_LIBOBJC__): New #define providing an easy way
+ to check the API version. Added some comments.
+
+ * objc-private/common.h: New file.
+ * NXConstStr.m: Include objc-private/common.h.
+ * Object.m: Same change.
+ * Protocol.m: Same change.
+ * archive.c: Same change.
+ * class.c: Same change.
+ * encoding.c: Same change.
+ * exception.c: Same change.
+ * gc.c: Same change.
+ * hash.c: Same change.
+ * init.c: Same change.
+ * libobjc_entry.c: Same change.
+ * linking.m: Same change.
+ * misc.c: Same change (and added a comment).
+ * nil_method.c: Same change.
+ * objects.c: Same change.
+ * sarray.c: Same change.
+ * selector.c: Same change.
+ * sendmsg.c: Same change.
+ * thr.c: Same change.
+
+2010-09-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-api.h: Removed obsolete #ifdef for NeXTSTEP.
+
+2010-09-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * archive.c: Removed not needed includes.
+ * class.c: Same change.
+ * hash.c: Same change.
+ * misc.c: Same change.
+ * nil_method.c: Same change.
+ * objects.c: Same change.
+ * sarray.c: Same change.
+ * sendmsg.c: Same change.
+ * thr.c: Same change.
+
+2010-09-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/runtime.h: Moved to objc-private/runtime.h. Do not include
+ all the objc/*.h files.
+ * objc-private/runtime.h: New file.
+ * archive.c: Include objc-private/runtime.h (and required objc/*.h
+ files) instead of objc/runtime.h.
+ * class.c: Same change.
+ * hash.c: Same change.
+ * init.c: Same change.
+ * misc.c: Same change.
+ * nil_method.c: Same change.
+ * objects.c: Same change.
+ * sarray.c: Same change.
+ * selector.c: Same change.
+ * sendmsg.c: Same change.
+ * thr.c: Same change.
+
+2010-09-11 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/deprecated/struct_objc_selector.h: New file. Definition of
+ 'struct objc_selector' and 'sel_eq' moved here.
+ * objc/deprecated/struct_objc_protocol.h: New file. Definition of
+ 'struct objc_procotol' moved here.
+ * objc/deprecated/struct_objc_class.h: New file. Definition of
+ 'struct objc_class' moved here.
+ * objc/deprecated/MetaClass.h: New file. Definition of MetClass
+ moved here.
+ * objc/deprecated/STR.h: New file. Definition of STR moved here.
+ * objc/message.h: New file. Definitions for relval_t, apply_t,
+ arglist, arglist_t and objc_msg_lookup were moved here.
+ * objc/objc.h: Include the above files instead of defining the
+ corresponding structs, types and functions here. Added new opaque
+ definitions for SEL and Class. Use Class and not 'struct
+ objc_class *' in the definition of 'struct objc_object'.
+ Commented all types defined in the file. Removed special
+ definition of BOOL as 'int' on __vxworks; use 'unsigned char'
+ there as well.
+ * objc/deprecated/objc-unexpected-exception.h: Renamed to
+ objc_unexpected_exception.h.
+ * objc/objc-api.h: Updated include of
+ objc-unexpetected-exception.h
+ * objc/objc-exception.h: Updated comments.
+ * Makefile.in (OBJC_H, OBJC_DEPRECATED_H): Added the new header
+ files. Reindented list of files.
+
+2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-api.h (objc_trace): Unused variable removed.
+
+2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/deprecated: New directory.
+ * objc/deprecated/README: New file.
+ * objc/README: New file.
+ * objc/typedstream.h: Moved into objc/deprecated/typedstream.h;
+ objc/typedstream.h replaced with a placeholder including the file
+ from the deprecated/ directory.
+ * objc/deprecated/objc-unexpected-exception.h: New file with the
+ definition of _objc_unexpected_exception.
+ * objc/objc-api.h: Include deprecated/objc-unexcepted-exception.h
+ instead of defining _objc_unexpected_exception.
+ * objc/deprecated/Object.h: New file with the deprecated Object
+ methods in a 'Deprecated' category.
+ * objc/Object.h Include deprecated/Object.h instead of defining
+ the deprecated methods.
+ * Object.m: Moved deprecated methods into 'Deprecated' category.
+ * objc-private: New directory.
+ * objc-private/README: New file.
+ * Makefile.in (OBJC_DEPRECATED_H): New variable.
+ (install-headers): Create installation directory for
+ OBJC_DEPRECATED_H headers, and install them.
+
+2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-exception.h: Fixed include of objc.h.
+
+2010-09-08 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/objc-exception.h: New file.
+ * exception.c (objc_set_uncaught_exception_handler): Implemented.
+ (objc_set_exception_matcher): Implemented.
+ (objc_exception_throw): Use the uncaught exception handler if set.
+ (PERSONALITY_FUNCTION): Use the exception matcher instead of the
+ hardcoded isKindOf.
+ (isKindOf): Renamed to is_kind_of_exception_matcher. Tidied code
+ up. Removed segmentation fault when value is 'nil'.
+ * objc/objc-api.h (_objc_unexpected_exception): Mark as
+ deprecated.
+ * Makefile.in (exception.lo, exception_gc.lo): Use
+ -Wno-deprecated-declarations when compiling.
+ (OBJC_H): Added objc-exception.h
+
+2010-09-08 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc/typedstream.h: Deprecate all functions in the file. This
+ file is obsolete.
+ * objc/Object.h ([+streamVersion:], [-read:], [-write:],
+ [-awake]): Documented that these methods are deprecated. Added a
+ brief description of the Object class and its relationship to the
+ NSObject class.
+ * Makefile.in: Compile archive.c and Object.m with
+ -Wno-deprecated-declarations.
+
+2010-09-08 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Removed obsolete intermediate threading layer.
+ * thr.c: Use __gthread_objc_xxx functions directly instead of
+ __objc_thread_xxx ones.
+ * objc/thr.h: Removed prototypes of no longer existing
+ __objc_thread_xxx functions.
+ * Makefile.in: Removed thr-objc.lo.
+ * thr-dce.c: File removed.
+ * thr-decosf1.c: File removed.
+ * thr-irix.c: File removed.
+ * thr-mach.c: File removed.
+ * thr-objc.c: File removed.
+ * thr-os2.c: File removed.
+ * thr-posix.c: File removed.
+ * thr-pthreads.c: File removed.
+ * thr-rtems.c: File removed.
+ * thr-single.c: File removed.
+ * thr-solaris.c: File removed.
+ * thr-vxworks.c: File removed.
+ * thr-win32.c: File removed.
+ * README.threads: File removed.
+ * THREADS.MACH: File removed.
+ * THREADS: Updated.
+
+2010-09-07 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * Object.m (MAX_CLASS_NAME_LEN): Unused define removed.
+
+2010-09-06 Iain Sandoe <iains@gcc.gnu.org>
+
+ * encoding.c: Add TARGET_ALIGN_NATURAL definition for m64 powerpc darwin.
+ Add a comment as to why, update FIXME comments.
+
+2010-09-06 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * makefile.dos: Obsolete file removed.
+
+2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * aclocal.m4: Regenerate.
+
+2010-03-23 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ PR libobjc/30445
+ * configure.ac (extra_ldflags_libobjc): Define appropriately for
+ Cygwin and MinGW hosts.
+ * Makefile.am (libobjc_s.a): Remove dead pre-libtool target.
+ (libobjc.dll): Likewise.
+ * configure: Regenerate.
+
+2009-12-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2009-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ * sarray.c (sarray_free): Use old_buckets variable.
+ * encoding.c (objc_layout_structure_next_member): Remove unused
+ bfld_type_size variable.
+
+2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (AC_PREREQ): Bump to 2.64.
+
+2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+
+2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (LIBTOOL): Add $(LIBTOOLFLAGS).
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, ACLOCAL, ACLOCAL_AMFLAGS, aclocal_deps):
+ New variables.
+ ($(srcdir)/configure, $(srcdir)/aclocal.m4): New rules.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
+2009-04-09 Nick Clifton <nickc@redhat.com>
+
+ * sendmsg.c: Change copyright header to refer to version 3 of
+ the GNU General Public License with version 3.1 of the GCC
+ Runtime Library Exception and to point readers at the COPYING3
+ and COPYING3.RUNTIME files and the FSF's license web page.
+ * NXConstStr.m: Likewise.
+ * Object.m: Likewise.
+ * Protocol.m: Likewise.
+ * archive.c: Likewise.
+ * class.c: Likewise.
+ * encoding.c: Likewise.
+ * exception.c: Likewise.
+ * gc.c: Likewise.
+ * hash.c: Likewise.
+ * init.c: Likewise.
+ * libobjc_entry.c: Likewise.
+ * linking.m: Likewise.
+ * misc.c: Likewise.
+ * nil_method.c: Likewise.
+ * objc/NXConstStr.h: Likewise.
+ * objc/Object.h: Likewise.
+ * objc/Protocol.h: Likewise.
+ * objc/encoding.h: Likewise.
+ * objc/hash.h: Likewise.
+ * objc/objc-api.h: Likewise.
+ * objc/objc-decls.h: Likewise.
+ * objc/objc-list.h: Likewise.
+ * objc/objc.h: Likewise.
+ * objc/runtime.h: Likewise.
+ * objc/sarray.h: Likewise.
+ * objc/thr.h: Likewise.
+ * objc/typedstream.h: Likewise.
+ * objects.c: Likewise.
+ * sarray.c: Likewise.
+ * selector.c: Likewise.
+ * thr-dce.c: Likewise.
+ * thr-decosf1.c: Likewise.
+ * thr-irix.c: Likewise.
+ * thr-mach.c: Likewise.
+ * thr-objc.c: Likewise.
+ * thr-os2.c: Likewise.
+ * thr-posix.c: Likewise.
+ * thr-pthreads.c: Likewise.
+ * thr-rtems.c: Likewise.
+ * thr-single.c: Likewise.
+ * thr-solaris.c: Likewise.
+ * thr-vxworks.c: Likewise.
+ * thr-win32.c: Likewise.
+ * thr.c: Likewise.
+ * libobjc.def: Change copyright header to refer to version 3 of
+ the GNU General Public License and to point readers at the COPYING3
+ file and the FSF's license web page.
+ * makefile.dos: Likewise.
+
+2009-04-09 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.in: Change copyright header to refer to version
+ 3 of the GNU General Public License and to point readers at the
+ COPYING3 file and the FSF's license web page.
+ * configure.ac: Likewise.
+
+2009-03-12 Richard Frith-Macdonald <rfm@gnu.org>
+ David Ayers <ayers@fsfe.org>
+
+ PR libobjc/27466
+ * objc/objc-api.h (_objc_unexpected_exception): Declare
+ new hook. Update copyright dates.
+ * exception.c (objc_exception_throw): Use hook. Update
+ copyright dates.
+ * libobjc.def (_objc_unexpected_exception): Export hook.
+ Update copyright dates.
+
+2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2008-12-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2008-11-21 Kai Tietz <kai.tietz@onevision.com>
+
+ * Object.m (errno): Replaced by errno.h include.
+ (compare): Cast self to id to prevent warning on comparison.
+ * objc/objc.h (BOOL): Prevent redeclaration of BOOL, if it is
+ already there.
+ * sendmsg.c (__objc_print_dtable_stats): Remove type warnings.
+ * thr-win32.c (__objc_thread_detach): Remove type warning.
+ (__objc_thread_id): Likewise.
+ * thr.c (__objc_thread_detach_functiont): Add __builtin_trap ()
+ for noreturn.
+
+2008-09-26 Peter O'Gorman <pogma@thewrittenword.com>
+ Steve Ellcey <sje@cup.hp.com>
+
+ * configure: Regenerate for new libtool.
+ * config.h.in: Regenerate for new libtool.
+
+2008-07-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.in: Ignore missing ../boehm-gc/threads.mk.
+
+2008-07-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.in: Include ../boehm-gc/threads.mk.
+ (OBJC_BOEHM_GC_LIBS): Define, (libobjc_gc$(libsuffix).la): Use it.
+
+2008-07-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (install-info): New stub target.
+
+2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure: Regenerate.
+
+2008-06-14 Kai Tietz <kai.tietz@onevision.com>
+
+ * exception.c (PERSONALITY_FUNCTION): Remove extra decrement
+ if HAVE_GETIPINFO is not defined.
+
+2008-06-10 Kai Tietz <kai.tietz@onevision.com>
+
+ * Object.m (compare): Add type id.
+ * objc/Object.h: Likewise.
+ * archive.c (objc_read_class): Use size_t to extend version to be
+ size of pointer scalar width.
+ * sendmsg.c (rtx): Undefine it before redefinition.
+ (__objc_print_dtable_stats): Cast arguments to long as intended.
+
+2008-05-30 Julian Brown <julian@codesourcery.com>
+
+ * exception.c (__objc_exception_class): Initialise as constant
+ array for ARM EABI. Change macro to static const for non-ARM EABI.
+ (ObjcException): Add note about structure layout. Remove landingPad
+ and handlerSwitchValue for ARM EABI.
+ (get_ttype_entry): Add __ARM_EABI_UNWINDER__ version
+ of function.
+ (CONTINUE_UNWINDING): Define for ARM EABI/otherwise cases.
+ (PERSONALITY_FUNCTION): Use ARM EABI-specific arguments, and add
+ ARM EABI unwinding support.
+ (objc_exception_throw): Use memcpy to initialise exception class.
+
+2008-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * encoding.c (strip_array_types): Rename from get_inner_array_type.
+ (rs6000_special_round_type_align): Update.
+
+2008-05-09 Julian Brown <julian@codesourcery.com>
+
+ * Makefile.in (LTLDFLAGS): New.
+ (libobjc$(libsuffix).la, libobjc_gc$(libsuffix).la): Use above.
+
+2008-04-18 Paolo Bonzini <bonzini@gnu.org>
+
+ PR bootstrap/35457
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+2008-01-24 David Edelsohn <edelsohn@gnu.org>
+
+ * configure: Regenerate.
+
+2007-10-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure.ac: Don't run config-ml.in directly.
+ (multilib_arg): New.
+ * configure: Regenerated.
+
+2007-08-06 Andrew Pinski <pinskia@gmail.com>
+
+ PR libobjc/30731
+ * exception.c (parse_lsda_header): Use _uleb128_t/_sleb128_t instead
+ of _Unwind_Word for variables which are used in
+ read_uleb128/read_sleb128.
+ (PERSONALITY_FUNCTION): Likewise.
+
+2007-07-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * aclocal.m4: Regenerated.
+
+2007-06-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * configure.ac: Fix a typo in *-*-darwin clause.
+ * configure: Regenerated.
+
+2007-06-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure.ac: Fix a typo.
+ * configure: Regenerated.
+
+2007-06-02 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure: Regenerate.
+
+2007-06-01 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * Makefile.in: Replace all uses of libext with libsuffix.
+ * configure.ac: Likewise.
+ * configure: Regenerate.
+
+ Revert:
+ * Makefile.in: Remove all uses of $(libext).
+
+2007-05-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * Makefile.in: Remove all uses of $(libext).
+
+2007-05-23 Steve Ellcey <sje@cup.hp.com>
+
+ * configure: Regenerate.
+ * aclocal.m4: Regenerate.
+
+2007-04-21 Andrew Ruder <andy@aeruder.net>
+
+ * sendmsg.c (__objc_get_forward_imp): Call
+ __objc_msg_forward2 for real.
+
+2007-04-09 Andrew Ruder <andy@aeruder.net>
+
+ * sendmsg.c: Added __objc_msg_forward2, a hook that allows
+ external libraries to provide a function that returns the real
+ forwarding function based on both the selector and the receiver.
+ * objc/objc-api.h: Define __objc_msg_forward2.
+
+2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
+
+ * Makefile.in: Add dummy install-pdf target.
+
+2007-02-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * objc/objc-list.h (list_free): Add keyword 'inline' to avoid
+ unused warning.
+
+2006-10-31 Geoffrey Keating <geoffk@apple.com>
+
+ * encoding.c (darwin_rs6000_special_round_type_align): New.
+
+2006-10-14 Geoffrey Keating <geoffk@apple.com>
+
+ * Makefile.in: Use multi_basedir instead of toplevel_srcdir.
+ * configure.ac: Use multi.m4 from aclocal rather than custom
+ code. Use multi_basedir instead of toplevel_srcdir.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+2006-10-10 Brooks Moses <bmoses@stanford.edu>
+
+ * Makefile.in: Added empty "pdf" target.
+
+2006-07-18 Paolo Bonzini <bonzini@gnu.org>
+
+ * configure: Regenerate.
+
+2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
+
+ * Makefile.in: Add install-html target. Add install-html to .PHONY
+
+2006-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ PR libobjc/26309
+ * thr-objc.c (_XOPEN_SOURCE): Don't define on Tru64 UNIX.
+
+2006-01-24 David Ayers <d.ayers@inode.at>
+
+ PR libobjc/9751
+ * gc.c (class_ivar_set_gcinvisible): Replace strncpy with memcpy
+ and insure the new strings are '\0' termintated.
+
+2006-01-24 David Ayers <d.ayers@inode.at>
+
+ PR libobjc/13946
+ * configure.ac: Add include directives for --enable-objc-gc.
+ * Makefile.in: Ditto.
+ * configure: Regenerate.
+
+ * gc.c (__objc_class_structure_encoding): Increment the used bytes
+ instead of the local pointer to them.
+
+2005-12-14 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR objc/25360
+ * objc/objc-api.c (_C_COMPLEX): New define.
+ * encoding.c (objc_sizeof_type): Handle _C_Complex.
+ (objc_alignof_type): Likewise.
+ (objc_skip_typespec): Likewise.
+
+2005-12-15 David Ayers <d.ayers@inode.at>
+
+ PR libobjc/14382
+ * README (+load,+initialize): Fix documentation to reflect
+ intended and implemented semantics for +load and +initialize.
+
+2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * encoding.c (TYPE_FIELDS): Fix to skip over just _C_STRUCT_B and
+ the name.
+ (get_inner_array_type): Fix to skip over _C_ARY_B and size.
+ (rs6000_special_round_type_align): Update for the ABI fix.
+ (objc_layout_finish_structure): Correct the encoding which is passed to
+ ROUND_TYPE_ALIGN.
+
+2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/25347
+ * encoding.c (objc_sizeof_type): Don't handle _C_UNION_B special
+ but use the struct layout functions.
+ (objc_alignof_type): Likewise.
+ (objc_layout_structure): Handle _C_UNION_B also.
+ (objc_layout_structure_next_member): Likewise.
+ (objc_layout_finish_structure): Likewise.
+
+2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/25346
+ * objc/objc-api.h (_C_BOOL): New define.
+ * encoding.c (objc_sizeof_type): Handle _C_BOOL.
+ (objc_alignof_type): Likewise.
+ (objc_skip_typespec): Likewise.
+
+2005-11-20 David Ayers <d.ayers@inode.at>
+
+ PR libobjc/19024
+ * objc/hash.h: Remove deprecated hash API.
+ * hash_compat.c: Remove.
+ * Makefile.in: Remove reference to hash_compat.c.
+
+ * configure.ac (VERSION): Bump library version to 2:0:0.
+ * configure: Regenerate.
+
+2005-11-09 Alexandre Oliva <aoliva@redhat.com>
+
+ PR other/4372
+ * thr-objc.c (_XOPEN_SOURCE): Define.
+
+2005-10-07 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR libobjc/23612
+ * objc/objc-api.h (struct objc_ivar): Move definition to
+ global scope.
+
+2005-09-04 Andrew Pinski <pinskia@physics.uc.edu>
+ Rasmus Hahn <rassahah@neofonie.de>
+
+ PR libobjc/23108
+ * archive.c (objc_write_type): Correct the element offset.
+ (objc_read_type): Likewise.
+
+2005-08-17 Kelley Cook <kcook@gcc.gnu.org>
+
+ * All files: Update FSF address.
+
+2005-08-13 Marcin Koziej <creep@desk.pl>
+ Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/22492
+ * exception.c (PERSONALITY_FUNCTION): Fix the PC with finally.
+
+2005-08-13 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * Makefile.in (extra_ldflags_libobjc): New.
+ (libobjc$(libext).la): Add extra_ldflags_libobjc to the link line.
+ (libobjc_gc$(libext).la): Likewise.
+ * configure.ac (extra_ldflags_libgfortran): Set for *-darwin* to
+ "-Wl,-single_module".
+ * configure: Regenerate.
+ * linking.m (_objcInit): Remove.
+
+2005-07-26 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/22606
+ * Makefile.in (ALL_CFLAGS): Add -fexceptions.
+
+2005-06-08 David Ayers <d.ayers@inode.at>
+
+ * objc/NXConstStr.h, objc/Object.h, objc/Protocol.h,
+ objc/encoding.h, objc/hash.h, objc/objc-api.h,
+ objc/runtime.h, objc/sarray.h, objc/thr.h,
+ objc/typedstream.h: Do not include Objective-C headers as
+ system headers.
+
+2005-06-07 David Ayers <d.ayers@inode.at>
+
+ * archive.c, init.c, selector.c: Include hash.h.
+ * archive.c, class.c, encoding.c, gc.c, hash.c, hash_compat.c,
+ init.c, misc.c, nil_method.c, objects.c, sarray.c, selector.c,
+ sendmsg.c, thr-dce.c, thr-decosf1.c, thr-irix.c, thr-mach.c,
+ thr-objc.c, thr-os2.c, thr-posix.c, thr-pthreads.c, thr-rtems.c,
+ thr-single.c, thr-solaris.c, thr-vxworks.c, thr-win32.c, thr.c:
+ Include Objective-C headers with quotes and objc/ directory
+ prefix.
+
+2005-05-19 Richard Henderson <rth@redhat.com>
+
+ * exception.c: Revert last change.
+
+2005-05-19 David Ayers <d.ayers@inode.at>
+
+ * exception.c: Include tsystem.h for unwind.h.
+
+2005-05-09 Mike Stump <mrs@apple.com>
+
+ * configure: Regenerate.
+
+2005-04-12 Mike Stump <mrs@apple.com>
+
+ * configure: Regenerate.
+
+2005-03-21 Zack Weinberg <zack@codesourcery.com>
+
+ * Makefile.in: Set gcc_version here.
+ * configure.ac: Do not invoke TL_AC_GCC_VERSION. Adjust quoting
+ in definition of toolexeclibdir so that $(gcc_version) is expanded
+ by the Makefile.
+ * aclocal.m4, configure: Regenerate.
+
+2005-03-03 David Ayers <d.ayers@inode.at>
+
+ * objc/hash.h (OBJC_IGNORE_DEPRECATED_API): Update deprecated
+ version reference. Correct typo.
+
+2005-03-02 David Ayers <d.ayers@inode.at>
+
+ PR libobjc/19024
+ * Makefile.in (OBJS): Add hash_compat.lo.
+ (OBJS_GC): Add hash_compat_gc.lo.
+ (hash_compat_gc.lo): New target and rule.
+ * objc/hash.h (hash_new, hash_delete, hash_add, hash_remove)
+ (hash_next, hash_value_for_key, hash_is_key_in_hash)
+ (hash_ptr, hash_string, compare_ptrs, compare_strings): Prefix
+ with objc_. Add deprecated non prefixed inlined versions.
+ (OBJC_IGNORE_DEPRECATED_API): New macro to hide deprecated
+ declarations.
+ * hash.c (hash_new, hash_delete, hash_add, hash_remove, hash_next)
+ (hash_value_for_key, hash_is_key_in_hash): Prefix with objc_ and
+ update callers.
+ * hash_compat.c: New file.
+ * archive.c: Update callers.
+ * init.c: Likewise.
+ * selector.c: Likewise.
+ * libobjc.def: Add objc_ versions of hash functions.
+
+2005-02-28 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/20252
+ * Makefile.in (GTHREAD_FLAGS): Remove.
+ (ALL_CFLAGS): Remove usage of GTHREAD_FLAGS.
+ * thr-objc.c: Include config.h.
+ * configure.ac: Instead of looking at GCC's makefile, figure out if
+ GTHREAD_FLAGS should be defined by looking at the `thread model'
+ of the current gcc.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+
+2005-02-28 Paolo Bonzini <bonzini@gnu.org>
+
+ PR bootstrap/17383
+ * configure.ac: Call GCC_TOPLEV_SUBDIRS.
+ (Determine CFLAGS for gthread): Use $host_subdir.
+ * configure: Regenerate.
+ * Makefile.in (host_subdir): New.
+ (INCLUDES): Use it.
+
+2004-12-20 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/12035
+ * gc.c: Remove definition of LOGWL, modWORDSZ, and divWORDSZ since
+ they are not used.
+ Include limits.h and stdlib.h.
+ Define BITS_PER_WORD.
+
+2004-12-12 Alexander Malmberg <alexander@malmberg.org>
+
+ * selector.c (__objc_init_selector_tables): Add missing void to
+ definition.
+
+2004-12-02 Richard Sandiford <rsandifo@redhat.com>
+
+ * configure.ac: Use TL_AC_GCC_VERSION to set gcc_version.
+ * configure, aclocal.m4: Regenerate.
+
+2004-11-29 Kelley Cook <kcook@gcc.gnu.org>
+
+ * configure: Regenerate for libtool change.
+
+2004-11-25 Kelley Cook <kcook@gcc.gnu.org>
+
+ * configure: Regenerate for libtool reversion.
+
+2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
+
+ * configure: Regenerate for libtool change.
+
+2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
+
+ * aclocal.m4, config.h.in: Regenerate.
+
+2004-10-08 Mike Stump <mrs@apple.com>
+ Andrew Pinski <pinskia@physics.uc.edu>
+
+ * aclocal.m4: Rename to ...
+ * acinclude.m4: here and also use m4_include instead of sinclude.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Add AM_MAINTAINER_MODE and AM_PROG_CC_C_O.
+ * Makefile.in (configure): Add @MAINT@ infront of configure.ac
+
+2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * archive.c: Fix all the warnings about passing unsigned char*
+ to char* and the other way too.
+
+2004-09-16 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/16448
+ * exception.c: Include config.h
+ (objc_exception_throw): Change _GLIBCXX_SJLJ_EXCEPTIONS to
+ SJLJ_EXCEPTIONS.
+ * configure.ac: Find out what exception handling code we use.
+ * configure: Regenerate.
+ * config.h.in: New file, regenerate.
+
+2004-09-16 Andrew Pinski <apinski@apple.com>
+
+ * encoding.c (ALTIVEC_VECTOR_MODE): Define a bogus macro.
+
+2004-08-28 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * configure.ac: Switch from _GCC_TOPLEV_NONCANONICAL_TARGET to
+ ACX_NONCANONICAL_TARGET.
+ * configure: Regenerate.
+
+2004-08-13 Ziemowit Laski <zlaski@apple.com>
+
+ * objc/sarray.h: Hoist include of assert.h near the top of file,
+ and mark the remainder of the file 'extern "C"'.
+
+2004-08-13 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * objc/Object.h: Move includes out of extern "C" blocks.
+ * objc/encoding.h: Likewise.
+ * objc/hash.h: Likewise.
+ * objc/objc-api.h: Likewise.
+ * objc/runtime.h: Likewise.
+ * objc/sarray.h: Likewise.
+ * objc/typedstream.h: Likewise.
+
+2004-08-12 Ziemowit Laski <zlaski@apple.com>
+
+ * objc/NXConstStr.h: Update copyright date; bracket with
+ 'extern "C"' for C++ use; make include syntax consistent
+ by using <...> instead of "..."; hoist <objc/...> includes
+ above the 'extern "C"' block.
+ * objc/Object.h: Likewise.
+ * objc/Protocol.h: Likewise.
+ * objc/encoding.h: Likewise.
+ * objc/hash.h: Likewise.
+ * objc/runtime.h: Likewise.
+ * objc/sarray.h: Likewise.
+ * objc/thr.h: Likewise.
+ * objc/typedstream.h: Likewise.
+ * objc/objc-api.h: Add 'extern "C"' block for C++ use.
+ (objc_static_instances): For C++ case, do away with
+ zero-sized array.
+ (objc_method): Hoist definition to file scope.
+ (_objc_load_callback, _objc_object_alloc, class_get_class_method,
+ class_get_instance_method, class_create_instance,
+ class_get_class_name, class_get_instance_size,
+ class_get_meta_class, class_get_super_class, class_get_version,
+ class_is_class, class_is_meta_class, class_set_version,
+ class_get_gc_object_type, class_ivar_set_gcinvisible,
+ get_imp): Rename 'class' parameter to '_class'.
+ * objc/objc-list.h: Add 'extern "C"' block for C++ use.
+ * objc/objc.h: Update copyright date.
+ (arglist_t): Provide a union tag.
+
+2004-07-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * thr.c (__objc_thread_detach_function): Do not mark as volatile
+ but instead use the attribute noreturn.
+
+2004-06-28 Zack Weinberg <zack@codesourcery.com>
+
+ * encoding.c: Rename target_flags with a #define to avoid
+ conflict with a prior declaration.
+
+2004-06-24 Andrew Pinski <apinski@apple.com>
+
+ * objc/encoding.h: Wrap the functions with extern "C" for C++
+ mode.
+ * objc/hash.h: Likewise.
+ * objc/objc-api.h: Likewise.
+ * objc/objc-list.h: Likewise.
+ * objc/runtime.h: Likewise.
+ * objc/sarray.h: Likewise.
+ * objc/thr.h: Likewise.
+ * objc/typedstream.h: Likewise.
+
+
+2004-06-21 Nick Clifton <nickc@redhat.com>
+
+ * encoding.c (BITS_PER_UNIT): Define if a definition is not
+ provided.
+
+2004-06-20 Alexander Malmberg <alexander@malmberg.org>
+
+ * Makefile.in (exception.lo): Remove $(OBJC_GCFLAGS).
+ (exception_gc.lo): New.
+ (OBJS_GC): Add exception_gc.lo.
+
+2004-06-17 Richard Henderson <rth@redhat.com>
+
+ * exception.c: New file.
+ * Makefile.in (exception.lo): New.
+ (OBJS): Add it.
+
+2004-06-14 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * linking.m (_objcInit): New empty function
+ for Darwin only.
+
+2004-06-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * configure.ac: Support --enable-shared=libobjc.
+ * configure: Regenerate.
+
+ PR libobjc/15901
+ * configure.ac: Do not disable shared by default.
+ * configure: Regenerate.
+
+2004-06-03 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * Protocol.m ([-isEqual:]): Small optimizations returning
+ immediately if the argument is equal to self, and accessing
+ the argument's name directly if it's a protocol.
+
+2004-06-03 David Ayers <d.ayers@inode.at>
+
+ * Protocol.m ([-isEqual:]): Test the class of the argument.
+
+2004-05-25 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * configure.ac (includedir): Rename to ...
+ (includedirname).
+ * Makefile.in: s/includedir/includedirname/.
+
+ PR target/11572
+ * configure.ac (includedir): Set to "include"
+ except for Darwin.
+ (libext) Set to empty except for Darwin.
+ * configure: Regenerate
+ * Makefile.in: s/libobjc.la/libobjc$(libext).la/g.
+ s/include/$(includedir)/g.
+
+2004-05-25 Daniel Jacobowitz <drow@false.org>
+
+ * Makefile.in: Add .NOEXPORT.
+
+2004-05-25 Andrew Pinski <pinskia@physics.uc.edu>
+
+ Merge from the libobjc-branch
+ 2004-02-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * Makefile.in (OBJC_H): Change objc-deps.h to objc-decls.h.
+
+ 2004-02-03 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * Makefile.in (OBJC_H): Add objc-deps.h.
+
+ 2004-01-27 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * Protocol.m ([-conformsTo:]): If the argument is nil, return NO.
+ ([-hash], [-isEqual:]): New methods.
+
+ 2004-01-27 Richard Frith-Macdonald <rfm@gnu.org>
+
+ * sarray.c (sarray_free): Add a better comment.
+
+ 2004-01-27 Adam Fedor <fedor@gnu.org>
+
+ * hash.c (hash_add): Cast cachep to int.
+ * selector.c (__sel_register_typed_name): Cast
+ soffset_decode to int.
+
+ 2004-01-27 Alexander Malmberg <alexander@malmberg.org>
+
+ * selector.c: Rename register_selectors_from_list to
+ __objc_register_selectors_from_list. Update caller.
+ (__objc_register_selectors_from_list): Lock __objc_runtime_mutex
+ while registering selectors. Use __sel_register_typed_name instead
+ of sel_register_typed_name. Check for NULL method_name:s.
+ (pool_alloc_selector): New function.
+ (__sel_register_typed_name): Use pool_alloc_selector to allocate
+ selector structures.
+ * sendmsg.c (class_add_method_list): Use
+ __objc_register_selectors_from_list.
+ * objc/runtime.h: Add __objc_register_selectors_from_list.
+
+ 2004-01-25 Adam Fedor <fedor@gnu.org>
+ Nicola Pero <n.pero@mi.flashnet.it>
+ Andrew Pinski <pinskia@physics.uc.edu>
+
+ * objc/objc-decls.h: New file.
+ * objc/objc-api.h (_objc_lookup_class): Mark as export.
+ (_objc_load_callback): Likewise.
+ (_objc_object_alloc): Likewise.
+ (_objc_object_copy): Likewise.
+ (_objc_object_dispose): Likewise.
+
+ 2004-01-25 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * archive.c: s/__inline__/inline
+ * sendmsg.c: Likewise.
+
+ * encoding.c: Remove FIXME about the warning
+ about unused variable.
+ * sendmsg.c: Add a FIXME comment saying that
+ this should be using libffi.
+
+ * Makefile.in (LIBTOOL): Use @LIBTOOL@ now as it works.
+
+
+2004-05-13 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * archive.c (objc_read_class): Initialize class_name.
+ (objc_read_selector): Initialize selector_name.
+
+2004-05-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * Makefile.in (toolexecdir): Remove trailing space.
+
+2004-04-15 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ PR libobjc/14948
+ * configure.ac: De-precious CC so multilibs work.
+ * configure: Regenerate.
+
+2004-04-14 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * configure.ac: Restore toolexecdir.
+ * Makefile.in: Restore toolexecdir.
+ * configure: Regenerate.
+
+2004-04-09 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * configure.ac: Remove (unused) glibcpp_prefixdir.
+ * configure: Regenerate.
+
+ * configure.in: Rename to configure.ac.
+ * Makefile.in: Update to match.
+
+ * Makefile.in: Remove toolexecdir, glibcpp_toolexecdir (unused).
+ Replace glibcpp_toolexeclibdir with toolexeclibdir.
+ * configure.in: Remove glibcpp_toolexecdir (unused).
+ Replace glibcpp_toolexeclibdir with toolexeclibdir. Don't generate
+ config.h or stamp-h (unused). Move one comment to the right place.
+ * configure: Regenerate.
+ * config.h.in: Remove (unused).
+
+ * config.h.in: Regenerate with autoheader.
+
+ * Makefile.in: Remove (unused) gcc_version_trigger.
+ * configure.in: Remove (unused) glibcpp_builddir. Don't AC_SUBST
+ gcc_version_trigger.
+ * configure: Regenerate.
+
+ * configure.in: Switch to modern style for AC_INIT, AC_OUTPUT.
+ Sort file into sections. Remove dnl where appropriate. Fix
+ other style issues.
+ * configure: Regenerate.
+
+ * configure.in: Replace old AC_PROG_CC hack with new one.
+ Define toplevel_srcdir in terms of srcdir, not top_srcdir (there
+ are no subdirectory output files, so this is fine). Change prereq
+ to autoconf 2.59.
+ * aclocal.m4: Include ../config/no-executables.m4.
+ * configure: Regenerate with autoconf 2.59.
+
+ * configure.in: Improve comments on gthread_cflags. Improve m4
+ quotation, and replace 'if test' with 'case', for --enable-objc-gc.
+ * configure: Regenerate.
+
+ * configure.in: Move PACKAGE and VERSION settings up top. Remove
+ unused call to AC_PROG_LN_S. Default RANLIB to ':'. Remove
+ redundant checks for values of RANLIB, AR, INSTALL.
+ * configure: Regenerate.
+
+ * configure.in: Clean up handling of
+ --enable-version-specific-runtime-libs and related variables;
+ replace 'if test' with 'case' where reasonable. Fix comments.
+ Remove useless libstdcxx_interface.
+ * configure: Regenerate.
+
+ * configure.in: Use _GCC_TOPLEV_NONCANONICAL_TARGET.
+ Replace uses of target_alias with target_noncanonical.
+ * aclocal.m4: Include ../config/acx.m4.
+ * configure: Regenerate.
+ * Makefile.in: Replace uses of target_alias with target_noncanonical.
+ Fix copyright statement.
+
+ * configure.in: Hand-inline bulky, confusing macros from
+ aclocal.m4. Replace references to "GNU Objective C" with "GCC".
+ Update copyright notice. Remove stuff for automake, which isn't
+ used in this directory. Remove emacs local variables.
+ * aclocal.m4: Remove hand-inlined macros. Update copyright notice.
+ * configure: Regenerate.
+
+2004-03-16 Manfred Hollstein <mh@suse.com>
+
+ * Makefile.in, configure.in, configure: Update copyright years.
+
+2004-03-15 Manfred Hollstein <mh@suse.com>
+
+ * Makefile.in (LIBOBJC_VERSION, LIBOBJC_GC_VERSION): Use
+ definition from configure.in.
+ * configure.in (PACKAGE): Add definition.
+ (VERSION): Add definition; substitute it in output files.
+ * configure: Re-generate.
+
+2004-03-05 Ziemowit Laski <zlaski@apple.com>
+
+ * objc/hash.h (hash_string, compare_strings):
+ Add type-casts to make Objective-C++ happy.
+ * objc/typedstream.h (objc_get_stream_class_version):
+ Rename parameter from 'class' to 'class_name' to make
+ Objective-C++ happy.
+
+2004-03-01 Michael Matz <matz@suse.de>
+
+ * Makefile.in (ALL_CFLAGS): Add -fno-strict-aliasing.
+
+2004-02-06 Ziemowit Laski <zlaski@apple.com>
+
+ * objc/objc-api.h (objc_super): The 'class' field shall
+ be named 'super_class' #ifdef __cplusplus.
+
+2004-01-17 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR target/10781
+ * encoding.c (rs6000_special_round_type_align): Define.
+
+2004-01-14 Adam Fedor <fedor@gnu.org>
+
+ PR libobjc/12155
+ * selector.c (__objc_register_instance_methods_to_class): Free
+ new_list if not used.
+
+2004-01-09 Andrew Ruder <aeruder@ksu.edu>
+
+ PR libobjc/11904
+ * sarray.c (sarray_free): Free array->is_copy_of latter.
+
+2003-12-01 Zack Weinberg <zack@codesourcery.com>
+
+ PR 11433
+ * Protocol.m (descriptionForInstanceMethod): Don't dereference
+ instance_methods if it's NULL.
+ (descriptionForClassMethod): Likewise for class_methods.
+
+2003-10-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * Makefile.in (runtime-info.h): Remove -Wp.
+
+2003-10-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * Makefile.in (CC1OBJ): Remove.
+ (runtime-info.h): Invoke $(CC) so all MULTIFLAGS are handled
+ correctly.
+ Use .m extension for temporary file.
+ Remove assembler temp file.
+
+2003-10-20 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * objc/hash.h (hash_string): Don't use a cast as an lvalue.
+
+2003-10-17 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * Makefile.in (runtime-info.h): Use MULTIFLAGS.
+
+2003-09-09 Alan Modra <amodra@bigpond.net.au>
+
+ * configure: Regenerate.
+
+2003-08-27 Alexander Malmberg <alexander@malmberg.org>
+
+ * Makefile.in, aclocal.m4: Update to $(libdir)/gcc/ instead of
+ (libdir)/gcc-lib/ when installing.
+ * configure: Regenerate.
+
+Thu Jul 10 10:27:43 2003 Nicola Pero <n.pero@mi.flashnet.it>
+
+ libobjc/9969
+ * sendmsg.c (get_imp): Fixed rare threading problem.
+ (__objc_responds_to): Similar fixes.
+ (objc_msg_lookup): Similar fixes.
+ (__objc_init_install_dtable): Lock the runtime before checking if the
+ table is installed.
+
+2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * hash.c, init.c, libobjc.def, libobjc_entry.c, linking.m,
+ makefile.dos, misc.c, nil_method.c, objects.c, sarray.c,
+ selector.c, sendmsg.c, thr-dce.c, thr-decosf1.c, thr-irix.c,
+ thr-mach.c, thr-objc.c, thr-os2.c, thr-posix.c, thr-pthreads.c,
+ thr-rtems.c, thr-single.c, thr-solaris.c, thr-vxworks.c,
+ thr-win32.c, thr.c: Replace "GNU CC" with "GCC".
+ * Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c,
+ class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h,
+ objc/Protocol.h, objc/encoding.h, objc/hash.h, objc/objc-api.h,
+ objc/objc-list.h, objc/objc.h, ocjc/runtime.h, objc/sarray.h,
+ objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC".
+
+Tue May 13 14:56:03 2003 Richard Frith-Macdonald <rfm@gnu.org>
+ Nicola Pero <n.pero@mi.flashnet.it>
+
+ libobjc/10742
+ * init.c (class_superclass_of_class): New function.
+ (create_tree_of_subclasses_inherited_from): Use it.
+ (__objc_tree_insert_class): Likewise.
+ (class_is_subclass_of_class): Likewise.
+
+2003-04-11 David Chad <davidc@freebsd.org>
+ Loren J. Rittle <ljrittle@acm.org>
+
+ libobjc/8562
+ * objc/hash.h (hash_string): Constify correctly.
+ (compare_ptrs): Use direct compare.
+ * objc/objc-list.h (list_nth): Rename index to indx to avoid shadow.
+ * objc/sarray.h: Global rename index to indx to avoid shadow.
+
+2003-03-12 Andreas Schwab <schwab@suse.de>
+
+ * aclocal.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Avoid trailing /. in
+ glibcpp_toolexeclibdir.
+ * configure: Rebuilt.
+
+2003-02-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
+ config.status.
+ * configure: Rebuilt.
+
+2003-01-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * aclocal.m4 (glibcpp_toolexeclibdir): Instead of
+ $(MULTISUBDIR), use `$CC -print-multi-os-directory`, unless
+ version_specific_libs is enabled.
+ * configure: Rebuilt.
+
+2003-01-09 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+
+ * Makefile.in (FLAGS_TO_PASS): Also pass DESTDIR.
+ (install-libs, install-headers): Prepend $(DESTDIR) to
+ destination paths in all (un)installation commands.
+
+2002-12-02 Zack Weinberg <zack@codesourcery.com>
+
+ * thr-objc.c: Include coretypes.h and tm.h.
+
+2002-12-01 Zack Weinberg <zack@codesourcery.com>
+
+ * encoding.c, sendmsg.c: Include coretypes.h and tm.h.
+
+2002-11-26 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * configure.in: Remove skip-this-dir support.
+ * configure: Regenerate.
+
+2002-09-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (all): Fix multilib parallel build.
+
+Thu Sep 12 12:44:37 2002 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * sendmsg.c (nil_method): Declare not to take a variable number of
+ args.
+ (objc_msg_lookup): Cast nil_method to IMP before returning it.
+ (objc_msg_lookup_super): The same.
+
+2002-09-10 Jan Hubicka <jh@suse.cz>
+
+ * nil_method.c (nil_method): No longer defined with variable
+ arguments.
+
+2002-07-02 Rodney Brown <rbrown64@csc.com.au>
+
+ * objc/encoding.h: Fix formatting.
+ * objc/hash.h: Likewise.
+ * objc/objc-api.h: Likewise.
+ * objc/runtime.h: Likewise.
+ * objc/thr.h: Likewise.
+ * archive.c: Likewise.
+ * class.c: Likewise.
+ * encoding.c: Likewise.
+ * gc.c: Likewise.
+ * hash.c: Likewise.
+ * init.c: Likewise.
+ * misc.c: Likewise.
+ * nil_method.c: Likewise.
+ * objects.c: Likewise.
+ * sarray.c: Likewise.
+ * selector.c: Likewise.
+ * sendmsg.c: Likewise.
+ * thr-mach.c: Likewise.
+ * thr.c: Likewise.
+
+2002-06-25 DJ Delorie <dj@redhat.com>
+
+ * aclocal.m4 (GLIBCPP_CONFIGURE): Split out
+ GLIBCPP_TOPREL_CONFIGURE.
+ * configure.in: Call it before AC_CANONICAL_SYSTEM.
+ * configure: Regenerate.
+
+2002-06-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Object.m (forward, read, write): Fix unused parameter warnings.
+ * encoding.c: Include <stdlib.h>.
+ (target_flags): Mark with attribute unused.
+ (atoi): Delete.
+ * runtime.h (__objc_selector_max_index): Change to unsigned int.
+ (__objc_generate_gc_type_description): Prototype.
+ * selector.c (__objc_selector_max_index): Change to unsigned int.
+
+Mon Jun 17 18:37:42 2002 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * sendmsg.c (__objc_get_forward_imp): Fix warning by making sure
+ we always have a return value: if __objc_msg_forward does not
+ supply a forwarding implementation, return the default
+ __builtin_apply based one.
+
+2002-06-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Object.m: Fix signed/unsigned warning.
+ * Protocol.m: Likewise.
+ * archive.c: Always include stdlib.h.
+ (objc_read_short, objc_read_unsigned_short, objc_read_int,
+ objc_read_long, __objc_read_nbyte_uint, __objc_read_nbyte_ulong):
+ Fix signed/unsigned warning.
+ (objc_write_type, objc_read_type, objc_write_types,
+ objc_read_types): Ensure ctype 8-bit safety.
+ (__objc_no_write, __objc_no_read): Mark unused parameters.
+ * class.c (class_table_setup): Specify void arg.
+ * encoding.c (atoi, objc_sizeof_type, objc_alignof_type,
+ objc_skip_typespec, objc_skip_offset,
+ objc_layout_structure_next_member): Ensure ctype 8-bit safety.
+ (objc_layout_structure_next_member): Ensure variables are
+ initialized.
+ * gc.c (__objc_generate_gc_type_description,
+ class_ivar_set_gcinvisible): Mark unused parameters.
+ * init.c (__objc_send_load, __objc_destroy_class_tree_node): Mark
+ unused parameters.
+ (__objc_init_protocols) Fix signed/unsigned warning.
+ * nil_method.c (nil_method): Mark unused parameters.
+ * thr.h (objc_thread_callback): Specify void arg.
+ * sarray.c (sarray_new, sarray_realloc, sarray_free): Fix
+ signed/unsigned warning.
+ (sarray_free): Fix formatting.
+ * selector.c (sel_types_match): Ensure ctype 8-bit safety.
+ * sendmsg.c (__objc_init_install_dtable) Mark unused parameters.
+
+2002-06-09 Andreas Jaeger <aj@suse.de>
+
+ * encoding.c (objc_layout_structure_next_member): Remove unused
+ variable.
+
+2002-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (SHELL): Set to @SHELL@.
+ (WARN_CFLAGS): New.
+ (ALL_CFLAGS): Add $(WARN_CFLAGS).
+
+2002-05-16 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * aclocal.m4: Allow for PWDCMD to override hardcoded pwd.
+ * configure: Regenerate.
+
+2002-05-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at
+ script entry, and set LD to it when configuring multilibs.
+ * configure: Rebuilt.
+
+2002-04-19 David O'Brien <obrien@FreeBSD.org>
+
+ * encoding.c (MAX, MIN, ROUNDING): #undef before defining.
+
+2002-04-09 Hans-Peter Nilsson <hp@bitrange.com>
+
+ PR objc/6107
+ * objc/objc-api.h (struct objc_protocol_list): Change type of
+ member count from int to size_t.
+
+2002-02-11 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ PR libobjc/4039
+ * aclocal.m4: Replace with version copied from libstdc++-v3.
+ * configure.in: Update for changes to aclocal and Makefile.
+ * configure: Regenerate.
+ * Makefile.in: Correct install of multilibs and shared libs, use
+ INSTALL_DATA for include files.
+
+Mon Dec 17 17:02:12 2001 Nicola Pero <nicola@brainstorm.co.uk>
+
+ * init.c (__objc_exec_class): Fixed bug in the loop on unclaimed
+ categories - when an unclaimed category was found, the loop was
+ doing two steps forward instead of one, so that in certain cases
+ it was failing to properly load all the categories. (Reported
+ with fix by Alexander Malmberg <alexander@malmberg.org>).
+
+2001-11-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * encoding.c: Add target_flags.
+
+2001-11-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * objc/objc-api.h (_C_VECTOR): New.
+
+ * encoding.c (VECTOR_TYPE): New.
+
+Mon Oct 29 21:29:21 2001 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * class.c: Rewritten the class table to use optimized, lock-free
+ lookup. This more than doubles the speed of class method
+ invocations. (class_table_setup), (class_table_insert),
+ (class_table_replace), (class_table_get_safe),
+ (class_table_next), (class_table_print),
+ (class_table_print_histogram): New functions.
+ (__objc_init_class_tables): Use class_table_setup.
+ (__objc_add_class_to_hash): Use class_table_get_safe and
+ class_table_insert. (objc_lookup_class), (objc_get_class): Do not
+ assert the existence of the table; do not lock the runtime; use
+ class_table_get_safe. (objc_next_class): Use class_table_next.
+ (__objc_resolve_class_links): Use class_table_next.
+ (class_pose_as): Use class_table_replace.
+
+2001-09-10 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * gc.c: Removed the DEBUG declaration.
+
+Wed Jul 18 12:48:56 2001 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * thr.c (objc_mutex_lock): Invoke __objc_thread_id directly,
+ rather than through objc_thread_id, to save a function call.
+ (objc_mutex_trylock, objc_mutex_unlock, objc_condition_wait):
+ Ditto.
+
+Mon Jul 16 12:15:00 2001 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * objc/objc-api.h (object_is_class): Fixed - buggy code was trying
+ to cast an id to a Class, which can not be done. Make the check
+ by using CLS_ISMETA on the class pointer instead.
+ (object_is_meta_class): Similar fix.
+
+2001-06-09 Alexandre Oliva <aoliva@redhat.com>, Stephen L Moshier <moshier@mediaone.net>
+
+ * configure.in (AC_EXEEXT): Work around in case it expands to
+ nothing, as in autoconf 2.50.
+ * acinclude.m4: Likewise.
+ * configure: Rebuilt.
+
+2001-06-08 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * THREADS: Explain that when we compile libobjc inside GCC, we
+ always use thr-objc.c as a backend, which uses GCC's thread code.
+
+2001-06-06 Richard Frith-Macdonald <rrfm@gnu.org>
+
+ * init.c (__objc_send_message_in_list): When setting a new entry
+ in __objc_load_methods use the method IMP as key, but check to see
+ if the method is in the hashtable by looking at the IMP also.
+ Also ... call the method after adding it to the hashtable rather
+ than before ... thus preventing an obscure possibility of infinite
+ recursion if a +load method itself loads a subclass.
+
+2001-05-25 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * init.c (__objc_send_message_in_list): When setting a new entry
+ in __objc_load_methods use the method name as key, not the method
+ IMP (reported by Richard Frith-Macdonald <richard@brainstorm.co.uk>).
+
+2001-05-09 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * objc-features.texi: Move to ../gcc/objc.texi.
+ * fdl.texi: Remove.
+ * Makefile.in: Don't generate documentation from
+ objc-features.texi.
+
+2001-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ * fdl.texi: New file.
+ * objc-features.texi: Simplify.
+ * Makefile.in: Adjust accordingly.
+
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * objc-features.texi: Use the GFDL.
+
+Wed Mar 21 04:44:58 EST 2001 John Wehle (john@feith.com)
+
+ * encoding.c (REAL_TYPE): Define.
+
+2001-03-19 David Edelsohn <edelsohn@gnu.org>
+
+ * encoding.c (TYPE_MODE): Define.
+
+2001-03-14 Nicola Pero <n.pero@mi.flashnet.it>
+
+ * thr.c (objc_thread_add): New function.
+ (objc_thread_remove): Ditto.
+ * objc/thr.h: Declare them.
+ * libobjc.def: Mention them.
+
+2001-02-28 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * objc-features.texi: Document the @compatibility_alias compiler
+ directive (description from Nicola Pero <n.pero@mi.flashnet.it>).
+
+Fri Feb 23 18:12:00 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * sendmsg.c (__objc_forward): Delete strlen() declaration.
+
+2001-02-08 Geoffrey Keating <geoffk@redhat.com>
+
+ * configure.in: Don't run AC_PROG_CC_WORKS or AC_EXEEXT, because
+ we're not interested in the result and they might fail.
+ * configure: Regenerated.
+
+2001-01-12 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * objc-features.texi: Use @email.
+
+2001-01-12 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * sendmsg.c (__objc_print_dtable_stats): Don't use #ifdef inside
+ printf.
+
+2000-01-11 Richard Earnshaw <rearnsha@arm.com>
+
+ * encoding.c (STRUCTURE_SIZE_BOUNDARY): Redefine in a way that
+ determines the value dynamically.
+
+Wed Jan 3 00:49:10 2001 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * sendmsg.c: Added __objc_msg_forward, a hook that allows external
+ libraries to provide a function that returns the real forwarding
+ function. This can alleviate problems __builtin_apply() and
+ friends have on various platforms. (Solution suggested by Helge
+ Hess.)
+
+ * objc/objc-api.h: Define __objc_msg_forward.
+
+ * sendmsg.c: Define gen_rtx_REG.
+
+2000-12-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+ * thr-rtems.c: New file. Stub to compile.
+
+2000-09-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure: Rebuilt with new libtool.m4.
+
+Tue Aug 15 00:38:56 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * configure.in: Create a config.h file. Check for <sched.h>.
+ * configure: Regenerate.
+
+ * config.h.in: Check for <sched.h>.
+
+2000-08-14 Zack Weinberg <zack@wolery.cumb.org>
+
+ * configure: Regenerate after change to ../libtool.m4.
+
+2000-08-14 Andreas Schwab <schwab@suse.de>
+
+ * objc-features.texi (Top): Move @menu at end of node.
+
+2000-08-11 Manfred Hollstein <manfredh@redhat.com>
+
+ * objc-features.texi: Move @node Top before @menu.
+
+Sun Aug 6 23:27:49 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * objc-features.texi: Documented the new -fconstant-string-class
+ option.
+
+Sun Aug 6 22:51:16 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * thr-posix.c: Integrated Chris Ball's <cball@fmco.com> changes to
+ improve the Posix thread support for Objective-C.
+
+2000-08-04 Zack Weinberg <zack@wolery.cumb.org>
+
+ * aclocal.m4: Replace copy of ../libtool.m4 with
+ sinclude(../libtool.m4).
+
+Fri Jul 28 08:58:02 2000 Nicola Pero <nicola@brainstorm.co.uk>
+
+ * configure.in: Added libtool support; build shared libraries
+ if --enable-shared was passed on command line.
+ * Makefile.in: Modified most compilation commands to use libtool.
+ * aclocal.m4: New symbolic link to the ../libtool.m4, from the
+ libtool distribution.
+
+Sat Jul 29 00:10:21 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * sarray.c, Object.m: Removed the explicit prototypes for strlen
+ and memcpy on 64-bit platforms (Suggested by Rodney Brown
+ <rdb@cup.hp.com>).
+
+2000-05-12 H.J. Lu (hjl@gnu.org)
+
+ * Makefile.in (GTHREAD_FLAGS): New.
+ (ALL_CFLAGS): Add $(GTHREAD_FLAGS).
+ (OBJC_THREAD_FILE): Changed to thr-objc.
+
+ * configure.in (GTHREAD_FLAGS): New, check and replace it for
+ Makefile.
+ (OBJC_THREAD_FILE): Removed.
+
+ * thr-objc.c: New.
+
+2000-07-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * objc/hash.h: Include string.h.
+
+2000-04-15 David Edelsohn <edelsohn@gnu.org>
+
+ * Object.m (strlen): 64-bit PowerPC is a 64bit platform as well.
+
+2000-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ * Object.m (strlen): Provide prototype on all 64bit platforms,
+ not only alpha.
+ * sarray.c (memcpy): Likewise.
+ * encoding.c (objc_layout_finish_structure): Don't use
+ ROUND_TYPE_ALIGN on sparc.
+
+ * encoding.c (objc_layout_structure_next_member): Do the whole
+ procedure even for the first member, so that we get correct
+ alignment.
+
+2000-03-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * objc/Protocol.h, objc/objc-list.h: Change #endif labels to
+ comments.
+
+2000-02-23 Zack Weinberg <zack@wolery.cumb.org>
+
+ * Makefile.in: Add -DIN_TARGET_LIBS to ALL_CFLAGS.
+
+Thu Sep 23 07:19:12 1999 Chris Ball <cball@fmco.com>
+
+ * thr-posix.c (__objc_mutex_deallocate): made deallocate work.
+
+Tue Sep 21 07:47:10 1999 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (gc.o, gc_gc.o): Do not pass -fgnu-runtime to
+ the compiler when building C code.
+
+Fri Aug 6 23:32:29 1999 Daniel Jacobowitz <drow@drow.them.org>
+
+ * Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix,
+ libdir, libsubdir and tooldir.
+
+Mon Jun 21 05:40:15 1999 John David Anglin <dave@hiauly1>
+
+ * init.c (__objc_force_linking): Make global.
+
+Thu May 20 03:20:59 1999 Jeffrey A Law (law@cygnus.com)
+
+ * configure.in (AC_EXEEXT): Remove call.
+ (compiler_name): Explicitly check with no extension and .exe
+ extension.
+ * configure: Regenerate.
+
+Sun Apr 25 01:15:34 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * Makefile.in (CC1OBJ): Define in terms of CC.
+ (runtime-info.h): Use.
+
+Fri April 8 08:21:07 1999 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * objc-features.texi: Updated the URL to Boehm's GC page.
+
+Fri Mar 26 23:41:07 1999 Ovidiu Predescu <ovidiu@cup.hp.com>
+
+ * archive.c (__objc_code_char, __objc_write_char): Explicitly specify
+ the char as being signed (patch from Daniel Jacobowitz
+ <drow@false.org>).
+
+Wed Mar 24 22:41:28 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * configure.in (AC_PREREQ): Update to 2.13.
+ (AC_EXEEXT): Call to find possible file extension.
+ (compiler_name): Use.
+ * configure: Regenerate.
+
+Wed Jan 27 02:31:01 1999 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (ALL_CFLAGS): Add -DIN_GCC.
+
+Tue Jan 5 01:38:53 1999 Jeffrey A Law (law@cygnus.com)
+
+ * configure.in (thread_file): Correct and simplify code to find
+ the thread file.
+ * configure: Rebuilt.
+
+1998-11-26 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * configure.in (compiler_name): Add check to detect if this
+ language's compiler has been built.
+ * configure: Regenerate.
+
+Mon Nov 23 16:50:28 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Use AC_PREREQ(2.12.1).
+
+Thu Nov 19 20:33:37 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (runtime-info.h): Avoid GNU make extensions.
+
+Sun Nov 8 17:46:14 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (INCLUDES): Add -I$(srcdir)/$(MULTISRCTOP)../include.
+
+Thu Oct 22 14:34:06 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Use AC_CONFIG_AUX_DIR($topsrcdir).
+
+Sat Oct 17 05:21:31 1998 Ovidiu Predescu <ovidiu@slip.net>
+
+ * objc-features.texi (Top): Changed the email address.
+ * objc-features.texi (Garbage Collection): Use @uref instead of @url.
+
+Mon Oct 11 21:25:27 1998 Ovidiu Predescu <ovidiu@slip.net>
+
+ * encoding.c: Redefine get_inner_array_type to get the first entry
+ in the structure.
+
+Thu Oct 8 12:21:14 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
+
+ * encoding.c (objc_skip_type_qualifiers): Handle _C_BYREF.
+ (objc_get_type_qualifiers): Similarly.
+ * objc/encoding.h (_C_BYREF): Define.
+ (_F_BYREF): Define.
+
+1998-10-07 David S. Miller <davem@pierdol.cobaltmicro.com>
+
+ * objc/sarray.h: Make boffset be an unsigned long when sparc so it
+ works out on 64-bit systems.
+
+Tue Oct 6 20:32:06 1998 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * Makefile.in (INCLUDES): Make it multilib-friendly.
+
+Fri Oct 2 07:12:14 1998 H.J. Lu (hjl@gnu.org)
+
+ * Makefile.in (INCLUDES): Add -I$(srcdir)/../gcc.
+
+Thu Oct 1 22:33:03 1998 Robert Lipe <robertl@dgii.com>
+ Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (INCLUDES): Reference gcc via $MULTIBUILDTOP.
+ (FLAGS_TO_PASS): Added.
+ (runtime-info.h): Reference cc1ibj via $MULTIBUILDTOP.
+
+ * archive.c: Change config.h to tconfig.h.
+
+ * configure.in: Find gcc's object directory even for multilibs.
+
+Wed Sep 30 18:17:17 1998 Robert Lipe <robertl@dgii.com>
+
+ * configure.in: Escape ^ in grep string.
+ * configure: Rebuilt.
+
+Wed Sep 30 09:14:52 1998 Jeffrey A Law (law@cygnus.com)
+
+ * All .h files pushed down into the objc/ subdirectory.
+ * Makefile.in (copy_headers): Corresponding changes.
+ * configure.in (AC_INIT): Corresponding changes.
+ * configure: Rebuilt.
+
+1998-09-30 Ben Elliston <bje@cygnus.com>
+ Jeff Law <law@cygnus.com>
+
+ * Makefile.in: Rewrite.
+
+ * configure.in: Likewise.
+
+ * configure: Regenerate.
+
+ * All .c files. Remove "objc" prefix when including objc header
+ files. Include tconfig.h, not ../tconfig.h.
+
+Mon Sep 21 23:27:10 1998 Ovidiu Predescu <ovidiu@slip.net>
+
+ * encoding.c (TREE_TYPE, ARRAY_TYPE): Define.
+ (get_inner_array_type): Define.
+
+1998-09-21 Ben Elliston <bje@cygnus.com>
+
+ * New directory. Moved files from ../gcc/objc.
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
new file mode 100644
index 000000000..b33c989e6
--- /dev/null
+++ b/libobjc/Makefile.in
@@ -0,0 +1,420 @@
+# Makefile for GNU Objective C runtime library.
+# Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+#This file is part of GCC.
+
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GCC; see the file COPYING3. If not see
+#<http://www.gnu.org/licenses/>.
+
+#This was cribbed from the libchill, libiberty and libstdc++
+#Makefile.in files. Some of this stuff may be unnecessary and
+#worthless.
+
+SHELL = @SHELL@
+MAKEOVERRIDES=
+
+#### Start of system configuration section. ####
+
+srcdir = @glibcpp_srcdir@
+VPATH = @glibcpp_srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+target_noncanonical = @target_noncanonical@
+gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+host_subdir = @host_subdir@
+top_srcdir = @top_srcdir@
+multi_basedir = @multi_basedir@
+toolexecdir = @toolexecdir@
+# Toolexecdir is used only by toolexeclibdir
+toolexeclibdir = @toolexeclibdir@
+
+includedirname = @includedirname@
+libsuffix = @libsuffix@
+
+lt_host_flags = @lt_host_flags@
+extra_ldflags_libobjc = @extra_ldflags_libobjc@
+
+top_builddir = .
+
+-include ../boehm-gc/threads.mk
+
+libdir = $(exec_prefix)/lib
+libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
+
+# Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# Not configured per top-level version, since that doesn't get passed
+# down at configure time, but overrridden by the top-level install
+# target.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+AR = @AR@
+AR_FLAGS = rc
+
+RANLIB = @RANLIB@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
+ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
+ -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
+
+# Libtool
+# The following strings describe the version of the obj-C library
+# begin compiled and compatibility issues.
+# Please refer to Libtool documentation about how to manage these
+# numbers.
+LIBOBJC_VERSION = @VERSION@
+LIBOBJC_GC_VERSION = @VERSION@
+LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS)
+LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
+LIBTOOL_LINK = $(LIBTOOL) --mode=link
+LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
+LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean
+#LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
+
+OBJC_GCFLAGS=-DOBJC_WITH_GC=1
+OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
+OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
+OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
+
+INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
+ -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
+ -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
+ -I$(srcdir)/$(MULTISRCTOP)../include \
+ $(OBJC_BOEHM_GC_INCLUDES)
+
+##
+## The list of header/source files
+##
+
+# User-visible header files, from the objc/ directory
+OBJC_H = \
+ objc.h \
+ objc-exception.h \
+ objc-sync.h \
+ \
+ NXConstStr.h \
+ Object.h \
+ Protocol.h \
+ encoding.h \
+ message.h \
+ objc-api.h \
+ objc-decls.h \
+ runtime.h \
+ thr.h \
+ \
+ hash.h \
+ objc-list.h \
+ sarray.h \
+ typedstream.h
+
+# User-visible header files containing deprecated APIs, from the
+# objc/deprecated directory
+OBJC_DEPRECATED_H = \
+ METHOD_NULL.h \
+ MetaClass.h \
+ Object.h \
+ Protocol.h \
+ STR.h \
+ hash.h \
+ objc-list.h \
+ objc_error.h \
+ objc_get_uninstalled_dtable.h \
+ objc_malloc.h \
+ objc_msg_sendv.h \
+ objc_object_alloc.h \
+ objc_unexpected_exception.h \
+ objc_valloc.h \
+ sarray.h \
+ struct_objc_category.h \
+ struct_objc_class.h \
+ struct_objc_ivar.h \
+ struct_objc_ivar_list.h \
+ struct_objc_method.h \
+ struct_objc_method_list.h \
+ struct_objc_module.h \
+ struct_objc_protocol.h \
+ struct_objc_protocol_list.h \
+ struct_objc_selector.h \
+ struct_objc_static_instances.h \
+ struct_objc_symtab.h \
+ typedstream.h
+
+# Objective-C source files to compile
+OBJC_SOURCE_FILES = \
+ NXConstStr.m \
+ Object.m \
+ Protocol.m \
+ accessors.m \
+ linking.m
+
+# C source files to compile
+C_SOURCE_FILES = \
+ archive.c \
+ class.c \
+ encoding.c \
+ error.c \
+ gc.c \
+ hash.c \
+ init.c \
+ ivars.c \
+ memory.c \
+ methods.c \
+ nil_method.c \
+ objc-foreach.c \
+ objc-sync.c \
+ objects.c \
+ protocols.c \
+ sarray.c \
+ selector.c \
+ sendmsg.c \
+ thr.c \
+ exception.c
+
+# Object files to link (when the library is linked with no GC (Garbage Collection))
+OBJS = \
+ $(patsubst %.m,%.lo,$(OBJC_SOURCE_FILES)) \
+ $(patsubst %.c,%.lo,$(C_SOURCE_FILES))
+
+# Object files to link (when the library is linked with GC (Garbage Collection))
+OBJS_GC = \
+ $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
+ $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
+
+
+##
+## The rules to build
+##
+
+# Flags to pass to a recursive make.
+FLAGS_TO_PASS = \
+ "AR=$(AR)" \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC=$(CC)" \
+ "CFLAGS=$(CFLAGS)" \
+ "DESTDIR=$(DESTDIR)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "EXTRA_OFILES=$(EXTRA_OFILES)" \
+ "HDEFINES=$(HDEFINES)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBTOOL=$(LIBTOOL)" \
+ "LOADLIBES=$(LOADLIBES)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "SHELL=$(SHELL)" \
+ "prefix=$(prefix)" \
+ "exec_prefix=$(exec_prefix)" \
+ "libdir=$(libdir)" \
+ "libsubdir=$(libsubdir)" \
+ "tooldir=$(tooldir)"
+
+# The 'all' rule must be the first one so that it is executed if
+# nothing is specified on the command-line.
+all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
+ : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
+
+.SUFFIXES:
+.SUFFIXES: .c .m .lo
+
+%.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) \
+ -o $@
+
+%_gc.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+ -o $@
+
+%.lo: %.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
+ -o $@
+
+%_gc.lo: %.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
+ -o $@
+
+# sendmsg has a special rule because it depends on runtime-info.h.
+runtime-info.h:
+ echo "" > tmp-runtime.m
+ echo "/* This file is automatically generated */" > $@
+ $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
+ rm -f tmp-runtime.m tmp-runtime.s
+
+sendmsg.lo: sendmsg.c runtime-info.h
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) \
+ -o $@
+
+sendmsg_gc.lo: sendmsg.c runtime-info.h
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+ -o $@
+
+# These files have separate rules because they require special
+# compiler flags.
+archive.lo: archive.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -Wno-deprecated-declarations \
+ -o $@
+
+archive_gc.lo: archive.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -Wno-deprecated-declarations \
+ -o $@
+
+# -Wno-deprecated-declarations is for the objc/typedstream.h functions.
+Object.lo: Object.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime -Wno-deprecated-declarations \
+ -o $@
+
+# -Wno-deprecated-declarations is for the objc/typedstream.h functions.
+Object_gc.lo: Object.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime -Wno-deprecated-declarations \
+ -o $@
+
+# -Wno-deprecated-declarations is to silence warnings from using
+# _objc_unexpected_exception.
+exception.lo: exception.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fexceptions -Wno-deprecated-declarations \
+ -o $@
+
+exception_gc.lo: exception.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions -Wno-deprecated-declarations \
+ -o $@
+
+doc: info dvi pdf html
+
+# No install-html or install-pdf support
+.PHONY: install-html install-pdf install-info
+install-html:
+install-pdf:
+install-info:
+
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
+libobjc$(libsuffix).la: $(OBJS)
+ $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
+ -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
+ -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
+ $(LTLDFLAGS)
+
+libobjc_gc$(libsuffix).la: $(OBJS_GC)
+ $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
+ -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
+ -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
+ $(LTLDFLAGS)
+
+info:
+dvi:
+pdf:
+html:
+
+Makefile: Makefile.in config.status
+ $(SHELL) config.status
+
+config.status: configure
+ rm -f config.cache
+ CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
+ CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
+
+AUTOCONF = autoconf
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I ../config -I ..
+aclocal_deps = \
+ $(srcdir)/../config/multi.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/proginstall.m4 \
+ $(srcdir)/../ltoptions.m4 \
+ $(srcdir)/../ltsugar.m4 \
+ $(srcdir)/../ltversion.m4 \
+ $(srcdir)/../lt~obsolete.m4 \
+ $(srcdir)/acinclude.m4
+
+$(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
+ rm -f config.cache
+ cd $(srcdir) && $(AUTOCONF)
+
+$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+install: install-libs install-headers
+
+install-libs: installdirs
+ $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
+ $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);
+ if [ "$(OBJC_BOEHM_GC)" ]; then \
+ $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \
+ $(DESTDIR)$(toolexeclibdir);\
+ fi
+ $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
+ @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
+
+# Copy Objective-C headers to installation include directory.
+install-headers:
+ $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
+ for file in $(OBJC_H); do \
+ realfile=$(srcdir)/objc/$${file}; \
+ $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
+ done
+ $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated
+ for file in $(OBJC_DEPRECATED_H); do \
+ realfile=$(srcdir)/objc/deprecated/$${file}; \
+ $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated; \
+ done
+
+check uninstall install-strip dist installcheck installdirs:
+
+mostlyclean:
+ -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo
+ -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
+ fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
+ *.toc *.tp *.vr *.html libobj.exp
+ @$(MULTICLEAN) multi-clean DO=mostlyclean
+
+clean: mostlyclean
+ rm -f config.log
+ @$(MULTICLEAN) multi-clean DO=clean
+
+distclean: clean
+ @$(MULTICLEAN) multi-clean DO=distclean
+ rm -f config.cache config.status Makefile configure
+
+maintainer-clean realclean: distclean
+
+.PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
+ install-strip dist installcheck installdirs
+
+# Don't export variables to the environment, in order to not confuse
+# configure.
+.NOEXPORT:
diff --git a/libobjc/NXConstStr.m b/libobjc/NXConstStr.m
new file mode 100644
index 000000000..1442ba6d3
--- /dev/null
+++ b/libobjc/NXConstStr.m
@@ -0,0 +1,41 @@
+/* Implementation of the NXConstantString class for Objective-C.
+ Copyright (C) 1995, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/NXConstStr.h"
+
+@implementation NXConstantString
+
+-(const char *) cString
+{
+ return (c_string);
+} /* -cString */
+
+-(unsigned int) length
+{
+ return (len);
+} /* -length */
+
+@end
diff --git a/libobjc/Object.m b/libobjc/Object.m
new file mode 100644
index 000000000..224c0aa66
--- /dev/null
+++ b/libobjc/Object.m
@@ -0,0 +1,389 @@
+/* The implementation of class Object for Objective-C.
+ Copyright (C) 1993, 1994, 1995, 1997, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include <stdarg.h>
+#include <errno.h>
+#include "objc/Object.h"
+#include "objc/Protocol.h"
+#include "objc/objc-api.h"
+
+@implementation Object
+
+- (Class)class
+{
+ return object_get_class (self);
+}
+
+- (BOOL)isEqual: (id)anObject
+{
+ return self == anObject;
+}
+
+@end
+
+/* The following methods were deprecated in GCC 4.6.0 and will be
+ removed in the next GCC release. */
+@implementation Object (Deprecated)
+
++ initialize
+{
+ return self;
+}
+
+- init
+{
+ return self;
+}
+
++ new
+{
+ return [[self alloc] init];
+}
+
++ alloc
+{
+ return class_create_instance(self);
+}
+
+- free
+{
+ return object_dispose(self);
+}
+
+- copy
+{
+ return [[self shallowCopy] deepen];
+}
+
+- shallowCopy
+{
+ return object_copy(self);
+}
+
+- deepen
+{
+ return self;
+}
+
+- deepCopy
+{
+ return [self copy];
+}
+
+- (Class)superClass
+{
+ return object_get_super_class(self);
+}
+
+- (MetaClass)metaClass
+{
+ return object_get_meta_class(self);
+}
+
+- (const char *)name
+{
+ return object_get_class_name(self);
+}
+
+- self
+{
+ return self;
+}
+
+- (unsigned int)hash
+{
+ return (size_t)self;
+}
+
+- (int)compare:(id)anotherObject;
+{
+ if ([self isEqual:anotherObject])
+ return 0;
+ // Ordering objects by their address is pretty useless,
+ // so subclasses should override this is some useful way.
+ else if ((id)self > anotherObject)
+ return 1;
+ else
+ return -1;
+}
+
+- (BOOL)isMetaClass
+{
+ return NO;
+}
+
+- (BOOL)isClass
+{
+ return object_is_class(self);
+}
+
+- (BOOL)isInstance
+{
+ return object_is_instance(self);
+}
+
+- (BOOL)isKindOf:(Class)aClassObject
+{
+ Class class;
+
+ for (class = self->isa; class!=Nil; class = class_get_super_class(class))
+ if (class==aClassObject)
+ return YES;
+ return NO;
+}
+
+- (BOOL)isMemberOf:(Class)aClassObject
+{
+ return self->isa==aClassObject;
+}
+
+- (BOOL)isKindOfClassNamed:(const char *)aClassName
+{
+ Class class;
+
+ if (aClassName!=NULL)
+ for (class = self->isa; class!=Nil; class = class_get_super_class(class))
+ if (!strcmp(class_get_class_name(class), aClassName))
+ return YES;
+ return NO;
+}
+
+- (BOOL)isMemberOfClassNamed:(const char *)aClassName
+{
+ return ((aClassName!=NULL)
+ &&!strcmp(class_get_class_name(self->isa), aClassName));
+}
+
++ (BOOL)instancesRespondTo:(SEL)aSel
+{
+ return class_get_instance_method(self, aSel) != (Method_t)0;
+}
+
+- (BOOL)respondsTo:(SEL)aSel
+{
+ return ((object_is_instance(self)
+ ?class_get_instance_method(self->isa, aSel)
+ :class_get_class_method(self->isa, aSel)) != (Method_t)0);
+}
+
++ (IMP)instanceMethodFor:(SEL)aSel
+{
+ return method_get_imp(class_get_instance_method(self, aSel));
+}
+
+// Indicates if the receiving class or instance conforms to the given protocol
+// not usually overridden by subclasses
+//
+// Modified 9/5/94 to always search the class object's protocol list, rather
+// than the meta class.
+
++ (BOOL) conformsTo: (Protocol*)aProtocol
+{
+ size_t i;
+ struct objc_protocol_list* proto_list;
+ id parent;
+
+ for (proto_list = ((Class)self)->protocols;
+ proto_list; proto_list = proto_list->next)
+ {
+ for (i=0; i < proto_list->count; i++)
+ {
+ if ([proto_list->list[i] conformsTo: aProtocol])
+ return YES;
+ }
+ }
+
+ if ((parent = [self superClass]))
+ return [parent conformsTo: aProtocol];
+ else
+ return NO;
+}
+
+- (BOOL) conformsTo: (Protocol*)aProtocol
+{
+ return [[self class] conformsTo:aProtocol];
+}
+
+- (IMP)methodFor:(SEL)aSel
+{
+ return (method_get_imp(object_is_instance(self)
+ ?class_get_instance_method(self->isa, aSel)
+ :class_get_class_method(self->isa, aSel)));
+}
+
++ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel
+{
+ return ((struct objc_method_description *)
+ class_get_instance_method(self, aSel));
+}
+
+- (struct objc_method_description *)descriptionForMethod:(SEL)aSel
+{
+ return ((struct objc_method_description *)
+ (object_is_instance(self)
+ ?class_get_instance_method(self->isa, aSel)
+ :class_get_class_method(self->isa, aSel)));
+}
+
+- perform:(SEL)aSel
+{
+ IMP msg = objc_msg_lookup(self, aSel);
+ if (!msg)
+ return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
+ return (*msg)(self, aSel);
+}
+
+- perform:(SEL)aSel with:anObject
+{
+ IMP msg = objc_msg_lookup(self, aSel);
+ if (!msg)
+ return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
+ return (*msg)(self, aSel, anObject);
+}
+
+- perform:(SEL)aSel with:anObject1 with:anObject2
+{
+ IMP msg = objc_msg_lookup(self, aSel);
+ if (!msg)
+ return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
+ return (*msg)(self, aSel, anObject1, anObject2);
+}
+
+- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame
+{
+ (void) argFrame; /* UNUSED */
+ return (retval_t)[self doesNotRecognize: aSel];
+}
+
+- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame
+{
+ return objc_msg_sendv(self, aSel, argFrame);
+}
+
++ poseAs:(Class)aClassObject
+{
+ return class_pose_as(self, aClassObject);
+}
+
+- (Class)transmuteClassTo:(Class)aClassObject
+{
+ if (object_is_instance(self))
+ if (class_is_class(aClassObject))
+ if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
+ if ([self isKindOf:aClassObject])
+ {
+ Class old_isa = isa;
+ isa = aClassObject;
+ return old_isa;
+ }
+ return nil;
+}
+
+- subclassResponsibility:(SEL)aSel
+{
+ return [self error:"subclass should override %s", sel_get_name(aSel)];
+}
+
+- notImplemented:(SEL)aSel
+{
+ return [self error:"method %s not implemented", sel_get_name(aSel)];
+}
+
+- shouldNotImplement:(SEL)aSel
+{
+ return [self error:"%s should not implement %s",
+ object_get_class_name(self), sel_get_name(aSel)];
+}
+
+- doesNotRecognize:(SEL)aSel
+{
+ return [self error:"%s does not recognize %s",
+ object_get_class_name(self), sel_get_name(aSel)];
+}
+
+- error:(const char *)aString, ...
+{
+#define FMT "error: %s (%s)\n%s\n"
+ char fmt[(strlen((char*)FMT)+strlen((char*)object_get_class_name(self))
+ +((aString!=NULL)?strlen((char*)aString):0)+8)];
+ va_list ap;
+
+ sprintf(fmt, FMT, object_get_class_name(self),
+ object_is_instance(self)?"instance":"class",
+ (aString!=NULL)?aString:"");
+ va_start(ap, aString);
+ objc_verror(self, OBJC_ERR_UNKNOWN, fmt, ap);
+ va_end(ap);
+ return nil;
+#undef FMT
+}
+
++ (int)version
+{
+ return class_get_version(self);
+}
+
++ setVersion:(int)aVersion
+{
+ class_set_version(self, aVersion);
+ return self;
+}
+
++ (int)streamVersion: (TypedStream*)aStream
+{
+ if (aStream->mode == OBJC_READONLY)
+ return objc_get_stream_class_version (aStream, self);
+ else
+ return class_get_version (self);
+}
+
+// These are used to write or read the instance variables
+// declared in this particular part of the object. Subclasses
+// should extend these, by calling [super read/write: aStream]
+// before doing their own archiving. These methods are private, in
+// the sense that they should only be called from subclasses.
+
+- read: (TypedStream*)aStream
+{
+ (void) aStream; /* UNUSED */
+ // [super read: aStream];
+ return self;
+}
+
+- write: (TypedStream*)aStream
+{
+ (void) aStream; /* UNUSED */
+ // [super write: aStream];
+ return self;
+}
+
+- awake
+{
+ // [super awake];
+ return self;
+}
+
+@end
diff --git a/libobjc/Protocol.m b/libobjc/Protocol.m
new file mode 100644
index 000000000..7c9207510
--- /dev/null
+++ b/libobjc/Protocol.m
@@ -0,0 +1,120 @@
+/* This file contains the implementation of class Protocol.
+ Copyright (C) 1993, 2004, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h"
+#include "objc/Protocol.h"
+
+@implementation Protocol
+- (BOOL) isEqual: (id)obj
+{
+ return protocol_isEqual (self, obj);
+}
+@end
+
+@implementation Protocol (Deprecated)
+
+- (const char *)name
+{
+ return protocol_name;
+}
+
+- (BOOL) conformsTo: (Protocol *)aProtocolObject
+{
+ return protocol_conformsToProtocol (self, aProtocolObject);
+}
+
+- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel
+{
+ int i;
+ struct objc_protocol_list* proto_list;
+ struct objc_method_description *result;
+
+ if (instance_methods)
+ for (i = 0; i < instance_methods->count; i++)
+ {
+ if (sel_isEqual (instance_methods->list[i].name, aSel))
+ return &(instance_methods->list[i]);
+ }
+
+ for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
+ {
+ size_t j;
+ for (j=0; j < proto_list->count; j++)
+ {
+ if ((result = [proto_list->list[j]
+ descriptionForInstanceMethod: aSel]))
+ return result;
+ }
+ }
+
+ return NULL;
+}
+
+- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
+{
+ int i;
+ struct objc_protocol_list* proto_list;
+ struct objc_method_description *result;
+
+ if (class_methods)
+ for (i = 0; i < class_methods->count; i++)
+ {
+ if (sel_isEqual (class_methods->list[i].name, aSel))
+ return &(class_methods->list[i]);
+ }
+
+ for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
+ {
+ size_t j;
+ for (j=0; j < proto_list->count; j++)
+ {
+ if ((result = [proto_list->list[j]
+ descriptionForClassMethod: aSel]))
+ return result;
+ }
+ }
+
+ return NULL;
+}
+
+- (unsigned) hash
+{
+ /* Compute a hash of the protocol_name; use the same hash algorithm
+ that we use for class names; protocol names and class names are
+ somewhat similar types of string spaces. */
+ int hash = 0, index;
+
+ for (index = 0; protocol_name[index] != '\0'; index++)
+ {
+ hash = (hash << 4) ^ (hash >> 28) ^ protocol_name[index];
+ }
+
+ hash = (hash ^ (hash >> 10) ^ (hash >> 20));
+
+ return hash;
+}
+
+@end
diff --git a/libobjc/README b/libobjc/README
new file mode 100644
index 000000000..093116fd5
--- /dev/null
+++ b/libobjc/README
@@ -0,0 +1,104 @@
+
+GNU Objective C notes
+*********************
+
+This document is to explain what has been done, and a little about how
+specific features differ from other implementations. The runtime has
+been completely rewritten in gcc 2.4. The earlier runtime had several
+severe bugs and was rather incomplete. The compiler has had several
+new features added as well.
+
+This is not documentation for Objective C, it is usable to someone
+who knows Objective C from somewhere else.
+
+
+Runtime API functions
+=====================
+
+The runtime is modeled after the NeXT Objective C runtime. That is,
+most functions have semantics as it is known from the NeXT. The
+names, however, have changed. All runtime API functions have names
+of lowercase letters and underscores as opposed to the
+`traditional' mixed case names.
+ The runtime api functions are not documented as of now.
+Someone offered to write it, and did it, but we were not allowed to
+use it by his university (Very sad story). We have started writing
+the documentation over again. This will be announced in appropriate
+places when it becomes available.
+
+
+Protocols
+=========
+
+Protocols are now fully supported. The semantics is exactly as on the
+NeXT. There is a flag to specify how protocols should be typechecked
+when adopted to classes. The normal typechecker requires that all
+methods in a given protocol must be implemented in the class that
+adopts it -- it is not enough to inherit them. The flag
+`-Wno-protocol' causes it to allow inherited methods, while
+`-Wprotocols' is the default which requires them defined.
+
+
++load
+===========
+This method, if defined, is called for each class and category
+implementation when the class is loaded into the runtime. This method
+is not inherited, and is thus not called for a subclass that doesn't
+define it itself. Thus, each +load method is called exactly once by
+the runtime. The runtime invocation of this method is thread safe.
+
+
++initialize
+===========
+
+This method, if defined, is called before any other instance or class
+methods of that particular class. For the GNU runtime, this method is
+not inherited, and is thus not called as initializer for a subclass that
+doesn't define it itself. Thus, each +initialize method is called exactly
+once by the runtime (or never if no methods of that particular class is
+never called). It is wise to guard against multiple invocations anyway
+to remain portable with the NeXT runtime. The runtime invocation of
+this method is thread safe.
+
+
+Passivation/Activation/Typedstreams
+===================================
+
+This is supported in the style of NeXT TypedStream's. Consult the
+headerfile Typedstreams.h for api functions. I (Kresten) have
+rewritten it in Objective C, but this implementation is not part of
+2.4, it is available from the GNU Objective C prerelease archive.
+ There is one difference worth noting concerning objects stored with
+objc_write_object_reference (aka NXWriteObjectReference). When these
+are read back in, their object is not guaranteed to be available until
+the `-awake' method is called in the object that requests that object.
+To objc_read_object you must pass a pointer to an id, which is valid
+after exit from the function calling it (like e.g. an instance
+variable). In general, you should not use objects read in until the
+-awake method is called.
+
+
+Acknowledgements
+================
+
+The GNU Objective C team: Geoffrey Knauth <gsk@marble.com> (manager),
+Tom Wood <wood@next.com> (compiler) and Kresten Krab Thorup
+<krab@iesd.auc.dk> (runtime) would like to thank a some people for
+participating in the development of the present GNU Objective C.
+
+Paul Burchard <burchard@geom.umn.edu> and Andrew McCallum
+<mccallum@cs.rochester.edu> has been very helpful debugging the
+runtime. Eric Herring <herring@iesd.auc.dk> has been very helpful
+cleaning up after the documentation-copyright disaster and is now
+helping with the new documentation.
+
+Steve Naroff <snaroff@next.com> and Richard Stallman
+<rms@gnu.ai.mit.edu> has been very helpful with implementation details
+in the compiler.
+
+
+Bug Reports
+===========
+
+Please read the section `Submitting Bugreports' of the gcc manual
+before you submit any bugs.
diff --git a/libobjc/THREADS b/libobjc/THREADS
new file mode 100644
index 000000000..5004b2cbc
--- /dev/null
+++ b/libobjc/THREADS
@@ -0,0 +1,339 @@
+This file describes in little detail the modifications to the
+Objective-C runtime needed to make it thread safe.
+
+First off, kudos to Galen Hunt who is the author of this great work.
+
+If you have an comments or just want to know where to
+send me money to express your undying gratitude for threading the
+Objective-C runtime you can reach Galen at:
+
+ gchunt@cs.rochester.edu
+
+Any questions, comments, bug reports, etc. should send email either to the
+GCC bug account or to:
+
+ Scott Christley <scottc@net-community.com>
+
+* Sarray Threading:
+
+The most critical component of the Objective-C runtime is the sparse array
+structure (sarray). Sarrays store object selectors and implementations.
+Following in the tradition of the Objective-C runtime, my threading
+support assumes that fast message dispatching is far more important
+than *ANY* and *ALL* other operations. The message dispatching thus
+uses *NO* locks on any kind. In fact, if you look in sarray.h, you
+will notice that the message dispatching has not been modified.
+Instead, I have modified the sarray management functions so that all
+updates to the sarray data structure can be made in parallel will
+message dispatching.
+
+To support concurrent message dispatching, no dynamically allocated
+sarray data structures are freed while more than one thread is
+operational. Sarray data structures that are no longer in use are
+kept in a linked list of garbage and are released whenever the program
+is operating with a single thread. The programmer can also flush the
+garbage list by calling sarray_remove_garbage when the programmer can
+ensure that no message dispatching is taking place concurrently. The
+amount of un-reclaimed sarray garbage should normally be extremely
+small in a real program as sarray structures are freed only when using
+the "poseAs" functionality and early in program initialization, which
+normally occurs while the program is single threaded.
+
+******************************************************************************
+* Static Variables:
+
+The following variables are either statically or globally defined. This list
+does not include variables which are internal to implementation dependent
+versions of thread-*.c.
+
+The following threading designations are used:
+ SAFE : Implicitly thread safe.
+ SINGLE : Must only be used in single thread mode.
+ MUTEX : Protected by single global mutex objc_runtime_mutex.
+ UNUSED : Not used in the runtime.
+
+Variable Name: Usage: Defined: Also used in:
+=========================== ====== ============ =====================
+__objc_class_hash MUTEX class.c
+__objc_class_links_resolved UNUSED class.c runtime.h
+__objc_class_number MUTEX class.c
+__objc_dangling_categories UNUSED init.c
+__objc_module_list MUTEX init.c
+__objc_selector_array MUTEX selector.c
+__objc_selector_hash MUTEX selector.c
+__objc_selector_max_index MUTEX selector.c sendmsg.c runtime.h
+__objc_selector_names MUTEX selector.c
+__objc_thread_exit_status SAFE thread.c
+__objc_uninstalled_dtable MUTEX sendmsg.c selector.c
+_objc_load_callback SAFE init.c objc-api.h
+_objc_lookup_class SAFE class.c objc-api.h
+_objc_object_alloc SINGLE objects.c objc-api.h
+_objc_object_copy SINGLE objects.c objc-api.h
+_objc_object_dispose SINGLE objects.c objc-api.h
+frwd_sel SAFE2 sendmsg.c
+idxsize MUTEX sarray.c sendmsg.c sarray.h
+initialize_sel SAFE2 sendmsg.c
+narrays MUTEX sarray.c sendmsg.c sarray.h
+nbuckets MUTEX sarray.c sendmsg.c sarray.h
+nindices MUTEX sarray.c sarray.h
+previous_constructors SAFE1 init.c
+proto_class SAFE1 init.c
+unclaimed_categories MUTEX init.c
+unclaimed_proto_list MUTEX init.c
+uninitialized_statics MUTEX init.c
+
+Notes:
+1) Initialized once in unithread mode.
+2) Initialized value will always be same, guaranteed by lock on selector
+ hash table.
+
+
+******************************************************************************
+* Frontend/Backend design:
+
+The design of the Objective-C runtime thread and mutex functions utilizes a
+frontend/backend implementation.
+
+The frontend, as characterized by the files thr.h and thr.c, is a set
+of platform independent structures and functions which represent the
+user interface. For example, objc_mutex_lock(). Objective-C programs
+should use these structures and functions for their thread and mutex
+work if they wish to maintain a high degree of portability across
+platforms.
+
+The backend is currently GCC's gthread code (gthr.h and related). For
+example, __gthread_objc_mutex_lock(). The thread system is
+automatically configured when GCC is configured. On most platforms
+this thread backend is able to automatically switch to non-multi-threaded
+mode if the threading library is not linked in.
+
+If you want to compile libobjc standalone, then you would need to modify
+the configure.in and makefiles for it and you need to import the
+gthread code from GCC.
+
+******************************************************************************
+* Threads:
+
+The thread system attempts to create multiple threads using whatever
+operating system or library thread support is available. It does
+assume that all system functions are thread safe. Notably this means
+that the system implementation of malloc and free must be thread safe.
+If a system has multiple processors, the threads are configured for
+full parallel processing.
+
+* Backend initialization functions
+
+__objc_init_thread_system(void), int
+ Initialize the thread subsystem. Called once by __objc_exec_class.
+ Return -1 if error otherwise return 0.
+
+__objc_close_thread_system(void), int
+ Closes the thread subsystem, not currently guaranteed to be called.
+ Return -1 if error otherwise return 0.
+
+*****
+* Frontend thread functions
+* User programs should use these functions.
+
+objc_thread_detach(SEL selector, id object, id argument), objc_thread_t
+ Creates and detaches a new thread. The new thread starts by
+ sending the given selector with a single argument to the
+ given object.
+
+objc_thread_set_priority(int priority), int
+ Sets a thread's relative priority within the program. Valid
+ options are:
+
+ OBJC_THREAD_INTERACTIVE_PRIORITY
+ OBJC_THREAD_BACKGROUND_PRIORITY
+ OBJC_THREAD_LOW_PRIORITY
+
+objc_thread_get_priority(void), int
+ Query a thread's priority.
+
+objc_thread_yield(void), void
+ Yields processor to another thread with equal or higher
+ priority. It is up to the system scheduler to determine if
+ the processor is taken or not.
+
+objc_thread_exit(void), int
+ Terminates a thread. If this is the last thread executing
+ then the program will terminate.
+
+objc_thread_id(void), int
+ Returns the current thread's id.
+
+objc_thread_set_data(void *value), int
+ Set a pointer to the thread's local storage. Local storage is
+ thread specific.
+
+objc_thread_get_data(void), void *
+ Returns the pointer to the thread's local storage.
+
+*****
+* Backend thread functions
+* User programs should *NOT* directly call these functions.
+
+__gthr_objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t
+ Spawns a new thread executing func, called by objc_thread_detach.
+ Return NULL if error otherwise return thread id.
+
+__gthr_objc_thread_set_priority(int priority), int
+ Set the thread's priority, called by objc_thread_set_priority.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_thread_get_priority(void), int
+ Query a thread's priority, called by objc_thread_get_priority.
+ Return -1 if error otherwise return the priority.
+
+__gthr_objc_thread_yield(void), void
+ Yields the processor, called by objc_thread_yield.
+
+__gthr_objc_thread_exit(void), int
+ Terminates the thread, called by objc_thread_exit.
+ Return -1 if error otherwise function does not return.
+
+__gthr_objc_thread_id(void), objc_thread_t
+ Returns the current thread's id, called by objc_thread_id.
+ Return -1 if error otherwise return thread id.
+
+__gthr_objc_thread_set_data(void *value), int
+ Set pointer for thread local storage, called by objc_thread_set_data.
+ Returns -1 if error otherwise return 0.
+
+__gthr_objc_thread_get_data(void), void *
+ Returns the pointer to the thread's local storage.
+ Returns NULL if error, called by objc_thread_get_data.
+
+
+******************************************************************************
+* Mutexes:
+
+Mutexes can be locked recursively. Each locked mutex remembers
+its owner (by thread id) and how many times it has been locked. The
+last unlock on a mutex removes the system lock and allows other
+threads to access the mutex.
+
+*****
+* Frontend mutex functions
+* User programs should use these functions.
+
+objc_mutex_allocate(void), objc_mutex_t
+ Allocates a new mutex. Mutex is initially unlocked.
+ Return NULL if error otherwise return mutex pointer.
+
+objc_mutex_deallocate(objc_mutex_t mutex), int
+ Free a mutex. Before freeing the mutex, makes sure that no
+ one else is using it.
+ Return -1 if error otherwise return 0.
+
+objc_mutex_lock(objc_mutex_t mutex), int
+ Locks a mutex. As mentioned earlier, the same thread may call
+ this routine repeatedly.
+ Return -1 if error otherwise return 0.
+
+objc_mutex_trylock(objc_mutex_t mutex), int
+ Attempts to lock a mutex. If lock on mutex can be acquired
+ then function operates exactly as objc_mutex_lock.
+ Return -1 if failed to acquire lock otherwise return 0.
+
+objc_mutex_unlock(objc_mutex_t mutex), int
+ Unlocks the mutex by one level. Other threads may not acquire
+ the mutex until this thread has released all locks on it.
+ Return -1 if error otherwise return 0.
+
+*****
+* Backend mutex functions
+* User programs should *NOT* directly call these functions.
+
+__gthr_objc_mutex_allocate(objc_mutex_t mutex), int
+ Allocates a new mutex, called by objc_mutex_allocate.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_mutex_deallocate(objc_mutex_t mutex), int
+ Free a mutex, called by objc_mutex_deallocate.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_mutex_lock(objc_mutex_t mutex), int
+ Locks a mutex, called by objc_mutex_lock.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_mutex_trylock(objc_mutex_t mutex), int
+ Attempts to lock a mutex, called by objc_mutex_trylock.
+ Return -1 if failed to acquire lock or error otherwise return 0.
+
+__gthr_objc_mutex_unlock(objc_mutex_t mutex), int
+ Unlocks the mutex, called by objc_mutex_unlock.
+ Return -1 if error otherwise return 0.
+
+******************************************************************************
+* Condition Mutexes:
+
+Mutexes can be locked recursively. Each locked mutex remembers
+its owner (by thread id) and how many times it has been locked. The
+last unlock on a mutex removes the system lock and allows other
+threads to access the mutex.
+
+*
+* Frontend condition mutex functions
+* User programs should use these functions.
+*
+
+objc_condition_allocate(void), objc_condition_t
+ Allocate a condition mutex.
+ Return NULL if error otherwise return condition pointer.
+
+objc_condition_deallocate(objc_condition_t condition), int
+ Deallocate a condition. Note that this includes an implicit
+ condition_broadcast to insure that waiting threads have the
+ opportunity to wake. It is legal to dealloc a condition only
+ if no other thread is/will be using it. Does NOT check for
+ other threads waiting but just wakes them up.
+ Return -1 if error otherwise return 0.
+
+objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
+ Wait on the condition unlocking the mutex until objc_condition_signal()
+ or objc_condition_broadcast() are called for the same condition. The
+ given mutex *must* have the depth 1 so that it can be unlocked
+ here, for someone else can lock it and signal/broadcast the condition.
+ The mutex is used to lock access to the shared data that make up the
+ "condition" predicate.
+ Return -1 if error otherwise return 0.
+
+objc_condition_broadcast(objc_condition_t condition), int
+ Wake up all threads waiting on this condition. It is recommended that
+ the called would lock the same mutex as the threads in
+ objc_condition_wait before changing the "condition predicate"
+ and make this call and unlock it right away after this call.
+ Return -1 if error otherwise return 0.
+
+objc_condition_signal(objc_condition_t condition), int
+ Wake up one thread waiting on this condition.
+ Return -1 if error otherwise return 0.
+
+*
+* Backend condition mutex functions
+* User programs should *NOT* directly call these functions.
+*
+
+__gthr_objc_condition_allocate(objc_condition_t condition), int
+ Allocate a condition mutex, called by objc_condition_allocate.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_condition_deallocate(objc_condition_t condition), int
+ Deallocate a condition, called by objc_condition_deallocate.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
+ Wait on the condition, called by objc_condition_wait.
+ Return -1 if error otherwise return 0 when condition is met.
+
+__gthr_objc_condition_broadcast(objc_condition_t condition), int
+ Wake up all threads waiting on this condition.
+ Called by objc_condition_broadcast.
+ Return -1 if error otherwise return 0.
+
+__gthr_objc_condition_signal(objc_condition_t condition), int
+ Wake up one thread waiting on this condition.
+ Called by objc_condition_signal.
+ Return -1 if error otherwise return 0.
diff --git a/libobjc/accessors.m b/libobjc/accessors.m
new file mode 100644
index 000000000..a47903a6c
--- /dev/null
+++ b/libobjc/accessors.m
@@ -0,0 +1,289 @@
+/* GNU Objective C Runtime accessors functions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/objc.h"
+#include "objc/thr.h"
+#include <string.h> /* For memcpy */
+
+/* This file contains functions that the compiler uses when
+ synthesizing accessors (getters/setters) for properties. The
+ functions are part of the ABI, but are meant to be used by the
+ compiler and not by users; for this reason, they are not declared
+ in public header files. The compiler automatically generates
+ declarations for these functions. */
+
+/* Properties can be "atomic", which requires protecting them from
+ concurrency issues using a lock. Unfortunately, we can't have a
+ lock for each property, so we'll go with a small pool of locks.
+ Any time a property is accessed in an "atomic" way, we pick a
+ random lock from the pool (random, but always the same one for the
+ same property of the same object) and use it to protect access to
+ the property.
+
+ The size of the pool is currently 16. A bigger pool can help
+ reduce contention, ie, reduce the chances that two threads,
+ operating on unrelated properties, will have to wait for each other
+ because the properties use the same lock. 16 seems big enough at
+ the moment. */
+#define ACCESSORS_NUMBER_OF_LOCKS 16
+
+#define ACCESSORS_HASH(POINTER) ((((size_t)POINTER >> 8) ^ (size_t)POINTER) & (ACCESSORS_NUMBER_OF_LOCKS - 1))
+
+static objc_mutex_t accessors_locks[ACCESSORS_NUMBER_OF_LOCKS];
+
+/* This is called at startup to setup the locks. */
+void
+__objc_accessors_init (void)
+{
+ int i;
+
+ for (i = 0; i < ACCESSORS_NUMBER_OF_LOCKS; i++)
+ accessors_locks[i] = objc_mutex_allocate ();
+}
+
+/* The property accessors automatically call various methods from the
+ Foundation library (eg, GNUstep-base). These methods are not
+ implemented here, but we need to declare them so we can compile the
+ runtime. The Foundation library will need to provide
+ implementations of these methods (most likely in the root class,
+ eg, NSObject) as the accessors only work with objects of classes
+ that implement these methods. */
+@interface _libobjcNSObject
+- (id) copyWithZone: (void *)zone;
+- (id) mutableCopyWithZone: (void *)zone;
+@end
+#define COPY(X) [((_libobjcNSObject *)(X)) copyWithZone: NULL]
+#define MUTABLE_COPY(X) [((_libobjcNSObject *)(X)) mutableCopyWithZone: NULL]
+
+
+#if OBJC_WITH_GC
+
+# define AUTORELEASE(X) (X)
+# define RELEASE(X)
+# define RETAIN(X) (X)
+
+#else
+
+@interface _libobjcNSObject (RetainReleaseMethods)
+- (id) autorelease;
+- (oneway void) release;
+- (id) retain;
+@end
+# define AUTORELEASE(X) [((_libobjcNSObject *)(X)) autorelease]
+# define RELEASE(X) [((_libobjcNSObject *)(X)) release]
+# define RETAIN(X) [((_libobjcNSObject *)(X)) retain]
+
+#endif
+
+/* The compiler uses this function when implementing some synthesized
+ getters for properties of type 'id'. */
+id
+objc_getProperty (id self, SEL __attribute__((unused)) _cmd, ptrdiff_t offset, BOOL is_atomic)
+{
+ if (self != nil)
+ {
+ id *pointer_to_ivar = (id *)((char *)self + offset);
+
+
+ if (is_atomic == NO)
+ {
+ /* Note that in this case, we do not RETAIN/AUTORELEASE the
+ returned value. The programmer should do it if it is
+ needed. Since access is non-atomic, other threads can be
+ ignored and the caller has full control of what happens
+ to the object and whether it needs to be RETAINed or not,
+ so it makes sense to leave the decision to him/her. This
+ is also what the Apple/NeXT runtime does. */
+ return *pointer_to_ivar;
+ }
+ else
+ {
+ objc_mutex_t lock = accessors_locks[ACCESSORS_HASH (pointer_to_ivar)];
+ id result;
+
+ objc_mutex_lock (lock);
+ result = RETAIN (*(pointer_to_ivar));
+ objc_mutex_unlock (lock);
+
+ return AUTORELEASE (result);
+ }
+ }
+
+ return nil;
+}
+
+/* The compiler uses this function when implementing some synthesized
+ setters for properties of type 'id'.
+
+ PS: Note how 'should_copy' is declared 'BOOL' but then actually
+ takes values from 0 to 2. This hack was introduced by Apple; we
+ do the same for compatibility reasons. */
+void
+objc_setProperty (id self, SEL __attribute__((unused)) _cmd, ptrdiff_t offset, id new_value, BOOL is_atomic, BOOL should_copy)
+{
+ if (self != nil)
+ {
+ id *pointer_to_ivar = (id *)((char *)self + offset);
+ id retained_value;
+#if !OBJC_WITH_GC
+ id old_value;
+#endif
+
+ switch (should_copy)
+ {
+ case 0: /* retain */
+ {
+ if (*pointer_to_ivar == new_value)
+ return;
+ retained_value = RETAIN (new_value);
+ break;
+ }
+ case 2: /* mutable copy */
+ {
+ retained_value = MUTABLE_COPY (new_value);
+ break;
+ }
+ case 1: /* copy */
+ default:
+ {
+ retained_value = COPY (new_value);
+ break;
+ }
+ }
+
+ if (is_atomic == NO)
+ {
+#if !OBJC_WITH_GC
+ old_value = *pointer_to_ivar;
+#endif
+ *pointer_to_ivar = retained_value;
+ }
+ else
+ {
+ objc_mutex_t lock = accessors_locks[ACCESSORS_HASH (pointer_to_ivar)];
+
+ objc_mutex_lock (lock);
+#if !OBJC_WITH_GC
+ old_value = *pointer_to_ivar;
+#endif
+ *pointer_to_ivar = retained_value;
+ objc_mutex_unlock (lock);
+ }
+#if !OBJC_WITH_GC
+ RELEASE (old_value);
+#endif
+ }
+}
+
+/* The compiler uses this function when implementing some synthesized
+ getters for properties of arbitrary C types. The data is just
+ copied. Compatibility Note: this function does not exist in the
+ Apple/NeXT runtime. */
+void
+objc_getPropertyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL __attribute__((unused)) has_strong)
+{
+ if (is_atomic == NO)
+ memcpy (destination, source, size);
+ else
+ {
+ objc_mutex_t lock = accessors_locks[ACCESSORS_HASH (source)];
+
+ objc_mutex_lock (lock);
+ memcpy (destination, source, size);
+ objc_mutex_unlock (lock);
+ }
+}
+
+/* The compiler uses this function when implementing some synthesized
+ setters for properties of arbitrary C types. The data is just
+ copied. Compatibility Note: this function does not exist in the
+ Apple/NeXT runtime. */
+void
+objc_setPropertyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL __attribute__((unused)) has_strong)
+{
+ if (is_atomic == NO)
+ memcpy (destination, source, size);
+ else
+ {
+ objc_mutex_t lock = accessors_locks[ACCESSORS_HASH (destination)];
+
+ objc_mutex_lock (lock);
+ memcpy (destination, source, size);
+ objc_mutex_unlock (lock);
+ }
+}
+
+/* This is the function that the Apple/NeXT runtime has instead of
+ objc_getPropertyStruct and objc_setPropertyStruct. We include it
+ for API compatibility (just for people who may have used
+ objc_copyStruct on the NeXT runtime thinking it was a public API);
+ the compiler never generates calls to it with the GNU runtime.
+ This function is clumsy because it requires two locks instead of
+ one. */
+void
+objc_copyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL __attribute__((unused)) has_strong)
+{
+ if (is_atomic == NO)
+ memcpy (destination, source, size);
+ else
+ {
+ /* We don't know which one is the property, so we have to lock
+ both. One of them is most likely a temporary buffer in the
+ local stack and we really wouldn't want to lock it (our
+ objc_getPropertyStruct and objc_setPropertyStruct functions
+ don't lock it). Note that if we're locking more than one
+ accessor lock at once, we need to always lock them in the
+ same order to avoid deadlocks. */
+ objc_mutex_t first_lock;
+ objc_mutex_t second_lock;
+
+ if (ACCESSORS_HASH (source) == ACCESSORS_HASH (destination))
+ {
+ /* A lucky collision. */
+ first_lock = accessors_locks[ACCESSORS_HASH (source)];
+ objc_mutex_lock (first_lock);
+ memcpy (destination, source, size);
+ objc_mutex_unlock (first_lock);
+ return;
+ }
+
+ if (ACCESSORS_HASH (source) > ACCESSORS_HASH (destination))
+ {
+ first_lock = accessors_locks[ACCESSORS_HASH (source)];
+ second_lock = accessors_locks[ACCESSORS_HASH (destination)];
+ }
+ else
+ {
+ first_lock = accessors_locks[ACCESSORS_HASH (destination)];
+ second_lock = accessors_locks[ACCESSORS_HASH (source)];
+ }
+
+ objc_mutex_lock (first_lock);
+ objc_mutex_lock (second_lock);
+ memcpy (destination, source, size);
+ objc_mutex_unlock (second_lock);
+ objc_mutex_unlock (first_lock);
+ }
+}
diff --git a/libobjc/acinclude.m4 b/libobjc/acinclude.m4
new file mode 100644
index 000000000..581a5f272
--- /dev/null
+++ b/libobjc/acinclude.m4
@@ -0,0 +1,26 @@
+dnl Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2010
+dnl Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+m4_include(../config/acx.m4)
+m4_include(../config/no-executables.m4)
+m4_include(../config/enable.m4)
+m4_include(../config/tls.m4)
+
+m4_include(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring an installed
+dnl libtool.m4 into aclocal.m4, while still arranging for automake to
+dnl add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[
+AC_DEFUN([AM_PROG_LIBTOOL],)
+AC_DEFUN([AC_LIBTOOL_DLOPEN],)
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
+AC_SUBST(LIBTOOL)
+])
diff --git a/libobjc/aclocal.m4 b/libobjc/aclocal.m4
new file mode 100644
index 000000000..93a97e31a
--- /dev/null
+++ b/libobjc/aclocal.m4
@@ -0,0 +1,204 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
+m4_include([../config/lthostflags.m4])
+m4_include([../config/multi.m4])
+m4_include([../config/override.m4])
+m4_include([acinclude.m4])
diff --git a/libobjc/archive.c b/libobjc/archive.c
new file mode 100644
index 000000000..f691b13b6
--- /dev/null
+++ b/libobjc/archive.c
@@ -0,0 +1,1656 @@
+ /* GNU Objective C Runtime archiving
+ Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004, 2009,
+ 2010 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* This file is entirely deprecated and will be removed. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#include "tconfig.h"
+#include "objc/objc-api.h"
+#include "objc/hash.h"
+#include "objc/objc-list.h"
+#include "objc-private/runtime.h"
+#include "objc/typedstream.h"
+#include "objc/encoding.h"
+#include <stdlib.h>
+
+extern int fflush (FILE *);
+
+#define ROUND(V, A) \
+ ({ typeof (V) __v = (V); typeof (A) __a = (A); \
+ __a * ((__v + __a - 1)/__a); })
+
+#define PTR2LONG(P) (((char *) (P))-(char *) 0)
+#define LONG2PTR(L) (((char *) 0) + (L))
+
+/* Declare some functions... */
+
+static int
+objc_read_class (struct objc_typed_stream *stream, Class *class);
+
+int objc_sizeof_type (const char *type);
+
+static int
+objc_write_use_common (struct objc_typed_stream *stream, unsigned long key);
+
+static int
+objc_write_register_common (struct objc_typed_stream *stream,
+ unsigned long key);
+
+static int
+objc_write_class (struct objc_typed_stream *stream,
+ struct objc_class *class);
+
+const char *objc_skip_type (const char *type);
+
+static void __objc_finish_write_root_object (struct objc_typed_stream *);
+static void __objc_finish_read_root_object (struct objc_typed_stream *);
+
+static inline int
+__objc_code_unsigned_char (unsigned char *buf, unsigned char val)
+{
+ if ((val&_B_VALUE) == val)
+ {
+ buf[0] = val|_B_SINT;
+ return 1;
+ }
+ else
+ {
+ buf[0] = _B_NINT|0x01;
+ buf[1] = val;
+ return 2;
+ }
+}
+
+int
+objc_write_unsigned_char (struct objc_typed_stream *stream,
+ unsigned char value)
+{
+ unsigned char buf[sizeof (unsigned char) + 1];
+ int len = __objc_code_unsigned_char (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_char (unsigned char *buf, signed char val)
+{
+ if (val >= 0)
+ return __objc_code_unsigned_char (buf, val);
+ else
+ {
+ buf[0] = _B_NINT|_B_SIGN|0x01;
+ buf[1] = -val;
+ return 2;
+ }
+}
+
+int
+objc_write_char (struct objc_typed_stream *stream, signed char value)
+{
+ unsigned char buf[sizeof (char) + 1];
+ int len = __objc_code_char (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_unsigned_short (unsigned char *buf, unsigned short val)
+{
+ if ((val&_B_VALUE) == val)
+ {
+ buf[0] = val|_B_SINT;
+ return 1;
+ }
+ else
+ {
+ int c, b;
+
+ buf[0] = _B_NINT;
+
+ for (c = sizeof (short); c != 0; c -= 1)
+ if (((val >> (8*(c - 1)))%0x100) != 0)
+ break;
+
+ buf[0] |= c;
+
+ for (b = 1; c != 0; c--, b++)
+ {
+ buf[b] = (val >> (8*(c - 1)))%0x100;
+ }
+
+ return b;
+ }
+}
+
+int
+objc_write_unsigned_short (struct objc_typed_stream *stream,
+ unsigned short value)
+{
+ unsigned char buf[sizeof (unsigned short) + 1];
+ int len = __objc_code_unsigned_short (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_short (unsigned char *buf, short val)
+{
+ int sign = (val < 0);
+ int size = __objc_code_unsigned_short (buf, sign ? -val : val);
+ if (sign)
+ buf[0] |= _B_SIGN;
+ return size;
+}
+
+int
+objc_write_short (struct objc_typed_stream *stream, short value)
+{
+ unsigned char buf[sizeof (short) + 1];
+ int len = __objc_code_short (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+
+static inline int
+__objc_code_unsigned_int (unsigned char *buf, unsigned int val)
+{
+ if ((val&_B_VALUE) == val)
+ {
+ buf[0] = val|_B_SINT;
+ return 1;
+ }
+ else
+ {
+ int c, b;
+
+ buf[0] = _B_NINT;
+
+ for (c = sizeof (int); c != 0; c -= 1)
+ if (((val >> (8*(c - 1)))%0x100) != 0)
+ break;
+
+ buf[0] |= c;
+
+ for (b = 1; c != 0; c--, b++)
+ {
+ buf[b] = (val >> (8*(c-1)))%0x100;
+ }
+
+ return b;
+ }
+}
+
+int
+objc_write_unsigned_int (struct objc_typed_stream *stream, unsigned int value)
+{
+ unsigned char buf[sizeof (unsigned int) + 1];
+ int len = __objc_code_unsigned_int (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_int (unsigned char *buf, int val)
+{
+ int sign = (val < 0);
+ int size = __objc_code_unsigned_int (buf, sign ? -val : val);
+ if (sign)
+ buf[0] |= _B_SIGN;
+ return size;
+}
+
+int
+objc_write_int (struct objc_typed_stream *stream, int value)
+{
+ unsigned char buf[sizeof (int) + 1];
+ int len = __objc_code_int (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_unsigned_long (unsigned char *buf, unsigned long val)
+{
+ if ((val&_B_VALUE) == val)
+ {
+ buf[0] = val|_B_SINT;
+ return 1;
+ }
+ else
+ {
+ int c, b;
+
+ buf[0] = _B_NINT;
+
+ for (c = sizeof (long); c != 0; c -= 1)
+ if (((val >> (8*(c - 1)))%0x100) != 0)
+ break;
+
+ buf[0] |= c;
+
+ for (b = 1; c != 0; c--, b++)
+ {
+ buf[b] = (val >> (8*(c - 1)))%0x100;
+ }
+
+ return b;
+ }
+}
+
+int
+objc_write_unsigned_long (struct objc_typed_stream *stream,
+ unsigned long value)
+{
+ unsigned char buf[sizeof (unsigned long) + 1];
+ int len = __objc_code_unsigned_long (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+static inline int
+__objc_code_long (unsigned char *buf, long val)
+{
+ int sign = (val < 0);
+ int size = __objc_code_unsigned_long (buf, sign ? -val : val);
+ if (sign)
+ buf[0] |= _B_SIGN;
+ return size;
+}
+
+int
+objc_write_long (struct objc_typed_stream *stream, long value)
+{
+ unsigned char buf[sizeof (long) + 1];
+ int len = __objc_code_long (buf, value);
+ return (*stream->write) (stream->physical, (char*)buf, len);
+}
+
+
+int
+objc_write_string (struct objc_typed_stream *stream,
+ const unsigned char *string, unsigned int nbytes)
+{
+ unsigned char buf[sizeof (unsigned int) + 1];
+ int len = __objc_code_unsigned_int (buf, nbytes);
+
+ if ((buf[0]&_B_CODE) == _B_SINT)
+ buf[0] = (buf[0]&_B_VALUE)|_B_SSTR;
+
+ else /* _B_NINT */
+ buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
+
+ if ((*stream->write) (stream->physical, (char*)buf, len) != 0)
+ return (*stream->write) (stream->physical, (char*)string, nbytes);
+ else
+ return 0;
+}
+
+int
+objc_write_string_atomic (struct objc_typed_stream *stream,
+ unsigned char *string, unsigned int nbytes)
+{
+ unsigned long key;
+ if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table, string))))
+ return objc_write_use_common (stream, key);
+ else
+ {
+ int length;
+ objc_hash_add (&stream->stream_table,
+ LONG2PTR(key=PTR2LONG(string)), string);
+ if ((length = objc_write_register_common (stream, key)))
+ return objc_write_string (stream, string, nbytes);
+ return length;
+ }
+}
+
+static int
+objc_write_register_common (struct objc_typed_stream *stream,
+ unsigned long key)
+{
+ unsigned char buf[sizeof (unsigned long)+2];
+ int len = __objc_code_unsigned_long (buf + 1, key);
+ if (len == 1)
+ {
+ buf[0] = _B_RCOMM|0x01;
+ buf[1] &= _B_VALUE;
+ return (*stream->write) (stream->physical, (char*)buf, len + 1);
+ }
+ else
+ {
+ buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
+ return (*stream->write) (stream->physical, (char*)buf + 1, len);
+ }
+}
+
+static int
+objc_write_use_common (struct objc_typed_stream *stream, unsigned long key)
+{
+ unsigned char buf[sizeof (unsigned long)+2];
+ int len = __objc_code_unsigned_long (buf + 1, key);
+ if (len == 1)
+ {
+ buf[0] = _B_UCOMM|0x01;
+ buf[1] &= _B_VALUE;
+ return (*stream->write) (stream->physical, (char*)buf, 2);
+ }
+ else
+ {
+ buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
+ return (*stream->write) (stream->physical, (char*)buf + 1, len);
+ }
+}
+
+static inline int
+__objc_write_extension (struct objc_typed_stream *stream, unsigned char code)
+{
+ if (code <= _B_VALUE)
+ {
+ unsigned char buf = code|_B_EXT;
+ return (*stream->write) (stream->physical, (char*)&buf, 1);
+ }
+ else
+ {
+ _objc_abort ("__objc_write_extension: bad opcode %c\n", code);
+ return -1;
+ }
+}
+
+int
+__objc_write_object (struct objc_typed_stream *stream, id object)
+{
+ unsigned char buf = '\0';
+ SEL write_sel = sel_get_any_uid ("write:");
+ if (object)
+ {
+ __objc_write_extension (stream, _BX_OBJECT);
+ objc_write_class (stream, object->class_pointer);
+ (*objc_msg_lookup (object, write_sel)) (object, write_sel, stream);
+ return (*stream->write) (stream->physical, (char*)&buf, 1);
+ }
+ else
+ return objc_write_use_common (stream, 0);
+}
+
+int
+objc_write_object_reference (struct objc_typed_stream *stream, id object)
+{
+ unsigned long key;
+ if ((key = PTR2LONG(objc_hash_value_for_key (stream->object_table, object))))
+ return objc_write_use_common (stream, key);
+
+ __objc_write_extension (stream, _BX_OBJREF);
+ return objc_write_unsigned_long (stream, PTR2LONG (object));
+}
+
+int
+objc_write_root_object (struct objc_typed_stream *stream, id object)
+{
+ int len = 0;
+ if (stream->writing_root_p)
+ _objc_abort ("objc_write_root_object called recursively");
+ else
+ {
+ stream->writing_root_p = 1;
+ __objc_write_extension (stream, _BX_OBJROOT);
+ if ((len = objc_write_object (stream, object)))
+ __objc_finish_write_root_object (stream);
+ stream->writing_root_p = 0;
+ }
+ return len;
+}
+
+int
+objc_write_object (struct objc_typed_stream *stream, id object)
+{
+ unsigned long key;
+ if ((key = PTR2LONG(objc_hash_value_for_key (stream->object_table, object))))
+ return objc_write_use_common (stream, key);
+
+ else if (object == nil)
+ return objc_write_use_common (stream, 0);
+
+ else
+ {
+ int length;
+ objc_hash_add (&stream->object_table,
+ LONG2PTR(key=PTR2LONG(object)), object);
+ if ((length = objc_write_register_common (stream, key)))
+ return __objc_write_object (stream, object);
+ return length;
+ }
+}
+
+int
+__objc_write_class (struct objc_typed_stream *stream, struct objc_class *class)
+{
+ __objc_write_extension (stream, _BX_CLASS);
+ objc_write_string_atomic (stream, (unsigned char *) class->name,
+ strlen ((char *) class->name));
+ return objc_write_unsigned_long (stream, class->version);
+}
+
+
+static int
+objc_write_class (struct objc_typed_stream *stream,
+ struct objc_class *class)
+{
+ unsigned long key;
+ if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table, class))))
+ return objc_write_use_common (stream, key);
+ else
+ {
+ int length;
+ objc_hash_add (&stream->stream_table,
+ LONG2PTR(key = PTR2LONG(class)), class);
+ if ((length = objc_write_register_common (stream, key)))
+ return __objc_write_class (stream, class);
+ return length;
+ }
+}
+
+
+int
+__objc_write_selector (struct objc_typed_stream *stream, SEL selector)
+{
+ const char *sel_name;
+ __objc_write_extension (stream, _BX_SEL);
+ /* to handle NULL selectors */
+ if ((SEL)0 == selector)
+ return objc_write_string (stream, (unsigned char*)"", 0);
+ sel_name = sel_get_name (selector);
+ return objc_write_string (stream, (unsigned char*)sel_name, strlen ((char*)sel_name));
+}
+
+int
+objc_write_selector (struct objc_typed_stream *stream, SEL selector)
+{
+ const char *sel_name;
+ unsigned long key;
+
+ /* to handle NULL selectors */
+ if ((SEL)0 == selector)
+ return __objc_write_selector (stream, selector);
+
+ sel_name = sel_get_name (selector);
+ if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table,
+ sel_name))))
+ return objc_write_use_common (stream, key);
+ else
+ {
+ int length;
+ objc_hash_add (&stream->stream_table,
+ LONG2PTR(key = PTR2LONG(sel_name)), (char *) sel_name);
+ if ((length = objc_write_register_common (stream, key)))
+ return __objc_write_selector (stream, selector);
+ return length;
+ }
+}
+
+
+
+/*
+** Read operations
+*/
+
+int
+objc_read_char (struct objc_typed_stream *stream, char *val)
+{
+ unsigned char buf;
+ int len;
+ len = (*stream->read) (stream->physical, (char*)&buf, 1);
+ if (len != 0)
+ {
+ if ((buf & _B_CODE) == _B_SINT)
+ (*val) = (buf & _B_VALUE);
+
+ else if ((buf & _B_NUMBER) == 1)
+ {
+ len = (*stream->read) (stream->physical, val, 1);
+ if (buf&_B_SIGN)
+ (*val) = -1 * (*val);
+ }
+
+ else
+ _objc_abort ("expected 8bit signed int, got %dbit int",
+ (int) (buf&_B_NUMBER)*8);
+ }
+ return len;
+}
+
+
+int
+objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val)
+{
+ unsigned char buf;
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)&buf, 1)))
+ {
+ if ((buf & _B_CODE) == _B_SINT)
+ (*val) = (buf & _B_VALUE);
+
+ else if ((buf & _B_NUMBER) == 1)
+ len = (*stream->read) (stream->physical, (char*)val, 1);
+
+ else
+ _objc_abort ("expected 8bit unsigned int, got %dbit int",
+ (int) (buf&_B_NUMBER)*8);
+ }
+ return len;
+}
+
+int
+objc_read_short (struct objc_typed_stream *stream, short *value)
+{
+ unsigned char buf[sizeof (short) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ {
+ int pos = 1;
+ int nbytes = buf[0] & _B_NUMBER;
+ if (nbytes > (int) sizeof (short))
+ _objc_abort ("expected short, got bigger (%dbits)", nbytes*8);
+ len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
+ (*value) = 0;
+ while (pos <= nbytes)
+ (*value) = ((*value)*0x100) + buf[pos++];
+ if (buf[0] & _B_SIGN)
+ (*value) = -(*value);
+ }
+ }
+ return len;
+}
+
+int
+objc_read_unsigned_short (struct objc_typed_stream *stream,
+ unsigned short *value)
+{
+ unsigned char buf[sizeof (unsigned short) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ {
+ int pos = 1;
+ int nbytes = buf[0] & _B_NUMBER;
+ if (nbytes > (int) sizeof (short))
+ _objc_abort ("expected short, got int or bigger");
+ len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
+ (*value) = 0;
+ while (pos <= nbytes)
+ (*value) = ((*value)*0x100) + buf[pos++];
+ }
+ }
+ return len;
+}
+
+
+int
+objc_read_int (struct objc_typed_stream *stream, int *value)
+{
+ unsigned char buf[sizeof (int) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ {
+ int pos = 1;
+ int nbytes = buf[0] & _B_NUMBER;
+ if (nbytes > (int) sizeof (int))
+ _objc_abort ("expected int, got bigger");
+ len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
+ (*value) = 0;
+ while (pos <= nbytes)
+ (*value) = ((*value)*0x100) + buf[pos++];
+ if (buf[0] & _B_SIGN)
+ (*value) = -(*value);
+ }
+ }
+ return len;
+}
+
+int
+objc_read_long (struct objc_typed_stream *stream, long *value)
+{
+ unsigned char buf[sizeof (long) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ {
+ int pos = 1;
+ int nbytes = buf[0] & _B_NUMBER;
+ if (nbytes > (int) sizeof (long))
+ _objc_abort ("expected long, got bigger");
+ len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
+ (*value) = 0;
+ while (pos <= nbytes)
+ (*value) = ((*value)*0x100) + buf[pos++];
+ if (buf[0] & _B_SIGN)
+ (*value) = -(*value);
+ }
+ }
+ return len;
+}
+
+int
+__objc_read_nbyte_uint (struct objc_typed_stream *stream,
+ unsigned int nbytes, unsigned int *val)
+{
+ int len;
+ unsigned int pos = 0;
+ unsigned char buf[sizeof (unsigned int) + 1];
+
+ if (nbytes > sizeof (int))
+ _objc_abort ("expected int, got bigger");
+
+ len = (*stream->read) (stream->physical, (char*)buf, nbytes);
+ (*val) = 0;
+ while (pos < nbytes)
+ (*val) = ((*val)*0x100) + buf[pos++];
+ return len;
+}
+
+
+int
+objc_read_unsigned_int (struct objc_typed_stream *stream,
+ unsigned int *value)
+{
+ unsigned char buf[sizeof (unsigned int) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), value);
+
+ }
+ return len;
+}
+
+int
+__objc_read_nbyte_ulong (struct objc_typed_stream *stream,
+ unsigned int nbytes, unsigned long *val)
+{
+ int len;
+ unsigned int pos = 0;
+ unsigned char buf[sizeof (unsigned long) + 1];
+
+ if (nbytes > sizeof (long))
+ _objc_abort ("expected long, got bigger");
+
+ len = (*stream->read) (stream->physical, (char*)buf, nbytes);
+ (*val) = 0;
+ while (pos < nbytes)
+ (*val) = ((*val)*0x100) + buf[pos++];
+ return len;
+}
+
+
+int
+objc_read_unsigned_long (struct objc_typed_stream *stream,
+ unsigned long *value)
+{
+ unsigned char buf[sizeof (unsigned long) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ if ((buf[0] & _B_CODE) == _B_SINT)
+ (*value) = (buf[0] & _B_VALUE);
+
+ else
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), value);
+
+ }
+ return len;
+}
+
+int
+objc_read_string (struct objc_typed_stream *stream,
+ char **string)
+{
+ unsigned char buf[sizeof (unsigned int) + 1];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ unsigned long key = 0;
+
+ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
+ {
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ len = (*stream->read) (stream->physical, (char*)buf, 1);
+ }
+
+ switch (buf[0]&_B_CODE) {
+ case _B_SSTR:
+ {
+ int length = buf[0]&_B_VALUE;
+ (*string) = (char*)objc_malloc (length + 1);
+ if (key)
+ objc_hash_add (&stream->stream_table, LONG2PTR(key), *string);
+ len = (*stream->read) (stream->physical, *string, length);
+ (*string)[length] = '\0';
+ }
+ break;
+
+ case _B_UCOMM:
+ {
+ char *tmp;
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ tmp = objc_hash_value_for_key (stream->stream_table, LONG2PTR (key));
+ *string = objc_malloc (strlen (tmp) + 1);
+ strcpy (*string, tmp);
+ }
+ break;
+
+ case _B_NSTR:
+ {
+ unsigned int nbytes = buf[0]&_B_VALUE;
+ len = __objc_read_nbyte_uint (stream, nbytes, &nbytes);
+ if (len) {
+ (*string) = (char*)objc_malloc (nbytes + 1);
+ if (key)
+ objc_hash_add (&stream->stream_table, LONG2PTR(key), *string);
+ len = (*stream->read) (stream->physical, *string, nbytes);
+ (*string)[nbytes] = '\0';
+ }
+ }
+ break;
+
+ default:
+ _objc_abort ("expected string, got opcode %c\n", (buf[0]&_B_CODE));
+ }
+ }
+
+ return len;
+}
+
+
+int
+objc_read_object (struct objc_typed_stream *stream, id *object)
+{
+ unsigned char buf[sizeof (unsigned int)];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ SEL read_sel = sel_get_any_uid ("read:");
+ unsigned long key = 0;
+
+ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */
+ {
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ len = (*stream->read) (stream->physical, (char*)buf, 1);
+ }
+
+ if (buf[0] == (_B_EXT | _BX_OBJECT))
+ {
+ Class class;
+
+ /* get class */
+ len = objc_read_class (stream, &class);
+
+ /* create instance */
+ (*object) = class_create_instance (class);
+
+ /* register? */
+ if (key)
+ objc_hash_add (&stream->object_table, LONG2PTR(key), *object);
+
+ /* send -read: */
+ if (__objc_responds_to (*object, read_sel))
+ (*get_imp (class, read_sel)) (*object, read_sel, stream);
+
+ /* check null-byte */
+ len = (*stream->read) (stream->physical, (char*)buf, 1);
+ if (buf[0] != '\0')
+ _objc_abort ("expected null-byte, got opcode %c", buf[0]);
+ }
+
+ else if ((buf[0]&_B_CODE) == _B_UCOMM)
+ {
+ if (key)
+ _objc_abort ("cannot register use upcode...");
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ (*object) = objc_hash_value_for_key (stream->object_table,
+ LONG2PTR(key));
+ }
+
+ else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */
+ {
+ struct objc_list *other;
+ len = objc_read_unsigned_long (stream, &key);
+ other
+ = (struct objc_list *) objc_hash_value_for_key (stream->object_refs,
+ LONG2PTR(key));
+ objc_hash_add (&stream->object_refs, LONG2PTR(key),
+ (void *)list_cons (object, other));
+ }
+
+ else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */
+ {
+ if (key)
+ _objc_abort ("cannot register root object...");
+ len = objc_read_object (stream, object);
+ __objc_finish_read_root_object (stream);
+ }
+
+ else
+ _objc_abort ("expected object, got opcode %c", buf[0]);
+ }
+ return len;
+}
+
+static int
+objc_read_class (struct objc_typed_stream *stream, Class *class)
+{
+ unsigned char buf[sizeof (unsigned int)];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ unsigned long key = 0;
+
+ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
+ {
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ len = (*stream->read) (stream->physical, (char*)buf, 1);
+ }
+
+ if (buf[0] == (_B_EXT | _BX_CLASS))
+ {
+ char temp[1] = "";
+ char *class_name = temp;
+ unsigned long version;
+
+ /* get class */
+ len = objc_read_string (stream, &class_name);
+ (*class) = objc_get_class (class_name);
+ objc_free (class_name);
+
+ /* register */
+ if (key)
+ objc_hash_add (&stream->stream_table, LONG2PTR(key), *class);
+
+ objc_read_unsigned_long (stream, &version);
+ objc_hash_add (&stream->class_table,
+ (*class)->name, (void *) ((size_t) version));
+ }
+
+ else if ((buf[0]&_B_CODE) == _B_UCOMM)
+ {
+ if (key)
+ _objc_abort ("cannot register use upcode...");
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ *class = objc_hash_value_for_key (stream->stream_table,
+ LONG2PTR(key));
+ if (! *class)
+ _objc_abort ("cannot find class for key %lu", key);
+ }
+
+ else
+ _objc_abort ("expected class, got opcode %c", buf[0]);
+ }
+ return len;
+}
+
+int
+objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
+{
+ unsigned char buf[sizeof (unsigned int)];
+ int len;
+ if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
+ {
+ unsigned long key = 0;
+
+ if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
+ {
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ len = (*stream->read) (stream->physical, (char*)buf, 1);
+ }
+
+ if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
+ {
+ char temp[1] = "";
+ char *selector_name = temp;
+
+ /* get selector */
+ len = objc_read_string (stream, &selector_name);
+ /* To handle NULL selectors */
+ if (0 == strlen (selector_name))
+ {
+ (*selector) = (SEL)0;
+ return 0;
+ }
+ else
+ (*selector) = sel_get_any_uid (selector_name);
+ objc_free (selector_name);
+
+ /* register */
+ if (key)
+ objc_hash_add (&stream->stream_table,
+ LONG2PTR(key), (void *) *selector);
+ }
+
+ else if ((buf[0]&_B_CODE) == _B_UCOMM)
+ {
+ if (key)
+ _objc_abort ("cannot register use upcode...");
+ len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
+ (*selector) = objc_hash_value_for_key (stream->stream_table,
+ LONG2PTR(key));
+ }
+
+ else
+ _objc_abort ("expected selector, got opcode %c", buf[0]);
+ }
+ return len;
+}
+
+/*
+** USER LEVEL FUNCTIONS
+*/
+
+/*
+** Write one object, encoded in TYPE and pointed to by DATA to the
+** typed stream STREAM.
+*/
+
+int
+objc_write_type (TypedStream *stream, const char *type, const void *data)
+{
+ switch (*type) {
+ case _C_ID:
+ return objc_write_object (stream, *(id *) data);
+ break;
+
+ case _C_CLASS:
+ return objc_write_class (stream, *(Class *) data);
+ break;
+
+ case _C_SEL:
+ return objc_write_selector (stream, *(SEL *) data);
+ break;
+
+ case _C_CHR:
+ return objc_write_char (stream, *(signed char *) data);
+ break;
+
+ case _C_UCHR:
+ return objc_write_unsigned_char (stream, *(unsigned char *) data);
+ break;
+
+ case _C_SHT:
+ return objc_write_short (stream, *(short *) data);
+ break;
+
+ case _C_USHT:
+ return objc_write_unsigned_short (stream, *(unsigned short *) data);
+ break;
+
+ case _C_INT:
+ return objc_write_int (stream, *(int *) data);
+ break;
+
+ case _C_UINT:
+ return objc_write_unsigned_int (stream, *(unsigned int *) data);
+ break;
+
+ case _C_LNG:
+ return objc_write_long (stream, *(long *) data);
+ break;
+
+ case _C_ULNG:
+ return objc_write_unsigned_long (stream, *(unsigned long *) data);
+ break;
+
+ case _C_CHARPTR:
+ return objc_write_string (stream,
+ *(unsigned char **) data, strlen (*(char **) data));
+ break;
+
+ case _C_ATOM:
+ return objc_write_string_atomic (stream, *(unsigned char **) data,
+ strlen (*(char **) data));
+ break;
+
+ case _C_ARY_B:
+ {
+ int len = atoi (type + 1);
+ while (isdigit ((unsigned char) *++type))
+ ;
+ return objc_write_array (stream, type, len, data);
+ }
+ break;
+
+ case _C_STRUCT_B:
+ {
+ int acc_size = 0;
+ int align;
+ while (*type != _C_STRUCT_E && *type++ != '=')
+ ; /* skip "<name>=" */
+ while (*type != _C_STRUCT_E)
+ {
+ align = objc_alignof_type (type); /* padd to alignment */
+ acc_size = ROUND (acc_size, align);
+ objc_write_type (stream, type, ((char *) data) + acc_size);
+ acc_size += objc_sizeof_type (type); /* add component size */
+ type = objc_skip_typespec (type); /* skip component */
+ }
+ return 1;
+ }
+
+ default:
+ {
+ _objc_abort ("objc_write_type: cannot parse typespec: %s\n", type);
+ return 0;
+ }
+ }
+}
+
+/*
+** Read one object, encoded in TYPE and pointed to by DATA to the
+** typed stream STREAM. DATA specifies the address of the types to
+** read. Expected type is checked against the type actually present
+** on the stream.
+*/
+
+int
+objc_read_type(TypedStream *stream, const char *type, void *data)
+{
+ char c;
+ switch (c = *type) {
+ case _C_ID:
+ return objc_read_object (stream, (id*)data);
+ break;
+
+ case _C_CLASS:
+ return objc_read_class (stream, (Class*)data);
+ break;
+
+ case _C_SEL:
+ return objc_read_selector (stream, (SEL*)data);
+ break;
+
+ case _C_CHR:
+ return objc_read_char (stream, (char*)data);
+ break;
+
+ case _C_UCHR:
+ return objc_read_unsigned_char (stream, (unsigned char*)data);
+ break;
+
+ case _C_SHT:
+ return objc_read_short (stream, (short*)data);
+ break;
+
+ case _C_USHT:
+ return objc_read_unsigned_short (stream, (unsigned short*)data);
+ break;
+
+ case _C_INT:
+ return objc_read_int (stream, (int*)data);
+ break;
+
+ case _C_UINT:
+ return objc_read_unsigned_int (stream, (unsigned int*)data);
+ break;
+
+ case _C_LNG:
+ return objc_read_long (stream, (long*)data);
+ break;
+
+ case _C_ULNG:
+ return objc_read_unsigned_long (stream, (unsigned long*)data);
+ break;
+
+ case _C_CHARPTR:
+ case _C_ATOM:
+ return objc_read_string (stream, (char**)data);
+ break;
+
+ case _C_ARY_B:
+ {
+ int len = atoi (type + 1);
+ while (isdigit ((unsigned char) *++type))
+ ;
+ return objc_read_array (stream, type, len, data);
+ }
+ break;
+
+ case _C_STRUCT_B:
+ {
+ int acc_size = 0;
+ int align;
+ while (*type != _C_STRUCT_E && *type++ != '=')
+ ; /* skip "<name>=" */
+ while (*type != _C_STRUCT_E)
+ {
+ align = objc_alignof_type (type); /* padd to alignment */
+ acc_size = ROUND (acc_size, align);
+ objc_read_type (stream, type, ((char*)data)+acc_size);
+ acc_size += objc_sizeof_type (type); /* add component size */
+ type = objc_skip_typespec (type); /* skip component */
+ }
+ return 1;
+ }
+
+ default:
+ {
+ _objc_abort ("objc_read_type: cannot parse typespec: %s\n", type);
+ return 0;
+ }
+ }
+}
+
+/*
+** Write the object specified by the template TYPE to STREAM. Last
+** arguments specify addresses of values to be written. It might
+** seem surprising to specify values by address, but this is extremely
+** convenient for copy-paste with objc_read_types calls. A more
+** down-to-the-earth cause for this passing of addresses is that values
+** of arbitrary size is not well supported in ANSI C for functions with
+** variable number of arguments.
+*/
+
+int
+objc_write_types (TypedStream *stream, const char *type, ...)
+{
+ va_list args;
+ const char *c;
+ int res = 0;
+
+ va_start(args, type);
+
+ for (c = type; *c; c = objc_skip_typespec (c))
+ {
+ switch (*c) {
+ case _C_ID:
+ res = objc_write_object (stream, *va_arg (args, id*));
+ break;
+
+ case _C_CLASS:
+ res = objc_write_class (stream, *va_arg (args, Class*));
+ break;
+
+ case _C_SEL:
+ res = objc_write_selector (stream, *va_arg (args, SEL*));
+ break;
+
+ case _C_CHR:
+ res = objc_write_char (stream, *va_arg (args, char*));
+ break;
+
+ case _C_UCHR:
+ res = objc_write_unsigned_char (stream,
+ *va_arg (args, unsigned char*));
+ break;
+
+ case _C_SHT:
+ res = objc_write_short (stream, *va_arg (args, short*));
+ break;
+
+ case _C_USHT:
+ res = objc_write_unsigned_short (stream,
+ *va_arg (args, unsigned short*));
+ break;
+
+ case _C_INT:
+ res = objc_write_int(stream, *va_arg (args, int*));
+ break;
+
+ case _C_UINT:
+ res = objc_write_unsigned_int(stream, *va_arg (args, unsigned int*));
+ break;
+
+ case _C_LNG:
+ res = objc_write_long(stream, *va_arg (args, long*));
+ break;
+
+ case _C_ULNG:
+ res = objc_write_unsigned_long(stream, *va_arg (args, unsigned long*));
+ break;
+
+ case _C_CHARPTR:
+ {
+ unsigned char **str = va_arg (args, unsigned char **);
+ res = objc_write_string (stream, *str, strlen ((char*)*str));
+ }
+ break;
+
+ case _C_ATOM:
+ {
+ unsigned char **str = va_arg (args, unsigned char **);
+ res = objc_write_string_atomic (stream, *str, strlen ((char*)*str));
+ }
+ break;
+
+ case _C_ARY_B:
+ {
+ int len = atoi (c + 1);
+ const char *t = c;
+ while (isdigit ((unsigned char) *++t))
+ ;
+ res = objc_write_array (stream, t, len, va_arg (args, void *));
+ t = objc_skip_typespec (t);
+ if (*t != _C_ARY_E)
+ _objc_abort ("expected `]', got: %s", t);
+ }
+ break;
+
+ default:
+ _objc_abort ("objc_write_types: cannot parse typespec: %s\n", type);
+ }
+ }
+ va_end(args);
+ return res;
+}
+
+
+/*
+** Last arguments specify addresses of values to be read. Expected
+** type is checked against the type actually present on the stream.
+*/
+
+int
+objc_read_types(TypedStream *stream, const char *type, ...)
+{
+ va_list args;
+ const char *c;
+ int res = 0;
+
+ va_start (args, type);
+
+ for (c = type; *c; c = objc_skip_typespec(c))
+ {
+ switch (*c) {
+ case _C_ID:
+ res = objc_read_object(stream, va_arg (args, id*));
+ break;
+
+ case _C_CLASS:
+ res = objc_read_class(stream, va_arg (args, Class*));
+ break;
+
+ case _C_SEL:
+ res = objc_read_selector(stream, va_arg (args, SEL*));
+ break;
+
+ case _C_CHR:
+ res = objc_read_char(stream, va_arg (args, char*));
+ break;
+
+ case _C_UCHR:
+ res = objc_read_unsigned_char(stream, va_arg (args, unsigned char*));
+ break;
+
+ case _C_SHT:
+ res = objc_read_short(stream, va_arg (args, short*));
+ break;
+
+ case _C_USHT:
+ res = objc_read_unsigned_short(stream, va_arg (args, unsigned short*));
+ break;
+
+ case _C_INT:
+ res = objc_read_int(stream, va_arg (args, int*));
+ break;
+
+ case _C_UINT:
+ res = objc_read_unsigned_int(stream, va_arg (args, unsigned int*));
+ break;
+
+ case _C_LNG:
+ res = objc_read_long(stream, va_arg (args, long*));
+ break;
+
+ case _C_ULNG:
+ res = objc_read_unsigned_long(stream, va_arg (args, unsigned long*));
+ break;
+
+ case _C_CHARPTR:
+ case _C_ATOM:
+ {
+ char **str = va_arg (args, char **);
+ res = objc_read_string (stream, str);
+ }
+ break;
+
+ case _C_ARY_B:
+ {
+ int len = atoi (c + 1);
+ const char *t = c;
+ while (isdigit ((unsigned char) *++t))
+ ;
+ res = objc_read_array (stream, t, len, va_arg (args, void *));
+ t = objc_skip_typespec (t);
+ if (*t != _C_ARY_E)
+ _objc_abort ("expected `]', got: %s", t);
+ }
+ break;
+
+ default:
+ _objc_abort ("objc_read_types: cannot parse typespec: %s\n", type);
+ }
+ }
+ va_end (args);
+ return res;
+}
+
+/*
+** Write an array of COUNT elements of TYPE from the memory address DATA.
+** This is equivalent of objc_write_type (stream, "[N<type>]", data)
+*/
+
+int
+objc_write_array (TypedStream *stream, const char *type,
+ int count, const void *data)
+{
+ int off = objc_sizeof_type(type);
+ const char *where = data;
+
+ while (count-- > 0)
+ {
+ objc_write_type(stream, type, where);
+ where += off;
+ }
+ return 1;
+}
+
+/*
+** Read an array of COUNT elements of TYPE into the memory address
+** DATA. The memory pointed to by data is supposed to be allocated
+** by the callee. This is equivalent of
+** objc_read_type (stream, "[N<type>]", data)
+*/
+
+int
+objc_read_array (TypedStream *stream, const char *type,
+ int count, void *data)
+{
+ int off = objc_sizeof_type(type);
+ char *where = (char*)data;
+
+ while (count-- > 0)
+ {
+ objc_read_type(stream, type, where);
+ where += off;
+ }
+ return 1;
+}
+
+static int
+__objc_fread (FILE *file, char *data, int len)
+{
+ return fread(data, len, 1, file);
+}
+
+static int
+__objc_fwrite (FILE *file, char *data, int len)
+{
+ return fwrite(data, len, 1, file);
+}
+
+static int
+__objc_feof (FILE *file)
+{
+ return feof(file);
+}
+
+static int
+__objc_no_write (FILE *file __attribute__ ((__unused__)),
+ const char *data __attribute__ ((__unused__)),
+ int len __attribute__ ((__unused__)))
+{
+ _objc_abort ("TypedStream not open for writing");
+ return 0;
+}
+
+static int
+__objc_no_read (FILE *file __attribute__ ((__unused__)),
+ const char *data __attribute__ ((__unused__)),
+ int len __attribute__ ((__unused__)))
+{
+ _objc_abort ("TypedStream not open for reading");
+ return 0;
+}
+
+static int
+__objc_read_typed_stream_signature (TypedStream *stream)
+{
+ char buffer[80];
+ int pos = 0;
+ do
+ (*stream->read) (stream->physical, buffer+pos, 1);
+ while (buffer[pos++] != '\0')
+ ;
+ sscanf (buffer, "GNU TypedStream %d", &stream->version);
+ if (stream->version != OBJC_TYPED_STREAM_VERSION)
+ _objc_abort ("cannot handle TypedStream version %d", stream->version);
+ return 1;
+}
+
+static int
+__objc_write_typed_stream_signature (TypedStream *stream)
+{
+ char buffer[80];
+ sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION);
+ stream->version = OBJC_TYPED_STREAM_VERSION;
+ (*stream->write) (stream->physical, buffer, strlen (buffer) + 1);
+ return 1;
+}
+
+static void __objc_finish_write_root_object(struct objc_typed_stream *stream)
+{
+ objc_hash_delete (stream->object_table);
+ stream->object_table = objc_hash_new (64,
+ (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+}
+
+static void __objc_finish_read_root_object(struct objc_typed_stream *stream)
+{
+ node_ptr node;
+ SEL awake_sel = sel_get_any_uid ("awake");
+ cache_ptr free_list = objc_hash_new (64,
+ (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+
+ /* resolve object forward references */
+ for (node = objc_hash_next (stream->object_refs, NULL); node;
+ node = objc_hash_next (stream->object_refs, node))
+ {
+ struct objc_list *reflist = node->value;
+ const void *key = node->key;
+ id object = objc_hash_value_for_key (stream->object_table, key);
+ while (reflist)
+ {
+ *((id*) reflist->head) = object;
+ if (objc_hash_value_for_key (free_list,reflist) == NULL)
+ objc_hash_add (&free_list,reflist,reflist);
+
+ reflist = reflist->tail;
+ }
+ }
+
+ /* apply __objc_free to all objects stored in free_list */
+ for (node = objc_hash_next (free_list, NULL); node;
+ node = objc_hash_next (free_list, node))
+ objc_free ((void *) node->key);
+
+ objc_hash_delete (free_list);
+
+ /* empty object reference table */
+ objc_hash_delete (stream->object_refs);
+ stream->object_refs = objc_hash_new (8, (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+
+ /* call -awake for all objects read */
+ if (awake_sel)
+ {
+ for (node = objc_hash_next (stream->object_table, NULL); node;
+ node = objc_hash_next (stream->object_table, node))
+ {
+ id object = node->value;
+ if (__objc_responds_to (object, awake_sel))
+ (*objc_msg_lookup (object, awake_sel)) (object, awake_sel);
+ }
+ }
+
+ /* empty object table */
+ objc_hash_delete (stream->object_table);
+ stream->object_table = objc_hash_new(64,
+ (hash_func_type)objc_hash_ptr,
+ (compare_func_type)objc_compare_ptrs);
+}
+
+/*
+** Open the stream PHYSICAL in MODE
+*/
+
+TypedStream *
+objc_open_typed_stream (FILE *physical, int mode)
+{
+ TypedStream *s = (TypedStream *) objc_malloc (sizeof (TypedStream));
+
+ s->mode = mode;
+ s->physical = physical;
+ s->stream_table = objc_hash_new (64,
+ (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+ s->object_table = objc_hash_new (64,
+ (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+ s->eof = (objc_typed_eof_func) __objc_feof;
+ s->flush = (objc_typed_flush_func) fflush;
+ s->writing_root_p = 0;
+ if (mode == OBJC_READONLY)
+ {
+ s->class_table
+ = objc_hash_new (8, (hash_func_type) objc_hash_string,
+ (compare_func_type) objc_compare_strings);
+ s->object_refs = objc_hash_new (8, (hash_func_type) objc_hash_ptr,
+ (compare_func_type) objc_compare_ptrs);
+ s->read = (objc_typed_read_func) __objc_fread;
+ s->write = (objc_typed_write_func) __objc_no_write;
+ __objc_read_typed_stream_signature (s);
+ }
+ else if (mode == OBJC_WRITEONLY)
+ {
+ s->class_table = 0;
+ s->object_refs = 0;
+ s->read = (objc_typed_read_func) __objc_no_read;
+ s->write = (objc_typed_write_func) __objc_fwrite;
+ __objc_write_typed_stream_signature (s);
+ }
+ else
+ {
+ objc_close_typed_stream (s);
+ return NULL;
+ }
+ s->type = OBJC_FILE_STREAM;
+ return s;
+}
+
+/*
+** Open the file named by FILE_NAME in MODE
+*/
+
+TypedStream*
+objc_open_typed_stream_for_file (const char *file_name, int mode)
+{
+ FILE *file = NULL;
+ TypedStream *s;
+
+ if (mode == OBJC_READONLY)
+ file = fopen (file_name, "r");
+ else
+ file = fopen (file_name, "w");
+
+ if (file)
+ {
+ s = objc_open_typed_stream (file, mode);
+ if (s)
+ s->type |= OBJC_MANAGED_STREAM;
+ return s;
+ }
+ else
+ return NULL;
+}
+
+/*
+** Close STREAM freeing the structure it self. If it was opened with
+** objc_open_typed_stream_for_file, the file will also be closed.
+*/
+
+void
+objc_close_typed_stream (TypedStream *stream)
+{
+ if (stream->mode == OBJC_READONLY)
+ {
+ __objc_finish_read_root_object (stream); /* Just in case... */
+ objc_hash_delete (stream->class_table);
+ objc_hash_delete (stream->object_refs);
+ }
+
+ objc_hash_delete (stream->stream_table);
+ objc_hash_delete (stream->object_table);
+
+ if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM))
+ fclose ((FILE *)stream->physical);
+
+ objc_free(stream);
+}
+
+BOOL
+objc_end_of_typed_stream (TypedStream *stream)
+{
+ return (*stream->eof) (stream->physical);
+}
+
+void
+objc_flush_typed_stream (TypedStream *stream)
+{
+ (*stream->flush) (stream->physical);
+}
+
+long
+objc_get_stream_class_version (TypedStream *stream, Class class)
+{
+ if (stream->class_table)
+ return PTR2LONG(objc_hash_value_for_key (stream->class_table,
+ class->name));
+ else
+ return class_get_version (class);
+}
+
diff --git a/libobjc/class.c b/libobjc/class.c
new file mode 100644
index 000000000..fb57293a1
--- /dev/null
+++ b/libobjc/class.c
@@ -0,0 +1,1138 @@
+/* GNU Objective C Runtime class related functions
+ Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup and Dennis Glatting.
+
+ Lock-free class table code designed and written from scratch by
+ Nicola Pero, 2001.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* The code in this file critically affects class method invocation
+ speed. This long preamble comment explains why, and the issues
+ involved.
+
+ One of the traditional weaknesses of the GNU Objective-C runtime is
+ that class method invocations are slow. The reason is that when you
+ write
+
+ array = [NSArray new];
+
+ this gets basically compiled into the equivalent of
+
+ array = [(objc_get_class ("NSArray")) new];
+
+ objc_get_class returns the class pointer corresponding to the string
+ `NSArray'; and because of the lookup, the operation is more
+ complicated and slow than a simple instance method invocation.
+
+ Most high performance Objective-C code (using the GNU Objc runtime)
+ I had the opportunity to read (or write) work around this problem by
+ caching the class pointer:
+
+ Class arrayClass = [NSArray class];
+
+ ... later on ...
+
+ array = [arrayClass new];
+ array = [arrayClass new];
+ array = [arrayClass new];
+
+ In this case, you always perform a class lookup (the first one), but
+ then all the [arrayClass new] methods run exactly as fast as an
+ instance method invocation. It helps if you have many class method
+ invocations to the same class.
+
+ The long-term solution to this problem would be to modify the
+ compiler to output tables of class pointers corresponding to all the
+ class method invocations, and to add code to the runtime to update
+ these tables - that should in the end allow class method invocations
+ to perform precisely as fast as instance method invocations, because
+ no class lookup would be involved. I think the Apple Objective-C
+ runtime uses this technique. Doing this involves synchronized
+ modifications in the runtime and in the compiler.
+
+ As a first medicine to the problem, I [NP] have redesigned and
+ rewritten the way the runtime is performing class lookup. This
+ doesn't give as much speed as the other (definitive) approach, but
+ at least a class method invocation now takes approximately 4.5 times
+ an instance method invocation on my machine (it would take approx 12
+ times before the rewriting), which is a lot better.
+
+ One of the main reason the new class lookup is so faster is because
+ I implemented it in a way that can safely run multithreaded without
+ using locks - a so-called `lock-free' data structure. The atomic
+ operation is pointer assignment. The reason why in this problem
+ lock-free data structures work so well is that you never remove
+ classes from the table - and the difficult thing with lock-free data
+ structures is freeing data when is removed from the structures. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#include "objc/runtime.h"
+#include "objc/thr.h"
+#include "objc-private/module-abi-8.h" /* For CLS_ISCLASS and similar. */
+#include "objc-private/runtime.h" /* the kitchen sink */
+#include "objc-private/sarray.h" /* For sarray_put_at_safe. */
+#include <string.h> /* For memset */
+
+/* We use a table which maps a class name to the corresponding class
+ pointer. The first part of this file defines this table, and
+ functions to do basic operations on the table. The second part of
+ the file implements some higher level Objective-C functionality for
+ classes by using the functions provided in the first part to manage
+ the table. */
+
+/**
+ ** Class Table Internals
+ **/
+
+/* A node holding a class */
+typedef struct class_node
+{
+ struct class_node *next; /* Pointer to next entry on the list.
+ NULL indicates end of list. */
+
+ const char *name; /* The class name string */
+ int length; /* The class name string length */
+ Class pointer; /* The Class pointer */
+
+} *class_node_ptr;
+
+/* A table containing classes is a class_node_ptr (pointing to the
+ first entry in the table - if it is NULL, then the table is
+ empty). */
+
+/* We have 1024 tables. Each table contains all class names which
+ have the same hash (which is a number between 0 and 1023). To look
+ up a class_name, we compute its hash, and get the corresponding
+ table. Once we have the table, we simply compare strings directly
+ till we find the one which we want (using the length first). The
+ number of tables is quite big on purpose (a normal big application
+ has less than 1000 classes), so that you shouldn't normally get any
+ collisions, and get away with a single comparison (which we can't
+ avoid since we need to know that you have got the right thing). */
+#define CLASS_TABLE_SIZE 1024
+#define CLASS_TABLE_MASK 1023
+
+static class_node_ptr class_table_array[CLASS_TABLE_SIZE];
+
+/* The table writing mutex - we lock on writing to avoid conflicts
+ between different writers, but we read without locks. That is
+ possible because we assume pointer assignment to be an atomic
+ operation. TODO: This is only true under certain circumstances,
+ which should be clarified. */
+static objc_mutex_t __class_table_lock = NULL;
+
+/* CLASS_TABLE_HASH is how we compute the hash of a class name. It is
+ a macro - *not* a function - arguments *are* modified directly.
+
+ INDEX should be a variable holding an int;
+ HASH should be a variable holding an int;
+ CLASS_NAME should be a variable holding a (char *) to the class_name.
+
+ After the macro is executed, INDEX contains the length of the
+ string, and HASH the computed hash of the string; CLASS_NAME is
+ untouched. */
+
+#define CLASS_TABLE_HASH(INDEX, HASH, CLASS_NAME) \
+ HASH = 0; \
+ for (INDEX = 0; CLASS_NAME[INDEX] != '\0'; INDEX++) \
+ { \
+ HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX]; \
+ } \
+ \
+ HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK;
+
+/* Setup the table. */
+static void
+class_table_setup (void)
+{
+ /* Start - nothing in the table. */
+ memset (class_table_array, 0, sizeof (class_node_ptr) * CLASS_TABLE_SIZE);
+
+ /* The table writing mutex. */
+ __class_table_lock = objc_mutex_allocate ();
+}
+
+
+/* Insert a class in the table (used when a new class is
+ registered). */
+static void
+class_table_insert (const char *class_name, Class class_pointer)
+{
+ int hash, length;
+ class_node_ptr new_node;
+
+ /* Find out the class name's hash and length. */
+ CLASS_TABLE_HASH (length, hash, class_name);
+
+ /* Prepare the new node holding the class. */
+ new_node = objc_malloc (sizeof (struct class_node));
+ new_node->name = class_name;
+ new_node->length = length;
+ new_node->pointer = class_pointer;
+
+ /* Lock the table for modifications. */
+ objc_mutex_lock (__class_table_lock);
+
+ /* Insert the new node in the table at the beginning of the table at
+ class_table_array[hash]. */
+ new_node->next = class_table_array[hash];
+ class_table_array[hash] = new_node;
+
+ objc_mutex_unlock (__class_table_lock);
+}
+
+/* Replace a class in the table (used only by poseAs:). */
+static void
+class_table_replace (Class old_class_pointer, Class new_class_pointer)
+{
+ int hash;
+ class_node_ptr node;
+
+ objc_mutex_lock (__class_table_lock);
+
+ hash = 0;
+ node = class_table_array[hash];
+
+ while (hash < CLASS_TABLE_SIZE)
+ {
+ if (node == NULL)
+ {
+ hash++;
+ if (hash < CLASS_TABLE_SIZE)
+ node = class_table_array[hash];
+ }
+ else
+ {
+ Class class1 = node->pointer;
+
+ if (class1 == old_class_pointer)
+ node->pointer = new_class_pointer;
+
+ node = node->next;
+ }
+ }
+
+ objc_mutex_unlock (__class_table_lock);
+}
+
+
+/* Get a class from the table. This does not need mutex protection.
+ Currently, this function is called each time you call a static
+ method, this is why it must be very fast. */
+static inline Class
+class_table_get_safe (const char *class_name)
+{
+ class_node_ptr node;
+ int length, hash;
+
+ /* Compute length and hash. */
+ CLASS_TABLE_HASH (length, hash, class_name);
+
+ node = class_table_array[hash];
+
+ if (node != NULL)
+ {
+ do
+ {
+ if (node->length == length)
+ {
+ /* Compare the class names. */
+ int i;
+
+ for (i = 0; i < length; i++)
+ {
+ if ((node->name)[i] != class_name[i])
+ break;
+ }
+
+ if (i == length)
+ {
+ /* They are equal! */
+ return node->pointer;
+ }
+ }
+ }
+ while ((node = node->next) != NULL);
+ }
+
+ return Nil;
+}
+
+/* Enumerate over the class table. */
+struct class_table_enumerator
+{
+ int hash;
+ class_node_ptr node;
+};
+
+
+static Class
+class_table_next (struct class_table_enumerator **e)
+{
+ struct class_table_enumerator *enumerator = *e;
+ class_node_ptr next;
+
+ if (enumerator == NULL)
+ {
+ *e = objc_malloc (sizeof (struct class_table_enumerator));
+ enumerator = *e;
+ enumerator->hash = 0;
+ enumerator->node = NULL;
+
+ next = class_table_array[enumerator->hash];
+ }
+ else
+ next = enumerator->node->next;
+
+ if (next != NULL)
+ {
+ enumerator->node = next;
+ return enumerator->node->pointer;
+ }
+ else
+ {
+ enumerator->hash++;
+
+ while (enumerator->hash < CLASS_TABLE_SIZE)
+ {
+ next = class_table_array[enumerator->hash];
+ if (next != NULL)
+ {
+ enumerator->node = next;
+ return enumerator->node->pointer;
+ }
+ enumerator->hash++;
+ }
+
+ /* Ok - table finished - done. */
+ objc_free (enumerator);
+ return Nil;
+ }
+}
+
+#if 0 /* DEBUGGING FUNCTIONS */
+/* Debugging function - print the class table. */
+void
+class_table_print (void)
+{
+ int i;
+
+ for (i = 0; i < CLASS_TABLE_SIZE; i++)
+ {
+ class_node_ptr node;
+
+ printf ("%d:\n", i);
+ node = class_table_array[i];
+
+ while (node != NULL)
+ {
+ printf ("\t%s\n", node->name);
+ node = node->next;
+ }
+ }
+}
+
+/* Debugging function - print an histogram of number of classes in
+ function of hash key values. Useful to evaluate the hash function
+ in real cases. */
+void
+class_table_print_histogram (void)
+{
+ int i, j;
+ int counter = 0;
+
+ for (i = 0; i < CLASS_TABLE_SIZE; i++)
+ {
+ class_node_ptr node;
+
+ node = class_table_array[i];
+
+ while (node != NULL)
+ {
+ counter++;
+ node = node->next;
+ }
+ if (((i + 1) % 50) == 0)
+ {
+ printf ("%4d:", i + 1);
+ for (j = 0; j < counter; j++)
+ printf ("X");
+
+ printf ("\n");
+ counter = 0;
+ }
+ }
+ printf ("%4d:", i + 1);
+ for (j = 0; j < counter; j++)
+ printf ("X");
+
+ printf ("\n");
+}
+#endif /* DEBUGGING FUNCTIONS */
+
+/**
+ ** Objective-C runtime functions
+ **/
+
+/* From now on, the only access to the class table data structure
+ should be via the class_table_* functions. */
+
+/* This is a hook which is called by objc_get_class and
+ objc_lookup_class if the runtime is not able to find the class.
+ This may e.g. try to load in the class using dynamic loading.
+
+ This hook was a public, global variable in the Traditional GNU
+ Objective-C Runtime API (objc/objc-api.h). The modern GNU
+ Objective-C Runtime API (objc/runtime.h) provides the
+ objc_setGetUnknownClassHandler() function instead.
+*/
+Class (*_objc_lookup_class) (const char *name) = 0; /* !T:SAFE */
+
+/* The handler currently in use. PS: if both
+ __obj_get_unknown_class_handler and _objc_lookup_class are defined,
+ __objc_get_unknown_class_handler is called first. */
+static objc_get_unknown_class_handler
+__objc_get_unknown_class_handler = NULL;
+
+objc_get_unknown_class_handler
+objc_setGetUnknownClassHandler (objc_get_unknown_class_handler
+ new_handler)
+{
+ objc_get_unknown_class_handler old_handler
+ = __objc_get_unknown_class_handler;
+ __objc_get_unknown_class_handler = new_handler;
+ return old_handler;
+}
+
+
+/* True when class links has been resolved. */
+BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */
+
+
+void
+__objc_init_class_tables (void)
+{
+ /* Allocate the class hash table. */
+
+ if (__class_table_lock)
+ return;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ class_table_setup ();
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* This function adds a class to the class hash table, and assigns the
+ class a number, unless it's already known. Return 'YES' if the
+ class was added. Return 'NO' if the class was already known. */
+BOOL
+__objc_add_class_to_hash (Class class)
+{
+ Class existing_class;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Make sure the table is there. */
+ assert (__class_table_lock);
+
+ /* Make sure it's not a meta class. */
+ assert (CLS_ISCLASS (class));
+
+ /* Check to see if the class is already in the hash table. */
+ existing_class = class_table_get_safe (class->name);
+
+ if (existing_class)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return NO;
+ }
+ else
+ {
+ /* The class isn't in the hash table. Add the class and assign
+ a class number. */
+ static unsigned int class_number = 1;
+
+ CLS_SETNUMBER (class, class_number);
+ CLS_SETNUMBER (class->class_pointer, class_number);
+
+ ++class_number;
+ class_table_insert (class->name, class);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return YES;
+ }
+}
+
+Class
+objc_getClass (const char *name)
+{
+ Class class;
+
+ if (name == NULL)
+ return Nil;
+
+ class = class_table_get_safe (name);
+
+ if (class)
+ return class;
+
+ if (__objc_get_unknown_class_handler)
+ return (*__objc_get_unknown_class_handler) (name);
+
+ if (_objc_lookup_class)
+ return (*_objc_lookup_class) (name);
+
+ return Nil;
+}
+
+Class
+objc_lookUpClass (const char *name)
+{
+ if (name == NULL)
+ return Nil;
+ else
+ return class_table_get_safe (name);
+}
+
+Class
+objc_getMetaClass (const char *name)
+{
+ Class class = objc_getClass (name);
+
+ if (class)
+ return class->class_pointer;
+ else
+ return Nil;
+}
+
+Class
+objc_getRequiredClass (const char *name)
+{
+ Class class = objc_getClass (name);
+
+ if (class)
+ return class;
+ else
+ _objc_abort ("objc_getRequiredClass ('%s') failed: class not found\n", name);
+}
+
+int
+objc_getClassList (Class *returnValue, int maxNumberOfClassesToReturn)
+{
+ /* Iterate over all entries in the table. */
+ int hash, count = 0;
+
+ for (hash = 0; hash < CLASS_TABLE_SIZE; hash++)
+ {
+ class_node_ptr node = class_table_array[hash];
+
+ while (node != NULL)
+ {
+ if (returnValue)
+ {
+ if (count < maxNumberOfClassesToReturn)
+ returnValue[count] = node->pointer;
+ else
+ return count;
+ }
+ count++;
+ node = node->next;
+ }
+ }
+
+ return count;
+}
+
+Class
+objc_allocateClassPair (Class super_class, const char *class_name, size_t extraBytes)
+{
+ Class new_class;
+ Class new_meta_class;
+
+ if (class_name == NULL)
+ return Nil;
+
+ if (objc_getClass (class_name))
+ return Nil;
+
+ if (super_class)
+ {
+ /* If you want to build a hierarchy of classes, you need to
+ build and register them one at a time. The risk is that you
+ are able to cause confusion by registering a subclass before
+ the superclass or similar. */
+ if (CLS_IS_IN_CONSTRUCTION (super_class))
+ return Nil;
+ }
+
+ /* Technically, we should create the metaclass first, then use
+ class_createInstance() to create the class. That complication
+ would be relevant if we had class variables, but we don't, so we
+ just ignore it and create everything directly and assume all
+ classes have the same size. */
+ new_class = objc_calloc (1, sizeof (struct objc_class) + extraBytes);
+ new_meta_class = objc_calloc (1, sizeof (struct objc_class) + extraBytes);
+
+ /* We create an unresolved class, similar to one generated by the
+ compiler. It will be resolved later when we register it.
+
+ Note how the metaclass details are not that important; when the
+ class is resolved, the ones that matter will be fixed up. */
+ new_class->class_pointer = new_meta_class;
+ new_meta_class->class_pointer = 0;
+
+ if (super_class)
+ {
+ /* Force the name of the superclass in place of the link to the
+ actual superclass, which will be put there when the class is
+ resolved. */
+ const char *super_class_name = class_getName (super_class);
+ new_class->super_class = (void *)super_class_name;
+ new_meta_class->super_class = (void *)super_class_name;
+ }
+ else
+ {
+ new_class->super_class = (void *)0;
+ new_meta_class->super_class = (void *)0;
+ }
+
+ new_class->name = objc_malloc (strlen (class_name) + 1);
+ strcpy ((char*)new_class->name, class_name);
+ new_meta_class->name = new_class->name;
+
+ new_class->version = 0;
+ new_meta_class->version = 0;
+
+ new_class->info = _CLS_CLASS | _CLS_IN_CONSTRUCTION;
+ new_meta_class->info = _CLS_META | _CLS_IN_CONSTRUCTION;
+
+ if (super_class)
+ new_class->instance_size = super_class->instance_size;
+ else
+ new_class->instance_size = 0;
+ new_meta_class->instance_size = sizeof (struct objc_class);
+
+ return new_class;
+}
+
+void
+objc_registerClassPair (Class class_)
+{
+ if (class_ == Nil)
+ return;
+
+ if ((! CLS_ISCLASS (class_)) || (! CLS_IS_IN_CONSTRUCTION (class_)))
+ return;
+
+ if ((! CLS_ISMETA (class_->class_pointer)) || (! CLS_IS_IN_CONSTRUCTION (class_->class_pointer)))
+ return;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ if (objc_getClass (class_->name))
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return;
+ }
+
+ CLS_SET_NOT_IN_CONSTRUCTION (class_);
+ CLS_SET_NOT_IN_CONSTRUCTION (class_->class_pointer);
+
+ __objc_init_class (class_);
+
+ /* Resolve class links immediately. No point in waiting. */
+ __objc_resolve_class_links ();
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+void
+objc_disposeClassPair (Class class_)
+{
+ if (class_ == Nil)
+ return;
+
+ if ((! CLS_ISCLASS (class_)) || (! CLS_IS_IN_CONSTRUCTION (class_)))
+ return;
+
+ if ((! CLS_ISMETA (class_->class_pointer)) || (! CLS_IS_IN_CONSTRUCTION (class_->class_pointer)))
+ return;
+
+ /* Undo any class_addIvar(). */
+ if (class_->ivars)
+ {
+ int i;
+ for (i = 0; i < class_->ivars->ivar_count; i++)
+ {
+ struct objc_ivar *ivar = &(class_->ivars->ivar_list[i]);
+
+ objc_free ((char *)ivar->ivar_name);
+ objc_free ((char *)ivar->ivar_type);
+ }
+
+ objc_free (class_->ivars);
+ }
+
+ /* Undo any class_addMethod(). */
+ if (class_->methods)
+ {
+ struct objc_method_list *list = class_->methods;
+ while (list)
+ {
+ int i;
+ struct objc_method_list *next = list->method_next;
+
+ for (i = 0; i < list->method_count; i++)
+ {
+ struct objc_method *method = &(list->method_list[i]);
+
+ objc_free ((char *)method->method_name);
+ objc_free ((char *)method->method_types);
+ }
+
+ objc_free (list);
+ list = next;
+ }
+ }
+
+ /* Undo any class_addProtocol(). */
+ if (class_->protocols)
+ {
+ struct objc_protocol_list *list = class_->protocols;
+ while (list)
+ {
+ struct objc_protocol_list *next = list->next;
+
+ objc_free (list);
+ list = next;
+ }
+ }
+
+ /* Undo any class_addMethod() on the meta-class. */
+ if (class_->class_pointer->methods)
+ {
+ struct objc_method_list *list = class_->class_pointer->methods;
+ while (list)
+ {
+ int i;
+ struct objc_method_list *next = list->method_next;
+
+ for (i = 0; i < list->method_count; i++)
+ {
+ struct objc_method *method = &(list->method_list[i]);
+
+ objc_free ((char *)method->method_name);
+ objc_free ((char *)method->method_types);
+ }
+
+ objc_free (list);
+ list = next;
+ }
+ }
+
+ /* Undo objc_allocateClassPair(). */
+ objc_free ((char *)(class_->name));
+ objc_free (class_->class_pointer);
+ objc_free (class_);
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+/* Get the class object for the class named NAME. If NAME does not
+ identify a known class, the hook _objc_lookup_class is called. If
+ this fails, nil is returned. */
+Class
+objc_lookup_class (const char *name)
+{
+ return objc_getClass (name);
+}
+
+/* Traditional GNU Objective-C Runtime API. Important: this method is
+ called automatically by the compiler while messaging (if using the
+ traditional ABI), so it is worth keeping it fast; don't make it
+ just a wrapper around objc_getClass(). */
+/* Note that this is roughly equivalent to objc_getRequiredClass(). */
+/* Get the class object for the class named NAME. If NAME does not
+ identify a known class, the hook _objc_lookup_class is called. If
+ this fails, an error message is issued and the system aborts. */
+Class
+objc_get_class (const char *name)
+{
+ Class class;
+
+ class = class_table_get_safe (name);
+
+ if (class)
+ return class;
+
+ if (__objc_get_unknown_class_handler)
+ class = (*__objc_get_unknown_class_handler) (name);
+
+ if ((!class) && _objc_lookup_class)
+ class = (*_objc_lookup_class) (name);
+
+ if (class)
+ return class;
+
+ _objc_abort ("objc runtime: cannot find class %s\n", name);
+
+ return 0;
+}
+
+MetaClass
+objc_get_meta_class (const char *name)
+{
+ return objc_get_class (name)->class_pointer;
+}
+
+/* This function provides a way to enumerate all the classes in the
+ executable. Pass *ENUM_STATE == NULL to start the enumeration. The
+ function will return 0 when there are no more classes.
+ For example:
+ id class;
+ void *es = NULL;
+ while ((class = objc_next_class (&es)))
+ ... do something with class;
+*/
+Class
+objc_next_class (void **enum_state)
+{
+ Class class;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Make sure the table is there. */
+ assert (__class_table_lock);
+
+ class = class_table_next ((struct class_table_enumerator **) enum_state);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return class;
+}
+
+/* This is used when the implementation of a method changes. It goes
+ through all classes, looking for the ones that have these methods
+ (either method_a or method_b; method_b can be NULL), and reloads
+ the implementation for these. You should call this with the
+ runtime mutex already locked. */
+void
+__objc_update_classes_with_methods (struct objc_method *method_a, struct objc_method *method_b)
+{
+ int hash;
+
+ /* Iterate over all classes. */
+ for (hash = 0; hash < CLASS_TABLE_SIZE; hash++)
+ {
+ class_node_ptr node = class_table_array[hash];
+
+ while (node != NULL)
+ {
+ /* We execute this loop twice: the first time, we iterate
+ over all methods in the class (instance methods), while
+ the second time we iterate over all methods in the meta
+ class (class methods). */
+ Class class = Nil;
+ BOOL done = NO;
+
+ while (done == NO)
+ {
+ struct objc_method_list * method_list;
+
+ if (class == Nil)
+ {
+ /* The first time, we work on the class. */
+ class = node->pointer;
+ }
+ else
+ {
+ /* The second time, we work on the meta class. */
+ class = class->class_pointer;
+ done = YES;
+ }
+
+ method_list = class->methods;
+
+ while (method_list)
+ {
+ int i;
+
+ for (i = 0; i < method_list->method_count; ++i)
+ {
+ struct objc_method *method = &method_list->method_list[i];
+
+ /* If the method is one of the ones we are
+ looking for, update the implementation. */
+ if (method == method_a)
+ sarray_at_put_safe (class->dtable,
+ (sidx) method_a->method_name->sel_id,
+ method_a->method_imp);
+
+ if (method == method_b)
+ {
+ if (method_b != NULL)
+ sarray_at_put_safe (class->dtable,
+ (sidx) method_b->method_name->sel_id,
+ method_b->method_imp);
+ }
+ }
+
+ method_list = method_list->method_next;
+ }
+ }
+ node = node->next;
+ }
+ }
+}
+
+/* Resolve super/subclass links for all classes. The only thing we
+ can be sure of is that the class_pointer for class objects point to
+ the right meta class objects. */
+void
+__objc_resolve_class_links (void)
+{
+ struct class_table_enumerator *es = NULL;
+ Class object_class = objc_get_class ("Object");
+ Class class1;
+
+ assert (object_class);
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Assign subclass links. */
+ while ((class1 = class_table_next (&es)))
+ {
+ /* Make sure we have what we think we have. */
+ assert (CLS_ISCLASS (class1));
+ assert (CLS_ISMETA (class1->class_pointer));
+
+ /* The class_pointer of all meta classes point to Object's meta
+ class. */
+ class1->class_pointer->class_pointer = object_class->class_pointer;
+
+ if (! CLS_ISRESOLV (class1))
+ {
+ CLS_SETRESOLV (class1);
+ CLS_SETRESOLV (class1->class_pointer);
+
+ if (class1->super_class)
+ {
+ Class a_super_class
+ = objc_get_class ((char *) class1->super_class);
+
+ assert (a_super_class);
+
+ DEBUG_PRINTF ("making class connections for: %s\n",
+ class1->name);
+
+ /* Assign subclass links for superclass. */
+ class1->sibling_class = a_super_class->subclass_list;
+ a_super_class->subclass_list = class1;
+
+ /* Assign subclass links for meta class of superclass. */
+ if (a_super_class->class_pointer)
+ {
+ class1->class_pointer->sibling_class
+ = a_super_class->class_pointer->subclass_list;
+ a_super_class->class_pointer->subclass_list
+ = class1->class_pointer;
+ }
+ }
+ else /* A root class, make its meta object be a subclass of
+ Object. */
+ {
+ class1->class_pointer->sibling_class
+ = object_class->subclass_list;
+ object_class->subclass_list = class1->class_pointer;
+ }
+ }
+ }
+
+ /* Assign superclass links. */
+ es = NULL;
+ while ((class1 = class_table_next (&es)))
+ {
+ Class sub_class;
+ for (sub_class = class1->subclass_list; sub_class;
+ sub_class = sub_class->sibling_class)
+ {
+ sub_class->super_class = class1;
+ if (CLS_ISCLASS (sub_class))
+ sub_class->class_pointer->super_class = class1->class_pointer;
+ }
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+const char *
+class_getName (Class class_)
+{
+ if (class_ == Nil)
+ return "nil";
+
+ return class_->name;
+}
+
+BOOL
+class_isMetaClass (Class class_)
+{
+ /* CLS_ISMETA includes the check for Nil class_. */
+ return CLS_ISMETA (class_);
+}
+
+/* Even inside libobjc it may be worth using class_getSuperclass
+ instead of accessing class_->super_class directly because it
+ resolves the class links if needed. If you access
+ class_->super_class directly, make sure to deal with the situation
+ where the class is not resolved yet! */
+Class
+class_getSuperclass (Class class_)
+{
+ if (class_ == Nil)
+ return Nil;
+
+ /* Classes that are in construction are not resolved and can not be
+ resolved! */
+ if (CLS_IS_IN_CONSTRUCTION (class_))
+ return Nil;
+
+ /* If the class is not resolved yet, super_class would point to a
+ string (the name of the super class) as opposed to the actual
+ super class. In that case, we need to resolve the class links
+ before we can return super_class. */
+ if (! CLS_ISRESOLV (class_))
+ __objc_resolve_class_links ();
+
+ return class_->super_class;
+}
+
+int
+class_getVersion (Class class_)
+{
+ if (class_ == Nil)
+ return 0;
+
+ return (int)(class_->version);
+}
+
+void
+class_setVersion (Class class_, int version)
+{
+ if (class_ == Nil)
+ return;
+
+ class_->version = version;
+}
+
+size_t
+class_getInstanceSize (Class class_)
+{
+ if (class_ == Nil)
+ return 0;
+
+ return class_->instance_size;
+}
+
+#define CLASSOF(c) ((c)->class_pointer)
+
+Class
+class_pose_as (Class impostor, Class super_class)
+{
+ if (! CLS_ISRESOLV (impostor))
+ __objc_resolve_class_links ();
+
+ /* Preconditions */
+ assert (impostor);
+ assert (super_class);
+ assert (impostor->super_class == super_class);
+ assert (CLS_ISCLASS (impostor));
+ assert (CLS_ISCLASS (super_class));
+ assert (impostor->instance_size == super_class->instance_size);
+
+ {
+ Class *subclass = &(super_class->subclass_list);
+
+ /* Move subclasses of super_class to impostor. */
+ while (*subclass)
+ {
+ Class nextSub = (*subclass)->sibling_class;
+
+ if (*subclass != impostor)
+ {
+ Class sub = *subclass;
+
+ /* Classes */
+ sub->sibling_class = impostor->subclass_list;
+ sub->super_class = impostor;
+ impostor->subclass_list = sub;
+
+ /* It will happen that SUB is not a class object if it is
+ the top of the meta class hierarchy chain (root
+ meta-class objects inherit their class object). If
+ that is the case... don't mess with the meta-meta
+ class. */
+ if (CLS_ISCLASS (sub))
+ {
+ /* Meta classes */
+ CLASSOF (sub)->sibling_class =
+ CLASSOF (impostor)->subclass_list;
+ CLASSOF (sub)->super_class = CLASSOF (impostor);
+ CLASSOF (impostor)->subclass_list = CLASSOF (sub);
+ }
+ }
+
+ *subclass = nextSub;
+ }
+
+ /* Set subclasses of superclass to be impostor only. */
+ super_class->subclass_list = impostor;
+ CLASSOF (super_class)->subclass_list = CLASSOF (impostor);
+
+ /* Set impostor to have no sibling classes. */
+ impostor->sibling_class = 0;
+ CLASSOF (impostor)->sibling_class = 0;
+ }
+
+ /* Check relationship of impostor and super_class is kept. */
+ assert (impostor->super_class == super_class);
+ assert (CLASSOF (impostor)->super_class == CLASSOF (super_class));
+
+ /* This is how to update the lookup table. Regardless of what the
+ keys of the hashtable is, change all values that are superclass
+ into impostor. */
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ class_table_replace (super_class, impostor);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ /* Next, we update the dispatch tables... */
+ __objc_update_dispatch_table_for_class (CLASSOF (impostor));
+ __objc_update_dispatch_table_for_class (impostor);
+
+ return impostor;
+}
diff --git a/libobjc/config.h.in b/libobjc/config.h.in
new file mode 100644
index 000000000..d9c8172d2
--- /dev/null
+++ b/libobjc/config.h.in
@@ -0,0 +1,74 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+#undef HAVE_CC_TLS
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if the compiler has a thread header that is non single. */
+#undef HAVE_GTHR_DEFAULT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <sched.h> header file. */
+#undef HAVE_SCHED_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if the target supports thread-local storage. */
+#undef HAVE_TLS
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define if the compiler is configured for setjmp/longjmp exceptions. */
+#undef SJLJ_EXCEPTIONS
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
diff --git a/libobjc/configure b/libobjc/configure
new file mode 100755
index 000000000..e6f0afdfa
--- /dev/null
+++ b/libobjc/configure
@@ -0,0 +1,13747 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.64 for package-unused version-unused.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='package-unused'
+PACKAGE_TARNAME='libobjc'
+PACKAGE_VERSION='version-unused'
+PACKAGE_STRING='package-unused version-unused'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+ac_unique_file="objc/objc.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+SET_MAKE
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+AWK
+STRIP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+OBJDUMP
+DLLTOOL
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+RANLIB
+AR
+AS
+extra_ldflags_libobjc
+lt_host_flags
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+libsuffix
+includedirname
+toolexeclibdir
+toolexecdir
+glibcpp_srcdir
+target_noncanonical
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+multi_basedir
+OBJC_BOEHM_GC_INCLUDES
+OBJC_BOEHM_GC
+VERSION
+target_subdir
+host_subdir
+build_subdir
+build_libsubdir
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+with_build_libsubdir
+with_target_subdir
+with_cross_host
+enable_version_specific_runtime_libs
+enable_objc_gc
+enable_multilib
+enable_maintainer_mode
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_tls
+enable_sjlj_exceptions
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CPP
+CPPFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures package-unused version-unused to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/libobjc]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of package-unused version-unused:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory
+ --enable-objc-gc enable the use of Boehm's garbage collector with
+ the GNU Objective-C runtime.
+ --enable-multilib build many library versions (default)
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-tls Use thread-local storage [default=yes]
+ --enable-sjlj-exceptions
+ force use of builtin_setjmp for exceptions
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-build-libsubdir=DIR Directory where to find libraries for build system
+ --with-target-subdir=SUBDIR
+ configuring in a subdirectory
+ --with-cross-host=HOST configuring with a cross compiler
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+package-unused configure version-unused
+generated by GNU Autoconf 2.64
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by package-unused $as_me version-unused, which was
+generated by GNU Autoconf 2.64. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ for ac_t in install-sh install.sh shtool; do
+ if test -f "$ac_dir/$ac_t"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/$ac_t -c"
+ break 2
+ fi
+ done
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+ case ${build_alias} in
+ "") build_noncanonical=${build} ;;
+ *) build_noncanonical=${build_alias} ;;
+esac
+
+ case ${host_alias} in
+ "") host_noncanonical=${build_noncanonical} ;;
+ *) host_noncanonical=${host_alias} ;;
+esac
+
+ case ${target_alias} in
+ "") target_noncanonical=${host_noncanonical} ;;
+ *) target_noncanonical=${target_alias} ;;
+esac
+
+
+# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
+# have matching libraries, they should use host libraries: Makefile.tpl
+# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR).
+# However, they still use the build modules, because the corresponding
+# host modules (e.g. bison) are only built for the host when bootstrap
+# finishes. So:
+# - build_subdir is where we find build modules, and never changes.
+# - build_libsubdir is where we find build libraries, and can be overridden.
+
+# Prefix 'build-' so this never conflicts with target_subdir.
+build_subdir="build-${build_noncanonical}"
+
+# Check whether --with-build-libsubdir was given.
+if test "${with_build_libsubdir+set}" = set; then :
+ withval=$with_build_libsubdir; build_libsubdir="$withval"
+else
+ build_libsubdir="$build_subdir"
+fi
+
+# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
+if ( test $srcdir = . && test -d gcc ) \
+ || test -d $srcdir/../host-${host_noncanonical}; then
+ host_subdir="host-${host_noncanonical}"
+else
+ host_subdir=.
+fi
+# No prefix.
+target_subdir=${target_noncanonical}
+
+
+# We need the following definitions because AC_PROG_LIBTOOL relies on them
+PACKAGE=libobjc
+# Version is pulled out to make it a bit easier to change using sed.
+VERSION=3:0:0
+
+
+# This works around the fact that libtool configuration may change LD
+# for this particular configuration, but some shells, instead of
+# keeping the changes in LD private, export them just because LD is
+# exported.
+ORIGINAL_LD_FOR_MULTILIBS=$LD
+
+# -------
+# Options
+# -------
+
+# We use these options to decide which functions to include.
+
+# Check whether --with-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then :
+ withval=$with_target_subdir;
+fi
+
+
+# Check whether --with-cross-host was given.
+if test "${with_cross_host+set}" = set; then :
+ withval=$with_cross_host;
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-version-specific-runtime-libs" >&5
+$as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
+# Check whether --enable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ enableval=$enable_version_specific_runtime_libs; case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no) version_specific_libs=no ;;
+ *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;;
+ esac
+else
+ version_specific_libs=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
+$as_echo "$version_specific_libs" >&6; }
+
+# Check whether --enable-objc-gc was given.
+if test "${enable_objc_gc+set}" = set; then :
+ enableval=$enable_objc_gc; case $enable_objc_gc in
+ no)
+ OBJC_BOEHM_GC=''
+ OBJC_BOEHM_GC_INCLUDES=''
+ ;;
+ *)
+ OBJC_BOEHM_GC=libobjc_gc.la
+ OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
+ ;;
+esac
+else
+ OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''
+fi
+
+
+
+
+# -----------
+# Directories
+# -----------
+
+# Find the rest of the source tree framework.
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+
+
+# Export source directory.
+# These need to be absolute paths, yet at the same time need to
+# canonicalize only relative paths, because then amd will not unmount
+# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+case $srcdir in
+ \\/$* | ?:\\/*) glibcpp_srcdir=${srcdir} ;;
+ *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+esac
+
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${version_specific_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_noncanonical)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+
+
+# Figure out if we want to name the include directory and the
+# library name changes differently.
+includedirname=include
+libsuffix=
+case "${host}" in
+ *-darwin*)
+ # Darwin is the only target so far that needs a different include directory.
+ includedirname=include-gnu-runtime
+ libsuffix=-gnu
+ ;;
+esac
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+# --------
+# Programs
+# --------
+
+
+
+# We must force CC to /not/ be a precious variable; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ rm -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# FIXME: Cleanup?
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ gcc_no_link=no
+else
+ gcc_no_link=yes
+fi
+if test x$gcc_no_link = xyes; then
+ # Setting cross_compile will disable run tests; it will
+ # also disable AC_CHECK_FILE but that's generally
+ # correct if we can't link.
+ cross_compiling=yes
+ EXEEXT=
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then :
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+fi
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# extra LD Flags which are required for targets
+
+
+
+case $host in
+ *-cygwin* | *-mingw*)
+ # 'host' will be top-level target in the case of a target lib,
+ # we must compare to with_cross_host to decide if this is a native
+ # or cross-compiler and select where to install dlls appropriately.
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ lt_host_flags='-no-undefined -bindir "$(toolexeclibdir)"';
+ else
+ lt_host_flags='-no-undefined -bindir "$(bindir)"';
+ fi
+ ;;
+ *)
+ lt_host_flags=
+ ;;
+esac
+
+
+
+case "${host}" in
+ *-darwin*)
+ # Darwin needs -single_module when linking libobjc
+ extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module'
+ ;;
+ *-cygwin*|*-mingw*)
+ # Tell libtool to build DLLs on Windows
+ extra_ldflags_libobjc='$(lt_host_flags)'
+ ;;
+esac
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# Enable Win32 DLL on MS Windows - FIXME
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+ ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.7a'
+macro_revision='1.3134'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if test "${lt_cv_ld_force_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ lt_prog_compiler_pic='-Xcompiler -fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if test "${lt_cv_prog_compiler__b+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if test "${lt_cv_archive_cmds_need_lc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10586 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10692 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# -------
+# Headers
+# -------
+
+# Sanity check for the cross-compilation case:
+ac_fn_c_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdio_h" = x""yes; then :
+ :
+else
+ as_fn_error "Can't find stdio.h.
+You must have a usable C system for the target already installed, at least
+including headers and, preferably, the library, before you can configure
+the Objective C runtime system. If necessary, install gcc now with
+\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'." "$LINENO" 5
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+
+for ac_header in sched.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default"
+if test "x$ac_cv_header_sched_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SCHED_H 1
+_ACEOF
+
+fi
+
+done
+
+
+# -----------
+# Miscellanea
+# -----------
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5
+$as_echo_n "checking for thread model used by GCC... " >&6; }
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5
+$as_echo "$target_thread_file" >&6; }
+
+if test $target_thread_file != single; then
+
+$as_echo "#define HAVE_GTHR_DEFAULT 1" >>confdefs.h
+
+fi
+
+# Check if we have thread-local storage
+
+
+ # Check whether --enable-tls was given.
+if test "${enable_tls+set}" = set; then :
+ enableval=$enable_tls;
+ case "$enableval" in
+ yes|no) ;;
+ *) as_fn_error "Argument to enable/disable tls must be yes or no" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_tls=yes
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports thread-local storage" >&5
+$as_echo_n "checking whether the target supports thread-local storage... " >&6; }
+if test "${gcc_cv_have_tls+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ chktls_save_LDFLAGS="$LDFLAGS"
+ case $host in
+ *-*-linux*)
+ LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
+ ;;
+ esac
+ chktls_save_CFLAGS="$CFLAGS"
+ CFLAGS="-fPIC $CFLAGS"
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int f() { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int f() { return a = b; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+else
+ gcc_cv_have_tls=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$chktls_save_CFLAGS"
+ LDFLAGS="$chktls_save_LDFLAGS"
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ chktls_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-static $LDFLAGS"
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main() { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+else
+ gcc_cv_have_tls=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$chktls_save_LDFLAGS"
+ if test $gcc_cv_have_tls = yes; then
+ chktls_save_CFLAGS="$CFLAGS"
+ thread_CFLAGS=failed
+ for flag in '' '-pthread' '-lpthread'; do
+ CFLAGS="$flag $chktls_save_CFLAGS"
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ thread_CFLAGS="$flag"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "X$thread_CFLAGS" != Xfailed; then
+ break
+ fi
+ done
+ CFLAGS="$chktls_save_CFLAGS"
+ if test "X$thread_CFLAGS" != Xfailed; then
+ CFLAGS="$thread_CFLAGS $chktls_save_CFLAGS"
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ __thread int a;
+ static int *volatile a_in_other_thread;
+ static void *
+ thread_func (void *arg)
+ {
+ a_in_other_thread = &a;
+ return (void *)0;
+ }
+int
+main ()
+{
+pthread_t thread;
+ void *thread_retval;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
+ if (pthread_create (&thread, (pthread_attr_t *)0,
+ thread_func, (void *)0))
+ return 0;
+ if (pthread_join (thread, &thread_retval))
+ return 0;
+ return (a_in_other_thread == a_in_main_thread);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=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="$chktls_save_CFLAGS"
+ fi
+ fi
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_tls" >&5
+$as_echo "$gcc_cv_have_tls" >&6; }
+ if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_TLS 1" >>confdefs.h
+
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exception model to use" >&5
+$as_echo_n "checking for exception model to use... " >&6; }
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# Check whether --enable-sjlj-exceptions was given.
+if test "${enable_sjlj_exceptions+set}" = set; then :
+ enableval=$enable_sjlj_exceptions; :
+else
+ cat > conftest.$ac_ext << EOF
+#line 11475 "configure"
+@interface Frob
+@end
+@implementation Frob
+@end
+int proc();
+int foo()
+{
+ @try {
+ return proc();
+ }
+ @catch (Frob* ex) {
+ return 0;
+ }
+}
+EOF
+old_CFLAGS="$CFLAGS"
+CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=no
+ fi
+fi
+CFLAGS="$old_CFLAGS"
+rm -f conftest*
+fi
+
+if test x$enable_sjlj_exceptions = xyes; then
+
+$as_echo "#define SJLJ_EXCEPTIONS 1" >>confdefs.h
+
+ ac_exception_model_name=sjlj
+elif test x$enable_sjlj_exceptions = xno; then
+ ac_exception_model_name="call frame"
+else
+ as_fn_error "unable to detect exception model" "$LINENO" 5
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_exception_model_name" >&5
+$as_echo "$ac_exception_model_name" >&6; }
+
+# ------
+# Output
+# ------
+
+if test ${multilib} = yes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by package-unused $as_me version-unused, which was
+generated by GNU Autoconf 2.64. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+package-unused config.status version-unused
+configured by $0, generated by GNU Autoconf 2.64,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in AS \
+DLLTOOL \
+OBJDUMP \
+SHELL \
+ECHO \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || as_fn_error "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error "could not create -" "$LINENO" 5
+ fi
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Assembler program.
+AS=$lt_AS
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$lt_OBJDUMP
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit $?
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
new file mode 100644
index 000000000..494a289ec
--- /dev/null
+++ b/libobjc/configure.ac
@@ -0,0 +1,287 @@
+# Process this file with autoconf to produce a configure script.
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
+# 2005, 2006, 2009 Free Software Foundation, Inc.
+# Originally contributed by Dave Love (d.love@dl.ac.uk).
+#
+#This file is part of GCC.
+#
+#GCC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3, or (at your option)
+#any later version.
+#
+#GCC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+#along with GCC; see the file COPYING3. If not see
+#<http://www.gnu.org/licenses/>.
+
+AC_PREREQ(2.64)
+AC_INIT(package-unused, version-unused,, libobjc)
+AC_CONFIG_SRCDIR([objc/objc.h])
+GCC_TOPLEV_SUBDIRS
+
+# We need the following definitions because AC_PROG_LIBTOOL relies on them
+PACKAGE=libobjc
+# Version is pulled out to make it a bit easier to change using sed.
+VERSION=3:0:0
+AC_SUBST(VERSION)
+
+# This works around the fact that libtool configuration may change LD
+# for this particular configuration, but some shells, instead of
+# keeping the changes in LD private, export them just because LD is
+# exported.
+ORIGINAL_LD_FOR_MULTILIBS=$LD
+
+# -------
+# Options
+# -------
+
+# We use these options to decide which functions to include.
+AC_ARG_WITH(target-subdir,
+[ --with-target-subdir=SUBDIR
+ configuring in a subdirectory])
+AC_ARG_WITH(cross-host,
+[ --with-cross-host=HOST configuring with a cross compiler])
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE(version-specific-runtime-libs,
+[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
+[case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no) version_specific_libs=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+[version_specific_libs=no])
+AC_MSG_RESULT($version_specific_libs)
+
+AC_ARG_ENABLE(objc-gc,
+[ --enable-objc-gc enable the use of Boehm's garbage collector with
+ the GNU Objective-C runtime.],
+[case $enable_objc_gc in
+ no)
+ OBJC_BOEHM_GC=''
+ OBJC_BOEHM_GC_INCLUDES=''
+ ;;
+ *)
+ OBJC_BOEHM_GC=libobjc_gc.la
+ OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
+ ;;
+esac],
+[OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
+AC_SUBST(OBJC_BOEHM_GC)
+AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
+
+# -----------
+# Directories
+# -----------
+
+# Find the rest of the source tree framework.
+AM_ENABLE_MULTILIB(, ..)
+
+AC_CANONICAL_SYSTEM
+ACX_NONCANONICAL_TARGET
+
+# Export source directory.
+# These need to be absolute paths, yet at the same time need to
+# canonicalize only relative paths, because then amd will not unmount
+# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+case $srcdir in
+ [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
+ *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+esac
+AC_SUBST(glibcpp_srcdir)
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${version_specific_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_noncanonical)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# Figure out if we want to name the include directory and the
+# library name changes differently.
+includedirname=include
+libsuffix=
+case "${host}" in
+ *-darwin*)
+ # Darwin is the only target so far that needs a different include directory.
+ includedirname=include-gnu-runtime
+ libsuffix=-gnu
+ ;;
+esac
+AC_SUBST(includedirname)
+AC_SUBST(libsuffix)
+
+AC_CONFIG_HEADERS(config.h)
+
+# --------
+# Programs
+# --------
+
+GCC_NO_EXECUTABLES
+
+# We must force CC to /not/ be a precious variable; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+# extra LD Flags which are required for targets
+ACX_LT_HOST_FLAGS
+case "${host}" in
+ *-darwin*)
+ # Darwin needs -single_module when linking libobjc
+ extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module'
+ ;;
+ *-cygwin*|*-mingw*)
+ # Tell libtool to build DLLs on Windows
+ extra_ldflags_libobjc='$(lt_host_flags)'
+ ;;
+esac
+AC_SUBST(extra_ldflags_libobjc)
+
+AC_SUBST(CFLAGS)
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_PROG_INSTALL
+
+AM_MAINTAINER_MODE
+
+# Enable Win32 DLL on MS Windows - FIXME
+AC_LIBTOOL_WIN32_DLL
+
+AC_PROG_LIBTOOL
+
+AM_PROG_CC_C_O
+
+AC_PROG_MAKE_SET
+
+# -------
+# Headers
+# -------
+
+# Sanity check for the cross-compilation case:
+AC_CHECK_HEADER(stdio.h,:,
+ [AC_MSG_ERROR([Can't find stdio.h.
+You must have a usable C system for the target already installed, at least
+including headers and, preferably, the library, before you can configure
+the Objective C runtime system. If necessary, install gcc now with
+\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
+
+AC_HEADER_STDC
+
+AC_CHECK_HEADERS(sched.h)
+
+# -----------
+# Miscellanea
+# -----------
+
+AC_MSG_CHECKING([for thread model used by GCC])
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+AC_MSG_RESULT([$target_thread_file])
+
+if test $target_thread_file != single; then
+ AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
+ [Define if the compiler has a thread header that is non single.])
+fi
+
+# Check if we have thread-local storage
+GCC_CHECK_TLS
+
+AC_MSG_CHECKING([for exception model to use])
+AC_LANG_PUSH(C)
+AC_ARG_ENABLE(sjlj-exceptions,
+ AS_HELP_STRING([--enable-sjlj-exceptions],
+ [force use of builtin_setjmp for exceptions]),
+[:],
+[dnl Botheration. Now we've got to detect the exception model.
+dnl Link tests against libgcc.a are problematic since -- at least
+dnl as of this writing -- we've not been given proper -L bits for
+dnl single-tree newlib and libgloss.
+dnl
+dnl This is what AC_TRY_COMPILE would do if it didn't delete the
+dnl conftest files before we got a change to grep them first.
+cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+@interface Frob
+@end
+@implementation Frob
+@end
+int proc();
+int foo()
+{
+ @try {
+ return proc();
+ }
+ @catch (Frob* ex) {
+ return 0;
+ }
+}
+EOF
+old_CFLAGS="$CFLAGS"
+dnl work around that we don't have Objective-C support in autoconf
+CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
+if AC_TRY_EVAL(ac_compile); then
+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=no
+ fi
+fi
+CFLAGS="$old_CFLAGS"
+rm -f conftest*])
+if test x$enable_sjlj_exceptions = xyes; then
+ AC_DEFINE(SJLJ_EXCEPTIONS, 1,
+ [Define if the compiler is configured for setjmp/longjmp exceptions.])
+ ac_exception_model_name=sjlj
+elif test x$enable_sjlj_exceptions = xno; then
+ ac_exception_model_name="call frame"
+else
+ AC_MSG_ERROR([unable to detect exception model])
+fi
+AC_LANG_POP(C)
+AC_MSG_RESULT($ac_exception_model_name)
+
+# ------
+# Output
+# ------
+
+if test ${multilib} = yes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libobjc/encoding.c b/libobjc/encoding.c
new file mode 100644
index 000000000..985ba0771
--- /dev/null
+++ b/libobjc/encoding.c
@@ -0,0 +1,1341 @@
+/* Encoding of types for Objective C.
+ Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+ Bitfield support by Ovidiu Predescu
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* FIXME: This file has no business including tm.h. */
+
+/* FIXME: This file contains functions that will abort the entire
+ program if they fail. Is that really needed ? */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h" /* For struct objc_method */
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h> /* For memcpy. */
+
+#undef MAX
+#define MAX(X, Y) \
+ ({ typeof (X) __x = (X), __y = (Y); \
+ (__x > __y ? __x : __y); })
+
+#undef MIN
+#define MIN(X, Y) \
+ ({ typeof (X) __x = (X), __y = (Y); \
+ (__x < __y ? __x : __y); })
+
+#undef ROUND
+#define ROUND(V, A) \
+ ({ typeof (V) __v = (V); typeof (A) __a = (A); \
+ __a * ((__v+__a - 1)/__a); })
+
+
+/* Various hacks for objc_layout_record. These are used by the target
+ macros. */
+
+#define TREE_CODE(TYPE) *(TYPE)
+#define TREE_TYPE(TREE) (TREE)
+
+#define RECORD_TYPE _C_STRUCT_B
+#define UNION_TYPE _C_UNION_B
+#define QUAL_UNION_TYPE _C_UNION_B
+#define ARRAY_TYPE _C_ARY_B
+
+#define REAL_TYPE _C_DBL
+
+#define VECTOR_TYPE _C_VECTOR
+
+#define TYPE_FIELDS(TYPE) ({const char *_field = (TYPE)+1; \
+ while (*_field != _C_STRUCT_E && *_field != _C_STRUCT_B \
+ && *_field != _C_UNION_B && *_field++ != '=') \
+ /* do nothing */; \
+ _field;})
+
+#define DECL_MODE(TYPE) *(TYPE)
+#define TYPE_MODE(TYPE) *(TYPE)
+
+#define DFmode _C_DBL
+
+#define strip_array_types(TYPE) ({const char *_field = (TYPE); \
+ while (*_field == _C_ARY_B)\
+ {\
+ while (isdigit ((unsigned char)*++_field))\
+ ;\
+ }\
+ _field;})
+
+/* Some ports (eg ARM) allow the structure size boundary to be
+ selected at compile-time. We override the normal definition with
+ one that has a constant value for this compilation. */
+#ifndef BITS_PER_UNIT
+#define BITS_PER_UNIT 8
+#endif
+#undef STRUCTURE_SIZE_BOUNDARY
+#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;}))
+
+/* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently
+ target_flags. Define a dummy entry here to so we don't die.
+ We have to rename it because target_flags may already have been
+ declared extern. */
+#define target_flags not_target_flags
+static int __attribute__ ((__unused__)) not_target_flags = 0;
+
+/* Some ROUND_TYPE_ALIGN use ALTIVEC_VECTOR_MODE (rs6000 darwin).
+ Define a dummy ALTIVEC_VECTOR_MODE so it will not die. */
+#undef ALTIVEC_VECTOR_MODE
+#define ALTIVEC_VECTOR_MODE(MODE) (0)
+
+/* Furthermore, some (powerpc) targets also use TARGET_ALIGN_NATURAL
+ in their alignment macros. Currently[4.5/6], rs6000.h points this
+ to a static variable, initialized by target overrides. This is reset
+ in linux64.h but not in darwin64.h. The macro is not used by *86*. */
+
+#if __MACH__
+# if __LP64__
+# undef TARGET_ALIGN_NATURAL
+# define TARGET_ALIGN_NATURAL 1
+# endif
+
+/* On Darwin32, we need to recurse until we find the starting stuct type. */
+static int
+_darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec)
+{
+ const char *_stp , *_fields = TYPE_FIELDS (struc);
+ if (!_fields)
+ return MAX (comp, spec);
+ _stp = strip_array_types (_fields);
+ if (TYPE_MODE(_stp) == _C_COMPLEX)
+ _stp++;
+ switch (TYPE_MODE(_stp))
+ {
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ return MAX (MAX (comp, spec), objc_alignof_type (_stp) * BITS_PER_UNIT);
+ break;
+ case DFmode:
+ case _C_LNG_LNG:
+ case _C_ULNG_LNG:
+ return MAX (MAX (comp, spec), 64);
+ break;
+
+ default:
+ return MAX (comp, spec);
+ break;
+ }
+}
+
+/* See comment below. */
+#define darwin_rs6000_special_round_type_align(S,C,S2) \
+ (_darwin_rs6000_special_round_type_align ((char*)(S), (int)(C), (int)(S2)))
+#endif
+
+/* FIXME: while this file has no business including tm.h, this
+ definitely has no business defining this macro but it
+ is only way around without really rewritting this file,
+ should look after the branch of 3.4 to fix this. */
+#define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \
+ ({ const char *_fields = TYPE_FIELDS (STRUCT); \
+ ((_fields != 0 \
+ && TYPE_MODE (strip_array_types (TREE_TYPE (_fields))) == DFmode) \
+ ? MAX (MAX (COMPUTED, SPECIFIED), 64) \
+ : MAX (COMPUTED, SPECIFIED));})
+
+
+/* Skip a variable name, enclosed in quotes ("). */
+static inline
+const char *
+objc_skip_variable_name (const char *type)
+{
+ /* Skip the variable name if any. */
+ if (*type == '"')
+ {
+ /* FIXME: How do we know we won't read beyond the end of the
+ string. Here and in the rest of the file! */
+ /* Skip '"'. */
+ type++;
+ /* Skip to the next '"'. */
+ while (*type != '"')
+ type++;
+ /* Skip '"'. */
+ type++;
+ }
+
+ return type;
+}
+
+int
+objc_sizeof_type (const char *type)
+{
+ type = objc_skip_variable_name (type);
+
+ switch (*type) {
+ case _C_BOOL:
+ return sizeof (_Bool);
+ break;
+
+ case _C_ID:
+ return sizeof (id);
+ break;
+
+ case _C_CLASS:
+ return sizeof (Class);
+ break;
+
+ case _C_SEL:
+ return sizeof (SEL);
+ break;
+
+ case _C_CHR:
+ return sizeof (char);
+ break;
+
+ case _C_UCHR:
+ return sizeof (unsigned char);
+ break;
+
+ case _C_SHT:
+ return sizeof (short);
+ break;
+
+ case _C_USHT:
+ return sizeof (unsigned short);
+ break;
+
+ case _C_INT:
+ return sizeof (int);
+ break;
+
+ case _C_UINT:
+ return sizeof (unsigned int);
+ break;
+
+ case _C_LNG:
+ return sizeof (long);
+ break;
+
+ case _C_ULNG:
+ return sizeof (unsigned long);
+ break;
+
+ case _C_LNG_LNG:
+ return sizeof (long long);
+ break;
+
+ case _C_ULNG_LNG:
+ return sizeof (unsigned long long);
+ break;
+
+ case _C_FLT:
+ return sizeof (float);
+ break;
+
+ case _C_DBL:
+ return sizeof (double);
+ break;
+
+ case _C_LNG_DBL:
+ return sizeof (long double);
+ break;
+
+ case _C_VOID:
+ return sizeof (void);
+ break;
+
+ case _C_PTR:
+ case _C_ATOM:
+ case _C_CHARPTR:
+ return sizeof (char *);
+ break;
+
+ case _C_ARY_B:
+ {
+ int len = atoi (type + 1);
+ while (isdigit ((unsigned char)*++type))
+ ;
+ return len * objc_aligned_size (type);
+ }
+ break;
+
+ case _C_VECTOR:
+ {
+ /* Skip the '!'. */
+ type++;
+ /* Skip the '['. */
+ type++;
+
+ /* The size in bytes is the following number. */
+ int size = atoi (type);
+ return size;
+ }
+ break;
+
+ case _C_BFLD:
+ {
+ /* The GNU encoding of bitfields is: b 'position' 'type'
+ 'size'. */
+ int position, size;
+ int startByte, endByte;
+
+ position = atoi (type + 1);
+ while (isdigit ((unsigned char)*++type))
+ ;
+ size = atoi (type + 1);
+
+ startByte = position / BITS_PER_UNIT;
+ endByte = (position + size) / BITS_PER_UNIT;
+ return endByte - startByte;
+ }
+
+ case _C_UNION_B:
+ case _C_STRUCT_B:
+ {
+ struct objc_struct_layout layout;
+ unsigned int size;
+
+ objc_layout_structure (type, &layout);
+ while (objc_layout_structure_next_member (&layout))
+ /* do nothing */ ;
+ objc_layout_finish_structure (&layout, &size, NULL);
+
+ return size;
+ }
+
+ case _C_COMPLEX:
+ {
+ type++; /* Skip after the 'j'. */
+ switch (*type)
+ {
+ case _C_CHR:
+ return sizeof (_Complex char);
+ break;
+
+ case _C_UCHR:
+ return sizeof (_Complex unsigned char);
+ break;
+
+ case _C_SHT:
+ return sizeof (_Complex short);
+ break;
+
+ case _C_USHT:
+ return sizeof (_Complex unsigned short);
+ break;
+
+ case _C_INT:
+ return sizeof (_Complex int);
+ break;
+
+ case _C_UINT:
+ return sizeof (_Complex unsigned int);
+ break;
+
+ case _C_LNG:
+ return sizeof (_Complex long);
+ break;
+
+ case _C_ULNG:
+ return sizeof (_Complex unsigned long);
+ break;
+
+ case _C_LNG_LNG:
+ return sizeof (_Complex long long);
+ break;
+
+ case _C_ULNG_LNG:
+ return sizeof (_Complex unsigned long long);
+ break;
+
+ case _C_FLT:
+ return sizeof (_Complex float);
+ break;
+
+ case _C_DBL:
+ return sizeof (_Complex double);
+ break;
+
+ case _C_LNG_DBL:
+ return sizeof (_Complex long double);
+ break;
+
+ default:
+ {
+ /* FIXME: Is this so bad that we have to abort the
+ entire program ? (it applies to all the other
+ _objc_abort calls in this file).
+ */
+ _objc_abort ("unknown complex type %s\n", type);
+ return 0;
+ }
+ }
+ }
+
+ default:
+ {
+ _objc_abort ("unknown type %s\n", type);
+ return 0;
+ }
+ }
+}
+
+int
+objc_alignof_type (const char *type)
+{
+ type = objc_skip_variable_name (type);
+
+ switch (*type) {
+ case _C_BOOL:
+ return __alignof__ (_Bool);
+ break;
+
+ case _C_ID:
+ return __alignof__ (id);
+ break;
+
+ case _C_CLASS:
+ return __alignof__ (Class);
+ break;
+
+ case _C_SEL:
+ return __alignof__ (SEL);
+ break;
+
+ case _C_CHR:
+ return __alignof__ (char);
+ break;
+
+ case _C_UCHR:
+ return __alignof__ (unsigned char);
+ break;
+
+ case _C_SHT:
+ return __alignof__ (short);
+ break;
+
+ case _C_USHT:
+ return __alignof__ (unsigned short);
+ break;
+
+ case _C_INT:
+ return __alignof__ (int);
+ break;
+
+ case _C_UINT:
+ return __alignof__ (unsigned int);
+ break;
+
+ case _C_LNG:
+ return __alignof__ (long);
+ break;
+
+ case _C_ULNG:
+ return __alignof__ (unsigned long);
+ break;
+
+ case _C_LNG_LNG:
+ return __alignof__ (long long);
+ break;
+
+ case _C_ULNG_LNG:
+ return __alignof__ (unsigned long long);
+ break;
+
+ case _C_FLT:
+ return __alignof__ (float);
+ break;
+
+ case _C_DBL:
+ return __alignof__ (double);
+ break;
+
+ case _C_LNG_DBL:
+ return __alignof__ (long double);
+ break;
+
+ case _C_PTR:
+ case _C_ATOM:
+ case _C_CHARPTR:
+ return __alignof__ (char *);
+ break;
+
+ case _C_ARY_B:
+ while (isdigit ((unsigned char)*++type))
+ /* do nothing */;
+ return objc_alignof_type (type);
+
+ case _C_VECTOR:
+ {
+ /* Skip the '!'. */
+ type++;
+ /* Skip the '['. */
+ type++;
+
+ /* Skip the size. */
+ while (isdigit ((unsigned char)*type))
+ type++;
+
+ /* Skip the ','. */
+ type++;
+
+ /* The alignment in bytes is the following number. */
+ return atoi (type);
+ }
+ case _C_STRUCT_B:
+ case _C_UNION_B:
+ {
+ struct objc_struct_layout layout;
+ unsigned int align;
+
+ objc_layout_structure (type, &layout);
+ while (objc_layout_structure_next_member (&layout))
+ /* do nothing */;
+ objc_layout_finish_structure (&layout, NULL, &align);
+
+ return align;
+ }
+
+
+ case _C_COMPLEX:
+ {
+ type++; /* Skip after the 'j'. */
+ switch (*type)
+ {
+ case _C_CHR:
+ return __alignof__ (_Complex char);
+ break;
+
+ case _C_UCHR:
+ return __alignof__ (_Complex unsigned char);
+ break;
+
+ case _C_SHT:
+ return __alignof__ (_Complex short);
+ break;
+
+ case _C_USHT:
+ return __alignof__ (_Complex unsigned short);
+ break;
+
+ case _C_INT:
+ return __alignof__ (_Complex int);
+ break;
+
+ case _C_UINT:
+ return __alignof__ (_Complex unsigned int);
+ break;
+
+ case _C_LNG:
+ return __alignof__ (_Complex long);
+ break;
+
+ case _C_ULNG:
+ return __alignof__ (_Complex unsigned long);
+ break;
+
+ case _C_LNG_LNG:
+ return __alignof__ (_Complex long long);
+ break;
+
+ case _C_ULNG_LNG:
+ return __alignof__ (_Complex unsigned long long);
+ break;
+
+ case _C_FLT:
+ return __alignof__ (_Complex float);
+ break;
+
+ case _C_DBL:
+ return __alignof__ (_Complex double);
+ break;
+
+ case _C_LNG_DBL:
+ return __alignof__ (_Complex long double);
+ break;
+
+ default:
+ {
+ _objc_abort ("unknown complex type %s\n", type);
+ return 0;
+ }
+ }
+ }
+
+ default:
+ {
+ _objc_abort ("unknown type %s\n", type);
+ return 0;
+ }
+ }
+}
+
+int
+objc_aligned_size (const char *type)
+{
+ int size, align;
+
+ type = objc_skip_variable_name (type);
+ size = objc_sizeof_type (type);
+ align = objc_alignof_type (type);
+
+ return ROUND (size, align);
+}
+
+int
+objc_promoted_size (const char *type)
+{
+ int size, wordsize;
+
+ type = objc_skip_variable_name (type);
+ size = objc_sizeof_type (type);
+ wordsize = sizeof (void *);
+
+ return ROUND (size, wordsize);
+}
+
+inline
+const char *
+objc_skip_type_qualifiers (const char *type)
+{
+ while (*type == _C_CONST
+ || *type == _C_IN
+ || *type == _C_INOUT
+ || *type == _C_OUT
+ || *type == _C_BYCOPY
+ || *type == _C_BYREF
+ || *type == _C_ONEWAY
+ || *type == _C_GCINVISIBLE)
+ {
+ type += 1;
+ }
+ return type;
+}
+
+inline
+const char *
+objc_skip_typespec (const char *type)
+{
+ type = objc_skip_variable_name (type);
+ type = objc_skip_type_qualifiers (type);
+
+ switch (*type) {
+
+ case _C_ID:
+ /* An id may be annotated by the actual type if it is known
+ with the @"ClassName" syntax */
+
+ if (*++type != '"')
+ return type;
+ else
+ {
+ while (*++type != '"')
+ /* do nothing */;
+ return type + 1;
+ }
+
+ /* The following are one character type codes */
+ case _C_CLASS:
+ case _C_SEL:
+ case _C_CHR:
+ case _C_UCHR:
+ case _C_CHARPTR:
+ case _C_ATOM:
+ case _C_SHT:
+ case _C_USHT:
+ case _C_INT:
+ case _C_UINT:
+ case _C_LNG:
+ case _C_BOOL:
+ case _C_ULNG:
+ case _C_LNG_LNG:
+ case _C_ULNG_LNG:
+ case _C_FLT:
+ case _C_DBL:
+ case _C_LNG_DBL:
+ case _C_VOID:
+ case _C_UNDEF:
+ return ++type;
+ break;
+
+ case _C_COMPLEX:
+ return type + 2;
+ break;
+
+ case _C_ARY_B:
+ /* skip digits, typespec and closing ']' */
+ while (isdigit ((unsigned char)*++type))
+ ;
+ type = objc_skip_typespec (type);
+ if (*type == _C_ARY_E)
+ return ++type;
+ else
+ {
+ _objc_abort ("bad array type %s\n", type);
+ return 0;
+ }
+
+ case _C_VECTOR:
+ /* Skip '!' */
+ type++;
+ /* Skip '[' */
+ type++;
+ /* Skip digits (size) */
+ while (isdigit ((unsigned char)*type))
+ type++;
+ /* Skip ',' */
+ type++;
+ /* Skip digits (alignment) */
+ while (isdigit ((unsigned char)*type))
+ type++;
+ /* Skip typespec. */
+ type = objc_skip_typespec (type);
+ /* Skip closing ']'. */
+ if (*type == _C_ARY_E)
+ return ++type;
+ else
+ {
+ _objc_abort ("bad vector type %s\n", type);
+ return 0;
+ }
+
+ case _C_BFLD:
+ /* The GNU encoding of bitfields is: b 'position' 'type'
+ 'size'. */
+ while (isdigit ((unsigned char)*++type))
+ ; /* skip position */
+ while (isdigit ((unsigned char)*++type))
+ ; /* skip type and size */
+ return type;
+
+ case _C_STRUCT_B:
+ /* skip name, and elements until closing '}' */
+
+ while (*type != _C_STRUCT_E && *type++ != '=')
+ ;
+ while (*type != _C_STRUCT_E)
+ {
+ type = objc_skip_typespec (type);
+ }
+ return ++type;
+
+ case _C_UNION_B:
+ /* skip name, and elements until closing ')' */
+
+ while (*type != _C_UNION_E && *type++ != '=')
+ ;
+ while (*type != _C_UNION_E)
+ {
+ type = objc_skip_typespec (type);
+ }
+ return ++type;
+
+ case _C_PTR:
+ /* Just skip the following typespec */
+
+ return objc_skip_typespec (++type);
+
+ default:
+ {
+ _objc_abort ("unknown type %s\n", type);
+ return 0;
+ }
+ }
+}
+
+inline
+const char *
+objc_skip_offset (const char *type)
+{
+ /* The offset is prepended by a '+' if the argument is passed in
+ registers. PS: The compiler stopped generating this '+' in
+ version 3.4. */
+ if (*type == '+')
+ type++;
+
+ /* Some people claim that on some platforms, where the stack grows
+ backwards, the compiler generates negative offsets (??). Skip a
+ '-' for such a negative offset. */
+ if (*type == '-')
+ type++;
+
+ /* Skip the digits that represent the offset. */
+ while (isdigit ((unsigned char) *type))
+ type++;
+
+ return type;
+}
+
+const char *
+objc_skip_argspec (const char *type)
+{
+ type = objc_skip_typespec (type);
+ type = objc_skip_offset (type);
+ return type;
+}
+
+char *
+method_copyReturnType (struct objc_method *method)
+{
+ if (method == NULL)
+ return 0;
+ else
+ {
+ char *returnValue;
+ size_t returnValueSize;
+
+ /* Determine returnValueSize. */
+ {
+ /* Find the end of the first argument. We want to return the
+ first argument spec, plus 1 byte for the \0 at the end. */
+ const char *type = method->method_types;
+ if (*type == '\0')
+ return NULL;
+ type = objc_skip_argspec (type);
+ returnValueSize = type - method->method_types + 1;
+ }
+
+ /* Copy the first argument into returnValue. */
+ returnValue = malloc (sizeof (char) * returnValueSize);
+ memcpy (returnValue, method->method_types, returnValueSize);
+ returnValue[returnValueSize - 1] = '\0';
+
+ return returnValue;
+ }
+}
+
+char *
+method_copyArgumentType (struct objc_method * method, unsigned int argumentNumber)
+{
+ if (method == NULL)
+ return 0;
+ else
+ {
+ char *returnValue;
+ const char *returnValueStart;
+ size_t returnValueSize;
+
+ /* Determine returnValueStart and returnValueSize. */
+ {
+ const char *type = method->method_types;
+
+ /* Skip the first argument (return type). */
+ type = objc_skip_argspec (type);
+
+ /* Now keep skipping arguments until we get to
+ argumentNumber. */
+ while (argumentNumber > 0)
+ {
+ /* We are supposed to skip an argument, but the string is
+ finished. This means we were asked for a non-existing
+ argument. */
+ if (*type == '\0')
+ return NULL;
+
+ type = objc_skip_argspec (type);
+ argumentNumber--;
+ }
+
+ /* If the argument does not exist, return NULL. */
+ if (*type == '\0')
+ return NULL;
+
+ returnValueStart = type;
+ type = objc_skip_argspec (type);
+ returnValueSize = type - returnValueStart + 1;
+ }
+
+ /* Copy the argument into returnValue. */
+ returnValue = malloc (sizeof (char) * returnValueSize);
+ memcpy (returnValue, returnValueStart, returnValueSize);
+ returnValue[returnValueSize - 1] = '\0';
+
+ return returnValue;
+ }
+}
+
+void method_getReturnType (struct objc_method * method, char *returnValue,
+ size_t returnValueSize)
+{
+ if (returnValue == NULL || returnValueSize == 0)
+ return;
+
+ /* Zero the string; we'll then write the argument type at the
+ beginning of it, if needed. */
+ memset (returnValue, 0, returnValueSize);
+
+ if (method == NULL)
+ return;
+ else
+ {
+ size_t argumentTypeSize;
+
+ /* Determine argumentTypeSize. */
+ {
+ /* Find the end of the first argument. We want to return the
+ first argument spec. */
+ const char *type = method->method_types;
+ if (*type == '\0')
+ return;
+ type = objc_skip_argspec (type);
+ argumentTypeSize = type - method->method_types;
+ if (argumentTypeSize > returnValueSize)
+ argumentTypeSize = returnValueSize;
+ }
+ /* Copy the argument at the beginning of the string. */
+ memcpy (returnValue, method->method_types, argumentTypeSize);
+ }
+}
+
+void method_getArgumentType (struct objc_method * method, unsigned int argumentNumber,
+ char *returnValue, size_t returnValueSize)
+{
+ if (returnValue == NULL || returnValueSize == 0)
+ return;
+
+ /* Zero the string; we'll then write the argument type at the
+ beginning of it, if needed. */
+ memset (returnValue, 0, returnValueSize);
+
+ if (method == NULL)
+ return;
+ else
+ {
+ const char *returnValueStart;
+ size_t argumentTypeSize;
+
+ /* Determine returnValueStart and argumentTypeSize. */
+ {
+ const char *type = method->method_types;
+
+ /* Skip the first argument (return type). */
+ type = objc_skip_argspec (type);
+
+ /* Now keep skipping arguments until we get to
+ argumentNumber. */
+ while (argumentNumber > 0)
+ {
+ /* We are supposed to skip an argument, but the string is
+ finished. This means we were asked for a non-existing
+ argument. */
+ if (*type == '\0')
+ return;
+
+ type = objc_skip_argspec (type);
+ argumentNumber--;
+ }
+
+ /* If the argument does not exist, it's game over. */
+ if (*type == '\0')
+ return;
+
+ returnValueStart = type;
+ type = objc_skip_argspec (type);
+ argumentTypeSize = type - returnValueStart;
+ if (argumentTypeSize > returnValueSize)
+ argumentTypeSize = returnValueSize;
+ }
+ /* Copy the argument at the beginning of the string. */
+ memcpy (returnValue, returnValueStart, argumentTypeSize);
+ }
+}
+
+unsigned int
+method_getNumberOfArguments (struct objc_method *method)
+{
+ if (method == NULL)
+ return 0;
+ else
+ {
+ unsigned int i = 0;
+ const char *type = method->method_types;
+ while (*type)
+ {
+ type = objc_skip_argspec (type);
+ i += 1;
+ }
+
+ if (i == 0)
+ {
+ /* This could only happen if method_types is invalid; in
+ that case, return 0. */
+ return 0;
+ }
+ else
+ {
+ /* Remove the return type. */
+ return (i - 1);
+ }
+ }
+}
+
+int
+method_get_number_of_arguments (struct objc_method *mth)
+{
+ return method_getNumberOfArguments (mth);
+}
+
+/* Return the size of the argument block needed on the stack to invoke
+ the method MTH. This may be zero, if all arguments are passed in
+ registers. */
+int
+method_get_sizeof_arguments (struct objc_method *mth)
+{
+ const char *type = objc_skip_typespec (mth->method_types);
+ return atoi (type);
+}
+
+/*
+ Return a pointer to the next argument of ARGFRAME. type points to
+ the last argument. Typical use of this look like:
+
+ {
+ char *datum, *type;
+ for (datum = method_get_first_argument (method, argframe, &type);
+ datum; datum = method_get_next_argument (argframe, &type))
+ {
+ unsigned flags = objc_get_type_qualifiers (type);
+ type = objc_skip_type_qualifiers (type);
+ if (*type != _C_PTR)
+ [portal encodeData: datum ofType: type];
+ else
+ {
+ if ((flags & _F_IN) == _F_IN)
+ [portal encodeData: *(char **) datum ofType: ++type];
+ }
+ }
+ }
+*/
+char *
+method_get_next_argument (arglist_t argframe, const char **type)
+{
+ const char *t = objc_skip_argspec (*type);
+
+ if (*t == '\0')
+ return 0;
+
+ *type = t;
+ t = objc_skip_typespec (t);
+
+ if (*t == '+')
+ return argframe->arg_regs + atoi (++t);
+ else
+ return argframe->arg_ptr + atoi (t);
+}
+
+/* Return a pointer to the value of the first argument of the method
+ described in M with the given argumentframe ARGFRAME. The type
+ is returned in TYPE. type must be passed to successive calls of
+ method_get_next_argument. */
+char *
+method_get_first_argument (struct objc_method *m,
+ arglist_t argframe,
+ const char **type)
+{
+ *type = m->method_types;
+ return method_get_next_argument (argframe, type);
+}
+
+/* Return a pointer to the ARGth argument of the method
+ M from the frame ARGFRAME. The type of the argument
+ is returned in the value-result argument TYPE. */
+char *
+method_get_nth_argument (struct objc_method *m,
+ arglist_t argframe, int arg,
+ const char **type)
+{
+ const char *t = objc_skip_argspec (m->method_types);
+
+ if (arg > method_get_number_of_arguments (m))
+ return 0;
+
+ while (arg--)
+ t = objc_skip_argspec (t);
+
+ *type = t;
+ t = objc_skip_typespec (t);
+
+ if (*t == '+')
+ return argframe->arg_regs + atoi (++t);
+ else
+ return argframe->arg_ptr + atoi (t);
+}
+
+unsigned
+objc_get_type_qualifiers (const char *type)
+{
+ unsigned res = 0;
+ BOOL flag = YES;
+
+ while (flag)
+ switch (*type++)
+ {
+ case _C_CONST: res |= _F_CONST; break;
+ case _C_IN: res |= _F_IN; break;
+ case _C_INOUT: res |= _F_INOUT; break;
+ case _C_OUT: res |= _F_OUT; break;
+ case _C_BYCOPY: res |= _F_BYCOPY; break;
+ case _C_BYREF: res |= _F_BYREF; break;
+ case _C_ONEWAY: res |= _F_ONEWAY; break;
+ case _C_GCINVISIBLE: res |= _F_GCINVISIBLE; break;
+ default: flag = NO;
+ }
+
+ return res;
+}
+
+/* The following three functions can be used to determine how a
+ structure is laid out by the compiler. For example:
+
+ struct objc_struct_layout layout;
+ int i;
+
+ objc_layout_structure (type, &layout);
+ while (objc_layout_structure_next_member (&layout))
+ {
+ int position, align;
+ const char *type;
+
+ objc_layout_structure_get_info (&layout, &position, &align, &type);
+ printf ("element %d has offset %d, alignment %d\n",
+ i++, position, align);
+ }
+
+ These functions are used by objc_sizeof_type and objc_alignof_type
+ functions to compute the size and alignment of structures. The
+ previous method of computing the size and alignment of a structure
+ was not working on some architectures, particulary on AIX, and in
+ the presence of bitfields inside the structure. */
+void
+objc_layout_structure (const char *type,
+ struct objc_struct_layout *layout)
+{
+ const char *ntype;
+
+ if (*type != _C_UNION_B && *type != _C_STRUCT_B)
+ {
+ _objc_abort ("record (or union) type expected in objc_layout_structure, got %s\n",
+ type);
+ }
+
+ type ++;
+ layout->original_type = type;
+
+ /* Skip "<name>=" if any. Avoid embedded structures and unions. */
+ ntype = type;
+ while (*ntype != _C_STRUCT_E && *ntype != _C_STRUCT_B && *ntype != _C_UNION_B
+ && *ntype++ != '=')
+ /* do nothing */;
+
+ /* If there's a "<name>=", ntype - 1 points to '='; skip the the name */
+ if (*(ntype - 1) == '=')
+ type = ntype;
+
+ layout->type = type;
+ layout->prev_type = NULL;
+ layout->record_size = 0;
+ layout->record_align = BITS_PER_UNIT;
+
+ layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY);
+}
+
+BOOL
+objc_layout_structure_next_member (struct objc_struct_layout *layout)
+{
+ register int desired_align = 0;
+
+ /* The following are used only if the field is a bitfield */
+ register const char *bfld_type = 0;
+ register int bfld_type_align = 0, bfld_field_size = 0;
+
+ /* The current type without the type qualifiers */
+ const char *type;
+ BOOL unionp = layout->original_type[-1] == _C_UNION_B;
+
+ /* Add the size of the previous field to the size of the record. */
+ if (layout->prev_type)
+ {
+ type = objc_skip_type_qualifiers (layout->prev_type);
+ if (unionp)
+ layout->record_size = MAX (layout->record_size,
+ objc_sizeof_type (type) * BITS_PER_UNIT);
+
+ else if (*type != _C_BFLD)
+ layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT;
+ else {
+ /* Get the bitfield's type */
+ for (bfld_type = type + 1;
+ isdigit ((unsigned char)*bfld_type);
+ bfld_type++)
+ /* do nothing */;
+
+ bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
+ bfld_field_size = atoi (objc_skip_typespec (bfld_type));
+ layout->record_size += bfld_field_size;
+ }
+ }
+
+ if ((unionp && *layout->type == _C_UNION_E)
+ || (!unionp && *layout->type == _C_STRUCT_E))
+ return NO;
+
+ /* Skip the variable name if any */
+ layout->type = objc_skip_variable_name (layout->type);
+ type = objc_skip_type_qualifiers (layout->type);
+
+ if (*type != _C_BFLD)
+ desired_align = objc_alignof_type (type) * BITS_PER_UNIT;
+ else
+ {
+ desired_align = 1;
+ /* Skip the bitfield's offset */
+ for (bfld_type = type + 1;
+ isdigit ((unsigned char) *bfld_type);
+ bfld_type++)
+ /* do nothing */;
+
+ bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
+ bfld_field_size = atoi (objc_skip_typespec (bfld_type));
+ }
+
+ /* The following won't work for vectors. */
+#ifdef BIGGEST_FIELD_ALIGNMENT
+ desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT);
+#endif
+#ifdef ADJUST_FIELD_ALIGN
+ desired_align = ADJUST_FIELD_ALIGN (type, desired_align);
+#endif
+
+ /* Record must have at least as much alignment as any field.
+ Otherwise, the alignment of the field within the record
+ is meaningless. */
+#ifndef PCC_BITFIELD_TYPE_MATTERS
+ layout->record_align = MAX (layout->record_align, desired_align);
+#else /* PCC_BITFIELD_TYPE_MATTERS */
+ if (*type == _C_BFLD)
+ {
+ /* For these machines, a zero-length field does not
+ affect the alignment of the structure as a whole.
+ It does, however, affect the alignment of the next field
+ within the structure. */
+ if (bfld_field_size)
+ layout->record_align = MAX (layout->record_align, desired_align);
+ else
+ desired_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
+
+ /* A named bit field of declared type `int'
+ forces the entire structure to have `int' alignment.
+ Q1: How is encoded this thing and how to check for it?
+ Q2: How to determine maximum_field_alignment at runtime? */
+
+/* if (DECL_NAME (field) != 0) */
+ {
+ int type_align = bfld_type_align;
+#if 0
+ if (maximum_field_alignment != 0)
+ type_align = MIN (type_align, maximum_field_alignment);
+ else if (DECL_PACKED (field))
+ type_align = MIN (type_align, BITS_PER_UNIT);
+#endif
+
+ layout->record_align = MAX (layout->record_align, type_align);
+ }
+ }
+ else
+ layout->record_align = MAX (layout->record_align, desired_align);
+#endif /* PCC_BITFIELD_TYPE_MATTERS */
+
+ /* Does this field automatically have alignment it needs
+ by virtue of the fields that precede it and the record's
+ own alignment? */
+
+ if (*type == _C_BFLD)
+ layout->record_size = atoi (type + 1);
+ else if (layout->record_size % desired_align != 0)
+ {
+ /* No, we need to skip space before this field.
+ Bump the cumulative size to multiple of field alignment. */
+ layout->record_size = ROUND (layout->record_size, desired_align);
+ }
+
+ /* Jump to the next field in record. */
+
+ layout->prev_type = layout->type;
+ layout->type = objc_skip_typespec (layout->type); /* skip component */
+
+ return YES;
+}
+
+void objc_layout_finish_structure (struct objc_struct_layout *layout,
+ unsigned int *size,
+ unsigned int *align)
+{
+ BOOL unionp = layout->original_type[-1] == _C_UNION_B;
+ if (layout->type
+ && ((!unionp && *layout->type == _C_STRUCT_E)
+ || (unionp && *layout->type == _C_UNION_E)))
+ {
+ /* Work out the alignment of the record as one expression and store
+ in the record type. Round it up to a multiple of the record's
+ alignment. */
+#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__)
+ layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1,
+ 1,
+ layout->record_align);
+#else
+ layout->record_align = MAX (1, layout->record_align);
+#endif
+
+#ifdef ROUND_TYPE_SIZE
+ layout->record_size = ROUND_TYPE_SIZE (layout->original_type,
+ layout->record_size,
+ layout->record_align);
+#else
+ /* Round the size up to be a multiple of the required alignment */
+ layout->record_size = ROUND (layout->record_size, layout->record_align);
+#endif
+
+ layout->type = NULL;
+ }
+ if (size)
+ *size = layout->record_size / BITS_PER_UNIT;
+ if (align)
+ *align = layout->record_align / BITS_PER_UNIT;
+}
+
+void objc_layout_structure_get_info (struct objc_struct_layout *layout,
+ unsigned int *offset,
+ unsigned int *align,
+ const char **type)
+{
+ if (offset)
+ *offset = layout->record_size / BITS_PER_UNIT;
+ if (align)
+ *align = layout->record_align / BITS_PER_UNIT;
+ if (type)
+ *type = layout->prev_type;
+}
diff --git a/libobjc/error.c b/libobjc/error.c
new file mode 100644
index 000000000..1dae36594
--- /dev/null
+++ b/libobjc/error.c
@@ -0,0 +1,97 @@
+/* GNU Objective C Runtime Error Functions
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+
+/* __USE_FIXED_PROTOTYPES__ used to be required to get prototypes for
+ malloc, free, etc. on some platforms. It is unclear if we still
+ need it, but it can't hurt. */
+#define __USE_FIXED_PROTOTYPES__
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+/* Prints an error message and aborts the program. */
+void
+_objc_abort (const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ abort ();
+ va_end (ap);
+}
+
+/* The rest of the file is deprecated. */
+#include "objc/objc-api.h" /* For objc_error_handler. */
+
+/*
+** Error handler function
+** NULL so that default is to just print to stderr
+*/
+static objc_error_handler _objc_error_handler = NULL;
+
+/* Trigger an objc error */
+void
+objc_error (id object, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ objc_verror (object, code, fmt, ap);
+ va_end (ap);
+}
+
+/* Trigger an objc error */
+void
+objc_verror (id object, int code, const char *fmt, va_list ap)
+{
+ BOOL result = NO;
+
+ /* Call the error handler if its there
+ Otherwise print to stderr */
+ if (_objc_error_handler)
+ result = (*_objc_error_handler) (object, code, fmt, ap);
+ else
+ vfprintf (stderr, fmt, ap);
+
+ /* Continue if the error handler says its ok
+ Otherwise abort the program */
+ if (result)
+ return;
+ else
+ abort ();
+}
+
+/* Set the error handler */
+objc_error_handler
+objc_set_error_handler (objc_error_handler func)
+{
+ objc_error_handler temp = _objc_error_handler;
+ _objc_error_handler = func;
+ return temp;
+}
diff --git a/libobjc/exception.c b/libobjc/exception.c
new file mode 100644
index 000000000..1ffb80b53
--- /dev/null
+++ b/libobjc/exception.c
@@ -0,0 +1,551 @@
+/* The implementation of exception handling primitives for Objective-C.
+ Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include <stdlib.h>
+#include "config.h"
+#include "objc/runtime.h"
+#include "objc/objc-exception.h"
+#include "unwind.h"
+#include "unwind-pe.h"
+#include <string.h> /* For memcpy */
+
+/* This hook allows libraries to sepecify special actions when an
+ exception is thrown without a handler in place. This is deprecated
+ in favour of objc_set_uncaught_exception_handler (). */
+void (*_objc_unexpected_exception) (id exception); /* !T:SAFE */
+
+
+/* 'is_kind_of_exception_matcher' is our default exception matcher -
+ it determines if the object 'exception' is of class 'catch_class',
+ or of a subclass. */
+static int
+is_kind_of_exception_matcher (Class catch_class, id exception)
+{
+ /* NULL catch_class is catch-all (eg, @catch (id object)). */
+ if (catch_class == Nil)
+ return 1;
+
+ /* If exception is nil (eg, @throw nil;), then it can only be
+ catched by a catch-all (eg, @catch (id object)). */
+ if (exception != nil)
+ {
+ Class c;
+
+ for (c = exception->class_pointer; c != Nil;
+ c = class_getSuperclass (c))
+ if (c == catch_class)
+ return 1;
+ }
+ return 0;
+}
+
+/* The exception matcher currently in use. */
+static objc_exception_matcher
+__objc_exception_matcher = is_kind_of_exception_matcher;
+
+objc_exception_matcher
+objc_setExceptionMatcher (objc_exception_matcher new_matcher)
+{
+ objc_exception_matcher old_matcher = __objc_exception_matcher;
+ __objc_exception_matcher = new_matcher;
+ return old_matcher;
+}
+
+/* The uncaught exception handler currently in use. */
+static objc_uncaught_exception_handler
+__objc_uncaught_exception_handler = NULL;
+
+objc_uncaught_exception_handler
+objc_setUncaughtExceptionHandler (objc_uncaught_exception_handler
+ new_handler)
+{
+ objc_uncaught_exception_handler old_handler
+ = __objc_uncaught_exception_handler;
+ __objc_uncaught_exception_handler = new_handler;
+ return old_handler;
+}
+
+
+
+#ifdef __ARM_EABI_UNWINDER__
+
+const _Unwind_Exception_Class __objc_exception_class
+ = {'G', 'N', 'U', 'C', 'O', 'B', 'J', 'C'};
+
+#else
+
+/* This is the exception class we report -- "GNUCOBJC". */
+static const _Unwind_Exception_Class __objc_exception_class
+ = ((((((((_Unwind_Exception_Class) 'G'
+ << 8 | (_Unwind_Exception_Class) 'N')
+ << 8 | (_Unwind_Exception_Class) 'U')
+ << 8 | (_Unwind_Exception_Class) 'C')
+ << 8 | (_Unwind_Exception_Class) 'O')
+ << 8 | (_Unwind_Exception_Class) 'B')
+ << 8 | (_Unwind_Exception_Class) 'J')
+ << 8 | (_Unwind_Exception_Class) 'C');
+
+#endif
+
+/* This is the object that is passed around by the Objective C runtime
+ to represent the exception in flight. */
+struct ObjcException
+{
+ /* This bit is needed in order to interact with the unwind runtime. */
+ struct _Unwind_Exception base;
+
+ /* The actual object we want to throw. Note: must come immediately
+ after unwind header. */
+ id value;
+
+#ifdef __ARM_EABI_UNWINDER__
+ /* Note: we use the barrier cache defined in the unwind control
+ block for ARM EABI. */
+#else
+ /* Cache some internal unwind data between phase 1 and phase 2. */
+ _Unwind_Ptr landingPad;
+ int handlerSwitchValue;
+#endif
+};
+
+
+
+struct lsda_header_info
+{
+ _Unwind_Ptr Start;
+ _Unwind_Ptr LPStart;
+ _Unwind_Ptr ttype_base;
+ const unsigned char *TType;
+ const unsigned char *action_table;
+ unsigned char ttype_encoding;
+ unsigned char call_site_encoding;
+};
+
+static const unsigned char *
+parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p,
+ struct lsda_header_info *info)
+{
+ _uleb128_t tmp;
+ unsigned char lpstart_encoding;
+
+ info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
+
+ /* Find @LPStart, the base to which landing pad offsets are
+ relative. */
+ lpstart_encoding = *p++;
+ if (lpstart_encoding != DW_EH_PE_omit)
+ p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart);
+ else
+ info->LPStart = info->Start;
+
+ /* Find @TType, the base of the handler and exception spec type
+ data. */
+ info->ttype_encoding = *p++;
+ if (info->ttype_encoding != DW_EH_PE_omit)
+ {
+ p = read_uleb128 (p, &tmp);
+ info->TType = p + tmp;
+ }
+ else
+ info->TType = 0;
+
+ /* The encoding and length of the call-site table; the action table
+ immediately follows. */
+ info->call_site_encoding = *p++;
+ p = read_uleb128 (p, &tmp);
+ info->action_table = p + tmp;
+
+ return p;
+}
+
+#ifdef __ARM_EABI_UNWINDER__
+
+static Class
+get_ttype_entry (struct lsda_header_info *info, _uleb128_t i)
+{
+ _Unwind_Ptr ptr;
+
+ ptr = (_Unwind_Ptr) (info->TType - (i * 4));
+ ptr = _Unwind_decode_target2 (ptr);
+
+ /* NULL ptr means catch-all. Note that if the class is not found,
+ this will abort the program. */
+ if (ptr)
+ return objc_getRequiredClass ((const char *) ptr);
+ else
+ return 0;
+}
+
+#else
+
+static Class
+get_ttype_entry (struct lsda_header_info *info, _Unwind_Word i)
+{
+ _Unwind_Ptr ptr;
+
+ i *= size_of_encoded_value (info->ttype_encoding);
+ read_encoded_value_with_base (info->ttype_encoding, info->ttype_base,
+ info->TType - i, &ptr);
+
+ /* NULL ptr means catch-all. Note that if the class is not found,
+ this will abort the program. */
+ if (ptr)
+ return objc_getRequiredClass ((const char *) ptr);
+ else
+ return 0;
+}
+
+#endif
+
+/* Using a different personality function name causes link failures
+ when trying to mix code using different exception handling
+ models. */
+#ifdef SJLJ_EXCEPTIONS
+#define PERSONALITY_FUNCTION __gnu_objc_personality_sj0
+#define __builtin_eh_return_data_regno(x) x
+#else
+#define PERSONALITY_FUNCTION __gnu_objc_personality_v0
+#endif
+
+#ifdef __ARM_EABI_UNWINDER__
+
+#define CONTINUE_UNWINDING \
+ do \
+ { \
+ if (__gnu_unwind_frame(ue_header, context) != _URC_OK) \
+ return _URC_FAILURE; \
+ return _URC_CONTINUE_UNWIND; \
+ } \
+ while (0)
+
+_Unwind_Reason_Code
+PERSONALITY_FUNCTION (_Unwind_State state,
+ struct _Unwind_Exception *ue_header,
+ struct _Unwind_Context *context)
+#else
+
+#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND
+
+_Unwind_Reason_Code
+PERSONALITY_FUNCTION (int version,
+ _Unwind_Action actions,
+ _Unwind_Exception_Class exception_class,
+ struct _Unwind_Exception *ue_header,
+ struct _Unwind_Context *context)
+#endif
+{
+ struct ObjcException *xh = (struct ObjcException *) ue_header;
+
+ struct lsda_header_info info;
+ const unsigned char *language_specific_data;
+ const unsigned char *action_record;
+ const unsigned char *p;
+ _Unwind_Ptr landing_pad, ip;
+ int handler_switch_value;
+ int saw_cleanup = 0, saw_handler, foreign_exception;
+ void *return_object;
+ int ip_before_insn = 0;
+
+#ifdef __ARM_EABI_UNWINDER__
+ _Unwind_Action actions;
+
+ switch (state & _US_ACTION_MASK)
+ {
+ case _US_VIRTUAL_UNWIND_FRAME:
+ actions = _UA_SEARCH_PHASE;
+ break;
+
+ case _US_UNWIND_FRAME_STARTING:
+ actions = _UA_CLEANUP_PHASE;
+ if (!(state & _US_FORCE_UNWIND)
+ && ue_header->barrier_cache.sp == _Unwind_GetGR (context, 13))
+ actions |= _UA_HANDLER_FRAME;
+ break;
+
+ case _US_UNWIND_FRAME_RESUME:
+ CONTINUE_UNWINDING;
+ break;
+
+ default:
+ abort();
+ }
+ actions |= state & _US_FORCE_UNWIND;
+
+ /* TODO: Foreign exceptions need some attention (e.g. rethrowing
+ doesn't work). */
+ foreign_exception = 0;
+
+ /* The dwarf unwinder assumes the context structure holds things
+ like the function and LSDA pointers. The ARM implementation
+ caches these in the exception header (UCB). To avoid rewriting
+ everything we make the virtual IP register point at the UCB. */
+ ip = (_Unwind_Ptr) ue_header;
+ _Unwind_SetGR (context, 12, ip);
+
+#else /* !__ARM_EABI_UNWINDER. */
+ /* Interface version check. */
+ if (version != 1)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ foreign_exception = (exception_class != __objc_exception_class);
+#endif
+
+ /* Shortcut for phase 2 found handler for domestic exception. */
+ if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME)
+ && !foreign_exception)
+ {
+#ifdef __ARM_EABI_UNWINDER__
+ handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1];
+ landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3];
+#else
+ handler_switch_value = xh->handlerSwitchValue;
+ landing_pad = xh->landingPad;
+#endif
+ goto install_context;
+ }
+
+ language_specific_data = (const unsigned char *)
+ _Unwind_GetLanguageSpecificData (context);
+
+ /* If no LSDA, then there are no handlers or cleanups. */
+ if (! language_specific_data)
+ CONTINUE_UNWINDING;
+
+ /* Parse the LSDA header. */
+ p = parse_lsda_header (context, language_specific_data, &info);
+ info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
+#ifdef HAVE_GETIPINFO
+ ip = _Unwind_GetIPInfo (context, &ip_before_insn);
+#else
+ ip = _Unwind_GetIP (context);
+#endif
+ if (!ip_before_insn)
+ --ip;
+ landing_pad = 0;
+ action_record = 0;
+ handler_switch_value = 0;
+
+#ifdef SJLJ_EXCEPTIONS
+ /* The given "IP" is an index into the call-site table, with two
+ exceptions -- -1 means no-action, and 0 means terminate. But
+ since we're using uleb128 values, we've not got random access to
+ the array. */
+ if ((int) ip < 0)
+ return _URC_CONTINUE_UNWIND;
+ else
+ {
+ _uleb128_t cs_lp, cs_action;
+ do
+ {
+ p = read_uleb128 (p, &cs_lp);
+ p = read_uleb128 (p, &cs_action);
+ }
+ while (--ip);
+
+ /* Can never have null landing pad for sjlj -- that would have
+ been indicated by a -1 call site index. */
+ landing_pad = cs_lp + 1;
+ if (cs_action)
+ action_record = info.action_table + cs_action - 1;
+ goto found_something;
+ }
+#else
+ /* Search the call-site table for the action associated with this
+ IP. */
+ while (p < info.action_table)
+ {
+ _Unwind_Ptr cs_start, cs_len, cs_lp;
+ _uleb128_t cs_action;
+
+ /* Note that all call-site encodings are "absolute"
+ displacements. */
+ p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
+ p = read_encoded_value (0, info.call_site_encoding, p, &cs_len);
+ p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp);
+ p = read_uleb128 (p, &cs_action);
+
+ /* The table is sorted, so if we've passed the ip, stop. */
+ if (ip < info.Start + cs_start)
+ p = info.action_table;
+ else if (ip < info.Start + cs_start + cs_len)
+ {
+ if (cs_lp)
+ landing_pad = info.LPStart + cs_lp;
+ if (cs_action)
+ action_record = info.action_table + cs_action - 1;
+ goto found_something;
+ }
+ }
+#endif /* SJLJ_EXCEPTIONS */
+
+ /* If ip is not present in the table, C++ would call terminate. */
+ /* ??? As with Java, it's perhaps better to tweek the LSDA to that
+ no-action is mapped to no-entry. */
+ CONTINUE_UNWINDING;
+
+ found_something:
+ saw_cleanup = 0;
+ saw_handler = 0;
+
+ if (landing_pad == 0)
+ {
+ /* If ip is present, and has a null landing pad, there are no
+ cleanups or handlers to be run. */
+ }
+ else if (action_record == 0)
+ {
+ /* If ip is present, has a non-null landing pad, and a null
+ action table offset, then there are only cleanups present.
+ Cleanups use a zero switch value, as set above. */
+ saw_cleanup = 1;
+ }
+ else
+ {
+ /* Otherwise we have a catch handler. */
+ _sleb128_t ar_filter, ar_disp;
+
+ while (1)
+ {
+ p = action_record;
+ p = read_sleb128 (p, &ar_filter);
+ read_sleb128 (p, &ar_disp);
+
+ if (ar_filter == 0)
+ {
+ /* Zero filter values are cleanups. */
+ saw_cleanup = 1;
+ }
+
+ /* During forced unwinding, we only run cleanups. With a
+ foreign exception class, we have no class info to
+ match. */
+ else if ((actions & _UA_FORCE_UNWIND) || foreign_exception)
+ ;
+
+ else if (ar_filter > 0)
+ {
+ /* Positive filter values are handlers. */
+ Class catch_type = get_ttype_entry (&info, ar_filter);
+
+ if ((*__objc_exception_matcher) (catch_type, xh->value))
+ {
+ handler_switch_value = ar_filter;
+ saw_handler = 1;
+ break;
+ }
+ }
+ else
+ {
+ /* Negative filter values are exception specifications,
+ which Objective-C does not use. */
+ abort ();
+ }
+
+ if (ar_disp == 0)
+ break;
+ action_record = p + ar_disp;
+ }
+ }
+
+ if (! saw_handler && ! saw_cleanup)
+ CONTINUE_UNWINDING;
+
+ if (actions & _UA_SEARCH_PHASE)
+ {
+ if (!saw_handler)
+ CONTINUE_UNWINDING;
+
+ /* For domestic exceptions, we cache data from phase 1 for phase
+ 2. */
+ if (!foreign_exception)
+ {
+#ifdef __ARM_EABI_UNWINDER__
+ ue_header->barrier_cache.sp = _Unwind_GetGR (context, 13);
+ ue_header->barrier_cache.bitpattern[1] = (_uw) handler_switch_value;
+ ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad;
+#else
+ xh->handlerSwitchValue = handler_switch_value;
+ xh->landingPad = landing_pad;
+#endif
+ }
+ return _URC_HANDLER_FOUND;
+ }
+
+ install_context:
+ if (saw_cleanup == 0)
+ {
+ return_object = xh->value;
+ if (!(actions & _UA_SEARCH_PHASE))
+ _Unwind_DeleteException(&xh->base);
+ }
+
+ _Unwind_SetGR (context, __builtin_eh_return_data_regno (0),
+ __builtin_extend_pointer (saw_cleanup ? xh : return_object));
+ _Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
+ handler_switch_value);
+ _Unwind_SetIP (context, landing_pad);
+ return _URC_INSTALL_CONTEXT;
+}
+
+static void
+__objc_exception_cleanup (_Unwind_Reason_Code code __attribute__((unused)),
+ struct _Unwind_Exception *exc)
+{
+ free (exc);
+}
+
+void
+objc_exception_throw (id exception)
+{
+ struct ObjcException *header = calloc (1, sizeof (*header));
+
+ memcpy (&header->base.exception_class, &__objc_exception_class,
+ sizeof (__objc_exception_class));
+ header->base.exception_cleanup = __objc_exception_cleanup;
+ header->value = exception;
+
+#ifdef SJLJ_EXCEPTIONS
+ _Unwind_SjLj_RaiseException (&header->base);
+#else
+ _Unwind_RaiseException (&header->base);
+#endif
+
+ /* No exception handler was installed. Call the uncaught exception
+ handler if any is defined. */
+ if (__objc_uncaught_exception_handler != 0)
+ {
+ (*__objc_uncaught_exception_handler) (exception);
+ }
+
+ /* As a last resort support the old, deprecated way of setting an
+ uncaught exception handler. */
+ if (_objc_unexpected_exception != 0)
+ {
+ (*_objc_unexpected_exception) (exception);
+ }
+
+ abort ();
+}
+
diff --git a/libobjc/gc.c b/libobjc/gc.c
new file mode 100644
index 000000000..5ea4f8a09
--- /dev/null
+++ b/libobjc/gc.c
@@ -0,0 +1,458 @@
+/* Basic data types for Objective C.
+ Copyright (C) 1998, 2002, 2004, 2005, 2006, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Ovidiu Predescu.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/objc.h"
+
+#if OBJC_WITH_GC
+
+#include "tconfig.h"
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include "objc/encoding.h"
+
+#include <gc.h>
+#include <limits.h>
+
+/* gc_typed.h uses the following but doesn't declare them */
+typedef GC_word word;
+typedef GC_signed_word signed_word;
+#define BITS_PER_WORD (CHAR_BIT * sizeof (word))
+
+#include <gc_typed.h>
+
+/* The following functions set up in `mask` the corresponding pointers.
+ The offset is incremented with the size of the type. */
+
+#define ROUND(V, A) \
+ ({ typeof (V) __v = (V); typeof (A) __a = (A); \
+ __a * ((__v+__a - 1)/__a); })
+
+#define SET_BIT_FOR_OFFSET(mask, offset) \
+ GC_set_bit (mask, offset / sizeof (void *))
+
+/* Some prototypes */
+static void
+__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset);
+static void
+__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset);
+
+
+static void
+__objc_gc_setup_array (GC_bitmap mask, const char *type, int offset)
+{
+ int i, len = atoi (type + 1);
+
+ while (isdigit (*++type))
+ /* do nothing */; /* skip the size of the array */
+
+ switch (*type) {
+ case _C_ARY_B:
+ for (i = 0; i < len; i++)
+ __objc_gc_setup_array (mask, type, offset);
+ break;
+
+ case _C_STRUCT_B:
+ for (i = 0; i < len; i++)
+ __objc_gc_setup_struct (mask, type, offset);
+ break;
+
+ case _C_UNION_B:
+ for (i = 0; i < len; i++)
+ __objc_gc_setup_union (mask, type, offset);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset)
+{
+ struct objc_struct_layout layout;
+ unsigned int position;
+ const char *mtype;
+
+ objc_layout_structure (type, &layout);
+
+ while (objc_layout_structure_next_member (&layout))
+ {
+ BOOL gc_invisible = NO;
+
+ objc_layout_structure_get_info (&layout, &position, NULL, &mtype);
+
+ /* Skip the variable name */
+ if (*mtype == '"')
+ {
+ for (mtype++; *mtype++ != '"';)
+ /* do nothing */;
+ }
+
+ if (*mtype == _C_GCINVISIBLE)
+ {
+ gc_invisible = YES;
+ mtype++;
+ }
+
+ /* Add to position the offset of this structure */
+ position += offset;
+
+ switch (*mtype) {
+ case _C_ID:
+ case _C_CLASS:
+ case _C_SEL:
+ case _C_PTR:
+ case _C_CHARPTR:
+ case _C_ATOM:
+ if (! gc_invisible)
+ SET_BIT_FOR_OFFSET (mask, position);
+ break;
+
+ case _C_ARY_B:
+ __objc_gc_setup_array (mask, mtype, position);
+ break;
+
+ case _C_STRUCT_B:
+ __objc_gc_setup_struct (mask, mtype, position);
+ break;
+
+ case _C_UNION_B:
+ __objc_gc_setup_union (mask, mtype, position);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+static void
+__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset)
+{
+ /* Sub-optimal, quick implementation: assume the union is made of
+ pointers, set up the mask accordingly. */
+
+ int i, size, align;
+
+ /* Skip the variable name */
+ if (*type == '"')
+ {
+ for (type++; *type++ != '"';)
+ /* do nothing */;
+ }
+
+ size = objc_sizeof_type (type);
+ align = objc_alignof_type (type);
+
+ offset = ROUND (offset, align);
+ for (i = 0; i < size; i += sizeof (void *))
+ {
+ SET_BIT_FOR_OFFSET (mask, offset);
+ offset += sizeof (void *);
+ }
+}
+
+
+/* Iterates over the types in the structure that represents the class
+ encoding and sets the bits in mask according to each ivar type. */
+static void
+__objc_gc_type_description_from_type (GC_bitmap mask, const char *type)
+{
+ struct objc_struct_layout layout;
+ unsigned int offset, align;
+ const char *ivar_type;
+
+ objc_layout_structure (type, &layout);
+
+ while (objc_layout_structure_next_member (&layout))
+ {
+ BOOL gc_invisible = NO;
+
+ objc_layout_structure_get_info (&layout, &offset, &align, &ivar_type);
+
+ /* Skip the variable name */
+ if (*ivar_type == '"')
+ {
+ for (ivar_type++; *ivar_type++ != '"';)
+ /* do nothing */;
+ }
+
+ if (*ivar_type == _C_GCINVISIBLE)
+ {
+ gc_invisible = YES;
+ ivar_type++;
+ }
+
+ switch (*ivar_type) {
+ case _C_ID:
+ case _C_CLASS:
+ case _C_SEL:
+ case _C_PTR:
+ case _C_CHARPTR:
+ if (! gc_invisible)
+ SET_BIT_FOR_OFFSET (mask, offset);
+ break;
+
+ case _C_ARY_B:
+ __objc_gc_setup_array (mask, ivar_type, offset);
+ break;
+
+ case _C_STRUCT_B:
+ __objc_gc_setup_struct (mask, ivar_type, offset);
+ break;
+
+ case _C_UNION_B:
+ __objc_gc_setup_union (mask, ivar_type, offset);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/* Computes in *type the full type encoding of this class including
+ its super classes. '*size' gives the total number of bytes allocated
+ into *type, '*current' the number of bytes used so far by the
+ encoding. */
+static void
+__objc_class_structure_encoding (Class class, char **type, int *size,
+ int *current)
+{
+ int i, ivar_count;
+ struct objc_ivar_list *ivars;
+
+ if (! class)
+ {
+ strcat (*type, "{");
+ (*current)++;
+ return;
+ }
+
+ /* Add the type encodings of the super classes */
+ __objc_class_structure_encoding (class->super_class, type, size, current);
+
+ ivars = class->ivars;
+ if (! ivars)
+ return;
+
+ ivar_count = ivars->ivar_count;
+
+ for (i = 0; i < ivar_count; i++)
+ {
+ struct objc_ivar *ivar = &(ivars->ivar_list[i]);
+ const char *ivar_type = ivar->ivar_type;
+ int len = strlen (ivar_type);
+
+ if (*current + len + 1 >= *size)
+ {
+ /* Increase the size of the encoding string so that it
+ contains this ivar's type. */
+ *size = ROUND (*current + len + 1, 10);
+ *type = objc_realloc (*type, *size);
+ }
+ strcat (*type + *current, ivar_type);
+ *current += len;
+ }
+}
+
+
+/* Allocates the memory that will hold the type description for class
+ and calls the __objc_class_structure_encoding that generates this
+ value. */
+void
+__objc_generate_gc_type_description (Class class)
+{
+ GC_bitmap mask;
+ int bits_no, size;
+ int type_size = 10, current;
+ char *class_structure_type;
+
+ if (! CLS_ISCLASS (class))
+ return;
+
+ /* We have to create a mask in which each bit counts for a pointer member.
+ We take into consideration all the non-pointer instance variables and we
+ round them up to the alignment. */
+
+ /* The number of bits in the mask is the size of an instance in bytes divided
+ by the size of a pointer. */
+ bits_no = (ROUND (class_get_instance_size (class), sizeof (void *))
+ / sizeof (void *));
+ size = ROUND (bits_no, BITS_PER_WORD) / BITS_PER_WORD;
+ mask = objc_atomic_malloc (size * sizeof (int));
+ memset (mask, 0, size * sizeof (int));
+
+ class_structure_type = objc_atomic_malloc (type_size);
+ *class_structure_type = current = 0;
+ __objc_class_structure_encoding (class, &class_structure_type,
+ &type_size, &current);
+ if (current + 1 == type_size)
+ class_structure_type = objc_realloc (class_structure_type, ++type_size);
+ strcat (class_structure_type + current, "}");
+#ifdef DEBUG
+ printf ("type description for '%s' is %s\n", class->name, class_structure_type);
+#endif
+
+ __objc_gc_type_description_from_type (mask, class_structure_type);
+ objc_free (class_structure_type);
+
+#ifdef DEBUG
+ printf (" mask for '%s', type '%s' (bits %d, mask size %d) is:",
+ class_structure_type, class->name, bits_no, size);
+ {
+ int i;
+ for (i = 0; i < size; i++)
+ printf (" %lx", mask[i]);
+ }
+ puts ("");
+#endif
+
+ class->gc_object_type = (void *) GC_make_descriptor (mask, bits_no);
+}
+
+
+/* Returns YES if type denotes a pointer type, NO otherwise */
+static inline BOOL
+__objc_ivar_pointer (const char *type)
+{
+ type = objc_skip_type_qualifiers (type);
+
+ return (*type == _C_ID
+ || *type == _C_CLASS
+ || *type == _C_SEL
+ || *type == _C_PTR
+ || *type == _C_CHARPTR
+ || *type == _C_ATOM);
+}
+
+
+/* Mark the instance variable whose name is given by ivarname as a
+ weak pointer (a pointer hidden to the garbage collector) if
+ gc_invisible is true. If gc_invisible is false it unmarks the
+ instance variable and makes it a normal pointer, visible to the
+ garbage collector.
+
+ This operation only makes sense on instance variables that are
+ pointers. */
+void
+class_ivar_set_gcinvisible (Class class, const char *ivarname,
+ BOOL gc_invisible)
+{
+ int i, ivar_count;
+ struct objc_ivar_list *ivars;
+
+ if (! class || ! ivarname)
+ return;
+
+ ivars = class->ivars;
+ if (! ivars)
+ return;
+
+ ivar_count = ivars->ivar_count;
+
+ for (i = 0; i < ivar_count; i++)
+ {
+ struct objc_ivar *ivar = &(ivars->ivar_list[i]);
+ const char *type;
+
+ if (! ivar->ivar_name || strcmp (ivar->ivar_name, ivarname))
+ continue;
+
+ assert (ivar->ivar_type);
+ type = ivar->ivar_type;
+
+ /* Skip the variable name */
+ if (*type == '"')
+ {
+ for (type++; *type++ != '"';)
+ /* do nothing */;
+ }
+
+ if (*type == _C_GCINVISIBLE)
+ {
+ char *new_type;
+ size_t len;
+
+ if (gc_invisible || ! __objc_ivar_pointer (type))
+ return; /* The type of the variable already matches the
+ requested gc_invisible type */
+
+ /* The variable is gc_invisible so we make it gc visible. */
+ new_type = objc_atomic_malloc (strlen(ivar->ivar_type));
+ len = (type - ivar->ivar_type);
+ memcpy (new_type, ivar->ivar_type, len);
+ new_type[len] = 0;
+ strcat (new_type, type + 1);
+ ivar->ivar_type = new_type;
+ }
+ else
+ {
+ char *new_type;
+ size_t len;
+
+ if (! gc_invisible || ! __objc_ivar_pointer (type))
+ return; /* The type of the variable already matches the
+ requested gc_invisible type */
+
+ /* The variable is gc visible so we make it gc_invisible. */
+ new_type = objc_malloc (strlen(ivar->ivar_type) + 2);
+
+ /* Copy the variable name. */
+ len = (type - ivar->ivar_type);
+ memcpy (new_type, ivar->ivar_type, len);
+ /* Add '!'. */
+ new_type[len++] = _C_GCINVISIBLE;
+ /* Copy the original types. */
+ strcpy (new_type + len, type);
+
+ ivar->ivar_type = new_type;
+ }
+
+ __objc_generate_gc_type_description (class);
+ return;
+ }
+
+ /* Search the instance variable in the superclasses */
+ class_ivar_set_gcinvisible (class->super_class, ivarname, gc_invisible);
+}
+
+#else /* !OBJC_WITH_GC */
+
+void
+__objc_generate_gc_type_description (Class class __attribute__ ((__unused__)))
+{
+}
+
+void class_ivar_set_gcinvisible (Class class __attribute__ ((__unused__)),
+ const char *ivarname __attribute__ ((__unused__)),
+ BOOL gc_invisible __attribute__ ((__unused__)))
+{
+}
+
+#endif /* OBJC_WITH_GC */
diff --git a/libobjc/hash.c b/libobjc/hash.c
new file mode 100644
index 000000000..733fc6501
--- /dev/null
+++ b/libobjc/hash.c
@@ -0,0 +1,295 @@
+/* Hash tables for Objective C internal structures
+ Copyright (C) 1993, 1996, 1997, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include <assert.h> /* For assert. */
+
+#include "objc/runtime.h" /* For objc_calloc. */
+#include "objc-private/hash.h"
+
+/* These two macros determine when a hash table is full and
+ by how much it should be expanded respectively.
+
+ These equations are percentages. */
+#define FULLNESS(cache) \
+ ((((cache)->size * 75) / 100) <= (cache)->used)
+#define EXPANSION(cache) \
+ ((cache)->size * 2)
+
+cache_ptr
+objc_hash_new (unsigned int size, hash_func_type hash_func,
+ compare_func_type compare_func)
+{
+ cache_ptr cache;
+
+ /* Pass me a value greater than 0 and a power of 2. */
+ assert (size);
+ assert (! (size & (size - 1)));
+
+ /* Allocate the cache structure. calloc insures its initialization
+ for default values. */
+ cache = (cache_ptr) objc_calloc (1, sizeof (struct cache));
+ assert (cache);
+
+ /* Allocate the array of buckets for the cache. calloc initializes
+ all of the pointers to NULL. */
+ cache->node_table
+ = (node_ptr *) objc_calloc (size, sizeof (node_ptr));
+ assert (cache->node_table);
+
+ cache->size = size;
+
+ /* This should work for all processor architectures (?). */
+ cache->mask = (size - 1);
+
+ /* Store the hashing function so that codes can be computed. */
+ cache->hash_func = hash_func;
+
+ /* Store the function that compares hash keys to determine if they
+ are equal. */
+ cache->compare_func = compare_func;
+
+ return cache;
+}
+
+
+void
+objc_hash_delete (cache_ptr cache)
+{
+ node_ptr node;
+ node_ptr next_node;
+ unsigned int i;
+
+ /* Purge all key/value pairs from the table. */
+ /* Step through the nodes one by one and remove every node WITHOUT
+ using objc_hash_next. this makes objc_hash_delete much more
+ efficient. */
+ for (i = 0; i < cache->size; i++)
+ {
+ if ((node = cache->node_table[i]))
+ {
+ /* An entry in the hash table has been found. Now step
+ through the nodes next in the list and free them. */
+ while ((next_node = node->next))
+ {
+ objc_hash_remove (cache,node->key);
+ node = next_node;
+ }
+ objc_hash_remove (cache,node->key);
+ }
+ }
+
+ /* Release the array of nodes and the cache itself. */
+ objc_free(cache->node_table);
+ objc_free(cache);
+}
+
+
+void
+objc_hash_add (cache_ptr *cachep, const void *key, void *value)
+{
+ size_t indx = (*(*cachep)->hash_func) (*cachep, key);
+ node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node));
+
+ assert (node);
+
+ /* Initialize the new node. */
+ node->key = key;
+ node->value = value;
+ node->next = (*cachep)->node_table[indx];
+
+ /* Debugging. Check the list for another key. */
+#ifdef DEBUG
+ {
+ node_ptr node1 = (*cachep)->node_table[indx];
+ while (node1)
+ {
+ assert (node1->key != key);
+ node1 = node1->next;
+ }
+ }
+#endif
+
+ /* Install the node as the first element on the list. */
+ (*cachep)->node_table[indx] = node;
+
+ /* Bump the number of entries in the cache. */
+ ++(*cachep)->used;
+
+ /* Check the hash table's fullness. We're going to expand if it is
+ above the fullness level. */
+ if (FULLNESS (*cachep))
+ {
+ /* The hash table has reached its fullness level. Time to
+ expand it.
+
+ I'm using a slow method here but is built on other primitive
+ functions thereby increasing its correctness. */
+ node_ptr node1 = NULL;
+ cache_ptr new = objc_hash_new (EXPANSION (*cachep),
+ (*cachep)->hash_func,
+ (*cachep)->compare_func);
+
+ DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n",
+ (int) *cachep, (*cachep)->size, new->size);
+
+ /* Copy the nodes from the first hash table to the new one. */
+ while ((node1 = objc_hash_next (*cachep, node1)))
+ objc_hash_add (&new, node1->key, node1->value);
+
+ /* Trash the old cache. */
+ objc_hash_delete (*cachep);
+
+ /* Return a pointer to the new hash table. */
+ *cachep = new;
+ }
+}
+
+void
+objc_hash_remove (cache_ptr cache, const void *key)
+{
+ size_t indx = (*cache->hash_func) (cache, key);
+ node_ptr node = cache->node_table[indx];
+
+ /* We assume there is an entry in the table. Error if it is
+ not. */
+ assert (node);
+
+ /* Special case. First element is the key/value pair to be
+ removed. */
+ if ((*cache->compare_func) (node->key, key))
+ {
+ cache->node_table[indx] = node->next;
+ objc_free(node);
+ }
+ else
+ {
+ /* Otherwise, find the hash entry. */
+ node_ptr prev = node;
+ BOOL removed = NO;
+ do
+ {
+ if ((*cache->compare_func) (node->key, key))
+ {
+ prev->next = node->next, removed = YES;
+ objc_free(node);
+ }
+ else
+ prev = node, node = node->next;
+ }
+ while (!removed && node);
+ assert (removed);
+ }
+
+ /* Decrement the number of entries in the hash table. */
+ --cache->used;
+}
+
+
+node_ptr
+objc_hash_next (cache_ptr cache, node_ptr node)
+{
+ /* If the scan is being started then reset the last node visitied
+ pointer and bucket index. */
+ if (!node)
+ cache->last_bucket = 0;
+
+ /* If there is a node visited last then check for another entry in
+ the same bucket. Otherwise step to the next bucket. */
+ if (node)
+ {
+ if (node->next)
+ {
+ /* There is a node which follows the last node returned.
+ Step to that node and retun it. */
+ return node->next;
+ }
+ else
+ ++cache->last_bucket;
+ }
+
+ /* If the list isn't exhausted then search the buckets for other
+ nodes. */
+ if (cache->last_bucket < cache->size)
+ {
+ /* Scan the remainder of the buckets looking for an entry at
+ the head of the list. Return the first item found. */
+ while (cache->last_bucket < cache->size)
+ if (cache->node_table[cache->last_bucket])
+ return cache->node_table[cache->last_bucket];
+ else
+ ++cache->last_bucket;
+
+ /* No further nodes were found in the hash table. */
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+
+/* Given KEY, return corresponding value for it in CACHE. Return NULL
+ if the KEY is not recorded. */
+void *
+objc_hash_value_for_key (cache_ptr cache, const void *key)
+{
+ node_ptr node = cache->node_table[(*cache->hash_func) (cache, key)];
+ void *retval = NULL;
+
+ if (node)
+ do
+ {
+ if ((*cache->compare_func) (node->key, key))
+ {
+ retval = node->value;
+ break;
+ }
+ else
+ node = node->next;
+ }
+ while (! retval && node);
+
+ return retval;
+}
+
+/* Given KEY, return YES if it exists in the CACHE. Return NO if it
+ does not */
+BOOL
+objc_hash_is_key_in_hash (cache_ptr cache, const void *key)
+{
+ node_ptr node = cache->node_table[(*cache->hash_func) (cache, key)];
+
+ if (node)
+ do
+ {
+ if ((*cache->compare_func)(node->key, key))
+ return YES;
+ else
+ node = node->next;
+ }
+ while (node);
+
+ return NO;
+}
diff --git a/libobjc/init.c b/libobjc/init.c
new file mode 100644
index 000000000..23ba41ba1
--- /dev/null
+++ b/libobjc/init.c
@@ -0,0 +1,1044 @@
+/* GNU Objective C Runtime initialization
+ Copyright (C) 1993, 1995, 1996, 1997, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+ +load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Uncommented the following line to enable debug logging. Use this
+ only while debugging the runtime. */
+/* #define DEBUG 1 */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#include "objc/runtime.h"
+#include "objc/thr.h"
+#include "objc-private/hash.h"
+#include "objc-private/objc-list.h"
+#include "objc-private/module-abi-8.h"
+#include "objc-private/runtime.h" /* For __objc_resolve_class_links(). */
+#include "objc-private/selector.h" /* For __sel_register_typed_name(). */
+#include "objc-private/objc-sync.h" /* For __objc_sync_init() */
+#include "objc-private/protocols.h" /* For __objc_protocols_init(),
+ __objc_protocols_add_protocol()
+ __objc_protocols_register_selectors() */
+#include "objc-private/accessors.h" /* For __objc_accessors_init() */
+
+/* The version number of this runtime. This must match the number
+ defined in gcc (objc-act.c). */
+#define OBJC_VERSION 8
+#define PROTOCOL_VERSION 2
+
+/* This list contains modules currently loaded into the runtime and
+ for which the +load method (and the load callback, if any) has not
+ been called yet. */
+static struct objc_list *__objc_module_list = 0; /* !T:MUTEX */
+
+/* This list contains all proto_list's not yet assigned class
+ links. */
+static struct objc_list *unclaimed_proto_list = 0; /* !T:MUTEX */
+
+/* List of unresolved static instances. */
+static struct objc_list *uninitialized_statics = 0; /* !T:MUTEX */
+
+/* List of duplicated classes found while loading modules. If we find
+ a class twice, we ignore it the second time. On some platforms,
+ where the order in which modules are loaded is well defined, this
+ allows you to replace a class in a shared library by linking in a
+ new implementation which is loaded in in the right order, and which
+ overrides the existing one.
+
+ Protected by __objc_runtime_mutex. */
+static cache_ptr duplicate_classes = NULL;
+
+/* Global runtime "write" mutex. Having a single mutex prevents
+ deadlocks, but reduces concurrency. To improve concurrency, some
+ groups of functions in the runtime have their own separate mutex
+ (eg, __class_table_lock in class.c); to avoid deadlocks, these
+ routines must make sure that they never acquire any other lock
+ while holding their own local lock. Ie, they should lock, execute
+ some C code that does not perform any calls to other runtime
+ functions which may potentially lock different locks, then unlock.
+ If they need to perform any calls to other runtime functions that
+ may potentially lock other locks, then they should use the global
+ __objc_runtime_mutex. */
+objc_mutex_t __objc_runtime_mutex = 0;
+
+/* Number of threads that are alive. */
+int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
+
+/* Check compiler vs runtime version. */
+static void init_check_module_version (struct objc_module *);
+
+/* Assign isa links to protos. */
+static void __objc_init_protocols (struct objc_protocol_list *protos);
+
+/* Assign isa link to a protocol, and register it. */
+static void __objc_init_protocol (struct objc_protocol *protocol);
+
+/* Add protocol to class. */
+static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
+
+/* Load callback hook. */
+void (*_objc_load_callback) (Class class, struct objc_category *category) = 0; /* !T:SAFE */
+
+/* Are all categories/classes resolved ? */
+BOOL __objc_dangling_categories = NO; /* !T:UNUSED */
+
+/* Sends +load to all classes and categories in certain
+ situations. */
+static void objc_send_load (void);
+
+/* Inserts all the classes defined in module in a tree of classes that
+ resembles the class hierarchy. This tree is traversed in preorder
+ and the classes in its nodes receive the +load message if these
+ methods were not executed before. The algorithm ensures that when
+ the +load method of a class is executed all the superclasses have
+ been already received the +load message. */
+static void __objc_create_classes_tree (struct objc_module *module);
+
+/* Calls the _objc_load_callback for each class and category in the
+ module (if _objc_load_callback is not NULL). */
+static void __objc_call_load_callback (struct objc_module *module);
+
+/* A special version that works only before the classes are completely
+ installed in the runtime. */
+static BOOL class_is_subclass_of_class (Class class, Class superclass);
+
+/* This is a node in the class tree hierarchy used to send +load
+ messages. */
+typedef struct objc_class_tree
+{
+ /* The class corresponding to the node. */
+ Class class;
+
+ /* This is a linked list of all the direct subclasses of this class.
+ 'head' points to a subclass node; 'tail' points to the next
+ objc_list node (whose 'head' points to another subclass node,
+ etc). */
+ struct objc_list *subclasses;
+} objc_class_tree;
+
+/* This is a linked list of objc_class_tree trees. The head of these
+ trees are root classes (their super class is Nil). These different
+ trees represent different class hierarchies. */
+static struct objc_list *__objc_class_tree_list = NULL;
+
+/* Keeps the +load methods who have been already executed. This hash
+ should not be destroyed during the execution of the program. */
+static cache_ptr __objc_load_methods = NULL;
+
+/* This function is used when building the class tree used to send
+ ordinately the +load message to all classes needing it. The tree
+ is really needed so that superclasses will get the message before
+ subclasses.
+
+ This tree may contain classes which are being loaded (or have just
+ being loaded), and whose super_class pointers have not yet been
+ resolved. This implies that their super_class pointers point to a
+ string with the name of the superclass; when the first message is
+ sent to the class (/an object of that class) the class links will
+ be resolved, which will replace the super_class pointers with
+ pointers to the actual superclasses.
+
+ Unfortunately, the tree might also contain classes which had been
+ loaded previously, and whose class links have already been
+ resolved.
+
+ This function returns the superclass of a class in both cases, and
+ can be used to build the determine the class relationships while
+ building the tree. */
+static Class class_superclass_of_class (Class class)
+{
+ char *super_class_name;
+
+ /* If the class links have been resolved, use the resolved
+ links. */
+ if (CLS_ISRESOLV (class))
+ return class->super_class;
+
+ /* Else, 'class' has not yet been resolved. This means that its
+ super_class pointer is really the name of the super class (rather
+ than a pointer to the actual superclass). */
+ super_class_name = (char *)class->super_class;
+
+ /* Return Nil for a root class. */
+ if (super_class_name == NULL)
+ return Nil;
+
+ /* Lookup the superclass of non-root classes. */
+ return objc_getClass (super_class_name);
+}
+
+
+/* Creates a tree of classes whose topmost class is directly inherited
+ from `upper' and the bottom class in this tree is `bottom_class'.
+ If `upper' is Nil, creates a class hierarchy up to a root class.
+ The classes in this tree are super classes of `bottom_class'. The
+ `subclasses' member of each tree node point to the list of
+ subclasses for the node. */
+static objc_class_tree *
+create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
+{
+ Class superclass;
+ objc_class_tree *tree, *prev;
+
+ DEBUG_PRINTF ("create_tree_of_subclasses_inherited_from:");
+ DEBUG_PRINTF (" bottom_class = %s, upper = %s\n",
+ (bottom_class ? bottom_class->name : NULL),
+ (upper ? upper->name : NULL));
+
+ superclass = class_superclass_of_class (bottom_class);
+
+ prev = objc_calloc (1, sizeof (objc_class_tree));
+ prev->class = bottom_class;
+
+ if (superclass == upper)
+ return prev;
+
+ while (superclass != upper)
+ {
+ tree = objc_calloc (1, sizeof (objc_class_tree));
+ tree->class = superclass;
+ tree->subclasses = list_cons (prev, tree->subclasses);
+ superclass = class_superclass_of_class (superclass);
+ prev = tree;
+ }
+
+ return tree;
+}
+
+/* Insert the `class' into the proper place in the `tree' class
+ hierarchy. This function returns a new tree if the class has been
+ successfully inserted into the tree or NULL if the class is not
+ part of the classes hierarchy described by `tree'. This function
+ is private to objc_tree_insert_class (), you should not call it
+ directly. */
+static objc_class_tree *
+__objc_tree_insert_class (objc_class_tree *tree, Class class)
+{
+ DEBUG_PRINTF ("__objc_tree_insert_class: tree = %p (root: %s), class = %s\n",
+ tree, ((tree && tree->class) ? tree->class->name : "Nil"), class->name);
+
+ if (tree == NULL)
+ return create_tree_of_subclasses_inherited_from (class, NULL);
+ else if (class == tree->class)
+ {
+ /* `class' has been already inserted. */
+ DEBUG_PRINTF (" 1. class %s was previously inserted\n", class->name);
+ return tree;
+ }
+ else if (class_superclass_of_class (class) == tree->class)
+ {
+ /* If class is a direct subclass of tree->class then add class
+ to the list of subclasses. First check to see if it wasn't
+ already inserted. */
+ struct objc_list *list = tree->subclasses;
+ objc_class_tree *node;
+
+ while (list)
+ {
+ /* Class has been already inserted; do nothing just return
+ the tree. */
+ if (((objc_class_tree *) list->head)->class == class)
+ {
+ DEBUG_PRINTF (" 2. class %s was previously inserted\n",
+ class->name);
+ return tree;
+ }
+ list = list->tail;
+ }
+
+ /* Create a new node class and insert it into the list of
+ subclasses. */
+ node = objc_calloc (1, sizeof (objc_class_tree));
+ node->class = class;
+ tree->subclasses = list_cons (node, tree->subclasses);
+ DEBUG_PRINTF (" 3. class %s inserted\n", class->name);
+ return tree;
+ }
+ else
+ {
+ /* The class is not a direct subclass of tree->class. Search
+ for class's superclasses in the list of subclasses. */
+ struct objc_list *subclasses = tree->subclasses;
+
+ /* Precondition: the class must be a subclass of tree->class;
+ otherwise return NULL to indicate our caller that it must
+ take the next tree. */
+ if (! class_is_subclass_of_class (class, tree->class))
+ return NULL;
+
+ for (; subclasses != NULL; subclasses = subclasses->tail)
+ {
+ Class aClass = ((objc_class_tree *) (subclasses->head))->class;
+
+ if (class_is_subclass_of_class (class, aClass))
+ {
+ /* If we found one of class's superclasses we insert the
+ class into its subtree and return the original tree
+ since nothing has been changed. */
+ subclasses->head
+ = __objc_tree_insert_class (subclasses->head, class);
+ DEBUG_PRINTF (" 4. class %s inserted\n", class->name);
+ return tree;
+ }
+ }
+
+ /* We haven't found a subclass of `class' in the `subclasses'
+ list. Create a new tree of classes whose topmost class is a
+ direct subclass of tree->class. */
+ {
+ objc_class_tree *new_tree
+ = create_tree_of_subclasses_inherited_from (class, tree->class);
+ tree->subclasses = list_cons (new_tree, tree->subclasses);
+ DEBUG_PRINTF (" 5. class %s inserted\n", class->name);
+ return tree;
+ }
+ }
+}
+
+/* This function inserts `class' in the right tree hierarchy classes. */
+static void
+objc_tree_insert_class (Class class)
+{
+ struct objc_list *list_node;
+ objc_class_tree *tree;
+
+ list_node = __objc_class_tree_list;
+ while (list_node)
+ {
+ /* Try to insert the class in this class hierarchy. */
+ tree = __objc_tree_insert_class (list_node->head, class);
+ if (tree)
+ {
+ list_node->head = tree;
+ return;
+ }
+ else
+ list_node = list_node->tail;
+ }
+
+ /* If the list was finished but the class hasn't been inserted, we
+ don't have an existing class hierarchy that can accomodate it.
+ Create a new one. */
+ __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
+ __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class);
+}
+
+/* Traverse tree in preorder. Used to send +load. */
+static void
+objc_preorder_traverse (objc_class_tree *tree,
+ int level,
+ void (*function) (objc_class_tree *, int))
+{
+ struct objc_list *node;
+
+ (*function) (tree, level);
+ for (node = tree->subclasses; node; node = node->tail)
+ objc_preorder_traverse (node->head, level + 1, function);
+}
+
+/* Traverse tree in postorder. Used to destroy a tree. */
+static void
+objc_postorder_traverse (objc_class_tree *tree,
+ int level,
+ void (*function) (objc_class_tree *, int))
+{
+ struct objc_list *node;
+
+ for (node = tree->subclasses; node; node = node->tail)
+ objc_postorder_traverse (node->head, level + 1, function);
+ (*function) (tree, level);
+}
+
+/* Used to print a tree class hierarchy. */
+#ifdef DEBUG
+static void
+__objc_tree_print (objc_class_tree *tree, int level)
+{
+ int i;
+
+ for (i = 0; i < level; i++)
+ printf (" ");
+ printf ("%s\n", tree->class->name);
+}
+#endif
+
+/* Walks on a linked list of methods in the reverse order and executes
+ all the methods corresponding to the `+load' selector. Walking in
+ the reverse order assures the +load of class is executed first and
+ then +load of categories because of the way in which categories are
+ added to the class methods. This function needs to be called with
+ the objc_runtime_mutex locked. */
+static void
+__objc_send_load_using_method_list (struct objc_method_list *method_list, Class class)
+{
+ static SEL load_selector = 0;
+ int i;
+
+ if (!method_list)
+ return;
+
+ /* This needs no lock protection because we are called with the
+ objc_runtime_mutex locked. */
+ if (!load_selector)
+ load_selector = sel_registerName ("load");
+
+ /* method_list is a linked list of method lists; since we're
+ executing in reverse order, we need to do the next list before we
+ do this one. */
+ __objc_send_load_using_method_list (method_list->method_next, class);
+
+ /* Search the method list. */
+ for (i = 0; i < method_list->method_count; i++)
+ {
+ struct objc_method *mth = &method_list->method_list[i];
+
+ /* We are searching for +load methods that we haven't executed
+ yet. */
+ if (mth->method_name && sel_eq (mth->method_name, load_selector)
+ && ! objc_hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
+ {
+ /* Add this method into the +load hash table, so we won't
+ execute it again next time. */
+ objc_hash_add (&__objc_load_methods,
+ mth->method_imp,
+ mth->method_imp);
+
+ /* Call +load. */
+ DEBUG_PRINTF (" begin of [%s +load]\n", class->name);
+ (*mth->method_imp) ((id)class, mth->method_name);
+ DEBUG_PRINTF (" end of [%s +load]\n", class->name);
+
+ break;
+ }
+ }
+}
+
+/* This function needs to be called with the objc_runtime_mutex
+ locked. */
+static void
+__objc_send_load (objc_class_tree *tree,
+ int level __attribute__ ((__unused__)))
+{
+ Class class = tree->class;
+ struct objc_method_list *method_list = class->class_pointer->methods;
+
+ DEBUG_PRINTF ("+load: need to send load to class '%s'\n", class->name);
+ __objc_send_load_using_method_list (method_list, class);
+}
+
+static void
+__objc_destroy_class_tree_node (objc_class_tree *tree,
+ int level __attribute__ ((__unused__)))
+{
+ objc_free (tree);
+}
+
+/* This is used to check if the relationship between two classes
+ before the runtime completely installs the classes. */
+static BOOL
+class_is_subclass_of_class (Class class, Class superclass)
+{
+ for (; class != Nil;)
+ {
+ if (class == superclass)
+ return YES;
+ class = class_superclass_of_class (class);
+ }
+
+ return NO;
+}
+
+/* This list contains all the classes in the runtime system for whom
+ their superclasses are not yet known to the runtime. */
+static struct objc_list *unresolved_classes = 0;
+
+/* Extern function used to reference the Object class. */
+extern void __objc_force_linking (void);
+
+void
+__objc_force_linking (void)
+{
+ extern void __objc_linking (void);
+ __objc_linking ();
+}
+
+/* Run through the statics list, removing modules as soon as all its
+ statics have been initialized. */
+static void
+objc_init_statics (void)
+{
+ struct objc_list **cell = &uninitialized_statics;
+ struct objc_static_instances **statics_in_module;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ while (*cell)
+ {
+ int module_initialized = 1;
+
+ for (statics_in_module = (*cell)->head;
+ *statics_in_module; statics_in_module++)
+ {
+ struct objc_static_instances *statics = *statics_in_module;
+ Class class = objc_getClass (statics->class_name);
+
+ if (! class)
+ {
+ /* It is unfortunate that this will cause all the
+ statics initialization to be done again (eg, if we
+ already initialized constant strings, and are now
+ initializing protocols, setting module_initialized to
+ 0 would cause constant strings to be initialized
+ again). It would be good to be able to track if we
+ have already initialized some of them. */
+ module_initialized = 0;
+ }
+ else
+ {
+ /* Note that if this is a list of Protocol objects, some
+ of them may have been initialized already (because
+ they were attached to classes or categories, and the
+ class/category loading code automatically fixes them
+ up), and some of them may not. We really need to go
+ through the whole list to be sure! Protocols are
+ also special because we want to register them and
+ register all their selectors. */
+ id *inst;
+
+ if (strcmp (statics->class_name, "Protocol") == 0)
+ {
+ /* Protocols are special, because not only we want
+ to fix up their class pointers, but we also want
+ to register them and their selectors with the
+ runtime. */
+ for (inst = &statics->instances[0]; *inst; inst++)
+ __objc_init_protocol ((struct objc_protocol *)*inst);
+ }
+ else
+ {
+ /* Other static instances (typically constant
+ strings) are easier as we just fix up their class
+ pointers. */
+ for (inst = &statics->instances[0]; *inst; inst++)
+ (*inst)->class_pointer = class;
+ }
+ }
+ }
+ if (module_initialized)
+ {
+ /* Remove this module from the uninitialized list. */
+ struct objc_list *this = *cell;
+ *cell = this->tail;
+ objc_free (this);
+ }
+ else
+ cell = &(*cell)->tail;
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* This function is called by constructor functions generated for each
+ module compiled. (_GLOBAL_$I$...) The purpose of this function is
+ to gather the module pointers so that they may be processed by the
+ initialization routines as soon as possible. */
+void
+__objc_exec_class (struct objc_module *module)
+{
+ /* Have we processed any constructors previously? This flag is used
+ to indicate that some global data structures need to be
+ built. */
+ static BOOL previous_constructors = 0;
+
+ static struct objc_list *unclaimed_categories = 0;
+
+ /* The symbol table (defined in objc-private/module-abi-8.h)
+ generated by gcc. */
+ struct objc_symtab *symtab = module->symtab;
+
+ /* The statics in this module. */
+ struct objc_static_instances **statics
+ = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt];
+
+ /* Entry used to traverse hash lists. */
+ struct objc_list **cell;
+
+ /* The table of selector references for this module. */
+ struct objc_selector *selectors = symtab->refs;
+
+ int i;
+
+ DEBUG_PRINTF ("\n__objc_exec_class (%p) - start processing module...\n", module);
+
+ /* Check gcc version. */
+ init_check_module_version (module);
+
+ /* On the first call of this routine, initialize some data
+ structures. */
+ if (! previous_constructors)
+ {
+ /* Initialize thread-safe system. */
+ __objc_init_thread_system ();
+ __objc_runtime_threads_alive = 1;
+ __objc_runtime_mutex = objc_mutex_allocate ();
+
+ __objc_init_selector_tables ();
+ __objc_init_class_tables ();
+ __objc_init_dispatch_tables ();
+ duplicate_classes = objc_hash_new (8,
+ (hash_func_type)objc_hash_ptr,
+ objc_compare_ptrs);
+ __objc_load_methods = objc_hash_new (128,
+ (hash_func_type)objc_hash_ptr,
+ objc_compare_ptrs);
+ __objc_protocols_init ();
+ __objc_accessors_init ();
+ __objc_sync_init ();
+ previous_constructors = 1;
+ }
+
+ /* Save the module pointer so that later we remember to call +load
+ on all classes and categories on it. */
+ objc_mutex_lock (__objc_runtime_mutex);
+ __objc_module_list = list_cons (module, __objc_module_list);
+
+ /* Replace referenced selectors from names to SELs. */
+ if (selectors)
+ {
+ DEBUG_PRINTF (" registering selectors\n");
+ __objc_register_selectors_from_module (selectors);
+ }
+
+ /* Parse the classes in the load module and gather selector
+ information. */
+ for (i = 0; i < symtab->cls_def_cnt; ++i)
+ {
+ Class class = (Class) symtab->defs[i];
+ const char *superclass = (char *) class->super_class;
+
+ /* Make sure we have what we think. */
+ assert (CLS_ISCLASS (class));
+ assert (CLS_ISMETA (class->class_pointer));
+ DEBUG_PRINTF (" installing class '%s'\n", class->name);
+
+ /* Workaround for a bug in clang: Clang may set flags other than
+ _CLS_CLASS and _CLS_META even when compiling for the
+ traditional ABI (version 8), confusing our runtime. Try to
+ wipe these flags out. */
+ if (CLS_ISCLASS (class))
+ __CLS_INFO (class) = _CLS_CLASS;
+ else
+ __CLS_INFO (class) = _CLS_META;
+
+ /* Initialize the subclass list to be NULL. In some cases it
+ isn't and this crashes the program. */
+ class->subclass_list = NULL;
+
+ if (__objc_init_class (class))
+ {
+ /* Check to see if the superclass is known in this point. If
+ it's not add the class to the unresolved_classes list. */
+ if (superclass && ! objc_getClass (superclass))
+ unresolved_classes = list_cons (class, unresolved_classes);
+ }
+ }
+
+ /* Process category information from the module. */
+ for (i = 0; i < symtab->cat_def_cnt; ++i)
+ {
+ struct objc_category *category = symtab->defs[i + symtab->cls_def_cnt];
+ Class class = objc_getClass (category->class_name);
+
+ /* If the class for the category exists then append its
+ methods. */
+ if (class)
+ {
+ DEBUG_PRINTF (" installing category '%s (%s)'\n", category->class_name, category->category_name);
+ /* Do instance methods. */
+ if (category->instance_methods)
+ class_add_method_list (class, category->instance_methods);
+
+ /* Do class methods. */
+ if (category->class_methods)
+ class_add_method_list ((Class) class->class_pointer,
+ category->class_methods);
+
+ if (category->protocols)
+ {
+ __objc_init_protocols (category->protocols);
+ __objc_class_add_protocols (class, category->protocols);
+ }
+
+ /* Register the instance methods as class methods, this is
+ only done for root classes. */
+ __objc_register_instance_methods_to_class (class);
+ }
+ else
+ {
+ DEBUG_PRINTF (" delaying installation of category '%s (%s)'\n", category->class_name, category->category_name);
+ /* The object to which the category methods belong can't be
+ found. Save the information. */
+ unclaimed_categories = list_cons (category, unclaimed_categories);
+ }
+ }
+
+ if (statics)
+ uninitialized_statics = list_cons (statics, uninitialized_statics);
+ if (uninitialized_statics)
+ objc_init_statics ();
+
+ /* Scan the unclaimed category hash. Attempt to attach any
+ unclaimed categories to objects. */
+ for (cell = &unclaimed_categories; *cell; )
+ {
+ struct objc_category *category = (*cell)->head;
+ Class class = objc_getClass (category->class_name);
+
+ if (class)
+ {
+ DEBUG_PRINTF (" installing (delayed) category '%s (%s)'\n", category->class_name, category->category_name);
+ list_remove_head (cell);
+
+ if (category->instance_methods)
+ class_add_method_list (class, category->instance_methods);
+
+ if (category->class_methods)
+ class_add_method_list ((Class) class->class_pointer,
+ category->class_methods);
+
+ if (category->protocols)
+ {
+ __objc_init_protocols (category->protocols);
+ __objc_class_add_protocols (class, category->protocols);
+ }
+
+ /* Register the instance methods as class methods, this is
+ only done for root classes. */
+ __objc_register_instance_methods_to_class (class);
+ }
+ else
+ cell = &(*cell)->tail;
+ }
+
+ if (unclaimed_proto_list && objc_getClass ("Protocol"))
+ {
+ list_mapcar (unclaimed_proto_list,
+ (void (*) (void *))__objc_init_protocols);
+ list_free (unclaimed_proto_list);
+ unclaimed_proto_list = 0;
+ }
+
+ objc_send_load ();
+
+ /* Check if there are no unresolved classes (ie, classes whose
+ superclass has not been loaded yet) and that the 'Object' class,
+ used as the class of classes, exist. If so, it is worth
+ "resolving the class links" at this point, which will setup all
+ the class/superclass pointers. */
+ if (!unresolved_classes && objc_getClass ("Object"))
+ {
+ DEBUG_PRINTF (" resolving class links\n");
+ __objc_resolve_class_links ();
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ DEBUG_PRINTF ("__objc_exec_class (%p) - finished processing module...\n\n", module);
+}
+
+/* This function needs to be called with the objc_runtime_mutex
+ locked. */
+static void
+objc_send_load (void)
+{
+ if (!__objc_module_list)
+ return;
+
+ /* Try to find out if all the classes loaded so far also have their
+ superclasses known to the runtime. We suppose that the objects
+ that are allocated in the +load method are in general of a class
+ declared in the same module. */
+ if (unresolved_classes)
+ {
+ Class class = unresolved_classes->head;
+
+ while (objc_getClass ((char *) class->super_class))
+ {
+ list_remove_head (&unresolved_classes);
+ if (unresolved_classes)
+ class = unresolved_classes->head;
+ else
+ break;
+ }
+
+ /* If we still have classes for whom we don't have yet their
+ super classes known to the runtime we don't send the +load
+ messages (and call the load callback) yet. */
+ if (unresolved_classes)
+ return;
+ }
+
+ /* Special check. If 'Object', which is used by meta-classes, has
+ not been loaded yet, delay sending of +load. */
+ if (! objc_getClass ("Object"))
+ return;
+
+ /* Iterate over all modules in the __objc_module_list and call on
+ them the __objc_create_classes_tree function. This function
+ creates a tree of classes that resembles the class hierarchy. */
+ list_mapcar (__objc_module_list,
+ (void (*) (void *)) __objc_create_classes_tree);
+
+ while (__objc_class_tree_list)
+ {
+#ifdef DEBUG
+ objc_preorder_traverse (__objc_class_tree_list->head,
+ 0, __objc_tree_print);
+#endif
+ objc_preorder_traverse (__objc_class_tree_list->head,
+ 0, __objc_send_load);
+ objc_postorder_traverse (__objc_class_tree_list->head,
+ 0, __objc_destroy_class_tree_node);
+ list_remove_head (&__objc_class_tree_list);
+ }
+
+ /* For each module, call the _objc_load_callback if any is
+ defined. */
+ list_mapcar (__objc_module_list, (void (*) (void *)) __objc_call_load_callback);
+
+ /* Empty the list of modules. */
+ list_free (__objc_module_list);
+ __objc_module_list = NULL;
+}
+
+static void
+__objc_create_classes_tree (struct objc_module *module)
+{
+ /* The runtime mutex is locked at this point */
+ struct objc_symtab *symtab = module->symtab;
+ int i;
+
+ /* Iterate thru classes defined in this module and insert them in
+ the classes tree hierarchy. */
+ for (i = 0; i < symtab->cls_def_cnt; i++)
+ {
+ Class class = (Class) symtab->defs[i];
+
+ if (!objc_hash_is_key_in_hash (duplicate_classes, class))
+ objc_tree_insert_class (class);
+ }
+
+ /* Now iterate over "claimed" categories too (ie, categories that
+ extend a class that has already been loaded by the runtime), and
+ insert them in the classes tree hiearchy too. Otherwise, if you
+ add a category, its +load method would not be called if the class
+ is already loaded in the runtime. It the category is
+ "unclaimed", ie, we haven't loaded the main class yet, postpone
+ sending +load as we want to execute +load from the class before
+ we execute the one from the category. */
+ for (i = 0; i < symtab->cat_def_cnt; ++i)
+ {
+ struct objc_category *category = symtab->defs[i + symtab->cls_def_cnt];
+ Class class = objc_getClass (category->class_name);
+
+ /* If the class for the category exists then append its
+ methods. */
+ if (class)
+ objc_tree_insert_class (class);
+ }
+}
+
+static void
+__objc_call_load_callback (struct objc_module *module)
+{
+ if (_objc_load_callback)
+ {
+ /* The runtime mutex is locked at this point. */
+ struct objc_symtab *symtab = module->symtab;
+ int i;
+
+ /* Iterate thru classes defined in this module and call the callback
+ for each one. */
+ for (i = 0; i < symtab->cls_def_cnt; i++)
+ {
+ Class class = (Class) symtab->defs[i];
+
+ if (!objc_hash_is_key_in_hash (duplicate_classes, class))
+ {
+ /* Call the _objc_load_callback for this class. */
+ DEBUG_PRINTF (" calling the load callback for class '%s'\n", class->name);
+ _objc_load_callback (class, 0);
+ }
+ }
+
+ /* Call the _objc_load_callback for categories. Don't register
+ the instance methods as class methods for categories to root
+ classes since they were already added in the class. */
+ for (i = 0; i < symtab->cat_def_cnt; i++)
+ {
+ struct objc_category *category = symtab->defs[i + symtab->cls_def_cnt];
+ Class class = objc_getClass (category->class_name);
+
+ DEBUG_PRINTF (" calling the load callback for category '%s (%s)'\n",
+ category->class_name, category->category_name);
+ _objc_load_callback (class, category);
+ }
+ }
+}
+
+/* Sanity check the version of gcc used to compile `module'. */
+static void
+init_check_module_version (struct objc_module *module)
+{
+ if ((module->version != OBJC_VERSION) || (module->size != sizeof (struct objc_module)))
+ {
+ _objc_abort ("Module %s version %d doesn't match runtime %d\n",
+ module->name, (int)module->version, OBJC_VERSION);
+ }
+}
+
+/* __objc_init_class must be called with __objc_runtime_mutex already
+ locked. Return YES if the class could be setup; return NO if the
+ class could not be setup because a class with the same name already
+ exists. */
+BOOL
+__objc_init_class (Class class)
+{
+ /* Store the class in the class table and assign class numbers. */
+ if (__objc_add_class_to_hash (class))
+ {
+ /* Register all of the selectors in the class and meta class. */
+ __objc_register_selectors_from_class (class);
+ __objc_register_selectors_from_class ((Class) class->class_pointer);
+
+ /* Install the fake dispatch tables. */
+ __objc_install_premature_dtable (class);
+ __objc_install_premature_dtable (class->class_pointer);
+
+ /* Register the instance methods as class methods, this is only
+ done for root classes. */
+ __objc_register_instance_methods_to_class (class);
+
+ if (class->protocols)
+ __objc_init_protocols (class->protocols);
+
+ return YES;
+ }
+ else
+ {
+ /* The module contains a duplicate class. Remember it so that
+ we will ignore it later. */
+ DEBUG_PRINTF (" duplicate class '%s' - will be ignored\n", class->name);
+ objc_hash_add (&duplicate_classes, class, class);
+ return NO;
+ }
+}
+
+/* __objc_init_protocol must be called with __objc_runtime_mutex
+ already locked, and the "Protocol" class already registered. */
+static void
+__objc_init_protocol (struct objc_protocol *protocol)
+{
+ static Class proto_class = 0;
+
+ if (! proto_class)
+ proto_class = objc_getClass ("Protocol");
+
+ if (((size_t)protocol->class_pointer) == PROTOCOL_VERSION)
+ {
+ /* Assign class pointer. */
+ protocol->class_pointer = proto_class;
+
+ /* Register all the selectors in the protocol with the runtime.
+ This both registers the selectors with the right types, and
+ it also fixes up the 'struct objc_method' structures inside
+ the protocol so that each method_name (a char * as compiled
+ by the compiler) is replaced with the appropriate runtime
+ SEL. */
+ if (protocol->class_methods)
+ __objc_register_selectors_from_description_list (protocol->class_methods);
+
+ if (protocol->instance_methods)
+ __objc_register_selectors_from_description_list (protocol->instance_methods);
+
+ /* Register the protocol in the hashtable or protocols by
+ name. */
+ __objc_protocols_add_protocol (protocol->protocol_name, protocol);
+
+ /* Init super protocols. */
+ __objc_init_protocols (protocol->protocol_list);
+ }
+ else if (protocol->class_pointer != proto_class)
+ {
+ _objc_abort ("Version %d doesn't match runtime protocol version %d\n",
+ (int) ((char *) protocol->class_pointer
+ - (char *) 0),
+ PROTOCOL_VERSION);
+ }
+}
+
+static void
+__objc_init_protocols (struct objc_protocol_list *protos)
+{
+ size_t i;
+ static Class proto_class = 0;
+
+ if (! protos)
+ return;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ if (! proto_class)
+ proto_class = objc_getClass ("Protocol");
+
+ if (! proto_class)
+ {
+ unclaimed_proto_list = list_cons (protos, unclaimed_proto_list);
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return;
+ }
+
+#if 0
+ assert (protos->next == 0); /* Only single ones allowed. */
+#endif
+
+ for (i = 0; i < protos->count; i++)
+ {
+ struct objc_protocol *aProto = protos->list[i];
+ __objc_init_protocol (aProto);
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+static void
+__objc_class_add_protocols (Class class, struct objc_protocol_list *protos)
+{
+ if (! protos)
+ return;
+
+ protos->next = class->protocols;
+ class->protocols = protos;
+}
diff --git a/libobjc/ivars.c b/libobjc/ivars.c
new file mode 100644
index 000000000..6111a03ea
--- /dev/null
+++ b/libobjc/ivars.c
@@ -0,0 +1,376 @@
+/* GNU Objective C Runtime ivar related functions.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h" /* For runtime structures */
+#include "objc/thr.h"
+#include "objc-private/runtime.h" /* the kitchen sink */
+#include <string.h> /* For strcmp. */
+#include <stdlib.h> /* For malloc. */
+
+struct objc_ivar *
+class_getInstanceVariable (Class class_, const char *name)
+{
+ if (class_ != Nil && name != NULL && ! CLS_IS_IN_CONSTRUCTION (class_))
+ {
+ while (class_ != Nil)
+ {
+ struct objc_ivar_list *ivars = class_->ivars;
+ if (ivars != NULL)
+ {
+ int i;
+
+ for (i = 0; i < ivars->ivar_count; i++)
+ {
+ struct objc_ivar *ivar = &(ivars->ivar_list[i]);
+
+ if (!strcmp (ivar->ivar_name, name))
+ return ivar;
+ }
+ }
+ class_ = class_getSuperclass (class_);
+ }
+ }
+ return NULL;
+}
+
+struct objc_ivar *
+class_getClassVariable (Class class_, const char *name)
+{
+ if (class_ == Nil)
+ return NULL;
+
+ /* Logically, since a class is an instance of its meta-class, and
+ since its class methods are the instance methods of the
+ meta-class, class variables should be instance variables of the
+ meta-class. That is different from the normal use of having
+ 'static' variables in the class implementation file, because
+ every class would have its own variables.
+
+ Anyway, it is all speculative at this stage, but if we get class
+ variables in Objective-C, it is conceivable that this
+ implementation should work. */
+ return class_getInstanceVariable (class_->class_pointer, name);
+}
+
+void *
+object_getIndexedIvars (id object)
+{
+ if (object == nil)
+ return NULL;
+ else
+ return (void *)(((char *)object)
+ + object->class_pointer->instance_size);
+}
+
+struct objc_ivar *
+object_getInstanceVariable (id object, const char *name, void **returnValue)
+{
+ if (object == nil || name == NULL)
+ return NULL;
+ else
+ {
+ struct objc_ivar * variable = class_getInstanceVariable (object->class_pointer, name);
+
+ if (variable != NULL && returnValue != NULL)
+ {
+ char *location = (char *)object + variable->ivar_offset;
+
+ *returnValue = *((id *)location);
+ }
+
+ return variable;
+ }
+}
+
+struct objc_ivar *
+object_setInstanceVariable (id object, const char *name, void *newValue)
+{
+ if (object == nil || name == NULL)
+ return NULL;
+ else
+ {
+ struct objc_ivar * variable = class_getInstanceVariable (object->class_pointer, name);
+
+ if (variable != NULL)
+ {
+ char *location = (char *)object + variable->ivar_offset;
+
+ *((id *)location) = (id)newValue;
+ }
+
+ return variable;
+ }
+}
+
+id object_getIvar (id object, struct objc_ivar * variable)
+{
+ if (object == nil || variable == NULL)
+ return nil;
+ else
+ {
+ char *location = (char *)object + variable->ivar_offset;
+
+ return *((id *)location);
+ }
+}
+
+void object_setIvar (id object, struct objc_ivar * variable, id value)
+{
+ if (object == nil || variable == NULL)
+ return;
+ else
+ {
+ char *location = (char *)object + variable->ivar_offset;
+
+ *((id *)location) = value;
+ }
+}
+
+const char * ivar_getName (struct objc_ivar * variable)
+{
+ if (variable == NULL)
+ return NULL;
+
+ return variable->ivar_name;
+}
+
+ptrdiff_t ivar_getOffset (struct objc_ivar * variable)
+{
+ if (variable == NULL)
+ return 0;
+
+ return (ptrdiff_t)(variable->ivar_offset);
+}
+
+const char * ivar_getTypeEncoding (struct objc_ivar * variable)
+{
+ if (variable == NULL)
+ return NULL;
+
+ return variable->ivar_type;
+}
+
+struct objc_ivar ** class_copyIvarList (Class class_, unsigned int *numberOfReturnedIvars)
+{
+ unsigned int count = 0;
+ struct objc_ivar **returnValue = NULL;
+ struct objc_ivar_list* ivar_list;
+
+ if (class_ == Nil || CLS_IS_IN_CONSTRUCTION (class_))
+ {
+ if (numberOfReturnedIvars)
+ *numberOfReturnedIvars = 0;
+ return NULL;
+ }
+
+ /* Count how many ivars we have. */
+ ivar_list = class_->ivars;
+ count = ivar_list->ivar_count;
+
+ if (count != 0)
+ {
+ unsigned int i = 0;
+
+ /* Allocate enough memory to hold them. */
+ returnValue = (struct objc_ivar **)(malloc (sizeof (struct objc_ivar *) * (count + 1)));
+
+ /* Copy the ivars. */
+ for (i = 0; i < count; i++)
+ returnValue[i] = &(ivar_list->ivar_list[i]);
+
+ returnValue[i] = NULL;
+ }
+
+ if (numberOfReturnedIvars)
+ *numberOfReturnedIvars = count;
+
+ return returnValue;
+}
+
+BOOL
+class_addIvar (Class class_, const char * ivar_name, size_t size,
+ unsigned char log_2_of_alignment, const char *type)
+{
+ struct objc_ivar_list *ivars;
+
+ if (class_ == Nil
+ || (! CLS_IS_IN_CONSTRUCTION (class_))
+ || ivar_name == NULL
+ || (strcmp (ivar_name, "") == 0)
+ || size == 0
+ || type == NULL)
+ return NO;
+
+ /* Check if the class has an instance variable with that name
+ already. */
+ ivars = class_->ivars;
+
+ if (ivars != NULL)
+ {
+ int i;
+
+ for (i = 0; i < ivars->ivar_count; i++)
+ {
+ struct objc_ivar *ivar = &(ivars->ivar_list[i]);
+
+ if (strcmp (ivar->ivar_name, ivar_name) == 0)
+ return NO;
+ }
+ }
+
+ /* Ok, no direct ivars. Check superclasses. */
+ if (class_getInstanceVariable (objc_getClass ((char *)(class_->super_class)),
+ ivar_name))
+ return NO;
+
+ /* Good. Create space for the new instance variable. */
+ if (ivars)
+ {
+ int ivar_count = ivars->ivar_count + 1;
+ int new_size = sizeof (struct objc_ivar_list)
+ + (ivar_count - 1) * sizeof (struct objc_ivar);
+
+ ivars = (struct objc_ivar_list*) objc_realloc (ivars, new_size);
+ ivars->ivar_count = ivar_count;
+ class_->ivars = ivars;
+ }
+ else
+ {
+ int new_size = sizeof (struct objc_ivar_list);
+
+ ivars = (struct objc_ivar_list*) objc_malloc (new_size);
+ ivars->ivar_count = 1;
+ class_->ivars = ivars;
+ }
+
+ /* Now ivars is set to a list of instance variables of the right
+ size. */
+ {
+ struct objc_ivar *ivar = &(ivars->ivar_list[ivars->ivar_count - 1]);
+ unsigned int alignment = 1 << log_2_of_alignment;
+ int misalignment;
+
+ ivar->ivar_name = objc_malloc (strlen (ivar_name) + 1);
+ strcpy ((char *)ivar->ivar_name, ivar_name);
+
+ ivar->ivar_type = objc_malloc (strlen (type) + 1);
+ strcpy ((char *)ivar->ivar_type, type);
+
+ /* The new instance variable is placed at the end of the existing
+ instance_size, at the first byte that is aligned with
+ alignment. */
+ misalignment = class_->instance_size % alignment;
+
+ if (misalignment == 0)
+ ivar->ivar_offset = class_->instance_size;
+ else
+ ivar->ivar_offset = class_->instance_size - misalignment + alignment;
+
+ class_->instance_size = ivar->ivar_offset + size;
+ }
+
+ return YES;
+}
+
+
+const char *
+property_getName (struct objc_property * property __attribute__ ((__unused__)))
+{
+ if (property == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on properties. */
+ return NULL;
+}
+
+const char *
+property_getAttributes (struct objc_property * property __attribute__ ((__unused__)))
+{
+ if (property == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on properties. */
+ return NULL;
+}
+
+struct objc_property *
+class_getProperty (Class class_ __attribute__ ((__unused__)),
+ const char *propertyName __attribute__ ((__unused__)))
+{
+ if (class_ == NULL || propertyName == NULL)
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on class properties. */
+ return NULL;
+}
+
+struct objc_property **
+class_copyPropertyList (Class class_ __attribute__ ((__unused__)),
+ unsigned int *numberOfReturnedProperties __attribute__ ((__unused__)))
+{
+ if (class_ == Nil)
+ {
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = 0;
+ return NULL;
+ }
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on class properties. */
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = 0;
+
+ return NULL;
+}
+
+const char *
+class_getIvarLayout (Class class_ __attribute__ ((__unused__)))
+{
+ return NULL;
+}
+
+const char *
+class_getWeakIvarLayout (Class class_ __attribute__ ((__unused__)))
+{
+ return NULL;
+}
+
+void
+class_setIvarLayout (Class class_ __attribute__ ((__unused__)),
+ const char *layout __attribute__ ((__unused__)))
+{
+ return;
+}
+
+void
+class_setWeakIvarLayout (Class class_ __attribute__ ((__unused__)),
+ const char *layout __attribute__ ((__unused__)))
+{
+ return;
+}
diff --git a/libobjc/libobjc.def b/libobjc/libobjc.def
new file mode 100644
index 000000000..e84d839ad
--- /dev/null
+++ b/libobjc/libobjc.def
@@ -0,0 +1,171 @@
+; GNU Objective C Runtime DLL Export Definitions
+; Copyright (C) 1997, 2001, 2003, 2005, 2009, 2010
+; Free Software Foundation, Inc.
+; Contributed by Scott Christley <scottc@net-community.com>
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under the
+; terms of the GNU General Public License as published by the Free Software
+; Foundation; either version 3, or (at your option) any later version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+; details.
+;
+; You should have received a copy of the GNU General Public License along with
+; GCC; see the file COPYING3. If not, see <http://www.gnu.org/licenses/>.
+
+; FIXME: This file needs to be updated or removed
+
+LIBRARY libobjc
+EXPORTS
+search_for_method_in_list
+objc_get_uninstalled_dtable
+objc_hash_is_key_in_hash
+hash_is_key_in_hash
+objc_verror
+_objc_load_callback
+objc_malloc
+objc_atomic_malloc
+objc_valloc
+objc_realloc
+objc_calloc
+objc_free
+__objc_init_thread_system
+objc_mutex_allocate
+objc_mutex_deallocate
+objc_mutex_lock
+objc_mutex_trylock
+objc_mutex_unlock
+_objc_unexpected_exception
+objc_thread_detach
+objc_thread_exit
+objc_thread_get_data
+objc_thread_get_priority
+objc_thread_id
+objc_thread_set_data
+objc_thread_set_priority
+objc_thread_yield
+objc_thread_add
+objc_thread_remove
+__objc_class_name_Object
+__objc_class_name_Protocol
+__objc_class_name_NXConstantString
+objc_error
+__objc_object_alloc
+__objc_object_copy
+__objc_object_dispose
+class_create_instance
+object_copy
+object_dispose
+__objc_init_selector_tables
+__objc_register_selectors_from_class
+__sel_register_typed_name
+sel_get_any_typed_uid
+sel_get_any_uid
+sel_get_name
+sel_get_type
+sel_get_typed_uid
+sel_get_uid
+sel_is_mapped
+sel_register_name
+sel_register_typed_name
+sel_types_match
+method_get_first_argument
+method_get_next_argument
+method_get_nth_argument
+method_get_number_of_arguments
+method_get_sizeof_arguments
+objc_aligned_size
+objc_alignof_type
+objc_get_type_qualifiers
+objc_promoted_size
+objc_sizeof_type
+objc_skip_argspec
+objc_skip_offset
+objc_skip_type_qualifiers
+objc_skip_typespec
+__objc_read_nbyte_uint
+__objc_read_nbyte_ulong
+__objc_write_class
+__objc_write_object
+__objc_write_selector
+objc_close_typed_stream
+objc_end_of_typed_stream
+objc_flush_typed_stream
+objc_get_stream_class_version
+objc_open_typed_stream
+objc_open_typed_stream_for_file
+objc_read_array
+objc_read_char
+objc_read_int
+objc_read_long
+objc_read_object
+objc_read_selector
+objc_read_short
+objc_read_string
+objc_read_type
+objc_read_types
+objc_read_unsigned_char
+objc_read_unsigned_int
+objc_read_unsigned_long
+objc_read_unsigned_short
+objc_write_array
+objc_write_char
+objc_write_int
+objc_write_long
+objc_write_object
+objc_write_object_reference
+objc_write_root_object
+objc_write_selector
+objc_write_short
+objc_write_string
+objc_write_string_atomic
+objc_write_type
+objc_write_types
+objc_write_unsigned_char
+objc_write_unsigned_int
+objc_write_unsigned_long
+objc_write_unsigned_short
+__objc_exec_class
+__objc_init_dispatch_tables
+__objc_install_premature_dtable
+__objc_print_dtable_stats
+__objc_update_dispatch_table_for_class
+class_add_method_list
+class_get_class_method
+class_get_instance_method
+get_imp
+nil_method
+objc_msg_lookup
+objc_msg_lookup_super
+objc_msg_sendv
+__objc_add_class_to_hash
+__objc_init_class_tables
+__objc_resolve_class_links
+class_pose_as
+objc_get_class
+objc_get_meta_class
+objc_lookup_class
+objc_next_class
+sarray_at_put
+sarray_at_put_safe
+sarray_free
+sarray_lazy_copy
+sarray_new
+sarray_realloc
+sarray_remove_garbage
+objc_hash_add
+hash_add
+objc_hash_delete
+hash_delete
+objc_hash_new
+hash_new
+objc_hash_next
+hash_next
+objc_hash_remove
+hash_remove
+objc_hash_value_for_key
+hash_value_for_key
diff --git a/libobjc/linking.m b/libobjc/linking.m
new file mode 100644
index 000000000..ba8e0649f
--- /dev/null
+++ b/libobjc/linking.m
@@ -0,0 +1,36 @@
+/* Force linking of classes required by Objective C runtime.
+ Copyright (C) 1997, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Ovidiu Predescu (ovidiu@net-community.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include <objc/Object.h>
+
+/* Generate references to Object class since it is needed by the
+ runtime system to run correctly. */
+
+void __objc_linking (void)
+{
+ [Object name];
+}
+
diff --git a/libobjc/memory.c b/libobjc/memory.c
new file mode 100644
index 000000000..b0519fc87
--- /dev/null
+++ b/libobjc/memory.c
@@ -0,0 +1,170 @@
+/* GNU Objective C Runtime Memory allocation functions
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* This file includes the standard functions for memory allocation and
+ disposal. Users should use these functions in their ObjC programs
+ so that they work properly with garbage collectors. */
+
+/* TODO: Turn these into macros or inline functions. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+
+/* __USE_FIXED_PROTOTYPES__ used to be required to get prototypes for
+ malloc, free, etc. on some platforms. It is unclear if we still
+ need it, but it can't hurt. */
+#define __USE_FIXED_PROTOTYPES__
+#include <stdlib.h>
+
+#include "objc/runtime.h"
+
+#if OBJC_WITH_GC
+#include <gc.h>
+
+void *
+objc_malloc (size_t size)
+{
+ void *res = (void *)(GC_malloc (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_atomic_malloc (size_t size)
+{
+ void *res = (void *)(GC_malloc_atomic (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_realloc (void *mem, size_t size)
+{
+ void *res = (void *)(GC_realloc (mem, size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_calloc (size_t nelem, size_t size)
+{
+ /* Note that GC_malloc returns cleared memory (see documentation) so
+ there is no need to clear it. */
+ void *res = (void *)(GC_malloc (nelem * size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void
+objc_free (void *mem __attribute__ ((__unused__)))
+{
+ return;
+}
+
+#else
+
+void *
+objc_malloc (size_t size)
+{
+ void *res = (void *)(malloc (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_atomic_malloc (size_t size)
+{
+ void *res = (void *)(malloc (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_realloc (void *mem, size_t size)
+{
+ void *res = (void *)(realloc (mem, size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void *
+objc_calloc (size_t nelem, size_t size)
+{
+ void *res = (void *)(calloc (nelem, size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+void
+objc_free (void *mem)
+{
+ free (mem);
+}
+
+#endif /* !OBJC_WITH_GC */
+
+/* The rest of the file contains deprecated code. */
+
+#if OBJC_WITH_GC
+
+void *
+objc_valloc (size_t size)
+{
+ void *res = (void *)(GC_malloc (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+#else
+
+void *
+objc_valloc (size_t size)
+{
+ void *res = (void *)(malloc (size));
+ if (! res)
+ _objc_abort ("Virtual memory exhausted\n");
+ return res;
+}
+
+#endif /* !OBJC_WITH_GC */
+
+/* Hook functions for memory allocation and disposal. Deprecated and
+ currently unused. */
+void *(*_objc_malloc) (size_t) = malloc;
+void *(*_objc_atomic_malloc) (size_t) = malloc;
+void *(*_objc_valloc) (size_t) = malloc;
+void *(*_objc_realloc) (void *, size_t) = realloc;
+void *(*_objc_calloc) (size_t, size_t) = calloc;
+void (*_objc_free) (void *) = free;
diff --git a/libobjc/methods.c b/libobjc/methods.c
new file mode 100644
index 000000000..b4faee533
--- /dev/null
+++ b/libobjc/methods.c
@@ -0,0 +1,177 @@
+/* GNU Objective C Runtime method related functions.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h" /* For runtime structures. */
+#include "objc/thr.h"
+#include "objc-private/runtime.h" /* For __objc_runtime_mutex. */
+#include <stdlib.h> /* For malloc. */
+
+SEL
+method_getName (struct objc_method * method)
+{
+ if (method == NULL)
+ return NULL;
+
+ return method->method_name;
+}
+
+const char *
+method_getTypeEncoding (struct objc_method * method)
+{
+ if (method == NULL)
+ return NULL;
+
+ return method->method_types;
+}
+
+IMP
+method_getImplementation (struct objc_method * method)
+{
+ if (method == NULL)
+ return NULL;
+
+ return method->method_imp;
+}
+
+struct objc_method_description *
+method_getDescription (struct objc_method * method)
+{
+ /* Note that the following returns NULL if method is NULL, which is
+ fine. */
+ return (struct objc_method_description *)method;
+}
+
+struct objc_method **
+class_copyMethodList (Class class_, unsigned int *numberOfReturnedMethods)
+{
+ unsigned int count = 0;
+ struct objc_method **returnValue = NULL;
+ struct objc_method_list* method_list;
+
+ if (class_ == Nil)
+ {
+ if (numberOfReturnedMethods)
+ *numberOfReturnedMethods = 0;
+ return NULL;
+ }
+
+ /* Lock the runtime mutex because the class methods may be
+ concurrently modified. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Count how many methods we have. */
+ method_list = class_->methods;
+
+ while (method_list)
+ {
+ count = count + method_list->method_count;
+ method_list = method_list->method_next;
+ }
+
+ if (count != 0)
+ {
+ unsigned int i = 0;
+
+ /* Allocate enough memory to hold them. */
+ returnValue
+ = (struct objc_method **)(malloc (sizeof (struct objc_method *)
+ * (count + 1)));
+
+ /* Copy the methods. */
+ method_list = class_->methods;
+
+ while (method_list)
+ {
+ int j;
+ for (j = 0; j < method_list->method_count; j++)
+ {
+ returnValue[i] = &(method_list->method_list[j]);
+ i++;
+ }
+ method_list = method_list->method_next;
+ }
+
+ returnValue[i] = NULL;
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ if (numberOfReturnedMethods)
+ *numberOfReturnedMethods = count;
+
+ return returnValue;
+}
+
+IMP
+method_setImplementation (struct objc_method * method, IMP implementation)
+{
+ IMP old_implementation;
+
+ if (method == NULL || implementation == NULL)
+ return NULL;
+
+ /* We lock the runtime mutex so that concurrent calls to change the
+ same method won't conflict with each other. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ old_implementation = method->method_imp;
+ method->method_imp = implementation;
+
+ /* That was easy :-). But now we need to find all classes that use
+ this method, and update the IMP in the dispatch tables. */
+ __objc_update_classes_with_methods (method, NULL);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return old_implementation;
+}
+
+void
+method_exchangeImplementations (struct objc_method * method_a, struct objc_method * method_b)
+{
+ IMP old_implementation_a;
+ IMP old_implementation_b;
+
+ if (method_a == NULL || method_b == NULL)
+ return;
+
+ /* We lock the runtime mutex so that concurrent calls to exchange
+ similar methods won't conflict with each other. Each of them
+ should be atomic. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ old_implementation_a = method_a->method_imp;
+ old_implementation_b = method_b->method_imp;
+
+ method_a->method_imp = old_implementation_b;
+ method_b->method_imp = old_implementation_a;
+
+ /* That was easy :-). But now we need to find all classes that use
+ these methods, and update the IMP in the dispatch tables. */
+ __objc_update_classes_with_methods (method_a, method_b);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
diff --git a/libobjc/nil_method.c b/libobjc/nil_method.c
new file mode 100644
index 000000000..15e3d528c
--- /dev/null
+++ b/libobjc/nil_method.c
@@ -0,0 +1,56 @@
+/* GNU Objective C Runtime nil receiver function
+ Copyright (C) 1993, 1995, 1996, 2002, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+/* This is the nil method, the function that is called when the receiver
+ of a method is nil */
+
+#include "objc-private/common.h"
+#include "objc/objc.h"
+
+/* When the receiver of a method invocation is nil, the runtime
+ returns nil_method() as the method implementation. This function
+ will be casted to whatever function was supposed to be executed to
+ execute that method (that function will take an id, followed by a
+ SEL, followed by who knows what arguments, depends on the method),
+ and executed.
+
+ For this reason, nil_method() should be a function which can be
+ called in place of any function taking an 'id' argument followed by
+ a 'SEL' argument, followed by zero, or one, or any number of
+ arguments (both a fixed number, or a variable number !).
+
+ There is no "proper" implementation of such a nil_method function
+ in C, however in all existing implementations it does not matter
+ when extra arguments are present, so we can simply create a function
+ taking a receiver and a selector, and all other arguments will be
+ ignored. :-)
+*/
+
+id
+nil_method (id receiver, SEL op __attribute__ ((__unused__)))
+{
+ return receiver;
+}
diff --git a/libobjc/objc-foreach.c b/libobjc/objc-foreach.c
new file mode 100644
index 000000000..911206118
--- /dev/null
+++ b/libobjc/objc-foreach.c
@@ -0,0 +1,51 @@
+/* GNU Objective C Runtime 'fast enumeration' implementation
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* This file implements objc_enumeration_mutation() and
+ objc_set_enumeration_mutation_handler(), the two functions required
+ to handle mutations during a fast enumeration. */
+#include "objc-private/common.h"
+#include "objc-private/error.h" /* For _objc_abort() */
+#include "objc/runtime.h" /* For objc_enumerationMutation() and objc_set_enumeration_mutation_handler() */
+
+/* The enumeration mutation handler currently in use. */
+static void (*__objc_enumeration_mutation_handler)(id) = NULL;
+
+void
+objc_setEnumerationMutationHandler (void (*handler)(id))
+{
+ __objc_enumeration_mutation_handler = handler;
+}
+
+void
+objc_enumerationMutation (id collection)
+{
+ if (__objc_enumeration_mutation_handler != NULL)
+ (*__objc_enumeration_mutation_handler) (collection);
+
+ /* We always abort if we get here; there is no point in going on as
+ the next iteration in the fast enumeration would probably go
+ deeply wrong. */
+ _objc_abort ("Collection %p mutated during fast enumeration", collection);
+}
diff --git a/libobjc/objc-private/README b/libobjc/objc-private/README
new file mode 100644
index 000000000..cce1d0416
--- /dev/null
+++ b/libobjc/objc-private/README
@@ -0,0 +1,4 @@
+This directory contains headers that are private to the runtime and
+that are only included while the runtime is being compiled. They are
+not installed, so developers using the library can't actually even see
+them.
diff --git a/libobjc/objc-private/accessors.h b/libobjc/objc-private/accessors.h
new file mode 100644
index 000000000..570ae7a85
--- /dev/null
+++ b/libobjc/objc-private/accessors.h
@@ -0,0 +1,32 @@
+/* GNU Objective C Runtime accessors - Private Declarations
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_accessors_INCLUDE_GNU
+#define __objc_private_accessors_INCLUDE_GNU
+
+/* This function needs to be called at startup by init.c. */
+void
+__objc_accessors_init (void);
+
+#endif /* not __objc_private_accessors_INCLUDE_GNU */
diff --git a/libobjc/objc-private/common.h b/libobjc/objc-private/common.h
new file mode 100644
index 000000000..4f4ec5cd0
--- /dev/null
+++ b/libobjc/objc-private/common.h
@@ -0,0 +1,49 @@
+/* GNU Objective C Runtime Common Private Definitions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_common_INCLUDE_GNU
+#define __objc_private_common_INCLUDE_GNU
+
+/* This file contains definitions that should be included by all .c
+ and .m files in libobjc. */
+
+/* This variable allows the public headers to determine when they are
+ being included by a file inside libobjc itself, or when they are
+ being included by an external file. */
+#define GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF 1
+
+/* When debugging libobjc, add
+
+ #define DEBUG 1
+
+ at the very beginning of a file in libobjc (before including this file) to turn
+ on DEBUG_PRINTF(). */
+#ifdef DEBUG
+#include <stdio.h>
+#define DEBUG_PRINTF(format, args...) printf (format, ## args)
+#else
+#define DEBUG_PRINTF(format, args...)
+#endif
+
+#endif /* __objc_private_common_INCLUDE_GNU */
diff --git a/libobjc/objc-private/error.h b/libobjc/objc-private/error.h
new file mode 100644
index 000000000..e8673f722
--- /dev/null
+++ b/libobjc/objc-private/error.h
@@ -0,0 +1,38 @@
+/* GNU Objective C Runtime Common Private Definitions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_error_INCLUDE_GNU
+#define __objc_private_error_INCLUDE_GNU
+
+/* Prints an unrecoverable error to stderr, then aborts the program.
+ This should only be used for errors that really are unrecorevable:
+ failure to allocate memory, and failure to load an Objective-C
+ module. All other usages of this function should be converted into
+ some milder type of error (unless aborting is explicitly required
+ by the documentation/API).
+*/
+void
+_objc_abort (const char *fmt, ...) __attribute__ ((noreturn));
+
+#endif /* __objc_private_error_INCLUDE_GNU */
diff --git a/libobjc/objc-private/hash.h b/libobjc/objc-private/hash.h
new file mode 100644
index 000000000..c330d618e
--- /dev/null
+++ b/libobjc/objc-private/hash.h
@@ -0,0 +1,201 @@
+/* Hash tables for Objective C method dispatch.
+ Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* You need to include this file after including objc.h */
+
+#ifndef __hash_INCLUDE_GNU
+#define __hash_INCLUDE_GNU
+
+#include <stddef.h>
+#include <string.h>
+
+/*
+ * This data structure is used to hold items
+ * stored in a hash table. Each node holds
+ * a key/value pair.
+ *
+ * Items in the cache are really of type void *.
+ */
+typedef struct cache_node
+{
+ struct cache_node *next; /* Pointer to next entry on the list.
+ NULL indicates end of list. */
+ const void *key; /* Key used to locate the value. Used
+ to locate value when more than one
+ key computes the same hash
+ value. */
+ void *value; /* Value stored for the key. */
+} *node_ptr;
+
+
+/*
+ * This data type is the function that computes a hash code given a key.
+ * Therefore, the key can be a pointer to anything and the function specific
+ * to the key type.
+ *
+ * Unfortunately there is a mutual data structure reference problem with this
+ * typedef. Therefore, to remove compiler warnings the functions passed to
+ * objc_hash_new will have to be casted to this type.
+ */
+typedef unsigned int (*hash_func_type) (void *, const void *);
+
+/*
+ * This data type is the function that compares two hash keys and returns an
+ * integer greater than, equal to, or less than 0, according as the first
+ * parameter is lexicographically greater than, equal to, or less than the
+ * second.
+ */
+
+typedef int (*compare_func_type) (const void *, const void *);
+
+
+/*
+ * This data structure is the cache.
+ *
+ * It must be passed to all of the hashing routines
+ * (except for new).
+ */
+typedef struct cache
+{
+ /* Variables used to implement the hash itself. */
+ node_ptr *node_table; /* Pointer to an array of hash nodes. */
+ /* Variables used to track the size of the hash table so to determine
+ when to resize it. */
+ unsigned int size; /* Number of buckets allocated for the hash table
+ (number of array entries allocated for
+ "node_table"). Must be a power of two. */
+ unsigned int used; /* Current number of entries in the hash table. */
+ unsigned int mask; /* Precomputed mask. */
+
+ /* Variables used to implement indexing through the hash table. */
+
+ unsigned int last_bucket; /* Tracks which entry in the array where
+ the last value was returned. */
+ /* Function used to compute a hash code given a key.
+ This function is specified when the hash table is created. */
+ hash_func_type hash_func;
+ /* Function used to compare two hash keys to see if they are equal. */
+ compare_func_type compare_func;
+} *cache_ptr;
+
+
+/* Allocate and initialize a hash table. */
+
+cache_ptr objc_hash_new (unsigned int size,
+ hash_func_type hash_func,
+ compare_func_type compare_func);
+
+/* Deallocate all of the hash nodes and the cache itself. */
+
+void objc_hash_delete (cache_ptr cache);
+
+/* Add the key/value pair to the hash table. If the
+ hash table reaches a level of fullness then it will be resized.
+
+ assert if the key is already in the hash. */
+
+void objc_hash_add (cache_ptr *cachep, const void *key, void *value);
+
+/* Remove the key/value pair from the hash table.
+ assert if the key isn't in the table. */
+
+void objc_hash_remove (cache_ptr cache, const void *key);
+
+/* Used to index through the hash table. Start with NULL
+ to get the first entry.
+
+ Successive calls pass the value returned previously.
+ ** Don't modify the hash during this operation ***
+
+ Cache nodes are returned such that key or value can
+ be extracted. */
+
+node_ptr objc_hash_next (cache_ptr cache, node_ptr node);
+
+/* Used to return a value from a hash table using a given key. */
+
+void *objc_hash_value_for_key (cache_ptr cache, const void *key);
+
+/* Used to determine if the given key exists in the hash table */
+
+BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key);
+
+/************************************************
+
+ Useful hashing functions.
+
+ Declared inline for your pleasure.
+
+************************************************/
+
+/* Calculate a hash code by performing some
+ manipulation of the key pointer. (Use the lowest bits
+ except for those likely to be 0 due to alignment.) */
+
+static inline unsigned int
+objc_hash_ptr (cache_ptr cache, const void *key)
+{
+ return ((size_t)key / sizeof (void *)) & cache->mask;
+}
+
+
+/* Calculate a hash code by iterating over a NULL
+ terminate string. */
+static inline unsigned int
+objc_hash_string (cache_ptr cache, const void *key)
+{
+ unsigned int ret = 0;
+ unsigned int ctr = 0;
+ const char *ckey = (const char *) key;
+
+ while (*ckey) {
+ ret ^= *ckey++ << ctr;
+ ctr = (ctr + 1) % sizeof (void *);
+ }
+
+ return ret & cache->mask;
+}
+
+
+/* Compare two pointers for equality. */
+static inline int
+objc_compare_ptrs (const void *k1, const void *k2)
+{
+ return (k1 == k2);
+}
+
+
+/* Compare two strings. */
+static inline int
+objc_compare_strings (const void *k1, const void *k2)
+{
+ if (k1 == k2)
+ return 1;
+ else if (k1 == 0 || k2 == 0)
+ return 0;
+ else
+ return ! strcmp ((const char *) k1, (const char *) k2);
+}
+
+#endif /* not __hash_INCLUDE_GNU */
diff --git a/libobjc/objc-private/module-abi-8.h b/libobjc/objc-private/module-abi-8.h
new file mode 100644
index 000000000..0c9574bb4
--- /dev/null
+++ b/libobjc/objc-private/module-abi-8.h
@@ -0,0 +1,315 @@
+/* Definitions of Module Structures used by ABI version 8
+ Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
+ 2007, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_module_abi_8_INCLUDE_GNU
+#define __objc_private_module_abi_8_INCLUDE_GNU
+
+/* For every class which happens to have statically allocated instances in
+ this module, one OBJC_STATIC_INSTANCES is allocated by the compiler.
+ INSTANCES is NULL terminated and points to all statically allocated
+ instances of this class. */
+struct objc_static_instances
+{
+ char *class_name;
+#ifdef __cplusplus
+ id instances[1];
+#else
+ id instances[0];
+#endif
+};
+
+/* Whereas a Module (defined further down) is the root (typically) of a file,
+ a Symtab is the root of the class and category definitions within the
+ module.
+
+ A Symtab contains a variable length array of pointers to classes and
+ categories defined in the module. */
+struct objc_symtab
+{
+ unsigned long sel_ref_cnt; /* Unused (always set to 0). */
+ struct objc_selector *refs; /* The table of selectors referenced in
+ this module. This is terminated by a
+ selector with NULL sel_id and NULL
+ sel_types. Note that we use the type
+ 'struct objc_selector *' and not
+ 'SEL' (which is 'const struct
+ objc_selector *') because the sel_id
+ of these selectors is patched up by
+ the runtime when the module is
+ loaded. */
+ unsigned short cls_def_cnt; /* Number of classes compiled (defined)
+ in the module. */
+ unsigned short cat_def_cnt; /* Number of categories compiled
+ (defined) in the module. */
+ void *defs[1]; /* Variable array of pointers.
+ cls_def_cnt of type Class followed by
+ cat_def_cnt of type Category_t,
+ followed by a NULL terminated array
+ of objc_static_instances. */
+};
+
+/* The compiler generates one of these structures for each module that
+ composes the executable (eg main.m).
+
+ This data structure is the root of the definition tree for the
+ module.
+
+ A collect program runs between ld stages and creates a ObjC ctor
+ array. That array holds a pointer to each module structure of the
+ executable. */
+struct objc_module
+{
+ unsigned long version; /* Version of the Module data
+ structure. */
+ unsigned long size; /* sizeof(Module) according to the
+ compiler - only used to sanity check
+ that it matches sizeof(Module)
+ according to the runtime. */
+ const char* name; /* Name of the file used to compile the
+ module - not set by modern compilers
+ for security reasons. */
+ struct objc_symtab *symtab; /* Pointer to the Symtab of the module.
+ The Symtab holds an array of pointers
+ to the classes and categories defined
+ in the module. */
+};
+
+/* The compiler generates one of these structures for a class that has
+ instance variables defined in its specification. */
+struct objc_ivar
+{
+ const char* ivar_name; /* Name of the instance variable as entered
+ in the class definition. */
+ const char* ivar_type; /* Description of the Ivar's type. Useful
+ for debuggers. */
+ int ivar_offset; /* Byte offset from the base address of the
+ instance structure to the variable. */
+};
+
+struct objc_ivar_list
+{
+ int ivar_count; /* Number of structures (Ivar)
+ contained in the list. One
+ structure per instance variable
+ defined in the class. */
+ struct objc_ivar ivar_list[1]; /* Variable length structure. */
+};
+
+/* The compiler generates one (or more) of these structures for a
+ class that has methods defined in its specification.
+
+ The implementation of a class can be broken into separate pieces in
+ a file and categories can break them across modules. To handle this
+ problem is a singly linked list of methods. */
+struct objc_method
+{
+ SEL method_name; /* This variable is the method's name.
+ The compiler puts a char* here, and
+ it's replaced by a real SEL at runtime
+ when the method is registered. */
+ const char* method_types; /* Description of the method's parameter
+ list. Used when registering the
+ selector with the runtime. When that
+ happens, method_name will contain the
+ method's parameter list. */
+ IMP method_imp; /* Address of the method in the
+ executable. */
+};
+
+struct objc_method_list
+{
+ struct objc_method_list* method_next; /* This variable is used to
+ link a method list to
+ another. It is a singly
+ linked list. */
+ int method_count; /* Number of methods defined
+ in this structure. */
+ struct objc_method method_list[1]; /* Variable length
+ structure. */
+};
+
+/* Currently defined in Protocol.m (that definition should go away
+ once we include this file). Note that a 'struct
+ objc_method_description' as embedded inside a Protocol uses the
+ same trick as a 'struct objc_method': the method_name is a 'char *'
+ according to the compiler, who puts the method name as a string in
+ there. At runtime, the selectors need to be registered, and the
+ method_name then becomes a SEL. */
+struct objc_method_description_list
+{
+ int count;
+ struct objc_method_description list[1];
+};
+
+/* Currently defined by objc/objc.h. */
+/*
+struct objc_protocol {
+ struct objc_class* class_pointer;
+ char *protocol_name;
+ struct objc_protocol_list *protocol_list;
+ struct objc_method_description_list *instance_methods, *class_methods;
+};
+*/
+
+struct objc_protocol_list
+{
+ struct objc_protocol_list *next;
+ size_t count;
+ Protocol *list[1];
+};
+
+/*
+ The compiler generates one of these structures for each class.
+
+ This structure is the definition for classes.
+
+ This structure is generated by the compiler in the executable and
+ used by the run-time during normal messaging operations. Therefore
+ some members change type. The compiler generates "char* const" and
+ places a string in the following member variables: super_class.
+*/
+#ifndef __objc_STRUCT_OBJC_CLASS_defined
+struct objc_class {
+ struct objc_class* class_pointer; /* Pointer to the class's meta
+ class. */
+ struct objc_class* super_class; /* Pointer to the super
+ class. NULL for class
+ Object. */
+ const char* name; /* Name of the class. */
+ long version; /* Unknown. */
+ unsigned long info; /* Bit mask. See class masks
+ defined below. */
+ long instance_size; /* Size in bytes of the class.
+ The sum of the class
+ definition and all super
+ class definitions. */
+#ifdef _WIN64
+ /* We pad the structure manually to prevent warning when -Wpadded is
+ used. The compiler automatically pads the structures that it
+ generates, so this manually padded structure still matches the
+ one generated by the compiler, but if we don't pad manually,
+ -Wpadded detects that padding is being added and generates
+ annoying warnings. This hack is necessary as on LLP64 targets
+ sizeof (long) isn't equal to sizeof (void *). */
+ long pad;
+#endif
+ struct objc_ivar_list* ivars; /* Pointer to a structure that
+ describes the instance
+ variables in the class
+ definition. NULL indicates
+ no instance variables.
+ Does not include super
+ class variables. */
+ struct objc_method_list* methods; /* Linked list of instance
+ methods defined for the
+ class. */
+ struct sarray * dtable; /* Pointer to instance method
+ dispatch table. */
+ struct objc_class* subclass_list; /* Subclasses */
+ struct objc_class* sibling_class;
+
+ struct objc_protocol_list *protocols; /* Protocols conformed to */
+ void* gc_object_type;
+};
+#endif /* __objc_STRUCT_OBJC_CLASS_defined */
+
+/* This is used to assure consistent access to the info field of
+ classes. */
+#ifndef HOST_BITS_PER_LONG
+# define HOST_BITS_PER_LONG (sizeof(long)*8)
+#endif
+
+#define __CLS_INFO(cls) ((cls)->info)
+#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask)
+#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask)
+#define __CLS_SETNOTINFO(cls, mask) (__CLS_INFO(cls) &= ~mask)
+
+/* The structure is of type MetaClass */
+#define _CLS_META 0x2L
+#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META))
+
+/* The structure is of type Class */
+#define _CLS_CLASS 0x1L
+#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS))
+
+/* The class is initialized within the runtime. This means that it
+ has had correct super and sublinks assigned. */
+#define _CLS_RESOLV 0x8L
+#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV)
+#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV)
+
+/* The class has been send a +initialize message or a such is not
+ defined for this class. */
+#define _CLS_INITIALIZED 0x04L
+#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)
+#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
+
+/* The class is being constructed; it has been allocated using
+ objc_allocateClassPair(), but has not been registered yet by using
+ objc_registerClassPair(). This means it is possible to freely add
+ instance variables to the class, but it can't be used for anything
+ yet. */
+#define _CLS_IN_CONSTRUCTION 0x10L
+#define CLS_IS_IN_CONSTRUCTION(cls) __CLS_ISINFO(cls, _CLS_IN_CONSTRUCTION)
+#define CLS_SET_IN_CONSTRUCTION(cls) __CLS_SETINFO(cls, _CLS_IN_CONSTRUCTION)
+#define CLS_SET_NOT_IN_CONSTRUCTION(cls) __CLS_SETNOTINFO(cls, _CLS_IN_CONSTRUCTION)
+
+/* The class number of this class. This must be the same for both the
+ class and its meta class object. */
+#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))
+#define CLS_SETNUMBER(cls, num) \
+ ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \
+ (cls)->info >>= (HOST_BITS_PER_LONG/2); \
+ __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })
+
+
+/* The compiler generates one of these structures for each category.
+ A class may have many categories and contain both instance and
+ factory methods. */
+struct objc_category
+{
+ const char* category_name; /* Name of the category.
+ Name contained in the
+ () of the category
+ definition. */
+ const char* class_name; /* Name of the class to
+ which the category
+ belongs. */
+ struct objc_method_list *instance_methods; /* Linked list of
+ instance methods
+ defined in the
+ category. NULL
+ indicates no instance
+ methods defined. */
+ struct objc_method_list *class_methods; /* Linked list of
+ factory methods
+ defined in the
+ category. NULL
+ indicates no class
+ methods defined. */
+ struct objc_protocol_list *protocols; /* List of Protocols
+ conformed to. */
+};
+
+#endif /* __objc_private_module_abi_8_INCLUDE_GNU */
diff --git a/libobjc/objc-private/objc-list.h b/libobjc/objc-private/objc-list.h
new file mode 100644
index 000000000..989b9c9d4
--- /dev/null
+++ b/libobjc/objc-private/objc-list.h
@@ -0,0 +1,94 @@
+/* Generic single linked list to keep various information
+ Copyright (C) 1993, 1994, 1996, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __GNU_OBJC_LIST_H
+#define __GNU_OBJC_LIST_H
+
+struct objc_list
+{
+ void *head;
+ struct objc_list *tail;
+};
+
+/* Return a cons cell produced from (head . tail). */
+static inline struct objc_list*
+list_cons (void* head, struct objc_list* tail)
+{
+ struct objc_list* cell;
+
+ cell = (struct objc_list*)objc_malloc (sizeof (struct objc_list));
+ cell->head = head;
+ cell->tail = tail;
+ return cell;
+}
+
+/* Remove the element at the head by replacing it by its
+ successor. */
+static inline void
+list_remove_head (struct objc_list** list)
+{
+ if ((*list)->tail)
+ {
+ /* Fetch next. */
+ struct objc_list* tail = (*list)->tail;
+
+ /* Copy next to list head. */
+ *(*list) = *tail;
+
+ /* Free next. */
+ objc_free (tail);
+ }
+ else
+ {
+ /* Inly one element in list. */
+ objc_free (*list);
+ (*list) = 0;
+ }
+}
+
+
+/* Map FUNCTION over all elements in LIST. */
+static inline void
+list_mapcar (struct objc_list* list, void(*function)(void*))
+{
+ while (list)
+ {
+ (*function) (list->head);
+ list = list->tail;
+ }
+}
+
+/* Free list (backwards recursive). */
+static inline void
+list_free (struct objc_list* list)
+{
+ if(list)
+ {
+ list_free (list->tail);
+ objc_free (list);
+ }
+}
+
+#endif /* not __GNU_OBJC_LIST_H */
diff --git a/libobjc/objc-private/objc-sync.h b/libobjc/objc-private/objc-sync.h
new file mode 100644
index 000000000..95eb28b30
--- /dev/null
+++ b/libobjc/objc-private/objc-sync.h
@@ -0,0 +1,33 @@
+/* GNU Objective C Runtime @synchronized implementation - Private functions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_objc_sync_INCLUDE_GNU
+#define __objc_private_objc_sync_INCLUDE_GNU
+
+/* This function needs to be called at startup before @synchronized()
+ can be used. */
+void
+__objc_sync_init (void);
+
+#endif /* not __objc_private_objc_sync_INCLUDE_GNU */
diff --git a/libobjc/objc-private/protocols.h b/libobjc/objc-private/protocols.h
new file mode 100644
index 000000000..87f8fc848
--- /dev/null
+++ b/libobjc/objc-private/protocols.h
@@ -0,0 +1,38 @@
+/* GNU Objective C Runtime protocols - Private functions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_protocols_INCLUDE_GNU
+#define __objc_private_protocols_INCLUDE_GNU
+
+/* This function needs to be called at startup by init.c. */
+void
+__objc_protocols_init (void);
+
+/* This function adds a protocol to the internal hashtable of
+ protocols by name, which allows objc_getProtocol(name) to be
+ implemented efficiently. */
+void
+__objc_protocols_add_protocol (const char *name, Protocol *object);
+
+#endif /* not __objc_private_protocols_INCLUDE_GNU */
diff --git a/libobjc/objc-private/runtime.h b/libobjc/objc-private/runtime.h
new file mode 100644
index 000000000..5406294f2
--- /dev/null
+++ b/libobjc/objc-private/runtime.h
@@ -0,0 +1,79 @@
+/* GNU Objective C Runtime internal declarations
+ Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004, 2009 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* You need to include this file after including a number of standard ObjC files.
+
+The original list was:
+
+#include "objc/objc.h"
+#include "objc/objc-api.h"
+#include "objc/thr.h"
+#include "objc/hash.h"
+#include "objc/objc-list.h"
+
+but can almost certainly be shrinked down.
+
+Note that you can use this file both with objc/objc-api.h and with
+objc/runtime.h. */
+
+#ifndef __objc_private_runtime_INCLUDE_GNU
+#define __objc_private_runtime_INCLUDE_GNU
+
+#include <stdarg.h> /* for varargs and va_list's */
+
+#include <stdio.h>
+#include <ctype.h>
+
+#include <stddef.h> /* so noone else will get system versions */
+#include <assert.h>
+
+extern BOOL __objc_add_class_to_hash (Class); /* (objc-class.c) */
+extern void __objc_init_class_tables (void); /* (objc-class.c) */
+extern void __objc_init_dispatch_tables (void); /* (objc-dispatch.c) */
+extern void __objc_install_premature_dtable (Class); /* (objc-dispatch.c) */
+extern void __objc_resolve_class_links (void); /* (objc-class.c) */
+extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */
+
+extern int __objc_init_thread_system (void); /* thread.c */
+extern int __objc_fini_thread_system (void); /* thread.c */
+extern BOOL __objc_init_class (Class class); /* init.c */
+extern void class_add_method_list (Class, struct objc_method_list *);
+
+/* Registering instance methods as class methods for root classes */
+extern void __objc_register_instance_methods_to_class (Class);
+extern struct objc_method * search_for_method_in_list (struct objc_method_list * list, SEL op);
+
+extern void
+__objc_update_classes_with_methods (struct objc_method *method_a, struct objc_method *method_b); /* class.c */
+
+/* Mutex locking __objc_selector_max_index and its arrays. */
+extern objc_mutex_t __objc_runtime_mutex;
+
+/* Number of threads which are alive. */
+extern int __objc_runtime_threads_alive;
+
+BOOL __objc_responds_to (id object, SEL sel); /* for internal use only! */
+extern void __objc_generate_gc_type_description (Class);
+
+#endif /* not __objc_private_runtime_INCLUDE_GNU */
diff --git a/libobjc/objc-private/sarray.h b/libobjc/objc-private/sarray.h
new file mode 100644
index 000000000..12fad921f
--- /dev/null
+++ b/libobjc/objc-private/sarray.h
@@ -0,0 +1,243 @@
+/* Sparse Arrays for Objective C dispatch tables
+ Copyright (C) 1993, 1995, 1996, 2004, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __sarray_INCLUDE_GNU
+#define __sarray_INCLUDE_GNU
+
+#define OBJC_SPARSE2 /* 2-level sparse array. */
+/* #define OBJC_SPARSE3 */ /* 3-level sparse array. */
+
+#ifdef OBJC_SPARSE2
+extern const char* __objc_sparse2_id;
+#endif
+
+#ifdef OBJC_SPARSE3
+extern const char* __objc_sparse3_id;
+#endif
+
+#include <stddef.h>
+
+extern int nbuckets; /* for stats */
+extern int nindices;
+extern int narrays;
+extern int idxsize;
+
+/* An unsigned integer of same size as a pointer. */
+#define SIZET_BITS (sizeof (size_t) * 8)
+
+#if defined (__sparc__) || defined (OBJC_SPARSE2)
+#define PRECOMPUTE_SELECTORS
+#endif
+
+#ifdef OBJC_SPARSE3
+
+/* Buckets are 8 words each. */
+#define BUCKET_BITS 3
+#define BUCKET_SIZE (1 << BUCKET_BITS)
+#define BUCKET_MASK (BUCKET_SIZE - 1)
+
+/* Indices are 16 words each. */
+#define INDEX_BITS 4
+#define INDEX_SIZE (1 << INDEX_BITS)
+#define INDEX_MASK (INDEX_SIZE - 1)
+
+#define INDEX_CAPACITY (BUCKET_SIZE * INDEX_SIZE)
+
+#else /* OBJC_SPARSE2 */
+
+/* Buckets are 32 words each. */
+#define BUCKET_BITS 5
+#define BUCKET_SIZE (1 << BUCKET_BITS)
+#define BUCKET_MASK (BUCKET_SIZE - 1)
+
+#endif /* OBJC_SPARSE2 */
+
+typedef size_t sidx;
+
+#ifdef PRECOMPUTE_SELECTORS
+
+struct soffset
+{
+#ifdef OBJC_SPARSE3
+ unsigned int unused : SIZET_BITS / 4;
+ unsigned int eoffset : SIZET_BITS / 4;
+ unsigned int boffset : SIZET_BITS / 4;
+ unsigned int ioffset : SIZET_BITS / 4;
+#else /* OBJC_SPARSE2 */
+#ifdef __sparc__
+ unsigned long boffset : (SIZET_BITS - 2) - BUCKET_BITS;
+ unsigned int eoffset : BUCKET_BITS;
+ unsigned int unused : 2;
+#else
+ unsigned int boffset : SIZET_BITS / 2;
+ unsigned int eoffset : SIZET_BITS / 2;
+#endif
+#endif /* OBJC_SPARSE2 */
+};
+
+union sofftype
+{
+ struct soffset off;
+ sidx idx;
+};
+
+#endif /* not PRECOMPUTE_SELECTORS */
+
+union sversion
+{
+ int version;
+ void *next_free;
+};
+
+struct sbucket
+{
+ /* Elements stored in array. */
+ void* elems[BUCKET_SIZE];
+
+ /* Used for copy-on-write. */
+ union sversion version;
+};
+
+#ifdef OBJC_SPARSE3
+
+struct sindex
+{
+ struct sbucket* buckets[INDEX_SIZE];
+
+ /* Used for copy-on-write. */
+ union sversion version;
+};
+
+#endif /* OBJC_SPARSE3 */
+
+struct sarray
+{
+#ifdef OBJC_SPARSE3
+ struct sindex** indices;
+ struct sindex* empty_index;
+#else /* OBJC_SPARSE2 */
+ struct sbucket** buckets;
+#endif /* OBJC_SPARSE2 */
+ struct sbucket* empty_bucket;
+
+ /* Used for copy-on-write. */
+ union sversion version;
+
+ short ref_count;
+ struct sarray* is_copy_of;
+ size_t capacity;
+};
+
+struct sarray* sarray_new (int, void* default_element);
+void sarray_free (struct sarray*);
+struct sarray* sarray_lazy_copy (struct sarray*);
+void sarray_realloc (struct sarray*, int new_size);
+void sarray_at_put (struct sarray*, sidx indx, void* elem);
+void sarray_at_put_safe (struct sarray*, sidx indx, void* elem);
+
+struct sarray* sarray_hard_copy (struct sarray*); /* ... like the name ? */
+void sarray_remove_garbage (void);
+
+
+#ifdef PRECOMPUTE_SELECTORS
+/* Transform soffset values to ints and vice versa. */
+static inline unsigned int
+soffset_decode (sidx indx)
+{
+ union sofftype x;
+ x.idx = indx;
+#ifdef OBJC_SPARSE3
+ return x.off.eoffset
+ + (x.off.boffset * BUCKET_SIZE)
+ + (x.off.ioffset * INDEX_CAPACITY);
+#else /* OBJC_SPARSE2 */
+ return x.off.eoffset + (x.off.boffset * BUCKET_SIZE);
+#endif /* OBJC_SPARSE2 */
+}
+
+static inline sidx
+soffset_encode (size_t offset)
+{
+ union sofftype x;
+ x.off.eoffset = offset % BUCKET_SIZE;
+#ifdef OBJC_SPARSE3
+ x.off.boffset = (offset / BUCKET_SIZE) % INDEX_SIZE;
+ x.off.ioffset = offset / INDEX_CAPACITY;
+#else /* OBJC_SPARSE2 */
+ x.off.boffset = offset / BUCKET_SIZE;
+#endif
+ return (sidx)x.idx;
+}
+
+#else /* not PRECOMPUTE_SELECTORS */
+
+static inline size_t
+soffset_decode (sidx indx)
+{
+ return indx;
+}
+
+static inline sidx
+soffset_encode (size_t offset)
+{
+ return offset;
+}
+#endif /* not PRECOMPUTE_SELECTORS */
+
+/* Get element from the Sparse array `array' at offset `indx'. */
+static inline void* sarray_get (struct sarray* array, sidx indx)
+{
+#ifdef PRECOMPUTE_SELECTORS
+ union sofftype x;
+ x.idx = indx;
+#ifdef OBJC_SPARSE3
+ return array->
+ indices[x.off.ioffset]->
+ buckets[x.off.boffset]->
+ elems[x.off.eoffset];
+#else /* OBJC_SPARSE2 */
+ return array->buckets[x.off.boffset]->elems[x.off.eoffset];
+#endif /* OBJC_SPARSE2 */
+#else /* not PRECOMPUTE_SELECTORS */
+#ifdef OBJC_SPARSE3
+ return array->
+ indices[indx / INDEX_CAPACITY]->
+ buckets[(indx / BUCKET_SIZE) % INDEX_SIZE]->
+ elems[indx % BUCKET_SIZE];
+#else /* OBJC_SPARSE2 */
+ return array->buckets[indx / BUCKET_SIZE]->elems[indx % BUCKET_SIZE];
+#endif /* not OBJC_SPARSE3 */
+#endif /* not PRECOMPUTE_SELECTORS */
+}
+
+static inline void* sarray_get_safe (struct sarray* array, sidx indx)
+{
+ if (soffset_decode (indx) < array->capacity)
+ return sarray_get (array, indx);
+ else
+ return (array->empty_bucket->elems[0]);
+}
+
+#endif /* __sarray_INCLUDE_GNU */
diff --git a/libobjc/objc-private/selector.h b/libobjc/objc-private/selector.h
new file mode 100644
index 000000000..490e17105
--- /dev/null
+++ b/libobjc/objc-private/selector.h
@@ -0,0 +1,57 @@
+/* GNU Objective C Runtime selector implementation - Private functions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_private_selector_INCLUDE_GNU
+#define __objc_private_selector_INCLUDE_GNU
+
+/* Private runtime functions that may go away or be rewritten or
+ replaced. */
+
+/* Number of selectors stored in each of the selector tables. */
+extern unsigned int __objc_selector_max_index;
+
+/* Initialize the selector tables. This must be called by init.c. */
+void __objc_init_selector_tables(void);
+
+/* Various private functions to register selectors. */
+void __objc_register_selectors_from_class(Class);
+void __objc_register_selectors_from_list (struct objc_method_list *);
+void __objc_register_selectors_from_description_list
+(struct objc_method_description_list *method_list);
+void __objc_register_selectors_from_module (struct objc_selector *selectors);
+
+/* Return whether a selector is mapped or not ("mapped" meaning that
+ it has been inserted into the selector table). This is private as
+ only the runtime should ever encounter or need to know about
+ unmapped selectors. */
+BOOL sel_is_mapped (SEL aSel);
+
+/* Return selector representing name without registering it if it
+ doesn't exist. Typically used internally by the runtime when it's
+ looking up methods that may or may not exist (such as +initialize)
+ in the most efficient way. */
+SEL
+sel_get_any_uid (const char *name);
+
+#endif /* not __objc_private_selector_INCLUDE_GNU */
diff --git a/libobjc/objc-sync.c b/libobjc/objc-sync.c
new file mode 100644
index 000000000..d685a3596
--- /dev/null
+++ b/libobjc/objc-sync.c
@@ -0,0 +1,459 @@
+/* GNU Objective C Runtime @synchronized implementation
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* This file implements objc_sync_enter() and objc_sync_exit(), the
+ two functions required to support @synchronized().
+
+ objc_sync_enter(object) needs to get a recursive lock associated
+ with 'object', and lock it.
+
+ objc_sync_exit(object) needs to get the recursive lock associated
+ with 'object', and unlock it. */
+
+/* To avoid the overhead of continuously allocating and deallocating
+ locks, we implement a pool of locks. When a lock is needed for an
+ object, we get a lock from the pool and associate it with the
+ object.
+
+ The lock pool need to be protected by its own lock (the
+ "protection" lock), which has to be locked then unlocked each time
+ objc_sync_enter() and objc_sync_exit() are called. To reduce the
+ contention on the protection lock, instead of a single pool with a
+ single (global) protection lock we use a number of smaller pools,
+ each with its own pool protection lock. To decide which lock pool
+ to use for each object, we compute a hash from the object pointer.
+
+ The implementation of each lock pool uses a linked list of all the
+ locks in the pool (both unlocked, and locked); this works in the
+ assumption that the number of locks concurrently required is very
+ low. In practice, it seems that you rarely see more than a few
+ locks ever concurrently required.
+
+ A standard case is a thread acquiring a lock recursively, over and
+ over again: for example when most methods of a class are protected
+ by @synchronized(self) but they also call each other. We use
+ thread-local storage to implement a cache and optimize this case.
+ The cache stores locks that the thread successfully acquired,
+ allowing objc_sync_enter() and objc_sync_exit() to locate a lock
+ which is already held by the current thread without having to use
+ any protection lock or synchronization mechanism. It can so detect
+ recursive locks/unlocks, and transform them into no-ops that
+ require no actual locking or synchronization mechanisms at all. */
+
+/* You can disable the thread-local cache (most likely to benchmark
+ the code with and without it) by compiling with
+ -DSYNC_CACHE_DISABLE, or commenting out the following line. */
+/* #define SYNC_CACHE_DISABLE */
+
+/* If thread-local storage is not available, automatically disable the
+ cache. */
+#ifndef HAVE_TLS
+# define SYNC_CACHE_DISABLE
+#endif
+
+#include "objc-private/common.h"
+#include "objc/objc-sync.h" /* For objc_sync_enter(), objc_sync_exit() */
+#include "objc/runtime.h" /* For objc_malloc() */
+#include "objc/thr.h" /* For objc_mutex_loc() and similar */
+#include "objc-private/objc-sync.h" /* For __objc_sync_init() */
+
+/* We have 32 pools of locks, each of them protected by its own
+ protection lock. It's tempting to increase this number to reduce
+ contention; but in our tests it is high enough. */
+#define SYNC_NUMBER_OF_POOLS 32
+
+/* Given an object, it determines which pool contains the associated
+ lock. */
+#define SYNC_OBJECT_HASH(OBJECT) ((((size_t)OBJECT >> 8) ^ (size_t)OBJECT) & (SYNC_NUMBER_OF_POOLS - 1))
+
+/* The locks protecting each pool. */
+static objc_mutex_t sync_pool_protection_locks[SYNC_NUMBER_OF_POOLS];
+
+/* The data structure (linked list) holding the locks. */
+typedef struct lock_node
+{
+ /* Pointer to next entry on the list. NULL indicates end of list.
+ You need to hold the appropriate sync_pool_protection_locks[N] to
+ read or write this variable. */
+ struct lock_node *next;
+
+ /* The (recursive) lock. Allocated when the node is created, and
+ always not-NULL, and unchangeable, after that. */
+ objc_mutex_t lock;
+
+ /* This is how many times the objc_mutex_lock() has been called on
+ the lock (it is 0 when the lock is unused). Used to track when
+ the lock is no longer associated with an object and can be reused
+ for another object. It records "real" locks, potentially (but
+ not necessarily) by multiple threads. You need to hold the
+ appropriate sync_pool_protection_locks[N] to read or write this
+ variable. */
+ unsigned int usage_count;
+
+ /* The object that the lock is associated with. This variable can
+ only be written when holding the sync_pool_protection_locks[N]
+ and when node->usage_count == 0, ie, the lock is not being used.
+ You can read this variable either when you hold the
+ sync_pool_protection_locks[N] or when you hold node->lock,
+ because in that case you know that node->usage_count can't get to
+ zero until you release the lock. It is valid to have usage_count
+ == 0 and object != nil; in that case, the lock is not currently
+ being used, but is still currently associated with the
+ object. */
+ id object;
+
+ /* This is a counter reserved for use by the thread currently
+ holding the lock. So, you need to hold node->lock to read or
+ write this variable. It is normally 0, and if the cache is not
+ being used, it is kept at 0 (even if recursive locks are being
+ done; in that case, no difference is made between recursive and
+ non-recursive locks: they all increase usage_count, and call
+ objc_mutex_lock()). When the cache is being used, a thread may
+ be able to find a lock that it already holds using the cache; in
+ that case, to perform additional locks/unlocks it can
+ increase/decrease the recursive_usage_count (which does not
+ require any synchronization with other threads, since it's
+ protected by the node->lock itself) instead of the usage_count
+ (which requires locking the pool protection lock). And it can
+ skip the call to objc_mutex_lock/unlock too. */
+ unsigned int recursive_usage_count;
+} *lock_node_ptr;
+
+
+/* The pools of locks. Each of them is a linked list of lock_nodes.
+ In the list we keep both unlocked and locked nodes. */
+static lock_node_ptr sync_pool_array[SYNC_NUMBER_OF_POOLS];
+
+#ifndef SYNC_CACHE_DISABLE
+/* We store a cache of locks acquired by each thread in thread-local
+ storage. */
+static __thread lock_node_ptr *lock_cache = NULL;
+
+/* This is a conservative implementation that uses a static array of
+ fixed size as cache. Because the cache is an array that we scan
+ linearly, the bigger it is, the slower it gets. This does not
+ matter much at small sizes (eg, the overhead of checking 8 cache
+ slots instead of 4 is very small compared to the other overheads
+ involved such as function calls and lock/unlock operations), but at
+ large sizes it becomes important as obviously there is a size over
+ which using the cache backfires: the lookup is so slow that the
+ cache slows down the software instead of speeding it up. In
+ practice, it seems that most threads use a small number of
+ concurrent locks, so we have a conservative implementation with a
+ fixed-size cache of 8 locks which gives a very predictable
+ behaviour. If a thread locks lots of different locks, only the
+ first 8 get the speed benefits of the cache, but the cache remains
+ always small, fast and predictable.
+
+ SYNC_CACHE_SIZE is the size of the lock cache for each thread. */
+#define SYNC_CACHE_SIZE 8
+#endif /* SYNC_CACHE_DISABLE */
+
+/* Called at startup by init.c. */
+void
+__objc_sync_init (void)
+{
+ int i;
+
+ for (i = 0; i < SYNC_NUMBER_OF_POOLS; i++)
+ {
+ lock_node_ptr new_node;
+
+ /* Create a protection lock for each pool. */
+ sync_pool_protection_locks[i] = objc_mutex_allocate ();
+
+ /* Preallocate a lock per pool. */
+ new_node = objc_malloc (sizeof (struct lock_node));
+ new_node->lock = objc_mutex_allocate ();
+ new_node->object = nil;
+ new_node->usage_count = 0;
+ new_node->recursive_usage_count = 0;
+ new_node->next = NULL;
+
+ sync_pool_array[i] = new_node;
+ }
+}
+
+int
+objc_sync_enter (id object)
+{
+#ifndef SYNC_CACHE_DISABLE
+ int free_cache_slot;
+#endif
+ int hash;
+ lock_node_ptr node;
+ lock_node_ptr unused_node;
+
+ if (object == nil)
+ return OBJC_SYNC_SUCCESS;
+
+#ifndef SYNC_CACHE_DISABLE
+ if (lock_cache == NULL)
+ {
+ /* Note that this calloc only happen only once per thread, the
+ very first time a thread does a objc_sync_enter(). */
+ lock_cache = objc_calloc (SYNC_CACHE_SIZE, sizeof (lock_node_ptr));
+ }
+
+ /* Check the cache to see if we have a record of having already
+ locked the lock corresponding to this object. While doing so,
+ keep track of the first free cache node in case we need it
+ later. */
+ node = NULL;
+ free_cache_slot = -1;
+
+ {
+ int i;
+ for (i = 0; i < SYNC_CACHE_SIZE; i++)
+ {
+ lock_node_ptr locked_node = lock_cache[i];
+
+ if (locked_node == NULL)
+ {
+ if (free_cache_slot == -1)
+ free_cache_slot = i;
+ }
+ else if (locked_node->object == object)
+ {
+ node = locked_node;
+ break;
+ }
+ }
+ }
+
+ if (node != NULL)
+ {
+ /* We found the lock. Increase recursive_usage_count, which is
+ protected by node->lock, which we already hold. */
+ node->recursive_usage_count++;
+
+ /* There is no need to actually lock anything, since we already
+ hold the lock. Correspondingly, objc_sync_exit() will just
+ decrease recursive_usage_count and do nothing to unlock. */
+ return OBJC_SYNC_SUCCESS;
+ }
+#endif /* SYNC_CACHE_DISABLE */
+
+ /* The following is the standard lookup for the lock in the standard
+ pool lock. It requires a pool protection lock. */
+ hash = SYNC_OBJECT_HASH(object);
+
+ /* Search for an existing lock for 'object'. While searching, make
+ note of any unused lock if we find any. */
+ unused_node = NULL;
+
+ objc_mutex_lock (sync_pool_protection_locks[hash]);
+
+ node = sync_pool_array[hash];
+
+ while (node != NULL)
+ {
+ if (node->object == object)
+ {
+ /* We found the lock. */
+ node->usage_count++;
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+#ifndef SYNC_CACHE_DISABLE
+ /* Put it in the cache. */
+ if (free_cache_slot != -1)
+ lock_cache[free_cache_slot] = node;
+#endif
+
+ /* Lock it. */
+ objc_mutex_lock (node->lock);
+
+ return OBJC_SYNC_SUCCESS;
+ }
+
+ if (unused_node == NULL && node->usage_count == 0)
+ {
+ /* We found the first unused node. Record it. */
+ unused_node = node;
+ }
+
+ node = node->next;
+ }
+
+ /* An existing lock for 'object' could not be found. */
+ if (unused_node != NULL)
+ {
+ /* But we found a unused lock; use it. */
+ unused_node->object = object;
+ unused_node->usage_count = 1;
+ unused_node->recursive_usage_count = 0;
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+#ifndef SYNC_CACHE_DISABLE
+ if (free_cache_slot != -1)
+ lock_cache[free_cache_slot] = unused_node;
+#endif
+
+ objc_mutex_lock (unused_node->lock);
+
+ return OBJC_SYNC_SUCCESS;
+ }
+ else
+ {
+ /* There are no unused nodes; allocate a new node. */
+ lock_node_ptr new_node;
+
+ /* Create the node. */
+ new_node = objc_malloc (sizeof (struct lock_node));
+ new_node->lock = objc_mutex_allocate ();
+ new_node->object = object;
+ new_node->usage_count = 1;
+ new_node->recursive_usage_count = 0;
+
+ /* Attach it at the beginning of the pool. */
+ new_node->next = sync_pool_array[hash];
+ sync_pool_array[hash] = new_node;
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+#ifndef SYNC_CACHE_DISABLE
+ if (free_cache_slot != -1)
+ lock_cache[free_cache_slot] = new_node;
+#endif
+
+ objc_mutex_lock (new_node->lock);
+
+ return OBJC_SYNC_SUCCESS;
+ }
+}
+
+int
+objc_sync_exit (id object)
+{
+ int hash;
+ lock_node_ptr node;
+
+ if (object == nil)
+ return OBJC_SYNC_SUCCESS;
+
+#ifndef SYNC_CACHE_DISABLE
+ if (lock_cache != NULL)
+ {
+ int i;
+
+ /* Find the lock in the cache. */
+ node = NULL;
+ for (i = 0; i < SYNC_CACHE_SIZE; i++)
+ {
+ lock_node_ptr locked_node = lock_cache[i];
+
+ if (locked_node != NULL && locked_node->object == object)
+ {
+ node = locked_node;
+ break;
+ }
+ }
+ /* Note that, if a node was found in the cache, the variable i
+ now holds the index where it was found, which will be used to
+ remove it from the cache. */
+ if (node != NULL)
+ {
+ if (node->recursive_usage_count > 0)
+ {
+ node->recursive_usage_count--;
+ return OBJC_SYNC_SUCCESS;
+ }
+ else
+ {
+ /* We need to do a real unlock. */
+ hash = SYNC_OBJECT_HASH(object);
+
+ /* TODO: If we had atomic increase/decrease operations
+ with memory barriers, we could avoid the lock
+ here! */
+ objc_mutex_lock (sync_pool_protection_locks[hash]);
+ node->usage_count--;
+ /* Normally, we do not reset object to nil here. We'll
+ leave the lock associated with that object, at zero
+ usage count. This makes it slighly more efficient to
+ provide a lock for that object if (as likely)
+ requested again. If the object is deallocated, we
+ don't care. It will never match a new lock that is
+ requested, and the node will be reused at some point.
+
+ But, if garbage collection is enabled, leaving a
+ pointer to the object in memory might prevent the
+ object from being released. In that case, we remove
+ it (TODO: maybe we should avoid using the garbage
+ collector at all ? Nothing is ever deallocated in
+ this file). */
+#if OBJC_WITH_GC
+ node->object = nil;
+#endif
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+ /* PS: Between objc_mutex_unlock
+ (sync_pool_protection_locks[hash]) and
+ objc_mutex_unlock (node->lock), the pool is unlocked
+ so other threads may allocate this same lock to
+ another object (!). This is not a problem, but it is
+ curious. */
+ objc_mutex_unlock (node->lock);
+
+ /* Remove the node from the cache. */
+ lock_cache[i] = NULL;
+
+ return OBJC_SYNC_SUCCESS;
+ }
+ }
+ }
+#endif
+
+ /* The cache either wasn't there, or didn't work (eg, we overflowed
+ it at some point and stopped recording new locks in the cache).
+ Proceed with a full search of the lock pool. */
+ hash = SYNC_OBJECT_HASH(object);
+
+ objc_mutex_lock (sync_pool_protection_locks[hash]);
+
+ /* Search for an existing lock for 'object'. */
+ node = sync_pool_array[hash];
+
+ while (node != NULL)
+ {
+ if (node->object == object)
+ {
+ /* We found the lock. */
+ node->usage_count--;
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+ objc_mutex_unlock (node->lock);
+
+ /* No need to remove the node from the cache, since it
+ wasn't found in the cache when we looked for it! */
+ return OBJC_SYNC_SUCCESS;
+ }
+
+ node = node->next;
+ }
+
+ objc_mutex_unlock (sync_pool_protection_locks[hash]);
+
+ /* A lock for 'object' to unlock could not be found (!!). */
+ return OBJC_SYNC_NOT_OWNING_THREAD_ERROR;
+}
diff --git a/libobjc/objc/NXConstStr.h b/libobjc/objc/NXConstStr.h
new file mode 100644
index 000000000..40eb66e32
--- /dev/null
+++ b/libobjc/objc/NXConstStr.h
@@ -0,0 +1,51 @@
+/* Interface for the NXConstantString class for Objective-C.
+ Copyright (C) 1995, 2004, 2009 Free Software Foundation, Inc.
+ Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __nxconstantstring_INCLUDE_GNU
+#define __nxconstantstring_INCLUDE_GNU
+
+#include "Object.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+@interface NXConstantString: Object
+{
+ char *c_string;
+ unsigned int len;
+}
+
+-(const char *) cString;
+-(unsigned int) length;
+
+@end
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libobjc/objc/Object.h b/libobjc/objc/Object.h
new file mode 100644
index 000000000..f036b76b9
--- /dev/null
+++ b/libobjc/objc/Object.h
@@ -0,0 +1,68 @@
+/* Interface for the Object class for Objective-C.
+ Copyright (C) 1993, 1994, 1995, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __object_INCLUDE_GNU
+#define __object_INCLUDE_GNU
+
+#include "objc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The Object class is a very minimal root class included with the
+ runtime. It is used as superclass for the two classes included
+ with the runtime, Protocol and NXConstantString.
+
+ Because Objective-C allows multiple root classes, you can define
+ your own root class, different from Object.
+
+ In particular, a Foundation library (such as GNUstep Base) is
+ expected to provide its own root class (typically called NSObject),
+ fully integrated with the library's own high-level features. It is
+ expected that you should always use and interact with NSObject, and
+ mostly ignore Object. */
+
+/* All classes are derived from Object. As such, this is the overhead
+ tacked onto those objects. */
+@interface Object
+{
+ Class isa; /* A pointer to the instance's class structure. */
+}
+- (Class)class;
+- (BOOL)isEqual: (id)anObject;
+@end
+
+/* All of the following includes were deprecated in GCC 4.6 and will
+ be removed in the next release. */
+#include "deprecated/hash.h"
+#include "deprecated/typedstream.h"
+#include "deprecated/Object.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libobjc/objc/Protocol.h b/libobjc/objc/Protocol.h
new file mode 100644
index 000000000..1cf9892b2
--- /dev/null
+++ b/libobjc/objc/Protocol.h
@@ -0,0 +1,56 @@
+/* Declare the class Protocol for Objective C programs.
+ Copyright (C) 1993, 2004, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __Protocol_INCLUDE_GNU
+#define __Protocol_INCLUDE_GNU
+
+#include "Object.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+@interface Protocol : Object
+{
+@private
+ char *protocol_name;
+ struct objc_protocol_list *protocol_list;
+ struct objc_method_description_list *instance_methods, *class_methods;
+}
+@end
+
+/* The Protocol methods have been replaced by
+ protocol_getName()
+ protocol_conformsToProtocol()
+ protocol_getMethodDescription()
+*/
+
+#include "deprecated/Protocol.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not __Protocol_INCLUDE_GNU */
diff --git a/libobjc/objc/README b/libobjc/objc/README
new file mode 100644
index 000000000..4a8be6e56
--- /dev/null
+++ b/libobjc/objc/README
@@ -0,0 +1,13 @@
+This directory contains the public headers that are installed when
+libobjc is installed.
+
+Deprecated parts of the API should be moved into objc/deprecated and
+then included by public headers until they are finally removed. For
+example, if objc-api.h contains an _objc_unexpected_exception variable
+which is then deprecated, it should be moved into a header in
+objc/deprecated. This header is then included into objc-api.h.
+
+The result is that all the deprecated parts of the API are clearly
+separated in objc/deprecated, while objc/ retains only the current public
+API.
+
diff --git a/libobjc/objc/deprecated/METHOD_NULL.h b/libobjc/objc/deprecated/METHOD_NULL.h
new file mode 100644
index 000000000..6912be345
--- /dev/null
+++ b/libobjc/objc/deprecated/METHOD_NULL.h
@@ -0,0 +1,2 @@
+/* For functions which return Method_t */
+#define METHOD_NULL (Method_t)0
diff --git a/libobjc/objc/deprecated/MetaClass.h b/libobjc/objc/deprecated/MetaClass.h
new file mode 100644
index 000000000..01597782c
--- /dev/null
+++ b/libobjc/objc/deprecated/MetaClass.h
@@ -0,0 +1 @@
+typedef struct objc_class *MetaClass;
diff --git a/libobjc/objc/deprecated/Object.h b/libobjc/objc/deprecated/Object.h
new file mode 100644
index 000000000..e15cf7dd9
--- /dev/null
+++ b/libobjc/objc/deprecated/Object.h
@@ -0,0 +1,84 @@
+/* The following methods were deprecated in GCC 4.6.0 and will be
+ removed in the next GCC release. */
+@interface Object (Deprecated)
+/* Initializing classes and instances */
++ initialize;
+- init;
+
+/* Creating, freeing, and copying instances */
++ new;
++ alloc;
+- free;
+- copy;
+- shallowCopy;
+- deepen;
+- deepCopy;
+
+/* Identifying classes */
+- (Class)superClass;
+- (MetaClass)metaClass;
+- (const char *)name;
+
+/* Identifying and comparing objects */
+- self;
+- (unsigned int)hash;
+- (int)compare:(id)anotherObject;
+
+/* Testing object type */
+- (BOOL)isMetaClass;
+- (BOOL)isClass;
+- (BOOL)isInstance;
+
+/* Testing inheritance relationships */
+- (BOOL)isKindOf:(Class)aClassObject;
+- (BOOL)isMemberOf:(Class)aClassObject;
+- (BOOL)isKindOfClassNamed:(const char *)aClassName;
+- (BOOL)isMemberOfClassNamed:(const char *)aClassName;
+
+/* Testing class functionality */
++ (BOOL)instancesRespondTo:(SEL)aSel;
+- (BOOL)respondsTo:(SEL)aSel;
+
+/* Testing protocol conformance */
+- (BOOL)conformsTo:(Protocol*)aProtocol;
+
+/* Introspection */
++ (IMP)instanceMethodFor:(SEL)aSel;
+- (IMP)methodFor:(SEL)aSel;
++ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
+- (struct objc_method_description *)descriptionForMethod:(SEL)aSel;
+
+/* Sending messages determined at run time */
+- perform:(SEL)aSel;
+- perform:(SEL)aSel with:anObject;
+- perform:(SEL)aSel with:anObject1 with:anObject2;
+
+/* Forwarding */
+- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame;
+- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
+
+/* Posing */
++ poseAs:(Class)aClassObject;
+- (Class)transmuteClassTo:(Class)aClassObject;
+
+/* Enforcing intentions */
+- subclassResponsibility:(SEL)aSel;
+- notImplemented:(SEL)aSel;
+- shouldNotImplement:(SEL)aSel;
+
+/* Error handling */
+- doesNotRecognize:(SEL)aSel;
+- error:(const char *)aString, ...;
+
+/* Archiving */
++ (int)version;
++ setVersion:(int)aVersion;
+
++ (int)streamVersion: (TypedStream*)aStream; /* __attribute__ ((deprecated)) */
+
+- read: (TypedStream*)aStream; /* __attribute__ ((deprecated)) */
+- write: (TypedStream*)aStream; /* __attribute__ ((deprecated)) */
+- awake; /* __attribute__ ((deprecated)) */
+
+@end
+
diff --git a/libobjc/objc/deprecated/Protocol.h b/libobjc/objc/deprecated/Protocol.h
new file mode 100644
index 000000000..7a77f51a0
--- /dev/null
+++ b/libobjc/objc/deprecated/Protocol.h
@@ -0,0 +1,13 @@
+/* The following methods were deprecated in GCC 4.6.0 and will be
+ removed in the next GCC release. */
+@interface Protocol (Deprecated)
+/* Obtaining attributes intrinsic to the protocol */
+- (const char *)name;
+
+/* Testing protocol conformance */
+- (BOOL) conformsTo: (Protocol *)aProtocolObject;
+
+/* Looking up information specific to a protocol */
+- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
+- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
+@end
diff --git a/libobjc/objc/deprecated/README b/libobjc/objc/deprecated/README
new file mode 100644
index 000000000..3f105196e
--- /dev/null
+++ b/libobjc/objc/deprecated/README
@@ -0,0 +1,11 @@
+This directory contains declarations and features that are deprecated
+and that will be removed in future versions of the compiler.
+
+Note that files in this directory are not really usable headers on
+their own - they shouldn't be included directly by end users. They
+are header fragments containing deprecated APIs that are still
+included (until removed) from the real headers in objc/.
+
+Files in this directory should not #include any other objc header.
+Any include that they need should be done in the real objc/ headers
+before including these fragments.
diff --git a/libobjc/objc/deprecated/STR.h b/libobjc/objc/deprecated/STR.h
new file mode 100644
index 000000000..17c20e2d6
--- /dev/null
+++ b/libobjc/objc/deprecated/STR.h
@@ -0,0 +1,2 @@
+/* Incredibly obsolete. */
+typedef char *STR; /* String alias */
diff --git a/libobjc/objc/deprecated/hash.h b/libobjc/objc/deprecated/hash.h
new file mode 100644
index 000000000..8b718a441
--- /dev/null
+++ b/libobjc/objc/deprecated/hash.h
@@ -0,0 +1,211 @@
+/* Hash tables for Objective C method dispatch.
+ Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+
+#ifndef __hash_INCLUDE_GNU
+#define __hash_INCLUDE_GNU
+
+#include <stddef.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * This data structure is used to hold items
+ * stored in a hash table. Each node holds
+ * a key/value pair.
+ *
+ * Items in the cache are really of type void *.
+ */
+typedef struct cache_node
+{
+ struct cache_node *next; /* Pointer to next entry on the list.
+ NULL indicates end of list. */
+ const void *key; /* Key used to locate the value. Used
+ to locate value when more than one
+ key computes the same hash
+ value. */
+ void *value; /* Value stored for the key. */
+} *node_ptr;
+
+
+/*
+ * This data type is the function that computes a hash code given a key.
+ * Therefore, the key can be a pointer to anything and the function specific
+ * to the key type.
+ *
+ * Unfortunately there is a mutual data structure reference problem with this
+ * typedef. Therefore, to remove compiler warnings the functions passed to
+ * objc_hash_new will have to be casted to this type.
+ */
+typedef unsigned int (*hash_func_type) (void *, const void *);
+
+/*
+ * This data type is the function that compares two hash keys and returns an
+ * integer greater than, equal to, or less than 0, according as the first
+ * parameter is lexicographically greater than, equal to, or less than the
+ * second.
+ */
+
+typedef int (*compare_func_type) (const void *, const void *);
+
+
+/*
+ * This data structure is the cache.
+ *
+ * It must be passed to all of the hashing routines
+ * (except for new).
+ */
+typedef struct cache
+{
+ /* Variables used to implement the hash itself. */
+ node_ptr *node_table; /* Pointer to an array of hash nodes. */
+ /* Variables used to track the size of the hash table so to determine
+ when to resize it. */
+ unsigned int size; /* Number of buckets allocated for the hash table
+ (number of array entries allocated for
+ "node_table"). Must be a power of two. */
+ unsigned int used; /* Current number of entries in the hash table. */
+ unsigned int mask; /* Precomputed mask. */
+
+ /* Variables used to implement indexing through the hash table. */
+
+ unsigned int last_bucket; /* Tracks which entry in the array where
+ the last value was returned. */
+ /* Function used to compute a hash code given a key.
+ This function is specified when the hash table is created. */
+ hash_func_type hash_func;
+ /* Function used to compare two hash keys to see if they are equal. */
+ compare_func_type compare_func;
+} *cache_ptr;
+
+
+/* Allocate and initialize a hash table. */
+
+cache_ptr objc_hash_new (unsigned int size,
+ hash_func_type hash_func,
+ compare_func_type compare_func);
+
+/* Deallocate all of the hash nodes and the cache itself. */
+
+void objc_hash_delete (cache_ptr cache);
+
+/* Add the key/value pair to the hash table. If the
+ hash table reaches a level of fullness then it will be resized.
+
+ assert if the key is already in the hash. */
+
+void objc_hash_add (cache_ptr *cachep, const void *key, void *value);
+
+/* Remove the key/value pair from the hash table.
+ assert if the key isn't in the table. */
+
+void objc_hash_remove (cache_ptr cache, const void *key);
+
+/* Used to index through the hash table. Start with NULL
+ to get the first entry.
+
+ Successive calls pass the value returned previously.
+ ** Don't modify the hash during this operation ***
+
+ Cache nodes are returned such that key or value can
+ be extracted. */
+
+node_ptr objc_hash_next (cache_ptr cache, node_ptr node);
+
+/* Used to return a value from a hash table using a given key. */
+
+void *objc_hash_value_for_key (cache_ptr cache, const void *key);
+
+/* Used to determine if the given key exists in the hash table */
+
+BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key);
+
+/************************************************
+
+ Useful hashing functions.
+
+ Declared inline for your pleasure.
+
+************************************************/
+
+/* Calculate a hash code by performing some
+ manipulation of the key pointer. (Use the lowest bits
+ except for those likely to be 0 due to alignment.) */
+
+static inline unsigned int
+objc_hash_ptr (cache_ptr cache, const void *key)
+{
+ return ((size_t)key / sizeof (void *)) & cache->mask;
+}
+
+
+/* Calculate a hash code by iterating over a NULL
+ terminate string. */
+static inline unsigned int
+objc_hash_string (cache_ptr cache, const void *key)
+{
+ unsigned int ret = 0;
+ unsigned int ctr = 0;
+ const char *ckey = (const char *) key;
+
+ while (*ckey) {
+ ret ^= *ckey++ << ctr;
+ ctr = (ctr + 1) % sizeof (void *);
+ }
+
+ return ret & cache->mask;
+}
+
+
+/* Compare two pointers for equality. */
+static inline int
+objc_compare_ptrs (const void *k1, const void *k2)
+{
+ return (k1 == k2);
+}
+
+
+/* Compare two strings. */
+static inline int
+objc_compare_strings (const void *k1, const void *k2)
+{
+ if (k1 == k2)
+ return 1;
+ else if (k1 == 0 || k2 == 0)
+ return 0;
+ else
+ return ! strcmp ((const char *) k1, (const char *) k2);
+}
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* not __hash_INCLUDE_GNU */
diff --git a/libobjc/objc/deprecated/objc-list.h b/libobjc/objc/deprecated/objc-list.h
new file mode 100644
index 000000000..e542bfc04
--- /dev/null
+++ b/libobjc/objc/deprecated/objc-list.h
@@ -0,0 +1,155 @@
+/* Generic single linked list to keep various information
+ Copyright (C) 1993, 1994, 1996, 2009 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __GNU_OBJC_LIST_H
+#define __GNU_OBJC_LIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+struct objc_list {
+ void *head;
+ struct objc_list *tail;
+};
+
+/* Return a cons cell produced from (head . tail) */
+
+static inline struct objc_list*
+list_cons(void* head, struct objc_list* tail)
+{
+ struct objc_list* cell;
+
+ cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list));
+ cell->head = head;
+ cell->tail = tail;
+ return cell;
+}
+
+/* Return the length of a list, list_length(NULL) returns zero */
+
+static inline int
+list_length(struct objc_list* list)
+{
+ int i = 0;
+ while(list)
+ {
+ i += 1;
+ list = list->tail;
+ }
+ return i;
+}
+
+/* Return the Nth element of LIST, where N count from zero. If N
+ larger than the list length, NULL is returned */
+
+static inline void*
+list_nth(int indx, struct objc_list* list)
+{
+ while(indx-- != 0)
+ {
+ if(list->tail)
+ list = list->tail;
+ else
+ return 0;
+ }
+ return list->head;
+}
+
+/* Remove the element at the head by replacing it by its successor */
+
+static inline void
+list_remove_head(struct objc_list** list)
+{
+ if ((*list)->tail)
+ {
+ struct objc_list* tail = (*list)->tail; /* fetch next */
+ *(*list) = *tail; /* copy next to list head */
+ objc_free(tail); /* free next */
+ }
+ else /* only one element in list */
+ {
+ objc_free(*list);
+ (*list) = 0;
+ }
+}
+
+
+/* Remove the element with `car' set to ELEMENT */
+
+static inline void
+list_remove_elem(struct objc_list** list, void* elem)
+{
+ while (*list) {
+ if ((*list)->head == elem)
+ list_remove_head(list);
+ list = &((*list)->tail);
+ }
+}
+
+/* Map FUNCTION over all elements in LIST */
+
+static inline void
+list_mapcar(struct objc_list* list, void(*function)(void*))
+{
+ while(list)
+ {
+ (*function)(list->head);
+ list = list->tail;
+ }
+}
+
+/* Return element that has ELEM as car */
+
+static inline struct objc_list**
+list_find(struct objc_list** list, void* elem)
+{
+ while(*list)
+ {
+ if ((*list)->head == elem)
+ return list;
+ list = &((*list)->tail);
+ }
+ return NULL;
+}
+
+/* Free list (backwards recursive) */
+
+static inline void
+list_free(struct objc_list* list)
+{
+ if(list)
+ {
+ list_free(list->tail);
+ objc_free(list);
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* not __GNU_OBJC_LIST_H */
diff --git a/libobjc/objc/deprecated/objc_error.h b/libobjc/objc/deprecated/objc_error.h
new file mode 100644
index 000000000..7a7ebe941
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_error.h
@@ -0,0 +1,56 @@
+/* This API is incredibly limited and unsophisticated. objc_error()
+ generally causes the program to abort, so it should only be used
+ when something so dramatic happens that it could be pointless to
+ continue. Only two cases I can think of: failure to allocate new
+ memory or failure to load an Objective-C module.
+*/
+/* Error handling
+
+ Call objc_error() or objc_verror() to record an error; this error
+ routine will generally exit the program but not necessarily if the
+ user has installed his own error handler.
+
+ Call objc_set_error_handler to assign your own function for
+ handling errors. The function should return YES if it is ok
+ to continue execution, or return NO or just abort if the
+ program should be stopped. The default error handler is just to
+ print a message on stderr.
+
+ The error handler function should be of type objc_error_handler
+ The first parameter is an object instance of relevance.
+ The second parameter is an error code.
+ The third parameter is a format string in the printf style.
+ The fourth parameter is a variable list of arguments. */
+void objc_error(id object, int code, const char* fmt, ...);
+void objc_verror(id object, int code, const char* fmt, va_list ap);
+typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap);
+objc_error_handler objc_set_error_handler(objc_error_handler func);
+
+/* Error codes
+ These are used by the runtime library, and your
+ error handling may use them to determine if the error is
+ hard or soft thus whether execution can continue or abort. */
+#define OBJC_ERR_UNKNOWN 0 /* Generic error */
+
+#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */
+#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */
+#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */
+#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */
+
+#define OBJC_ERR_MEMORY 10 /* Out of memory */
+
+#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root
+ object more than once. */
+#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */
+#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */
+#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */
+#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */
+#define OBJC_ERR_NO_READ 25 /* Cannot read stream */
+#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */
+#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */
+#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */
+
+#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */
+
+#define OBJC_ERR_BAD_STATE 40 /* Bad thread state */
+
diff --git a/libobjc/objc/deprecated/objc_get_uninstalled_dtable.h b/libobjc/objc/deprecated/objc_get_uninstalled_dtable.h
new file mode 100644
index 000000000..48d508a15
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_get_uninstalled_dtable.h
@@ -0,0 +1,2 @@
+objc_EXPORT struct sarray*
+objc_get_uninstalled_dtable(void);
diff --git a/libobjc/objc/deprecated/objc_malloc.h b/libobjc/objc/deprecated/objc_malloc.h
new file mode 100644
index 000000000..cf6c6e9d0
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_malloc.h
@@ -0,0 +1,17 @@
+/*
+** Hook functions for memory allocation and disposal.
+** This makes it easy to substitute garbage collection systems
+** such as Boehm's GC by assigning these function pointers
+** to the GC's allocation routines. By default these point
+** to the ANSI standard malloc, realloc, free, etc.
+**
+** Users should call the normal objc routines above for
+** memory allocation and disposal within their programs.
+*/
+objc_EXPORT void *(*_objc_malloc)(size_t);
+objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
+objc_EXPORT void *(*_objc_valloc)(size_t);
+objc_EXPORT void *(*_objc_realloc)(void *, size_t);
+objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
+objc_EXPORT void (*_objc_free)(void *);
+
diff --git a/libobjc/objc/deprecated/objc_msg_sendv.h b/libobjc/objc/deprecated/objc_msg_sendv.h
new file mode 100644
index 000000000..825d9a766
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_msg_sendv.h
@@ -0,0 +1,12 @@
+/* The following types and functions are provided only for
+ backwards-compatibility and should not be used in new code. They
+ were deprecated in GCC 4.6 and will be removed in the next
+ release. */
+typedef void* retval_t; /* return value */
+typedef void(*apply_t)(void); /* function pointer */
+typedef union arglist {
+ char *arg_ptr;
+ char arg_regs[sizeof (char*)];
+} *arglist_t; /* argument frame */
+
+objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t);
diff --git a/libobjc/objc/deprecated/objc_object_alloc.h b/libobjc/objc/deprecated/objc_object_alloc.h
new file mode 100644
index 000000000..f6336ca8e
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_object_alloc.h
@@ -0,0 +1,8 @@
+/* These functions are deprecated and currently ignored. */
+/*
+** Hook functions for allocating, copying and disposing of instances
+*/
+objc_EXPORT id (*_objc_object_alloc)(Class _class);
+objc_EXPORT id (*_objc_object_copy)(id object);
+objc_EXPORT id (*_objc_object_dispose)(id object);
+
diff --git a/libobjc/objc/deprecated/objc_unexpected_exception.h b/libobjc/objc/deprecated/objc_unexpected_exception.h
new file mode 100644
index 000000000..69ffd4e87
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_unexpected_exception.h
@@ -0,0 +1,9 @@
+/*
+** Hook for uncaught exceptions. This hook is called when an
+** exception is thrown and no valid exception handler is in place.
+** The function is expected never to return. If the function returns
+** the result is currently undefined. This is deprecated. Please use
+** objc_set_uncaught_exception_handler() from objc/objc-exception.h
+** instead.
+*/
+objc_EXPORT void (*_objc_unexpected_exception)(id) __attribute__ ((deprecated));
diff --git a/libobjc/objc/deprecated/objc_valloc.h b/libobjc/objc/deprecated/objc_valloc.h
new file mode 100644
index 000000000..a715f1a73
--- /dev/null
+++ b/libobjc/objc/deprecated/objc_valloc.h
@@ -0,0 +1,2 @@
+void *
+objc_valloc(size_t size);
diff --git a/libobjc/objc/deprecated/sarray.h b/libobjc/objc/deprecated/sarray.h
new file mode 100644
index 000000000..aa2f3350a
--- /dev/null
+++ b/libobjc/objc/deprecated/sarray.h
@@ -0,0 +1,240 @@
+/* Sparse Arrays for Objective C dispatch tables
+ Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __sarray_INCLUDE_GNU
+#define __sarray_INCLUDE_GNU
+
+#define OBJC_SPARSE2 /* 2-level sparse array */
+/* #define OBJC_SPARSE3 */ /* 3-level sparse array */
+
+#ifdef OBJC_SPARSE2
+extern const char* __objc_sparse2_id;
+#endif
+
+#ifdef OBJC_SPARSE3
+extern const char* __objc_sparse3_id;
+#endif
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern int nbuckets; /* for stats */
+extern int nindices;
+extern int narrays;
+extern int idxsize;
+
+/* An unsigned integer of same size as a pointer */
+#define SIZET_BITS (sizeof(size_t)*8)
+
+#if defined(__sparc__) || defined(OBJC_SPARSE2)
+#define PRECOMPUTE_SELECTORS
+#endif
+
+#ifdef OBJC_SPARSE3
+
+/* Buckets are 8 words each */
+#define BUCKET_BITS 3
+#define BUCKET_SIZE (1<<BUCKET_BITS)
+#define BUCKET_MASK (BUCKET_SIZE-1)
+
+/* Indices are 16 words each */
+#define INDEX_BITS 4
+#define INDEX_SIZE (1<<INDEX_BITS)
+#define INDEX_MASK (INDEX_SIZE-1)
+
+#define INDEX_CAPACITY (BUCKET_SIZE*INDEX_SIZE)
+
+#else /* OBJC_SPARSE2 */
+
+/* Buckets are 32 words each */
+#define BUCKET_BITS 5
+#define BUCKET_SIZE (1<<BUCKET_BITS)
+#define BUCKET_MASK (BUCKET_SIZE-1)
+
+#endif /* OBJC_SPARSE2 */
+
+typedef size_t sidx;
+
+#ifdef PRECOMPUTE_SELECTORS
+
+struct soffset {
+#ifdef OBJC_SPARSE3
+ unsigned int unused : SIZET_BITS/4;
+ unsigned int eoffset : SIZET_BITS/4;
+ unsigned int boffset : SIZET_BITS/4;
+ unsigned int ioffset : SIZET_BITS/4;
+#else /* OBJC_SPARSE2 */
+#ifdef __sparc__
+ unsigned long boffset : (SIZET_BITS - 2) - BUCKET_BITS;
+ unsigned int eoffset : BUCKET_BITS;
+ unsigned int unused : 2;
+#else
+ unsigned int boffset : SIZET_BITS/2;
+ unsigned int eoffset : SIZET_BITS/2;
+#endif
+#endif /* OBJC_SPARSE2 */
+};
+
+union sofftype {
+ struct soffset off;
+ sidx idx;
+};
+
+#endif /* not PRECOMPUTE_SELECTORS */
+
+union sversion {
+ int version;
+ void *next_free;
+};
+
+struct sbucket {
+ void* elems[BUCKET_SIZE]; /* elements stored in array */
+ union sversion version; /* used for copy-on-write */
+};
+
+#ifdef OBJC_SPARSE3
+
+struct sindex {
+ struct sbucket* buckets[INDEX_SIZE];
+ union sversion version; /* used for copy-on-write */
+};
+
+#endif /* OBJC_SPARSE3 */
+
+struct sarray {
+#ifdef OBJC_SPARSE3
+ struct sindex** indices;
+ struct sindex* empty_index;
+#else /* OBJC_SPARSE2 */
+ struct sbucket** buckets;
+#endif /* OBJC_SPARSE2 */
+ struct sbucket* empty_bucket;
+ union sversion version; /* used for copy-on-write */
+ short ref_count;
+ struct sarray* is_copy_of;
+ size_t capacity;
+};
+
+struct sarray* sarray_new(int, void* default_element);
+void sarray_free(struct sarray*);
+struct sarray* sarray_lazy_copy(struct sarray*);
+void sarray_realloc(struct sarray*, int new_size);
+void sarray_at_put(struct sarray*, sidx indx, void* elem);
+void sarray_at_put_safe(struct sarray*, sidx indx, void* elem);
+
+struct sarray* sarray_hard_copy(struct sarray*); /* ... like the name? */
+void sarray_remove_garbage(void);
+
+
+#ifdef PRECOMPUTE_SELECTORS
+/* Transform soffset values to ints and vica verca */
+static inline unsigned int
+soffset_decode(sidx indx)
+{
+ union sofftype x;
+ x.idx = indx;
+#ifdef OBJC_SPARSE3
+ return x.off.eoffset
+ + (x.off.boffset*BUCKET_SIZE)
+ + (x.off.ioffset*INDEX_CAPACITY);
+#else /* OBJC_SPARSE2 */
+ return x.off.eoffset + (x.off.boffset*BUCKET_SIZE);
+#endif /* OBJC_SPARSE2 */
+}
+
+static inline sidx
+soffset_encode(size_t offset)
+{
+ union sofftype x;
+ x.off.eoffset = offset%BUCKET_SIZE;
+#ifdef OBJC_SPARSE3
+ x.off.boffset = (offset/BUCKET_SIZE)%INDEX_SIZE;
+ x.off.ioffset = offset/INDEX_CAPACITY;
+#else /* OBJC_SPARSE2 */
+ x.off.boffset = offset/BUCKET_SIZE;
+#endif
+ return (sidx)x.idx;
+}
+
+#else /* not PRECOMPUTE_SELECTORS */
+
+static inline size_t
+soffset_decode(sidx indx)
+{
+ return indx;
+}
+
+static inline sidx
+soffset_encode(size_t offset)
+{
+ return offset;
+}
+#endif /* not PRECOMPUTE_SELECTORS */
+
+/* Get element from the Sparse array `array' at offset `indx' */
+
+static inline void* sarray_get(struct sarray* array, sidx indx)
+{
+#ifdef PRECOMPUTE_SELECTORS
+ union sofftype x;
+ x.idx = indx;
+#ifdef OBJC_SPARSE3
+ return
+ array->
+ indices[x.off.ioffset]->
+ buckets[x.off.boffset]->
+ elems[x.off.eoffset];
+#else /* OBJC_SPARSE2 */
+ return array->buckets[x.off.boffset]->elems[x.off.eoffset];
+#endif /* OBJC_SPARSE2 */
+#else /* not PRECOMPUTE_SELECTORS */
+#ifdef OBJC_SPARSE3
+ return array->
+ indices[indx/INDEX_CAPACITY]->
+ buckets[(indx/BUCKET_SIZE)%INDEX_SIZE]->
+ elems[indx%BUCKET_SIZE];
+#else /* OBJC_SPARSE2 */
+ return array->buckets[indx/BUCKET_SIZE]->elems[indx%BUCKET_SIZE];
+#endif /* not OBJC_SPARSE3 */
+#endif /* not PRECOMPUTE_SELECTORS */
+}
+
+static inline void* sarray_get_safe(struct sarray* array, sidx indx)
+{
+ if(soffset_decode(indx) < array->capacity)
+ return sarray_get(array, indx);
+ else
+ return (array->empty_bucket->elems[0]);
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __sarray_INCLUDE_GNU */
diff --git a/libobjc/objc/deprecated/struct_objc_category.h b/libobjc/objc/deprecated/struct_objc_category.h
new file mode 100644
index 000000000..6de3980a9
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_category.h
@@ -0,0 +1,21 @@
+/*
+** The compiler generates one of these structures for each category. A class
+** may have many categories and contain both instance and factory methods.
+*/
+struct objc_category {
+ const char* category_name; /* Name of the category. Name
+ contained in the () of the
+ category definition. */
+ const char* class_name; /* Name of the class to which
+ the category belongs. */
+ MethodList_t instance_methods; /* Linked list of instance
+ methods defined in the
+ category. NULL indicates no
+ instance methods defined. */
+ MethodList_t class_methods; /* Linked list of factory
+ methods defined in the
+ category. NULL indicates no
+ class methods defined. */
+ struct objc_protocol_list *protocols; /* List of Protocols
+ conformed to */
+};
diff --git a/libobjc/objc/deprecated/struct_objc_class.h b/libobjc/objc/deprecated/struct_objc_class.h
new file mode 100644
index 000000000..07927feb6
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_class.h
@@ -0,0 +1,56 @@
+/* This structure used to be public, but is now private to the runtime. */
+#define __objc_STRUCT_OBJC_CLASS_defined
+
+/*
+** The compiler generates one of these structures for each class.
+**
+** This structure is the definition for classes.
+**
+** This structure is generated by the compiler in the executable and used by
+** the run-time during normal messaging operations. Therefore some members
+** change type. The compiler generates "char* const" and places a string in
+** the following member variables: super_class.
+*/
+struct objc_class {
+ MetaClass class_pointer; /* Pointer to the class's
+ meta class. */
+ struct objc_class* super_class; /* Pointer to the super
+ class. NULL for class
+ Object. */
+ const char* name; /* Name of the class. */
+ long version; /* Unknown. */
+ unsigned long info; /* Bit mask. See class masks
+ defined above. */
+ long instance_size; /* Size in bytes of the class.
+ The sum of the class
+ definition and all super
+ class definitions. */
+#ifdef _WIN64
+ /* We pad the structure manually to prevent warning when -Wpadded
+ is used. The compiler automatically pads the structures that it
+ generates, so this manually padded structure still matches the one
+ generated by the compiler, but if we don't pad manually, -Wpadded
+ detects that padding is being added and generates annoying warnings.
+ This hack is necessary as on LLP64 targets sizeof (long) isn't equal
+ to sizeof (void *). */
+ long pad;
+#endif
+ struct objc_ivar_list* ivars; /* Pointer to a structure that
+ describes the instance
+ variables in the class
+ definition. NULL indicates
+ no instance variables. Does
+ not include super class
+ variables. */
+ struct objc_method_list* methods; /* Linked list of instance
+ methods defined for the
+ class. */
+ struct sarray * dtable; /* Pointer to instance
+ method dispatch table. */
+ struct objc_class* subclass_list; /* Subclasses */
+ struct objc_class* sibling_class;
+
+ struct objc_protocol_list *protocols; /* Protocols conformed to */
+ void* gc_object_type;
+};
+
diff --git a/libobjc/objc/deprecated/struct_objc_ivar.h b/libobjc/objc/deprecated/struct_objc_ivar.h
new file mode 100644
index 000000000..57170ad11
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_ivar.h
@@ -0,0 +1,15 @@
+/*
+** The compiler generates one of these structures for a class that has
+** instance variables defined in its specification.
+*/
+typedef struct objc_ivar {
+ const char* ivar_name; /* Name of the instance
+ variable as entered in the
+ class definition. */
+ const char* ivar_type; /* Description of the Ivar's
+ type. Useful for
+ debuggers. */
+ int ivar_offset; /* Byte offset from the base
+ address of the instance
+ structure to the variable. */
+} *Ivar_t;
diff --git a/libobjc/objc/deprecated/struct_objc_ivar_list.h b/libobjc/objc/deprecated/struct_objc_ivar_list.h
new file mode 100644
index 000000000..8f5051fb9
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_ivar_list.h
@@ -0,0 +1,10 @@
+typedef struct objc_ivar_list {
+ int ivar_count; /* Number of structures (Ivar)
+ contained in the list. One
+ structure per instance
+ variable defined in the
+ class. */
+ struct objc_ivar ivar_list[1]; /* Variable length
+ structure. */
+} IvarList, *IvarList_t;
+
diff --git a/libobjc/objc/deprecated/struct_objc_method.h b/libobjc/objc/deprecated/struct_objc_method.h
new file mode 100644
index 000000000..af83c07b6
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_method.h
@@ -0,0 +1,22 @@
+/*
+** The compiler generates one (or more) of these structures for a class that
+** has methods defined in its specification.
+**
+** The implementation of a class can be broken into separate pieces in a file
+** and categories can break them across modules. To handle this problem is a
+** singly linked list of methods.
+*/
+struct objc_method {
+ SEL method_name; /* This variable is the method's
+ name. It is a char*.
+ The unique integer passed to
+ objc_msg_send is a char* too.
+ It is compared against
+ method_name using strcmp. */
+ const char* method_types; /* Description of the method's
+ parameter list. Useful for
+ debuggers. */
+ IMP method_imp; /* Address of the method in the
+ executable. */
+};
+
diff --git a/libobjc/objc/deprecated/struct_objc_method_list.h b/libobjc/objc/deprecated/struct_objc_method_list.h
new file mode 100644
index 000000000..5156cabbf
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_method_list.h
@@ -0,0 +1,9 @@
+typedef struct objc_method_list {
+ struct objc_method_list* method_next; /* This variable is used to link
+ a method list to another. It
+ is a singly linked list. */
+ int method_count; /* Number of methods defined in
+ this structure. */
+ Method method_list[1]; /* Variable length
+ structure. */
+} MethodList, *MethodList_t;
diff --git a/libobjc/objc/deprecated/struct_objc_module.h b/libobjc/objc/deprecated/struct_objc_module.h
new file mode 100644
index 000000000..57950851f
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_module.h
@@ -0,0 +1,24 @@
+/*
+** The compiler generates one of these structures for each module that
+** composes the executable (eg main.m).
+**
+** This data structure is the root of the definition tree for the module.
+**
+** A collect program runs between ld stages and creates a ObjC ctor array.
+** That array holds a pointer to each module structure of the executable.
+*/
+typedef struct objc_module {
+ unsigned long version; /* Version of the Module data structure. */
+ unsigned long size; /* sizeof(Module) according to the compiler -
+ only used to sanity check that it matches
+ sizeof(Module) according to the
+ runtime. */
+ const char* name; /* Name of the file used to compile the
+ module - not set by modern compilers for
+ security reasons. */
+ Symtab_t symtab; /* Pointer to the Symtab of the module. The
+ Symtab holds an array of pointers to the
+ classes and categories defined in the
+ module. */
+} Module, *Module_t;
+
diff --git a/libobjc/objc/deprecated/struct_objc_protocol.h b/libobjc/objc/deprecated/struct_objc_protocol.h
new file mode 100644
index 000000000..5344e3f54
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_protocol.h
@@ -0,0 +1,6 @@
+typedef struct objc_protocol {
+ struct objc_class* class_pointer;
+ char *protocol_name;
+ struct objc_protocol_list *protocol_list;
+ struct objc_method_description_list *instance_methods, *class_methods;
+} Protocol;
diff --git a/libobjc/objc/deprecated/struct_objc_protocol_list.h b/libobjc/objc/deprecated/struct_objc_protocol_list.h
new file mode 100644
index 000000000..5e5788b50
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_protocol_list.h
@@ -0,0 +1,5 @@
+struct objc_protocol_list {
+ struct objc_protocol_list *next;
+ size_t count;
+ Protocol *list[1];
+};
diff --git a/libobjc/objc/deprecated/struct_objc_selector.h b/libobjc/objc/deprecated/struct_objc_selector.h
new file mode 100644
index 000000000..34aaf0d8b
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_selector.h
@@ -0,0 +1,20 @@
+/* This struct used to be public, but is now private to the runtime. */
+
+/*
+** Definition of a selector. Selectors themselves are not unique, but
+** the sel_id is a unique identifier.
+*/
+struct objc_selector
+{
+ void *sel_id;
+ const char *sel_types;
+};
+
+inline static BOOL
+sel_eq (SEL s1, SEL s2)
+{
+ if (s1 == 0 || s2 == 0)
+ return s1 == s2;
+ else
+ return s1->sel_id == s2->sel_id;
+}
diff --git a/libobjc/objc/deprecated/struct_objc_static_instances.h b/libobjc/objc/deprecated/struct_objc_static_instances.h
new file mode 100644
index 000000000..9d889bfc0
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_static_instances.h
@@ -0,0 +1,14 @@
+/* For every class which happens to have statically allocated instances in
+ this module, one OBJC_STATIC_INSTANCES is allocated by the compiler.
+ INSTANCES is NULL terminated and points to all statically allocated
+ instances of this class. */
+struct objc_static_instances
+{
+ char *class_name;
+#ifdef __cplusplus
+ id instances[1];
+#else
+ id instances[0];
+#endif
+};
+
diff --git a/libobjc/objc/deprecated/struct_objc_symtab.h b/libobjc/objc/deprecated/struct_objc_symtab.h
new file mode 100644
index 000000000..75bb27f1b
--- /dev/null
+++ b/libobjc/objc/deprecated/struct_objc_symtab.h
@@ -0,0 +1,26 @@
+/* Whereas a Module (defined further down) is the root (typically) of a file,
+ a Symtab is the root of the class and category definitions within the
+ module.
+
+ A Symtab contains a variable length array of pointers to classes and
+ categories defined in the module. */
+typedef struct objc_symtab {
+ unsigned long sel_ref_cnt; /* Unused (always set to 0). */
+ SEL refs; /* The table of selectors referenced in
+ this module. This is terminated by a
+ selector with NULL sel_id and NULL
+ sel_types. */
+ unsigned short cls_def_cnt; /* Number of classes compiled
+ (defined) in the module. */
+ unsigned short cat_def_cnt; /* Number of categories
+ compiled (defined) in the
+ module. */
+
+ void *defs[1]; /* Variable array of pointers.
+ cls_def_cnt of type Class
+ followed by cat_def_cnt of
+ type Category_t, followed
+ by a NULL terminated array
+ of objc_static_instances. */
+} Symtab, *Symtab_t;
+
diff --git a/libobjc/objc/deprecated/typedstream.h b/libobjc/objc/deprecated/typedstream.h
new file mode 100644
index 000000000..4d948d5fb
--- /dev/null
+++ b/libobjc/objc/deprecated/typedstream.h
@@ -0,0 +1,141 @@
+/* GNU Objective-C Typed Streams interface.
+ Copyright (C) 1993, 1995, 2004, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __typedstream_INCLUDE_GNU
+#define __typedstream_INCLUDE_GNU
+
+/* The API in this file was entirely deprecated in GCC 4.6.0 and will
+ be removed in the following GCC release.
+*/
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef int (*objc_typed_read_func)(void*, char*, int);
+typedef int (*objc_typed_write_func)(void*, const char*, int);
+typedef int (*objc_typed_flush_func)(void*);
+typedef int (*objc_typed_eof_func)(void*);
+
+#define OBJC_READONLY 0x01
+#define OBJC_WRITEONLY 0x02
+
+#define OBJC_MANAGED_STREAM 0x01
+#define OBJC_FILE_STREAM 0x02
+#define OBJC_MEMORY_STREAM 0x04
+
+#define OBJC_TYPED_STREAM_VERSION 0x01
+
+typedef struct objc_typed_stream {
+ void* physical;
+ cache_ptr object_table; /* read/written objects */
+ cache_ptr stream_table; /* other read/written but shared things.. */
+ cache_ptr class_table; /* class version mapping */
+ cache_ptr object_refs; /* forward references */
+ int mode; /* OBJC_READONLY or OBJC_WRITEONLY */
+ int type; /* MANAGED, FILE, MEMORY etc bit string */
+ int version; /* version used when writing */
+ int writing_root_p;
+ objc_typed_read_func read;
+ objc_typed_write_func write;
+ objc_typed_eof_func eof;
+ objc_typed_flush_func flush;
+} TypedStream;
+
+/* opcode masks */
+#define _B_VALUE 0x1fU
+#define _B_CODE 0xe0U
+#define _B_SIGN 0x10U
+#define _B_NUMBER 0x0fU
+
+/* standard opcodes */
+#define _B_INVALID 0x00U
+#define _B_SINT 0x20U
+#define _B_NINT 0x40U
+#define _B_SSTR 0x60U
+#define _B_NSTR 0x80U
+#define _B_RCOMM 0xa0U
+#define _B_UCOMM 0xc0U
+#define _B_EXT 0xe0U
+
+/* eXtension opcodes */
+#define _BX_OBJECT 0x00U
+#define _BX_CLASS 0x01U
+#define _BX_SEL 0x02U
+#define _BX_OBJREF 0x03U
+#define _BX_OBJROOT 0x04U
+#define _BX_EXT 0x1fU
+
+/*
+** Read and write objects as specified by TYPE. All the `last'
+** arguments are pointers to the objects to read/write.
+*/
+
+int objc_write_type (TypedStream* stream, const char* type, const void* data) __attribute__ ((deprecated));
+int objc_read_type (TypedStream* stream, const char* type, void* data) __attribute__ ((deprecated));
+
+int objc_write_types (TypedStream* stream, const char* type, ...) __attribute__ ((deprecated));
+int objc_read_types (TypedStream* stream, const char* type, ...) __attribute__ ((deprecated));
+
+int objc_write_object_reference (TypedStream* stream, id object) __attribute__ ((deprecated));
+int objc_write_root_object (TypedStream* stream, id object) __attribute__ ((deprecated));
+
+long objc_get_stream_class_version (TypedStream* stream, Class class_type) __attribute__ ((deprecated));
+
+
+/*
+** Convenience functions
+*/
+
+int objc_write_array (TypedStream* stream, const char* type,
+ int count, const void* data) __attribute__ ((deprecated));
+int objc_read_array (TypedStream* stream, const char* type,
+ int count, void* data) __attribute__ ((deprecated));
+
+int objc_write_object (TypedStream* stream, id object) __attribute__ ((deprecated));
+int objc_read_object (TypedStream* stream, id* object) __attribute__ ((deprecated));
+
+
+
+/*
+** Open a typed stream for reading or writing. MODE may be either of
+** OBJC_READONLY or OBJC_WRITEONLY.
+*/
+
+TypedStream* objc_open_typed_stream (FILE* physical, int mode) __attribute__ ((deprecated));
+TypedStream* objc_open_typed_stream_for_file (const char* file_name, int mode) __attribute__ ((deprecated));
+
+void objc_close_typed_stream (TypedStream* stream) __attribute__ ((deprecated));
+
+BOOL objc_end_of_typed_stream (TypedStream* stream) __attribute__ ((deprecated));
+void objc_flush_typed_stream (TypedStream* stream) __attribute__ ((deprecated));
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* not __typedstream_INCLUDE_GNU */
diff --git a/libobjc/objc/encoding.h b/libobjc/objc/encoding.h
new file mode 100644
index 000000000..7852466b8
--- /dev/null
+++ b/libobjc/objc/encoding.h
@@ -0,0 +1,117 @@
+/* Encoding of types for Objective C.
+ Copyright (C) 1993, 1997, 2002, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+
+Author: Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __encoding_INCLUDE_GNU
+#define __encoding_INCLUDE_GNU
+
+/* This file is to be used with the "traditional" GNU Objective-C
+ Runtime API (the one declared in objc/objc-api.h). If you are
+ using the "modern" GNU Objective-C Runtime API, then the useful
+ functions from this file are declared in objc/runtime.h. */
+
+#include "objc-api.h"
+#include <ctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* The following are used in encode strings to describe some
+ qualifiers of method and ivar types. */
+#define _C_CONST 'r'
+#define _C_IN 'n'
+#define _C_INOUT 'N'
+#define _C_OUT 'o'
+#define _C_BYCOPY 'O'
+#define _C_BYREF 'R'
+#define _C_ONEWAY 'V'
+#define _C_GCINVISIBLE '|'
+
+/* The same when used as flags. */
+#define _F_CONST 0x01
+#define _F_IN 0x01
+#define _F_OUT 0x02
+#define _F_INOUT 0x03
+#define _F_BYCOPY 0x04
+#define _F_BYREF 0x08
+#define _F_ONEWAY 0x10
+#define _F_GCINVISIBLE 0x20
+
+int objc_sizeof_type (const char *type);
+int objc_alignof_type (const char *type);
+int objc_aligned_size (const char *type);
+int objc_promoted_size (const char *type);
+
+const char *objc_skip_type_qualifiers (const char *type);
+const char *objc_skip_typespec (const char *type);
+const char *objc_skip_offset (const char *type);
+const char *objc_skip_argspec (const char *type);
+unsigned objc_get_type_qualifiers (const char *type);
+
+/* The following functions are replaced, in the modern API, by
+ method_getNumberOfArguments(), method_getArgumentType(). */
+int method_get_number_of_arguments (struct objc_method *);
+int method_get_sizeof_arguments (struct objc_method *);
+
+/* The following functions are deprecated and they use arglist_t which
+ is deprecated. */
+char *method_get_first_argument (struct objc_method *,
+ arglist_t argframe,
+ const char **type);
+char *method_get_next_argument (arglist_t argframe,
+ const char **type);
+char *method_get_nth_argument (struct objc_method *m,
+ arglist_t argframe,
+ int arg,
+ const char **type);
+
+struct objc_struct_layout
+{
+ const char *original_type;
+ const char *type;
+ const char *prev_type;
+ unsigned int record_size;
+ unsigned int record_align;
+};
+
+void objc_layout_structure (const char *type,
+ struct objc_struct_layout *layout);
+BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout);
+void objc_layout_finish_structure (struct objc_struct_layout *layout,
+ unsigned int *size,
+ unsigned int *align);
+void objc_layout_structure_get_info (struct objc_struct_layout *layout,
+ unsigned int *offset,
+ unsigned int *align,
+ const char **type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __encoding_INCLUDE_GNU */
diff --git a/libobjc/objc/hash.h b/libobjc/objc/hash.h
new file mode 100644
index 000000000..8225a0992
--- /dev/null
+++ b/libobjc/objc/hash.h
@@ -0,0 +1,3 @@
+#include "objc.h"
+#include "deprecated/hash.h"
+
diff --git a/libobjc/objc/message.h b/libobjc/objc/message.h
new file mode 100644
index 000000000..8d03fefe4
--- /dev/null
+++ b/libobjc/objc/message.h
@@ -0,0 +1,141 @@
+/* GNU Objective C Runtime messaging declarations
+ Copyright (C) 1993, 1995, 1996, 2004, 2009,
+ 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_message_INCLUDE_GNU
+#define __objc_message_INCLUDE_GNU
+
+#include "objc.h"
+#include "objc-decls.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This file includes declarations of the messaging functions and
+ types. */
+
+/* Compatibility note: the messaging function is one area where the
+ GNU runtime and the Apple/NeXT runtime differ significantly. If
+ you can, it is recommended that you use higher-level facilities
+ (provided by a Foundation library such as GNUstep Base) to perform
+ forwarding or other advanced messaging tricks. */
+
+/* This function returns the IMP (C function implementing a method) to
+ use to invoke the method with selector 'op' of receiver 'receiver'.
+
+ This is the function used by the compiler when compiling method
+ invocations with the GNU runtime. For example, the method call
+
+ result = [receiver method];
+
+ is compiled by the compiler (with the GNU runtime) into the
+ equivalent of:
+
+ {
+ IMP function = objc_msg_lookup (receiver, @selector (method));
+ result = function (receiver, @selector (method));
+ }
+
+ so, a call to objc_msg_lookup() determines the IMP (the C function
+ implementing the method) to call. Then, the function is called.
+ If the method takes or returns different arguments, the compiler
+ will cast 'function' to the right type before invoking it, making
+ sure arguments and return value are handled correctly.
+
+ objc_msg_lookup() must always return a valid function that can be
+ called with the required method signature (otherwise the
+ compiler-generated code shown above could segfault). If 'receiver'
+ is NULL, objc_msg_lookup() returns a C function that does nothing,
+ ignores all its arguments, and returns NULL (see nil_method.c). If
+ 'receiver' does not respond to the selector 'op', objc_msg_lookup()
+ will try to call +resolveClassMethod: or resolveInstanceMethod: as
+ appropriate, and if they return YES, it will try the lookup again
+ (+resolveClassMethod: and +resolveInstanceMethod: can thus install
+ dynamically methods as they are requested). If
+ +resolveClassMethod: or +resolveInstanceMethod: are either not
+ available, or return NO, or return YES but 'receiver' still doesn't
+ implement the 'selector' after calling them, the runtime returns a
+ generic "forwarding" function that can be called with the required
+ method signature and which can process the method invocation
+ according to the forwarding API. There are two runtime hooks that
+ allow Foundation libraries (such as GNUstep-Base) to return their
+ own forwarding function in preference to the runtime ones. When
+ that happens, the Foundation library effectively takes complete
+ control of the forwarding process; any method invocation where the
+ selector is not implemented by the receiver will end up calling a
+ forwarding function chosen by the Foundation library. */
+objc_EXPORT IMP objc_msg_lookup (id receiver, SEL op);
+
+/* Structure used when a message is send to a class's super class.
+ The compiler generates one of these structures and passes it to
+ objc_msg_lookup_super() when a [super method] call is compiled. */
+
+/* In the traditional API, the super class field is called 'class' in
+ Objective-C and 'super_class' in Objective-C++. In the new API
+ (objc/runtime.h) it is always called 'super_class'. We detect the
+ "traditional API" by the fact that the objc/objc-api.h header
+ include guards are defined, which means objc/objc-api.h has been
+ included. This works because objc/message.h does not exist in the
+ Traditional API and is only read because objc-api.h itself includes
+ it. */
+#ifdef __objc_api_INCLUDE_GNU
+/* Traditional API. */
+typedef struct objc_super
+{
+ id self; /* Id of the object sending the message. */
+#ifdef __cplusplus
+ Class super_class;
+#else
+ Class class; /* Object's super class. */
+#endif
+} Super, *Super_t;
+#else
+/* Modern API. */
+struct objc_super
+{
+ id self; /* The receiver of the message. */
+ Class super_class; /* The superclass of the receiver. */
+};
+#endif
+
+/* This is used by the compiler instead of objc_msg_lookup () when
+ compiling a call to 'super', such as [super method]. This requires
+ sending a message to super->self, but looking up the method as if
+ super->self was in class super->super_class. */
+objc_EXPORT IMP objc_msg_lookup_super (struct objc_super *super, SEL sel);
+
+/* Hooks for method forwarding. They make it easy to substitute the
+ built-in forwarding with one based on a library, such as ffi, that
+ implement closures, thereby avoiding gcc's __builtin_apply
+ problems. __objc_msg_forward2's result will be preferred over that
+ of __objc_msg_forward if both are set and return non-NULL. */
+objc_EXPORT IMP (*__objc_msg_forward)(SEL);
+objc_EXPORT IMP (*__objc_msg_forward2)(id, SEL);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not __objc_message_INCLUDE_GNU */
diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h
new file mode 100644
index 000000000..521f79efb
--- /dev/null
+++ b/libobjc/objc/objc-api.h
@@ -0,0 +1,411 @@
+/* GNU Objective-C Runtime API - Traditional API
+ Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
+ 2007, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_api_INCLUDE_GNU
+#define __objc_api_INCLUDE_GNU
+
+/* This file declares the "traditional" GNU Objective-C Runtime API.
+ It is the API supported by older versions of the GNU Objective-C
+ Runtime. Include this file to use it.
+
+ This API is being replaced by the "modern" GNU Objective-C Runtime
+ API, which is declared in objc/runtime.h. The "modern" API is very
+ similar to the API used by the modern Apple/NeXT runtime.
+
+ The last version of GCC supporting the traditional API is GCC 4.6.
+ This file will not exist in later versions of GCC.
+
+ Because the two APIs have some conflicting definitions (in
+ particular, Method and Category are defined differently) you should
+ include either objc/objc-api.h (to use the traditional GNU
+ Objective-C Runtime API) or objc/runtime.h (to use the modern GNU
+ Objective-C Runtime API), but not both. */
+#ifdef __objc_runtime_INCLUDE_GNU
+# error You can not include both objc/objc-api.h and objc/runtime.h. Include objc/objc-api.h for the traditional GNU Objective-C Runtime API and objc/runtime.h for the modern one.
+#endif
+
+/* TODO: A deprecation warning any time the file is included ? */
+
+#include "objc.h"
+#ifndef GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF
+# include "deprecated/hash.h"
+#endif
+#include "thr.h"
+#include "objc-decls.h"
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "deprecated/METHOD_NULL.h"
+
+/* Method descriptor returned by introspective Object methods.
+ This is really just the first part of the more complete objc_method
+ structure defined below and used internally by the runtime. */
+struct objc_method_description
+{
+ SEL name; /* this is a selector, not a string */
+ char *types; /* type encoding */
+};
+
+/* The following are used in encode strings to describe the type of
+ Ivars and Methods. */
+#define _C_ID '@'
+#define _C_CLASS '#'
+#define _C_SEL ':'
+#define _C_CHR 'c'
+#define _C_UCHR 'C'
+#define _C_SHT 's'
+#define _C_USHT 'S'
+#define _C_INT 'i'
+#define _C_UINT 'I'
+#define _C_LNG 'l'
+#define _C_ULNG 'L'
+#define _C_LNG_LNG 'q'
+#define _C_ULNG_LNG 'Q'
+#define _C_FLT 'f'
+#define _C_DBL 'd'
+#define _C_LNG_DBL 'D'
+#define _C_BFLD 'b'
+#define _C_BOOL 'B'
+#define _C_VOID 'v'
+#define _C_UNDEF '?'
+#define _C_PTR '^'
+#define _C_CHARPTR '*'
+#define _C_ARY_B '['
+#define _C_ARY_E ']'
+#define _C_UNION_B '('
+#define _C_UNION_E ')'
+#define _C_STRUCT_B '{'
+#define _C_STRUCT_E '}'
+#define _C_VECTOR '!'
+#define _C_COMPLEX 'j'
+
+/* _C_ATOM is never generated by the compiler. You can treat it as
+ equivalent to "*". */
+#define _C_ATOM '%'
+
+#include "deprecated/objc_error.h"
+
+#include "deprecated/struct_objc_static_instances.h"
+#include "deprecated/struct_objc_symtab.h"
+#include "deprecated/struct_objc_module.h"
+#include "deprecated/struct_objc_ivar.h"
+#include "deprecated/struct_objc_ivar_list.h"
+#include "deprecated/struct_objc_method.h"
+typedef struct objc_method Method, *Method_t;
+
+#include "deprecated/struct_objc_method_list.h"
+#include "deprecated/struct_objc_protocol_list.h"
+
+/*
+** This is used to assure consistent access to the info field of
+** classes
+*/
+#ifndef HOST_BITS_PER_LONG
+#define HOST_BITS_PER_LONG (sizeof(long)*8)
+#endif
+
+#define __CLS_INFO(cls) ((cls)->info)
+#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask)
+#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask)
+
+/* The structure is of type MetaClass */
+#define _CLS_META 0x2L
+#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META))
+
+
+/* The structure is of type Class */
+#define _CLS_CLASS 0x1L
+#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS))
+
+/*
+** The class is initialized within the runtime. This means that
+** it has had correct super and sublinks assigned
+*/
+#define _CLS_RESOLV 0x8L
+#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV)
+#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV)
+
+/*
+** The class has been send a +initialize message or a such is not
+** defined for this class
+*/
+#define _CLS_INITIALIZED 0x04L
+#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)
+#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
+
+/*
+** The class number of this class. This must be the same for both the
+** class and its meta class object
+*/
+#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))
+#define CLS_SETNUMBER(cls, num) \
+ ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \
+ (cls)->info >>= (HOST_BITS_PER_LONG/2); \
+ __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })
+
+#include "deprecated/struct_objc_category.h"
+
+typedef struct objc_category Category, *Category_t;
+
+/* We include message.h for compatibility with the old objc-api.h
+ which included the declarations currently in message.h. The
+ Apple/NeXT runtime does not do this and only includes message.h in
+ objc-runtime.h. It does not matter that much since most of the
+ definitions in message.h are runtime-specific. */
+#include "message.h"
+
+/*
+** This is a hook which is called by objc_lookup_class and
+** objc_get_class if the runtime is not able to find the class.
+** This may e.g. try to load in the class using dynamic loading.
+** The function is guaranteed to be passed a non-NULL name string.
+** In the Modern API, this is replaced by
+** objc_setGetUnknownClassHandler ().
+*/
+objc_EXPORT Class (*_objc_lookup_class)(const char *name);
+
+/*
+** This is a hook which is called by __objc_exec_class every time a class
+** or a category is loaded into the runtime. This may e.g. help a
+** dynamic loader determine the classes that have been loaded when
+** an object file is dynamically linked in.
+*/
+objc_EXPORT void (*_objc_load_callback)(Class _class, Category* category);
+
+#include "deprecated/objc_object_alloc.h"
+
+/*
+ Standard functions for memory allocation and disposal. Users should
+ use these functions in their ObjC programs so that they work so that
+ they work properly with garbage collectors.
+*/
+objc_EXPORT void *
+objc_malloc(size_t size);
+
+/* FIXME: Shouldn't the following be called objc_malloc_atomic ? The
+ GC function is GC_malloc_atomic() which makes sense.
+ */
+objc_EXPORT void *
+objc_atomic_malloc(size_t size);
+
+objc_EXPORT void *
+objc_realloc(void *mem, size_t size);
+
+objc_EXPORT void *
+objc_calloc(size_t nelem, size_t size);
+
+objc_EXPORT void
+objc_free(void *mem);
+
+#include "deprecated/objc_valloc.h"
+#include "deprecated/objc_malloc.h"
+
+#include "deprecated/objc_unexpected_exception.h"
+
+objc_EXPORT Method_t class_get_class_method(MetaClass _class, SEL aSel);
+
+objc_EXPORT Method_t class_get_instance_method(Class _class, SEL aSel);
+
+objc_EXPORT Class class_pose_as(Class impostor, Class superclass);
+
+objc_EXPORT Class objc_get_class(const char *name);
+
+objc_EXPORT Class objc_lookup_class(const char *name);
+
+objc_EXPORT Class objc_next_class(void **enum_state);
+
+objc_EXPORT const char *sel_get_name(SEL selector);
+
+objc_EXPORT const char *sel_get_type(SEL selector);
+
+objc_EXPORT SEL sel_get_uid(const char *name);
+
+objc_EXPORT SEL sel_get_any_uid(const char *name);
+
+objc_EXPORT SEL sel_get_any_typed_uid(const char *name);
+
+objc_EXPORT SEL sel_get_typed_uid(const char *name, const char*);
+
+objc_EXPORT SEL sel_register_name(const char *name);
+
+objc_EXPORT SEL sel_register_typed_name(const char *name, const char*type);
+
+
+objc_EXPORT BOOL sel_is_mapped (SEL aSel);
+
+extern id class_create_instance(Class _class);
+
+static inline const char *
+class_get_class_name(Class _class)
+{
+ return CLS_ISCLASS(_class)?_class->name:((_class==Nil)?"Nil":0);
+}
+
+static inline long
+class_get_instance_size(Class _class)
+{
+ return CLS_ISCLASS(_class)?_class->instance_size:0;
+}
+
+static inline MetaClass
+class_get_meta_class(Class _class)
+{
+ return CLS_ISCLASS(_class)?_class->class_pointer:Nil;
+}
+
+static inline Class
+class_get_super_class(Class _class)
+{
+ return CLS_ISCLASS(_class)?_class->super_class:Nil;
+}
+
+static inline int
+class_get_version(Class _class)
+{
+ return CLS_ISCLASS(_class)?_class->version:-1;
+}
+
+static inline BOOL
+class_is_class(Class _class)
+{
+ return CLS_ISCLASS(_class);
+}
+
+static inline BOOL
+class_is_meta_class(Class _class)
+{
+ return CLS_ISMETA(_class);
+}
+
+
+static inline void
+class_set_version(Class _class, long version)
+{
+ if (CLS_ISCLASS(_class))
+ _class->version = version;
+}
+
+static inline void *
+class_get_gc_object_type (Class _class)
+{
+ return CLS_ISCLASS(_class) ? _class->gc_object_type : NULL;
+}
+
+/* Mark the instance variable as innaccessible to the garbage collector */
+extern void class_ivar_set_gcinvisible (Class _class,
+ const char* ivarname,
+ BOOL gcInvisible);
+
+objc_EXPORT IMP method_get_imp(Method_t method);
+
+objc_EXPORT IMP get_imp (Class _class, SEL sel);
+
+/* object_copy used to take a single argument in the traditional GNU
+ Objective-C Runtime API (the one declared here), but takes 2 in the
+ modern API (implemented in the actual runtime). Define the old
+ object_copy in terms of the new one. */
+objc_EXPORT id object_copy (id object, size_t size);
+#define object_copy(X) (object_copy ((X), 0))
+
+objc_EXPORT id object_dispose(id object);
+
+static inline Class
+object_get_class(id object)
+{
+ return ((object!=nil)
+ ? (CLS_ISCLASS(object->class_pointer)
+ ? object->class_pointer
+ : (CLS_ISMETA(object->class_pointer)
+ ? (Class)object
+ : Nil))
+ : Nil);
+}
+
+static inline const char *
+object_get_class_name(id object)
+{
+ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
+ ?object->class_pointer->name
+ :((Class)object)->name)
+ :"Nil");
+}
+
+static inline MetaClass
+object_get_meta_class(id object)
+{
+ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
+ ?object->class_pointer->class_pointer
+ :(CLS_ISMETA(object->class_pointer)
+ ?object->class_pointer
+ :Nil))
+ :Nil);
+}
+
+static inline Class
+object_get_super_class
+(id object)
+{
+ return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
+ ?object->class_pointer->super_class
+ :(CLS_ISMETA(object->class_pointer)
+ ?((Class)object)->super_class
+ :Nil))
+ :Nil);
+}
+
+static inline BOOL
+object_is_class (id object)
+{
+ return ((object != nil) && CLS_ISMETA (object->class_pointer));
+}
+
+static inline BOOL
+object_is_instance (id object)
+{
+ return ((object != nil) && CLS_ISCLASS (object->class_pointer));
+}
+
+static inline BOOL
+object_is_meta_class (id object)
+{
+ return ((object != nil)
+ && !object_is_instance (object)
+ && !object_is_class (object));
+}
+
+#include "deprecated/objc_get_uninstalled_dtable.h"
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* not __objc_api_INCLUDE_GNU */
+
+
+
diff --git a/libobjc/objc/objc-decls.h b/libobjc/objc/objc-decls.h
new file mode 100644
index 000000000..44df64397
--- /dev/null
+++ b/libobjc/objc/objc-decls.h
@@ -0,0 +1,46 @@
+/* GNU Objective-C Extern helpers for Win32.
+ Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef __objc_decls_INCLUDE_GNU
+#define __objc_decls_INCLUDE_GNU
+
+#if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
+
+# ifdef DLL_EXPORT /* defined by libtool (if required) */
+# define objc_EXPORT
+# define objc_DECLARE
+# else
+# define objc_EXPORT extern __declspec(dllimport)
+# define objc_DECLARE extern __declspec(dllimport)
+# endif
+
+#else
+
+# define objc_EXPORT extern
+# define objc_DECLARE
+
+#endif
+
+#endif /* __objc_decls_INCLUDE_GNU */
diff --git a/libobjc/objc/objc-exception.h b/libobjc/objc/objc-exception.h
new file mode 100644
index 000000000..4f3ee4fbf
--- /dev/null
+++ b/libobjc/objc/objc-exception.h
@@ -0,0 +1,109 @@
+/* GNU Objective C Runtime native exceptions
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_exception_INCLUDE_GNU
+#define __objc_exception_INCLUDE_GNU
+
+#include "objc.h"
+#include "objc-decls.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 'objc_exception_throw' throws the exception 'exception', which is
+ an exception object.
+
+ Calls to 'objc_exception_throw' are automatically generated by the
+ compiler: an Objective-C "@throw exception;" statement gets
+ compiled into the equivalent of "objc_exception_throw
+ (exception);".
+
+ 'objc_exception_throw' searches for a @catch() that can catch the
+ exception. By default, @catch (MyClass object) will catch all
+ exception objects that are of class MyClass or of a subclass of
+ MyClass; if the exception object is 'nil', then the exception can
+ only be caught with a catch-all exception handler where no
+ exception class is specified (such as @catch(id object)). This
+ behaviour can be customized by setting an 'objc_exception_matcher'
+ function (using objc_set_exception_matcher(), see below); if one is
+ set, it is used instead of the default one.
+
+ If the exception is uncaught (there is no @catch() to catch it),
+ the program aborts. It is possible to customize this behaviour by
+ setting an 'objc_uncaught_exception_handler' function (using
+ objc_set_uncaught_exception_handler(), see below); if one is set,
+ it is executed before abort() is called. An uncaught exception
+ handler is expected to never return. */
+objc_EXPORT void objc_exception_throw (id exception);
+
+/* Compatibility note: the Apple/NeXT runtime seems to also have
+ objc_exception_rethrow(), objc_begin_catch() and objc_end_catch().
+ Currently the GNU runtime does not use them. */
+
+/* The following functions allow customizing to a certain extent the
+ exception handling. They are not thread safe and should be called
+ during the program initialization before threads are started. They
+ are mostly reserved for "Foundation" libraries; in the case of
+ GNUstep, GNUstep Base may be using these functions to improve the
+ standard exception handling. You probably shouldn't use these
+ functions unless you are writing your own Foundation library. */
+
+/* Compatibility note: objc_set_exception_preprocessor() (available on
+ the Apple/NeXT runtime) is not available on the GNU runtime. */
+
+/* An 'objc_exception_matcher' function is used to match an exception
+ to a @catch clause. 'catch_class' is the class of objects caught
+ by the @catch clause (for example, in "@catch (Object *o)", the
+ catch_class is Object). It should return 1 if the exception should
+ be caught by a @catch with a catch_class argument, and 0 if
+ not. */
+typedef int (*objc_exception_matcher)(Class catch_class, id exception);
+
+/* Sets a new exception matcher function, and returns the previous
+ exception matcher function. This function is not safe to call in a
+ multi-threaded environment because other threads may be trying to
+ invoke the exception matcher while you change it! */
+objc_EXPORT objc_exception_matcher
+objc_setExceptionMatcher (objc_exception_matcher new_matcher);
+
+
+/* An 'objc_uncaught_exception_handler' function is a function that
+ handles uncaught exceptions. It should never return. */
+typedef void (*objc_uncaught_exception_handler)(id exception);
+
+/* Sets a new uncaught exception handler function, and returns the
+ previous exception handler function. This function is not safe to
+ call in a multi-threaded environment because other threads may be
+ trying to invoke the uncaught exception handler while you change
+ it. */
+objc_EXPORT objc_uncaught_exception_handler
+objc_setUncaughtExceptionHandler (objc_uncaught_exception_handler new_handler);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not __objc_exception_INCLUDE_GNU */
diff --git a/libobjc/objc/objc-list.h b/libobjc/objc/objc-list.h
new file mode 100644
index 000000000..b713a3c0e
--- /dev/null
+++ b/libobjc/objc/objc-list.h
@@ -0,0 +1,2 @@
+#include "deprecated/objc-list.h"
+
diff --git a/libobjc/objc/objc-sync.h b/libobjc/objc/objc-sync.h
new file mode 100644
index 000000000..04d1db653
--- /dev/null
+++ b/libobjc/objc/objc-sync.h
@@ -0,0 +1,69 @@
+/* GNU Objective C Runtime @synchronized implementation
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_sync_INCLUDE_GNU
+#define __objc_sync_INCLUDE_GNU
+
+#include "objc.h"
+#include "objc-decls.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These functions are automatically called by @synchronized(). */
+
+/* 'objc_sync_enter' is automatically called when entering a
+ @synchronized() block. It locks the recursive lock associated with
+ 'object'. If 'object' is nil, it does nothing. It returns
+ OBJC_SYNC_SUCCESS on success; see the enumeration below for error
+ values.
+
+ Note that you should not rely on the behaviour when 'object' is nil
+ because it could change. */
+objc_EXPORT int objc_sync_enter (id object);
+
+/* 'objc_sync_exit' is automatically called when exiting from a
+ @synchronized() block. It unlocks the recursive lock associated
+ with 'object'. If 'object' is nil, it does nothing. It returns
+ OBJC_SYNC_SUCCESS on success; see the enumeration below for error
+ values. */
+objc_EXPORT int objc_sync_exit (id object);
+
+/* All the possible return values for objc_sync_enter() and
+ objc_sync_exit().
+ */
+enum {
+ OBJC_SYNC_SUCCESS = 0,
+ OBJC_SYNC_NOT_OWNING_THREAD_ERROR = -1,
+ OBJC_SYNC_TIMED_OUT = -2,
+ OBJC_SYNC_NOT_INITIALIZED = -3
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not __objc_sync_INCLUDE_GNU */
diff --git a/libobjc/objc/objc.h b/libobjc/objc/objc.h
new file mode 100644
index 000000000..ece0f8841
--- /dev/null
+++ b/libobjc/objc/objc.h
@@ -0,0 +1,169 @@
+/* Basic data types for Objective C.
+ Copyright (C) 1993, 1995, 1996, 2004, 2009,
+ 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_INCLUDE_GNU
+#define __objc_INCLUDE_GNU
+
+/* This file contains the definition of the basic types used by the
+ Objective-C language. It needs to be included to do almost
+ anything with Objective-C. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+
+/* objc-decls.h is included because deprecated/objc_msg_sendv.h needs
+ it. When that goes away, the include of objc-decls.h should be
+ removed. */
+#include "objc-decls.h"
+
+/* The current version of the GNU Objective-C Runtime library in
+ compressed ISO date format. This should be updated any time a new
+ version is released with changes to the public API (there is no
+ need to update it if there were no API changes since the previous
+ release). This macro is only defined starting with the GNU
+ Objective-C Runtime shipped with GCC 4.6.0. If it is not defined,
+ it is either an older version of the runtime, or another runtime. */
+#define __GNU_LIBOBJC__ 20100911
+
+/* Definition of the boolean type.
+
+ Compatibility note: the Apple/NeXT runtime defines a BOOL as a
+ 'signed char'. The GNU runtime uses an 'unsigned char'.
+
+ Important: this could change and we could switch to 'typedef bool
+ BOOL' in the future. Do not depend on the type of BOOL. */
+#undef BOOL
+typedef unsigned char BOOL;
+
+#define YES (BOOL)1
+#define NO (BOOL)0
+
+/* The basic Objective-C types (SEL, Class, id) are defined as pointer
+ to opaque structures. The details of the structures are private to
+ the runtime and may potentially change from one version to the
+ other. */
+
+/* A SEL (selector) represents an abstract method (in the
+ object-oriented sense) and includes all the details of how to
+ invoke the method (which means its name, arguments and return
+ types) but provides no implementation of its own. You can check
+ whether a class implements a selector or not, and if you have a
+ selector and know that the class implements it, you can use it to
+ call the method for an object in the class. */
+typedef const struct objc_selector *SEL;
+#include "deprecated/struct_objc_selector.h"
+
+/* A Class is a class (in the object-oriented sense). In Objective-C
+ there is the complication that each Class is an object itself, and
+ so belongs to a class too. This class that a class belongs to is
+ called its 'meta class'. */
+typedef struct objc_class *Class;
+#include "deprecated/MetaClass.h"
+#include "deprecated/struct_objc_class.h"
+
+/* An 'id' is an object of an unknown class. The way the object data
+ is stored inside the object is private and what you see here is
+ only the beginning of the actual struct. The first field is always
+ a pointer to the Class that the object belongs to. */
+typedef struct objc_object
+{
+ /* 'class_pointer' is the Class that the object belongs to. In case
+ of a Class object, this pointer points to the meta class.
+
+ Compatibility Note: The Apple/NeXT runtime calls this field
+ 'isa'. To access this field, use object_getClass() from
+ runtime.h, which is an inline function so does not add any
+ overhead and is also portable to other runtimes. */
+ Class class_pointer;
+} *id;
+
+/* 'IMP' is a C function that implements a method. When retrieving
+ the implementation of a method from the runtime, this is the type
+ of the pointer returned. The idea of the definition of IMP is to
+ represent a 'pointer to a general function taking an id, a SEL,
+ followed by other unspecified arguments'. You must always cast an
+ IMP to a pointer to a function taking the appropriate, specific
+ types for that function, before calling it - to make sure the
+ appropriate arguments are passed to it. The code generated by the
+ compiler to perform method calls automatically does this cast
+ inside method calls. */
+typedef id (*IMP)(id, SEL, ...);
+
+/* 'nil' is the null object. Messages to nil do nothing and always
+ return 0. */
+#define nil (id)0
+
+/* 'Nil' is the null class. Since classes are objects too, this is
+ actually the same object as 'nil' (and behaves in the same way),
+ but it has a type of Class, so it is good to use it instead of
+ 'nil' if you are comparing a Class object to nil as it enables the
+ compiler to do some type-checking. */
+#define Nil (Class)0
+
+#include "deprecated/STR.h"
+
+/* TODO: Move the 'Protocol' declaration into objc/runtime.h. A
+ Protocol is simply an object, not a basic Objective-C type. The
+ Apple runtime defines Protocol in objc/runtime.h too, so it's good
+ to move it there for API compatibility. */
+
+/* A 'Protocol' is a formally defined list of selectors (normally
+ created using the @protocol Objective-C syntax). It is mostly used
+ at compile-time to check that classes implement all the methods
+ that they are supposed to. Protocols are also available in the
+ runtime system as Protocol objects. */
+#ifndef __OBJC__
+ /* Once we stop including the deprecated struct_objc_protocol.h
+ there is no reason to even define a 'struct objc_protocol'. As
+ all the structure details will be hidden, a Protocol basically is
+ simply an object (as it should be). */
+ /* typedef struct objc_object Protocol; */
+ #include "deprecated/struct_objc_protocol.h"
+#else /* __OBJC__ */
+ @class Protocol;
+#endif
+
+/* Deprecated include - here temporarily, for backwards-compatibility
+ as reval_t, apply_t, arglist_t and objc_msg_lookup() used to be
+ defined here. objc_msg_lookup() is now defined in message.h,
+ included by objc-api.h or runtime.h. */
+#include "deprecated/objc_msg_sendv.h"
+
+/* Compatibility note: the Apple/NeXT runtime defines sel_getName(),
+ sel_registerName(), object_getClassName(), object_getIndexedIvars()
+ in this file while the GNU runtime defines them in runtime.h.
+
+ The reason the GNU runtime does not define them here is that they
+ are not basic Objective-C types (defined in this file), but are
+ part of the runtime API (defined in runtime.h). */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* not __objc_INCLUDE_GNU */
diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h
new file mode 100644
index 000000000..6e1f1ec36
--- /dev/null
+++ b/libobjc/objc/runtime.h
@@ -0,0 +1,1153 @@
+/* GNU Objective-C Runtime API - Modern API
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __objc_runtime_INCLUDE_GNU
+#define __objc_runtime_INCLUDE_GNU
+
+/*
+ This file declares the "modern" GNU Objective-C Runtime API.
+ Include this file to use it.
+
+ This API is replacing the "traditional" GNU Objective-C Runtime API
+ (declared in objc/objc-api.h) which is the one supported by older
+ versions of the GNU Objective-C Runtime. The "modern" API is very
+ similar to the API used by the modern Apple/NeXT runtime.
+
+ Because the two APIs have some conflicting definitions (in
+ particular, Method and Category are defined differently) you should
+ include either objc/objc-api.h (to use the traditional GNU
+ Objective-C Runtime API) or objc/runtime.h (to use the modern GNU
+ Objective-C Runtime API), but not both.
+*/
+#ifdef __objc_api_INCLUDE_GNU
+# error You can not include both objc/objc-api.h and objc/runtime.h. Include objc/objc-api.h for the traditional GNU Objective-C Runtime API and objc/runtime.h for the modern one.
+#endif
+
+#include "objc.h"
+#include "objc-decls.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* An 'Ivar' represents an instance variable. It holds information
+ about the name, type and offset of the instance variable. */
+typedef struct objc_ivar *Ivar;
+
+/* A 'Property' represents a property. It holds information about the
+ name of the property, and its attributes.
+
+ Compatibility Note: the Apple/NeXT runtime defines this as
+ objc_property_t, so we define it that way as well, but obviously
+ Property is the right name. */
+typedef struct objc_property *Property;
+typedef struct objc_property *objc_property_t;
+
+/* A 'Method' represents a method. It holds information about the
+ name, types and the IMP of the method. */
+typedef struct objc_method *Method;
+
+/* A 'Category' represents a category. It holds information about the
+ name of the category, the class it belongs to, and the methods,
+ protocols and such like provided by the category. */
+typedef struct objc_category *Category;
+
+/* 'Protocol' is defined in objc/objc.h (which is included by this
+ file). */
+
+/* Method descriptor returned by introspective Object methods. At the
+ moment, this is really just the first part of the more complete
+ objc_method structure used internally by the runtime. (PS: In the
+ GNU Objective-C Runtime, selectors already include a type, so an
+ objc_method_description does not add much to a SEL. But in other
+ runtimes, that is not the case, which is why
+ objc_method_description exists). */
+struct objc_method_description
+{
+ SEL name; /* Selector (name and signature) */
+ char *types; /* Type encoding */
+};
+
+/* The following are used in encode strings to describe the type of
+ Ivars and Methods. */
+#define _C_ID '@'
+#define _C_CLASS '#'
+#define _C_SEL ':'
+#define _C_CHR 'c'
+#define _C_UCHR 'C'
+#define _C_SHT 's'
+#define _C_USHT 'S'
+#define _C_INT 'i'
+#define _C_UINT 'I'
+#define _C_LNG 'l'
+#define _C_ULNG 'L'
+#define _C_LNG_LNG 'q'
+#define _C_ULNG_LNG 'Q'
+#define _C_FLT 'f'
+#define _C_DBL 'd'
+#define _C_LNG_DBL 'D'
+#define _C_BFLD 'b'
+#define _C_BOOL 'B'
+#define _C_VOID 'v'
+#define _C_UNDEF '?'
+#define _C_PTR '^'
+#define _C_CHARPTR '*'
+#define _C_ARY_B '['
+#define _C_ARY_E ']'
+#define _C_UNION_B '('
+#define _C_UNION_E ')'
+#define _C_STRUCT_B '{'
+#define _C_STRUCT_E '}'
+#define _C_VECTOR '!'
+#define _C_COMPLEX 'j'
+
+/* _C_ATOM is never generated by the compiler. You can treat it as
+ equivalent to "*". */
+#define _C_ATOM '%'
+
+/* The following are used in encode strings to describe some
+ qualifiers of method and ivar types. */
+#define _C_CONST 'r'
+#define _C_IN 'n'
+#define _C_INOUT 'N'
+#define _C_OUT 'o'
+#define _C_BYCOPY 'O'
+#define _C_BYREF 'R'
+#define _C_ONEWAY 'V'
+#define _C_GCINVISIBLE '|'
+
+/* The same when used as flags. */
+#define _F_CONST 0x01
+#define _F_IN 0x01
+#define _F_OUT 0x02
+#define _F_INOUT 0x03
+#define _F_BYCOPY 0x04
+#define _F_BYREF 0x08
+#define _F_ONEWAY 0x10
+#define _F_GCINVISIBLE 0x20
+
+
+/** Implementation: the following functions are defined inline. */
+
+/* Return the class of 'object', or Nil if the object is nil. If
+ 'object' is a class, the meta class is returned; if 'object' is a
+ meta class, the root meta class is returned (note that this is
+ different from the traditional GNU Objective-C Runtime API function
+ object_get_class(), which for a meta class would return the meta
+ class itself). This function is inline, so it is really fast and
+ should be used instead of accessing object->class_pointer
+ directly. */
+static inline Class
+object_getClass (id object)
+{
+ if (object != nil)
+ return object->class_pointer;
+ else
+ return Nil;
+}
+
+
+/** Implementation: the following functions are in selector.c. */
+
+/* Return the name of a given selector. If 'selector' is NULL, return
+ "<null selector>". */
+objc_EXPORT const char *sel_getName (SEL selector);
+
+/* Return the type of a given selector. Return NULL if selector is
+ NULL.
+
+ Compatibility Note: the Apple/NeXT runtime has untyped selectors,
+ so it does not have this function, which is specific to the GNU
+ Runtime. */
+objc_EXPORT const char *sel_getTypeEncoding (SEL selector);
+
+/* This is the same as sel_registerName (). Please use
+ sel_registerName () instead. */
+objc_EXPORT SEL sel_getUid (const char *name);
+
+/* Register a selector with a given name (but unspecified types). If
+ you know the types, it is better to call sel_registerTypedName().
+ If a selector with this name and no types already exists, it is
+ returned. Note that this function should really be called
+ 'objc_registerSelector'. Return NULL if 'name' is NULL. */
+objc_EXPORT SEL sel_registerName (const char *name);
+
+/* Register a selector with a given name and types. If a selector
+ with this name and types already exists, it is returned. Note that
+ this function should really be called 'objc_registerTypedSelector',
+ and it's called 'sel_registerTypedName' only for consistency with
+ 'sel_registerName'. Return NULL if 'name' is NULL.
+
+ Compatibility Note: the Apple/NeXT runtime has untyped selectors,
+ so it does not have this function, which is specific to the GNU
+ Runtime. */
+objc_EXPORT SEL sel_registerTypedName (const char *name, const char *type);
+
+/* Return YES if first_selector is the same as second_selector, and NO
+ if not. */
+objc_EXPORT BOOL sel_isEqual (SEL first_selector, SEL second_selector);
+
+/* Return all the selectors with the supplied name. In the GNU
+ runtime, selectors are typed and there may be multiple selectors
+ with the same name but a different type. The return value of the
+ function is a pointer to an area, allocated with malloc(), that
+ contains all the selectors with the supplier name known to the
+ runtime. The list is terminated by NULL. Optionally, if you pass
+ a non-NULL 'numberOfReturnedSelectors' pointer, the unsigned int
+ that it points to will be filled with the number of selectors
+ returned.
+
+ Compatibility Note: the Apple/NeXT runtime has untyped selectors,
+ so it does not have this function, which is specific to the GNU
+ Runtime. */
+objc_EXPORT SEL * sel_copyTypedSelectorList (const char *name,
+ unsigned int *numberOfReturnedSelectors);
+
+/* Return a selector with name 'name' and a non-zero type encoding, if
+ there is a single selector with a type, and with that name,
+ registered with the runtime. If there is no such selector, or if
+ there are multiple selectors with the same name but conflicting
+ types, NULL is returned. Return NULL if 'name' is NULL.
+
+ This is useful if you have the name of the selector, and would
+ really like to get a selector for it that includes the type
+ encoding. Unfortunately, if the program contains multiple selector
+ with the same name but different types, sel_getTypedSelector can
+ not possibly know which one you need, and so will return NULL.
+
+ Compatibility Note: the Apple/NeXT runtime has untyped selectors,
+ so it does not have this function, which is specific to the GNU
+ Runtime. */
+objc_EXPORT SEL sel_getTypedSelector (const char *name);
+
+
+/** Implementation: the following functions are in objects.c. */
+
+/* Create an instance of class 'class_', adding extraBytes to the size
+ of the returned object. This method allocates the appropriate
+ amount of memory for the instance, initializes it to zero, then
+ calls all the C++ constructors on appropriate C++ instance
+ variables of the instance (if any) (TODO: The C++ constructors bit
+ is not implemented yet). */
+objc_EXPORT id class_createInstance (Class class_, size_t extraBytes);
+
+/* Copy an object and return the copy. extraBytes should be identical
+ to the extraBytes parameter that was passed when creating the
+ original object. */
+objc_EXPORT id object_copy (id object, size_t extraBytes);
+
+/* Dispose of an object. This method calls the appropriate C++
+ destructors on appropriate C++ instance variables of the instance
+ (if any) (TODO: This is not implemented yet), then frees the memory
+ for the instance. */
+objc_EXPORT id object_dispose (id object);
+
+/* Return the name of the class of 'object'. If 'object' is 'nil',
+ returns "Nil". */
+objc_EXPORT const char * object_getClassName (id object);
+
+/* Change the class of object to be class_. Return the previous class
+ of object. This is currently not really thread-safe. */
+objc_EXPORT Class object_setClass (id object, Class class_);
+
+
+/** Implementation: the following functions are in ivars.c. */
+
+/* Return an instance variable given the class and the instance
+ variable name. This is an expensive function to call, so try to
+ reuse the returned Ivar if you can. */
+objc_EXPORT Ivar class_getInstanceVariable (Class class_, const char *name);
+
+/* Return a class variable given the class and the class variable
+ name. This is an expensive function to call, so try to reuse the
+ returned Ivar if you can.
+
+ This function always returns NULL since class variables are
+ currently unavailable in Objective-C. */
+objc_EXPORT Ivar class_getClassVariable (Class class_, const char *name);
+
+/* If the object was created in class_createInstance() with some
+ extraBytes, returns a pointer to them. If it was not, then the
+ returned pointer may make no sense. */
+objc_EXPORT void * object_getIndexedIvars (id object);
+
+/* Get the value of an instance variable of type 'id'. The function
+ returns the instance variable. To get the value of the instance
+ variable, you should pass as 'returnValue' a pointer to an 'id';
+ the value will be copied there. Note that 'returnValue' is really
+ a 'void *', not a 'void **'. This function really works only with
+ instance variables of type 'id'; for other types of instance
+ variables, access directly the data at (char *)object +
+ ivar_getOffset (ivar). */
+objc_EXPORT Ivar object_getInstanceVariable (id object, const char *name, void **returnValue);
+
+/* Set the value of an instance variable. The value to set is passed
+ in 'newValue' (which really is an 'id', not a 'void *'). The
+ function returns the instance variable. This function really works
+ only with instance variables of type 'id'; for other types of
+ instance variables, access directly the data at (char *)object +
+ ivar_getOffset (ivar). */
+objc_EXPORT Ivar object_setInstanceVariable (id object, const char *name, void *newValue);
+
+/* Get the value of an instance variable of type 'id' of the object
+ 'object'. This is faster than object_getInstanceVariable if you
+ already have the instance variable because it avoids the expensive
+ call to class_getInstanceVariable that is done by
+ object_getInstanceVariable. */
+objc_EXPORT id object_getIvar (id object, Ivar variable);
+
+/* Set the value of an instance variable of type 'id' of the object
+ 'object'. This is faster than object_setInstanceVariable if you
+ already have the instance variable because it avoids the expensive
+ call to class_getInstanceVariable that is done by
+ object_setInstanceVariable. */
+objc_EXPORT void object_setIvar (id object, Ivar variable, id value);
+
+/* Return the name of the instance variable. Return NULL if
+ 'variable' is NULL. */
+objc_EXPORT const char * ivar_getName (Ivar variable);
+
+/* Return the offset of the instance variable from the start of the
+ object data. Return 0 if 'variable' is NULL. */
+objc_EXPORT ptrdiff_t ivar_getOffset (Ivar variable);
+
+/* Return the type encoding of the variable. Return NULL if
+ 'variable' is NULL. */
+objc_EXPORT const char * ivar_getTypeEncoding (Ivar variable);
+
+/* Return all the instance variables of the class. The return value
+ of the function is a pointer to an area, allocated with malloc(),
+ that contains all the instance variables of the class. It does not
+ include instance variables of superclasses. The list is terminated
+ by NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedIvars' pointer, the unsigned int that it points to
+ will be filled with the number of instance variables returned.
+ Return NULL for classes still in construction (ie, allocated using
+ objc_allocatedClassPair() but not yet registered with the runtime
+ using objc_registerClassPair()). */
+objc_EXPORT Ivar * class_copyIvarList (Class class_, unsigned int *numberOfReturnedIvars);
+
+/* Add an instance variable with name 'ivar_name' to class 'class_',
+ where 'class_' is a class in construction that has been created
+ using objc_allocateClassPair() and has not been registered with the
+ runtime using objc_registerClassPair() yet. You can not add
+ instance variables to classes already registered with the runtime.
+ 'size' is the size of the instance variable, 'log_2_of_alignment'
+ the alignment as a power of 2 (so 0 means alignment to a 1 byte
+ boundary, 1 means alignment to a 2 byte boundary, 2 means alignment
+ to a 4 byte boundary, etc), and 'type' the type encoding of the
+ variable type. You can use sizeof(), log2(__alignof__()) and
+ @encode() to determine the right 'size', 'alignment' and 'type' for
+ your instance variable. For example, to add an instance variable
+ name "my_variable" and of type 'id', you can use:
+
+ class_addIvar (class, "my_variable", sizeof (id), log2 ( __alignof__ (id)),
+ @encode (id));
+
+ Return YES if the variable was added, and NO if not. In
+ particular, return NO if 'class_' is Nil, or a meta-class or a
+ class not in construction. Return Nil also if 'ivar_name' or
+ 'type' is NULL, or 'size' is 0.
+ */
+objc_EXPORT BOOL class_addIvar (Class class_, const char * ivar_name, size_t size,
+ unsigned char log_2_of_alignment, const char *type);
+
+/* Return the name of the property. Return NULL if 'property' is
+ NULL. */
+objc_EXPORT const char * property_getName (Property property);
+
+/* Return the attributes of the property as a string. Return NULL if
+ 'property' is NULL. */
+objc_EXPORT const char * property_getAttributes (Property property);
+
+/* Return the property with name 'propertyName' of the class 'class_'.
+ This function returns NULL if the required property can not be
+ found. Return NULL if 'class_' or 'propertyName' is NULL.
+
+ Note that the traditional ABI does not store the list of properties
+ of a class in a compiled module, so the traditional ABI will always
+ return NULL. */
+objc_EXPORT Property class_getProperty (Class class_, const char *propertyName);
+
+/* Return all the properties of the class. The return value
+ of the function is a pointer to an area, allocated with malloc(),
+ that contains all the properties of the class. It does not
+ include properties of superclasses. The list is terminated
+ by NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedIvars' pointer, the unsigned int that it points to
+ will be filled with the number of properties returned.
+
+ Note that the traditional ABI does not store the list of properties
+ of a class in a compiled module, so the traditional ABI will always
+ return an empty list. */
+objc_EXPORT Property * class_copyPropertyList
+(Class class_, unsigned int *numberOfReturnedProperties);
+
+/* Return the ivar layout for class 'class_'.
+
+ At the moment this function always returns NULL. */
+objc_EXPORT const char * class_getIvarLayout (Class class_);
+
+/* Return the weak ivar layout for class 'class_'.
+
+ At the moment this function always returns NULL. */
+objc_EXPORT const char * class_getWeakIvarLayout (Class class_);
+
+/* Set the ivar layout for class 'class_'.
+
+ At the moment, this function does nothing. */
+objc_EXPORT void class_setIvarLayout (Class class_, const char *layout);
+
+/* Set the weak ivar layout for class 'class_'.
+
+ At the moment, this function does nothing. With the GNU runtime,
+ you should use class_ivar_set_gcinvisible () to hide variables from
+ the Garbage Collector. */
+objc_EXPORT void class_setWeakIvarLayout (Class class_, const char *layout);
+
+
+/** Implementation: the following functions are in class.c. */
+
+/* Compatibility Note: The Apple/NeXT runtime does not have
+ objc_get_unknown_class_handler and
+ objc_setGetUnknownClassHandler(). They provide functionality that
+ the traditional GNU Objective-C Runtime API used to provide via the
+ _objc_lookup_class hook. */
+
+/* An 'objc_get_unknown_class_handler' function is used by
+ objc_getClass() to get a class that is currently unknown to the
+ compiler. You could use it for example to have the class loaded by
+ dynamically loading a library. 'class_name' is the name of the
+ class. The function should return the Class object if it manages to
+ load the class, and Nil if not. */
+typedef Class (*objc_get_unknown_class_handler)(const char *class_name);
+
+/* Sets a new handler function for getting unknown classes (to be used
+ by objc_getClass () and related), and returns the previous one.
+ This function is not safe to call in a multi-threaded environment
+ because other threads may be trying to use the get unknown class
+ handler while you change it! */
+objc_EXPORT
+objc_get_unknown_class_handler
+objc_setGetUnknownClassHandler (objc_get_unknown_class_handler new_handler);
+
+/* Return the class with name 'name', if it is already registered with
+ the runtime. If it is not registered, and
+ objc_setGetUnknownClassHandler() has been called to set a handler
+ for unknown classes, the handler is called to give it a chance to
+ load the class in some other way. If the class is not known to the
+ runtime and the handler is not set or returns Nil, objc_getClass()
+ returns Nil. */
+objc_EXPORT Class objc_getClass (const char *name);
+
+/* Return the class with name 'name', if it is already registered with
+ the runtime. Return Nil if not. This function does not call the
+ objc_get_unknown_class_handler function if the class is not
+ found. */
+objc_EXPORT Class objc_lookUpClass (const char *name);
+
+/* Return the meta class associated to the class with name 'name', if
+ it is already registered with the runtime. First, it finds the
+ class using objc_getClass(). Then, it returns the associated meta
+ class. If the class could not be found using objc_getClass(),
+ returns Nil. */
+objc_EXPORT Class objc_getMetaClass (const char *name);
+
+/* This is identical to objc_getClass(), but if the class is not found,
+ it aborts the process instead of returning Nil. */
+objc_EXPORT Class objc_getRequiredClass (const char *name);
+
+/* If 'returnValue' is NULL, 'objc_getClassList' returns the number of
+ classes currently registered with the runtime. If 'returnValue' is
+ not NULL, it should be a (Class *) pointer to an area of memory
+ which can contain up to 'maxNumberOfClassesToReturn' Class records.
+ 'objc_getClassList' will fill the area pointed to by 'returnValue'
+ with all the Classes registered with the runtime (or up to
+ maxNumberOfClassesToReturn if there are more than
+ maxNumberOfClassesToReturn). The function return value is the
+ number of classes actually returned in 'returnValue'. */
+objc_EXPORT int objc_getClassList (Class *returnValue, int maxNumberOfClassesToReturn);
+
+/* Compatibility Note: The Apple/NeXT runtime also has
+
+ Class objc_getFutureClass (const char *name);
+ void objc_setFutureClass (Class class_, const char *name);
+
+ the documentation is unclear on what they are supposed to do, and
+ the GNU Objective-C Runtime currently does not provide them. */
+
+/* Return the name of the class 'class_', or the string "nil" if the
+ class_ is Nil. */
+objc_EXPORT const char * class_getName (Class class_);
+
+/* Return YES if 'class_' is a meta class, and NO if not. If 'class_'
+ is Nil, return NO. */
+objc_EXPORT BOOL class_isMetaClass (Class class_);
+
+/* Return the superclass of 'class_'. If 'class_' is Nil, or it is a
+ root class, return Nil. If 'class_' is a class being constructed,
+ that is, a class returned by objc_allocateClassPair() but before it
+ has been registered with the runtime using
+ objc_registerClassPair(), return Nil. */
+objc_EXPORT Class class_getSuperclass (Class class_);
+
+/* Return the 'version' number of the class, which is an integer that
+ can be used to track changes in the class API, methods and
+ variables. If class_ is Nil, return 0. If class_ is not Nil, the
+ version is 0 unless class_setVersion() has been called to set a
+ different one.
+
+ Please note that internally the version is a long, but the API only
+ allows you to set and retrieve int values. */
+objc_EXPORT int class_getVersion (Class class_);
+
+/* Set the 'version' number of the class, which is an integer that can
+ be used to track changes in the class API, methods and variables.
+ If 'class_' is Nil, does nothing.
+
+ This is typically used internally by "Foundation" libraries such as
+ GNUstep Base to support serialization / deserialization of objects
+ that work across changes in the classes. If you are using such a
+ library, you probably want to use their versioning API, which may
+ be based on this one, but is integrated with the rest of the
+ library.
+
+ Please note that internally the version is a long, but the API only
+ allows you to set and retrieve int values. */
+objc_EXPORT void class_setVersion (Class class_, int version);
+
+/* Return the size in bytes (a byte is the size of a char) of an
+ instance of the class. If class_ is Nil, return 0; else it return
+ a non-zero number (since the 'isa' instance variable is required
+ for all classes). */
+objc_EXPORT size_t class_getInstanceSize (Class class_);
+
+/* Change the implementation of the method. It also searches all
+ classes for any class implementing the method, and replaces the
+ existing implementation with the new one. For that to work,
+ 'method' must be a method returned by class_getInstanceMethod() or
+ class_getClassMethod() as the matching is done by comparing the
+ pointers; in that case, only the implementation in the class is
+ modified. Return the previous implementation that has been
+ replaced. If method or implementation is NULL, do nothing and
+ return NULL. */
+objc_EXPORT IMP
+method_setImplementation (Method method, IMP implementation);
+
+/* Swap the implementation of two methods in a single, atomic
+ operation. This is equivalent to getting the implementation of
+ each method and then calling method_setImplementation() on the
+ other one. For this to work, the two methods must have been
+ returned by class_getInstanceMethod() or class_getClassMethod().
+ If 'method_a' or 'method_b' is NULL, do nothing. */
+objc_EXPORT void
+method_exchangeImplementations (Method method_a, Method method_b);
+
+/* Create a new class/meta-class pair. This function is called to
+ create a new class at runtime. The class is created with
+ superclass 'superclass' (use 'Nil' to create a new root class) and
+ name 'class_name'. 'extraBytes' can be used to specify some extra
+ space for indexed variables to be added at the end of the class and
+ meta-class objects (it is recommended that you set extraBytes to
+ 0). Once you have created the class, it is not usable yet. You
+ need to add any instance variables (by using class_addIvar()), any
+ instance methods (by using class_addMethod()) and any class methods
+ (by using class_addMethod() on the meta-class, as in
+ class_addMethod (object_getClass (class), method)) that are
+ required, and then you need to call objc_registerClassPair() to
+ activate the class. If you need to create a hierarchy of classes,
+ you need to create and register them one at a time. You can not
+ create a new class using another class in construction as
+ superclass. Return Nil if 'class-name' is NULL or if a class with
+ that name already exists or 'superclass' is a class still in
+ construction.
+
+ Implementation Note: in the GNU runtime, allocating a class pair
+ only creates the structures for the class pair, but does not
+ register anything with the runtime. The class is registered with
+ the runtime only when objc_registerClassPair() is called. In
+ particular, if a class is in construction, objc_getClass() will not
+ find it, the superclass will not know about it,
+ class_getSuperclass() will return Nil and another thread may
+ allocate a class pair with the same name; the conflict will only be
+ detected when the classes are registered with the runtime.
+ */
+objc_EXPORT Class
+objc_allocateClassPair (Class super_class, const char *class_name,
+ size_t extraBytes);
+
+/* Register a class pair that was created with
+ objc_allocateClassPair(). After you register a class, you can no
+ longer make changes to its instance variables, but you can start
+ creating instances of it. Do nothing if 'class_' is NULL or if it
+ is not a class allocated by objc_allocateClassPair() and still in
+ construction. */
+objc_EXPORT void
+objc_registerClassPair (Class class_);
+
+/* Dispose of a class pair created using objc_allocateClassPair().
+ Call this function if you started creating a new class with
+ objc_allocateClassPair() but then want to abort the process. You
+ should not access 'class_' after calling this method. Note that if
+ 'class_' has already been registered with the runtime via
+ objc_registerClassPair(), this function does nothing; you can only
+ dispose of class pairs that are still being constructed. Do
+ nothing if class is 'Nil' or if 'class_' is not a class being
+ constructed. */
+objc_EXPORT void
+objc_disposeClassPair (Class class_);
+
+/* Compatibility Note: The Apple/NeXT runtime has the function
+ objc_duplicateClass () but it's undocumented. The GNU runtime does
+ not have it. */
+
+
+/** Implementation: the following functions are in sendmsg.c. */
+
+/* Return the instance method with selector 'selector' of class
+ 'class_', or NULL if the class (or one of its superclasses) does
+ not implement the method. Return NULL if class_ is Nil or selector
+ is NULL. Calling this function may trigger a call to
+ +resolveInstanceMethod:, but does not return a forwarding
+ function. */
+objc_EXPORT Method class_getInstanceMethod (Class class_, SEL selector);
+
+/* Return the class method with selector 'selector' of class 'class_',
+ or NULL if the class (or one of its superclasses) does not
+ implement the method. Return NULL if class_ is Nil or selector is
+ NULL. Calling this function may trigger a call to
+ +resolveClassMethod:, but does not return a forwarding
+ function. */
+objc_EXPORT Method class_getClassMethod (Class class_, SEL selector);
+
+/* Return the IMP (pointer to the function implementing a method) for
+ the instance method with selector 'selector' in class 'class_'.
+ This is the same routine that is used while messaging, and should
+ be very fast. Note that you most likely would need to cast the
+ return function pointer to a function pointer with the appropriate
+ arguments and return type before calling it. To get a class
+ method, you can pass the meta-class as the class_ argument (ie, use
+ class_getMethodImplementation (object_getClass (class_),
+ selector)). Return NULL if class_ is Nil or selector is NULL.
+ This function first looks for an existing method; if it is not
+ found, it calls +resolveClassMethod: or +resolveInstanceMethod:
+ (depending on whether a class or instance method is being looked
+ up) if it is implemented. If the method returns YES, then it tries
+ the look up again (the assumption being that +resolveClassMethod:
+ or resolveInstanceMethod: will add the method using
+ class_addMethod()). If it is still not found, it returns a
+ forwarding function. */
+objc_EXPORT IMP class_getMethodImplementation (Class class_, SEL selector);
+
+/* Compatibility Note: the Apple/NeXT runtime has the function
+ class_getMethodImplementation_stret () which currently does not
+ exist on the GNU runtime because the messaging implementation is
+ different. */
+
+/* Return YES if class 'class_' has an instance method implementing
+ selector 'selector', and NO if not. Return NO if class_ is Nil or
+ selector is NULL. If you need to check a class method, use the
+ meta-class as the class_ argument (ie, use class_respondsToSelector
+ (object_getClass (class_), selector)). */
+objc_EXPORT BOOL class_respondsToSelector (Class class_, SEL selector);
+
+/* Add a method to a class. Use this function to add a new method to
+ a class (potentially overriding a method with the same selector in
+ the superclass); if you want to modify an existing method, use
+ method_setImplementation() instead (or class_replaceMethod ()).
+ This method adds an instance method to 'class_'; to add a class
+ method, get the meta class first, then add the method to the meta
+ class, that is, use
+
+ class_addMethod (object_getClass (class_), selector,
+ implementation, type);
+
+ Return YES if the method was added, and NO if not. Do nothing if
+ one of the arguments is NULL. */
+objc_EXPORT BOOL class_addMethod (Class class_, SEL selector, IMP implementation,
+ const char *method_types);
+
+/* Replace a method in a class. If the class already have a method
+ with this 'selector', find it and use method_setImplementation() to
+ replace the implementation with 'implementation' (method_types is
+ ignored in that case). If the class does not already have a method
+ with this 'selector', call 'class_addMethod() to add it.
+
+ Return the previous implementation of the method, or NULL if none
+ was found. Return NULL if any of the arguments is NULL. */
+objc_EXPORT IMP class_replaceMethod (Class class_, SEL selector, IMP implementation,
+ const char *method_types);
+
+
+/** Implementation: the following functions are in methods.c. */
+
+/* Return the selector for method 'method'. Return NULL if 'method'
+ is NULL.
+
+ This function is misnamed; it should be called
+ 'method_getSelector'. To get the actual name, get the selector,
+ then the name from the selector (ie, use sel_getName
+ (method_getName (method))). */
+objc_EXPORT SEL method_getName (Method method);
+
+/* Return the IMP of the method. Return NULL if 'method' is NULL. */
+objc_EXPORT IMP method_getImplementation (Method method);
+
+/* Return the type encoding of the method. Return NULL if 'method' is
+ NULL. */
+objc_EXPORT const char * method_getTypeEncoding (Method method);
+
+/* Return a method description for the method. Return NULL if
+ 'method' is NULL. */
+objc_EXPORT struct objc_method_description * method_getDescription (Method method);
+
+/* Return all the instance methods of the class. The return value of
+ the function is a pointer to an area, allocated with malloc(), that
+ contains all the instance methods of the class. It does not
+ include instance methods of superclasses. The list is terminated
+ by NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedMethods' pointer, the unsigned int that it points
+ to will be filled with the number of instance methods returned. To
+ get the list of class methods, pass the meta-class in the 'class_'
+ argument, (ie, use class_copyMethodList (object_getClass (class_),
+ &numberOfReturnedMethods)). */
+objc_EXPORT Method * class_copyMethodList (Class class_, unsigned int *numberOfReturnedMethods);
+
+
+/** Implementation: the following functions are in encoding.c. */
+
+/* Return the number of arguments that the method 'method' expects.
+ Note that all methods need two implicit arguments ('self' for the
+ receiver, and '_cmd' for the selector). Return 0 if 'method' is
+ NULL. */
+objc_EXPORT unsigned int method_getNumberOfArguments (Method method);
+
+/* Return the string encoding for the return type of method 'method'.
+ The string is a standard zero-terminated string in an area of
+ memory allocated with malloc(); you should free it with free() when
+ you finish using it. Return an empty string if method is NULL. */
+objc_EXPORT char * method_copyReturnType (Method method);
+
+/* Return the string encoding for the argument type of method
+ 'method', argument number 'argumentNumber' ('argumentNumber' is 0
+ for self, 1 for _cmd, and 2 or more for the additional arguments if
+ any). The string is a standard zero-terminated string in an area
+ of memory allocated with malloc(); you should free it with free()
+ when you finish using it. Return an empty string if method is NULL
+ or if 'argumentNumber' refers to a non-existing argument. */
+objc_EXPORT char * method_copyArgumentType (Method method, unsigned int argumentNumber);
+
+/* Return the string encoding for the return type of method 'method'.
+ The string is returned by copying it into the supplied
+ 'returnValue' string, which is of size 'returnValueSize'. No more
+ than 'returnValueSize' characters are copied; if the encoding is
+ smaller than 'returnValueSize', the rest of 'returnValue' is filled
+ with zeros. If it is bigger, it is truncated (and would not be
+ zero-terminated). You should supply a big enough
+ 'returnValueSize'. If the method is NULL, returnValue is set to a
+ string of zeros. */
+objc_EXPORT void method_getReturnType (Method method, char *returnValue,
+ size_t returnValueSize);
+
+/* Return the string encoding for the argument type of method
+ 'method', argument number 'argumentNumber' ('argumentNumber' is 0
+ for self, 1 for _cmd, and 2 or more for the additional arguments if
+ any). The string is returned by copying it into the supplied
+ 'returnValue' string, which is of size 'returnValueSize'. No more
+ than 'returnValueSize' characters are copied; if the encoding is
+ smaller than 'returnValueSize', the rest of 'returnValue' is filled
+ with zeros. If it is bigger, it is truncated (and would not be
+ zero-terminated). You should supply a big enough
+ 'returnValueSize'. If the method is NULL, returnValue is set to a
+ string of zeros. */
+objc_EXPORT void method_getArgumentType (Method method, unsigned int argumentNumber,
+ char *returnValue, size_t returnValueSize);
+
+
+/** Implementation: the following functions are in protocols.c. */
+
+/* Return the protocol with name 'name', or nil if it the protocol is
+ not known to the runtime. */
+objc_EXPORT Protocol *objc_getProtocol (const char *name);
+
+/* Return all the protocols known to the runtime. The return value of
+ the function is a pointer to an area, allocated with malloc(), that
+ contains all the protocols known to the runtime; the list is
+ terminated by NULL. You should free this area using free() once
+ you no longer need it. Optionally, if you pass a non-NULL
+ 'numberOfReturnedProtocols' pointer, the unsigned int that it
+ points to will be filled with the number of protocols returned. If
+ there are no protocols known to the runtime, NULL is returned. */
+objc_EXPORT Protocol **objc_copyProtocolList (unsigned int *numberOfReturnedProtocols);
+
+/* Add a protocol to a class, and return YES if it was done
+ succesfully, and NO if not. At the moment, NO should only happen
+ if class_ or protocol are nil, if the protocol is not a Protocol
+ object or if the class already conforms to the protocol. */
+objc_EXPORT BOOL class_addProtocol (Class class_, Protocol *protocol);
+
+/* Return YES if the class 'class_' conforms to Protocol 'protocol',
+ and NO if not. This function does not check superclasses; if you
+ want to check for superclasses (in the way that [NSObject
+ +conformsToProtocol:] does) you need to iterate over the class
+ hierarchy using class_getSuperclass(), and call
+ class_conformsToProtocol() for each of them. */
+objc_EXPORT BOOL class_conformsToProtocol (Class class_, Protocol *protocol);
+
+/* Return all the protocols that the class conforms to. The return
+ value of the function is a pointer to an area, allocated with
+ malloc(), that contains all the protocols formally adopted by the
+ class. It does not include protocols adopted by superclasses. The
+ list is terminated by NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedProtocols' pointer, the unsigned int that it
+ points to will be filled with the number of protocols returned.
+ This function does not return protocols that superclasses conform
+ to. */
+objc_EXPORT Protocol **class_copyProtocolList (Class class_, unsigned int *numberOfReturnedProtocols);
+
+/* Return YES if protocol 'protocol' conforms to protocol
+ 'anotherProtocol', and NO if not. Note that if one of the two
+ protocols is nil, it returns NO. */
+objc_EXPORT BOOL protocol_conformsToProtocol (Protocol *protocol, Protocol *anotherProtocol);
+
+/* Return YES if protocol 'protocol' is the same as protocol
+ 'anotherProtocol', and 'NO' if not. Note that it returns YES if
+ the two protocols are both nil. */
+objc_EXPORT BOOL protocol_isEqual (Protocol *protocol, Protocol *anotherProtocol);
+
+/* Return the name of protocol 'protocol'. If 'protocol' is nil or is
+ not a Protocol, return NULL. */
+objc_EXPORT const char *protocol_getName (Protocol *protocol);
+
+/* Return the method description for the method with selector
+ 'selector' in protocol 'protocol'; if 'requiredMethod' is YES, the
+ function searches the list of required methods; if NO, the list of
+ optional methods. If 'instanceMethod' is YES, the function search
+ for an instance method; if NO, for a class method. If there is no
+ matching method, an objc_method_description structure with both
+ name and types set to NULL is returned. This function will only
+ find methods that are directly declared in the protocol itself, not
+ in other protocols that this protocol adopts.
+
+ Note that the traditional ABI does not store the list of optional
+ methods of a protocol in a compiled module, so the traditional ABI
+ will always return (NULL, NULL) when requiredMethod == NO. */
+objc_EXPORT struct objc_method_description protocol_getMethodDescription (Protocol *protocol,
+ SEL selector,
+ BOOL requiredMethod,
+ BOOL instanceMethod);
+
+/* Return the method descriptions of all the methods of the protocol.
+ The return value of the function is a pointer to an area, allocated
+ with malloc(), that contains all the method descriptions of the
+ methods of the protocol. It does not recursively include methods
+ of the protocols adopted by this protocol. The list is terminated
+ by a NULL objc_method_description (one with both fields set to
+ NULL). Optionally, if you pass a non-NULL
+ 'numberOfReturnedMethods' pointer, the unsigned int that it points
+ to will be filled with the number of properties returned.
+
+ Note that the traditional ABI does not store the list of optional
+ methods of a protocol in a compiled module, so the traditional ABI
+ will always return an empty list if requiredMethod is set to
+ NO. */
+objc_EXPORT struct objc_method_description *protocol_copyMethodDescriptionList (Protocol *protocol,
+ BOOL requiredMethod,
+ BOOL instanceMethod,
+ unsigned int *numberOfReturnedMethods);
+
+/* Return the property with name 'propertyName' of the protocol
+ 'protocol'. If 'requiredProperty' is YES, the function searches
+ the list of required properties; if NO, the list of optional
+ properties. If 'instanceProperty' is YES, the function searches
+ the list of instance properties; if NO, the list of class
+ properties. At the moment, optional properties and class
+ properties are not part of the Objective-C language, so both
+ 'requiredProperty' and 'instanceProperty' should be set to YES.
+ This function returns NULL if the required property can not be
+ found.
+
+ Note that the traditional ABI does not store the list of properties
+ of a protocol in a compiled module, so the traditional ABI will
+ always return NULL. */
+objc_EXPORT Property protocol_getProperty (Protocol *protocol, const char *propertyName,
+ BOOL requiredProperty, BOOL instanceProperty);
+
+/* Return all the properties of the protocol. The return value of the
+ function is a pointer to an area, allocated with malloc(), that
+ contains all the properties of the protocol. It does not
+ recursively include properties of the protocols adopted by this
+ protocol. The list is terminated by NULL. Optionally, if you pass
+ a non-NULL 'numberOfReturnedProperties' pointer, the unsigned int
+ that it points to will be filled with the number of properties
+ returned.
+
+ Note that the traditional ABI does not store the list of properties
+ of a protocol in a compiled module, so the traditional ABI will
+ always return NULL and store 0 in numberOfReturnedProperties. */
+objc_EXPORT Property *protocol_copyPropertyList (Protocol *protocol, unsigned int *numberOfReturnedProperties);
+
+/* Return all the protocols that the protocol conforms to. The return
+ value of the function is a pointer to an area, allocated with
+ malloc(), that contains all the protocols formally adopted by the
+ protocol. It does not recursively include protocols adopted by the
+ protocols adopted by this protocol. The list is terminated by
+ NULL. Optionally, if you pass a non-NULL
+ 'numberOfReturnedProtocols' pointer, the unsigned int that it
+ points to will be filled with the number of protocols returned. */
+objc_EXPORT Protocol **protocol_copyProtocolList (Protocol *protocol, unsigned int *numberOfReturnedProtocols);
+
+
+/** Implementation: the following hook is in init.c. */
+
+/* This is a hook which is called by __objc_exec_class every time a
+ class or a category is loaded into the runtime. This may e.g. help
+ a dynamic loader determine the classes that have been loaded when
+ an object file is dynamically linked in. */
+objc_EXPORT void (*_objc_load_callback)(Class _class, struct objc_category *category);
+
+
+/** Implementation: the following functions are in objc-foreach.c. */
+
+/* 'objc_enumerationMutation()' is called when a collection is
+ mutated while being "fast enumerated". That is a hard error, and
+ objc_enumerationMutation is called to deal with it. 'collection'
+ is the collection object that was mutated during an enumeration.
+
+ objc_enumerationMutation() will invoke the mutation handler if any
+ is set. Then, it will abort the program.
+
+ Compatibility note: the Apple runtime will not abort the program
+ after calling the mutation handler. */
+objc_EXPORT void objc_enumerationMutation (id collection);
+
+/* 'objc_set_enumeration_mutation_handler' can be used to set a
+ function that will be called (instead of aborting) when a fast
+ enumeration is mutated during enumeration. The handler will be
+ called with the 'collection' being mutated as the only argument and
+ it should not return; it should either exit the program, or could
+ throw an exception. The recommended implementation is to throw an
+ exception - the user can then use exception handlers to deal with
+ it.
+
+ This function is not thread safe (other threads may be trying to
+ invoke the enumeration mutation handler while you are changing it!)
+ and should be called during during the program initialization
+ before threads are started. It is mostly reserved for "Foundation"
+ libraries; in the case of GNUstep, GNUstep Base may be using this
+ function to improve the standard enumeration mutation handling.
+ You probably shouldn't use this function unless you are writing
+ your own Foundation library. */
+objc_EXPORT void objc_setEnumerationMutationHandler (void (*handler)(id));
+
+/* This structure (used during fast enumeration) is automatically
+ defined by the compiler (it is as if this definition was always
+ included in all Objective-C files). Note that it is usually
+ defined again with the name of NSFastEnumeration by "Foundation"
+ libraries such as GNUstep Base. And if NSFastEnumeration is
+ defined, the compiler will use it instead of
+ __objcFastEnumerationState when doing fast enumeration. */
+/*
+struct __objcFastEnumerationState
+{
+ unsigned long state;
+ id *itemsPtr;
+ unsigned long *mutationsPtr;
+ unsigned long extra[5];
+};
+*/
+
+
+/* Compatibility Note: The Apple/NeXT runtime has the functions
+ objc_copyImageNames (), class_getImageName () and
+ objc_copyClassNamesForImage () but they are undocumented. The GNU
+ runtime does not have them at the moment. */
+
+/* Compatibility Note: The Apple/NeXT runtime has the functions
+ objc_setAssociatedObject (), objc_getAssociatedObject (),
+ objc_removeAssociatedObjects () and the objc_AssociationPolicy type
+ and related enum. The GNU runtime does not have them yet.
+ TODO: Implement them. */
+
+/* Compatibility Note: The Apple/NeXT runtime has the function
+ objc_setForwardHandler (). The GNU runtime does not have it
+ because messaging (and, in particular, forwarding) works in a
+ different (incompatible) way with the GNU runtime. If you need to
+ customize message forwarding at the Objective-C runtime level (that
+ is, if you are implementing your own "Foundation" library such as
+ GNUstep Base on top of the Objective-C runtime), in objc/message.h
+ there are hooks (that work in the framework of the GNU runtime) to
+ do so. */
+
+
+/** Implementation: the following functions are in memory.c. */
+
+/* Traditional GNU Objective-C Runtime functions that are used for
+ memory allocation and disposal. These functions are used in the
+ same way as you use malloc, realloc, calloc and free and make sure
+ that memory allocation works properly with the garbage
+ collector.
+
+ Compatibility Note: these functions are not available with the
+ Apple/NeXT runtime. */
+
+objc_EXPORT void *objc_malloc(size_t size);
+
+/* FIXME: Shouldn't the following be called objc_malloc_atomic ? The
+ GC function is GC_malloc_atomic() which makes sense.
+ */
+objc_EXPORT void *objc_atomic_malloc(size_t size);
+
+objc_EXPORT void *objc_realloc(void *mem, size_t size);
+
+objc_EXPORT void *objc_calloc(size_t nelem, size_t size);
+
+objc_EXPORT void objc_free(void *mem);
+
+
+/** Implementation: the following functions are in gc.c. */
+
+/* The GNU Objective-C Runtime has a different implementation of
+ garbage collection.
+
+ Compatibility Note: these functions are not available with the
+ Apple/NeXT runtime. */
+
+/* Mark the instance variable as inaccessible to the garbage
+ collector. */
+objc_EXPORT void class_ivar_set_gcinvisible (Class _class,
+ const char* ivarname,
+ BOOL gcInvisible);
+
+
+/** Implementation: the following functions are in encoding.c. */
+
+/* Traditional GNU Objective-C Runtime functions that are currently
+ used to implement method forwarding.
+
+ Compatibility Note: these functions are not available with the
+ Apple/NeXT runtime. */
+
+/* Return the size of a variable which has the specified 'type'
+ encoding. */
+objc_EXPORT int objc_sizeof_type (const char *type);
+
+/* Return the align of a variable which has the specified 'type'
+ encoding. */
+objc_EXPORT int objc_alignof_type (const char *type);
+
+/* Return the aligned size of a variable which has the specified
+ 'type' encoding. The aligned size is the size rounded up to the
+ nearest alignment. */
+objc_EXPORT int objc_aligned_size (const char *type);
+
+/* Return the promoted size of a variable which has the specified
+ 'type' encoding. This is the size rounded up to the nearest
+ integral of the wordsize, taken to be the size of a void *. */
+objc_EXPORT int objc_promoted_size (const char *type);
+
+
+/* The following functions are used when parsing the type encoding of
+ methods, to skip over parts that are ignored. They take as
+ argument a pointer to a location inside the type encoding of a
+ method (which is a string) and return a new pointer, pointing to a
+ new location inside the string after having skipped the unwanted
+ information. */
+
+/* Skip some type qualifiers (_C_CONST, _C_IN, etc). These may
+ eventually precede typespecs occurring in method prototype
+ encodings. */
+objc_EXPORT const char *objc_skip_type_qualifiers (const char *type);
+
+/* Skip one typespec element (_C_CLASS, _C_SEL, etc). If the typespec
+ is prepended by type qualifiers, these are skipped as well. */
+objc_EXPORT const char *objc_skip_typespec (const char *type);
+
+/* Skip an offset. */
+objc_EXPORT const char *objc_skip_offset (const char *type);
+
+/* Skip an argument specification (ie, skipping a typespec, which may
+ include qualifiers, and an offset too). */
+objc_EXPORT const char *objc_skip_argspec (const char *type);
+
+/* Read type qualifiers (_C_CONST, _C_IN, etc) from string 'type'
+ (stopping at the first non-type qualifier found) and return an
+ unsigned int which is the logical OR of all the corresponding flags
+ (_F_CONST, _F_IN etc). */
+objc_EXPORT unsigned objc_get_type_qualifiers (const char *type);
+
+
+/* Note that the following functions work for very simple structures,
+ but get easily confused by more complicated ones (for example,
+ containing vectors). A better solution is required. These
+ functions are likely to change in the next GCC release. */
+
+/* The following three functions can be used to determine how a
+ structure is laid out by the compiler. For example:
+
+ struct objc_struct_layout layout;
+ int i;
+
+ objc_layout_structure (type, &layout);
+ while (objc_layout_structure_next_member (&layout))
+ {
+ int position, align;
+ const char *type;
+
+ objc_layout_structure_get_info (&layout, &position, &align, &type);
+ printf ("element %d has offset %d, alignment %d\n",
+ i++, position, align);
+ }
+
+ These functions are used by objc_sizeof_type and objc_alignof_type
+ functions to compute the size and alignment of structures. The
+ previous method of computing the size and alignment of a structure
+ was not working on some architectures, particulary on AIX, and in
+ the presence of bitfields inside the structure. */
+struct objc_struct_layout
+{
+ const char *original_type;
+ const char *type;
+ const char *prev_type;
+ unsigned int record_size;
+ unsigned int record_align;
+};
+
+objc_EXPORT void objc_layout_structure (const char *type,
+ struct objc_struct_layout *layout);
+objc_EXPORT BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout);
+objc_EXPORT void objc_layout_finish_structure (struct objc_struct_layout *layout,
+ unsigned int *size,
+ unsigned int *align);
+objc_EXPORT void objc_layout_structure_get_info (struct objc_struct_layout *layout,
+ unsigned int *offset,
+ unsigned int *align,
+ const char **type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/libobjc/objc/sarray.h b/libobjc/objc/sarray.h
new file mode 100644
index 000000000..ff51e47f9
--- /dev/null
+++ b/libobjc/objc/sarray.h
@@ -0,0 +1,2 @@
+#include "deprecated/sarray.h"
+
diff --git a/libobjc/objc/thr.h b/libobjc/objc/thr.h
new file mode 100644
index 000000000..d5ddf9b2f
--- /dev/null
+++ b/libobjc/objc/thr.h
@@ -0,0 +1,117 @@
+/* Thread and mutex controls for Objective C.
+ Copyright (C) 1996, 1997, 2002, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __thread_INCLUDE_GNU
+#define __thread_INCLUDE_GNU
+
+#include "objc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*************************************************************************
+ * Universal static variables:
+ */
+extern int __objc_thread_exit_status; /* Global exit status. */
+
+/********
+ * Thread safe implementation types and functions.
+ */
+
+/* Thread priorities */
+#define OBJC_THREAD_INTERACTIVE_PRIORITY 2
+#define OBJC_THREAD_BACKGROUND_PRIORITY 1
+#define OBJC_THREAD_LOW_PRIORITY 0
+
+/* A thread */
+typedef void * objc_thread_t;
+
+/* This structure represents a single mutual exclusion lock. */
+struct objc_mutex
+{
+ volatile objc_thread_t owner; /* Id of thread that owns. */
+ volatile int depth; /* # of acquires. */
+ void * backend; /* Specific to backend */
+};
+typedef struct objc_mutex *objc_mutex_t;
+
+/* This structure represents a single condition mutex */
+struct objc_condition
+{
+ void * backend; /* Specific to backend */
+};
+typedef struct objc_condition *objc_condition_t;
+
+/* Frontend mutex functions */
+objc_mutex_t objc_mutex_allocate (void);
+int objc_mutex_deallocate (objc_mutex_t mutex);
+int objc_mutex_lock (objc_mutex_t mutex);
+int objc_mutex_unlock (objc_mutex_t mutex);
+int objc_mutex_trylock (objc_mutex_t mutex);
+
+/* Frontend condition mutex functions */
+objc_condition_t objc_condition_allocate (void);
+int objc_condition_deallocate (objc_condition_t condition);
+int objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex);
+int objc_condition_signal (objc_condition_t condition);
+int objc_condition_broadcast (objc_condition_t condition);
+
+/* Frontend thread functions */
+objc_thread_t objc_thread_detach (SEL selector, id object, id argument);
+void objc_thread_yield (void);
+int objc_thread_exit (void);
+int objc_thread_set_priority (int priority);
+int objc_thread_get_priority (void);
+void * objc_thread_get_data (void);
+int objc_thread_set_data (void *value);
+objc_thread_t objc_thread_id (void);
+void objc_thread_add (void);
+void objc_thread_remove (void);
+
+/*
+ Use this to set the hook function that will be called when the
+ runtime initially becomes multi threaded.
+ The hook function is only called once, meaning only when the
+ 2nd thread is spawned, not for each and every thread.
+
+ It returns the previous hook function or NULL if there is none.
+
+ A program outside of the runtime could set this to some function so
+ it can be informed; for example, the GNUstep Base Library sets it
+ so it can implement the NSBecomingMultiThreaded notification.
+ */
+typedef void (*objc_thread_callback) (void);
+objc_thread_callback objc_set_thread_callback (objc_thread_callback func);
+
+/* Backend initialization functions */
+int __objc_init_thread_system (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* not __thread_INCLUDE_GNU */
diff --git a/libobjc/objc/typedstream.h b/libobjc/objc/typedstream.h
new file mode 100644
index 000000000..a39c51b29
--- /dev/null
+++ b/libobjc/objc/typedstream.h
@@ -0,0 +1,4 @@
+#include "objc.h"
+#include "deprecated/hash.h"
+#include "deprecated/typedstream.h"
+
diff --git a/libobjc/objects.c b/libobjc/objects.c
new file mode 100644
index 000000000..1c69456a6
--- /dev/null
+++ b/libobjc/objects.c
@@ -0,0 +1,130 @@
+/* GNU Objective C Runtime class related functions
+ Copyright (C) 1993, 1995, 1996, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc/thr.h" /* Required by objc-private/runtime.h. */
+#include "objc-private/module-abi-8.h" /* For CLS_ISCLASS and similar. */
+#include "objc-private/runtime.h" /* the kitchen sink */
+
+#include <string.h> /* For memcpy() */
+
+#if OBJC_WITH_GC
+# include <gc.h>
+# include <gc_typed.h>
+#endif
+
+/* FIXME: The semantics of extraBytes are not really clear. */
+inline
+id
+class_createInstance (Class class, size_t extraBytes)
+{
+ id new = nil;
+
+#if OBJC_WITH_GC
+ if (CLS_ISCLASS (class))
+ new = (id) GC_malloc_explicitly_typed (class->instance_size + extraBytes,
+ (GC_descr)class->gc_object_type);
+#else
+ if (CLS_ISCLASS (class))
+ new = (id) objc_calloc (class->instance_size + extraBytes, 1);
+#endif
+
+ if (new != nil)
+ {
+ /* There is no need to zero the memory, since both
+ GC_malloc_explicitly_typed and objc_calloc return zeroed
+ memory. */
+ new->class_pointer = class;
+ }
+
+ /* TODO: Invoke C++ constructors on all appropriate C++ instance
+ variables of the new object. */
+
+ return new;
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+id
+class_create_instance (Class class)
+{
+ return class_createInstance (class, 0);
+}
+
+id
+object_copy (id object, size_t extraBytes)
+{
+ if ((object != nil) && CLS_ISCLASS (object->class_pointer))
+ {
+ /* TODO: How should it work with C++ constructors ? */
+ id copy = class_createInstance (object->class_pointer, extraBytes);
+ memcpy (copy, object, object->class_pointer->instance_size + extraBytes);
+ return copy;
+ }
+ else
+ return nil;
+}
+
+id
+object_dispose (id object)
+{
+ if ((object != nil) && CLS_ISCLASS (object->class_pointer))
+ {
+ /* TODO: Invoke C++ destructors on all appropriate C++ instance
+ variables. But what happens with the garbage collector ?
+ Would object_dispose() be ever called in that case ? */
+
+ objc_free (object);
+ }
+ return nil;
+}
+
+const char *
+object_getClassName (id object)
+{
+ if (object != nil)
+ return object->class_pointer->name;
+ else
+ return "Nil";
+}
+
+Class
+object_setClass (id object, Class class_)
+{
+ if (object == nil)
+ return Nil;
+ else
+ {
+ Class old_class = object->class_pointer;
+
+ object->class_pointer = class_;
+ return old_class;
+ }
+}
+
+/* Hook functions for memory allocation and disposal. Deprecated and
+ currently unused. */
+id (*_objc_object_alloc) (Class) = 0;
+id (*_objc_object_dispose) (id) = 0;
+id (*_objc_object_copy) (id) = 0;
diff --git a/libobjc/protocols.c b/libobjc/protocols.c
new file mode 100644
index 000000000..3ff6fbaa1
--- /dev/null
+++ b/libobjc/protocols.c
@@ -0,0 +1,557 @@
+/* GNU Objective C Runtime protocol related functions.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Contributed by Nicola Pero
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc-private/module-abi-8.h" /* For runtime structures */
+#include "objc/thr.h"
+#include "objc-private/runtime.h" /* the kitchen sink */
+#include "objc-private/hash.h" /* For the hash table of protocols. */
+#include "objc-private/protocols.h" /* For __objc_protocols_init() and
+ __objc_protocols_add_protocol(). */
+#include <stdlib.h> /* For malloc. */
+
+/* This is a table that maps a name to a Protocol instance with that
+ name. Because there may be multiple Protocol instances with the
+ same name (no harm in that) the table records only one
+ instance. */
+static cache_ptr __protocols_hashtable;
+
+/* A mutex protecting the protocol_hashtable. */
+static objc_mutex_t __protocols_hashtable_lock = NULL;
+
+/* Called at startup by init.c. */
+void
+__objc_protocols_init (void)
+{
+ __protocols_hashtable_lock = objc_mutex_allocate ();
+
+ /* The keys in the table are strings, and the values are Protocol
+ objects. */
+ __protocols_hashtable = objc_hash_new (64, (hash_func_type) objc_hash_string,
+ (compare_func_type) objc_compare_strings);
+}
+
+/* Add a protocol to the hashtable. */
+void
+__objc_protocols_add_protocol (const char *name, Protocol *object)
+{
+ objc_mutex_lock (__protocols_hashtable_lock);
+
+ /* If we find a protocol with the same name already in the
+ hashtable, we do not need to add the new one, because it will be
+ identical to it. This in the reasonable assumption that two
+ protocols with the same name are identical, which is expected in
+ any sane program. If we are really paranoid, we would compare
+ the protocols and abort if they are not identical.
+ Unfortunately, this would slow down the startup of all
+ Objective-C programs while trying to catch a problem that has
+ never been seen in practice, so we don't do it. */
+ if (! objc_hash_is_key_in_hash (__protocols_hashtable, name))
+ objc_hash_add (&__protocols_hashtable, name, object);
+
+ objc_mutex_unlock (__protocols_hashtable_lock);
+}
+
+Protocol *
+objc_getProtocol (const char *name)
+{
+ Protocol *protocol;
+
+ if (name == NULL)
+ return NULL;
+
+ objc_mutex_lock (__protocols_hashtable_lock);
+ protocol = (Protocol *)(objc_hash_value_for_key (__protocols_hashtable, name));
+ objc_mutex_unlock (__protocols_hashtable_lock);
+
+ return protocol;
+}
+
+Protocol **
+objc_copyProtocolList (unsigned int *numberOfReturnedProtocols)
+{
+ unsigned int count = 0;
+ Protocol **returnValue = NULL;
+ node_ptr node;
+
+ objc_mutex_lock (__protocols_hashtable_lock);
+
+ /* Count how many protocols we have. */
+ node = objc_hash_next (__protocols_hashtable, NULL);
+ while (node)
+ {
+ count++;
+ node = objc_hash_next (__protocols_hashtable, node);
+ }
+
+ if (count != 0)
+ {
+ unsigned int i = 0;
+
+ /* Allocate enough memory to hold them. */
+ returnValue = (Protocol **)(malloc (sizeof (Protocol *) * (count + 1)));
+
+ /* Copy the protocols. */
+ node = objc_hash_next (__protocols_hashtable, NULL);
+ while (node)
+ {
+ returnValue[i] = node->value;
+ i++;
+ node = objc_hash_next (__protocols_hashtable, node);
+ }
+
+ returnValue[i] = NULL;
+ }
+ objc_mutex_unlock (__protocols_hashtable_lock);
+
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = count;
+
+ return returnValue;
+}
+
+BOOL
+class_addProtocol (Class class_, Protocol *protocol)
+{
+ struct objc_protocol_list *protocols;
+
+ if (class_ == Nil || protocol == NULL)
+ return NO;
+
+ if (class_conformsToProtocol (class_, protocol))
+ return NO;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NO;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Create the objc_protocol_list. */
+ protocols = malloc (sizeof (struct objc_protocol_list));
+ protocols->count = 1;
+ protocols->list[0] = protocol;
+
+ /* Attach it to the list of class protocols. */
+ protocols->next = class_->protocols;
+ class_->protocols = protocols;
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return YES;
+}
+
+BOOL
+class_conformsToProtocol (Class class_, Protocol *protocol)
+{
+ struct objc_protocol_list* proto_list;
+
+ if (class_ == Nil || protocol == NULL)
+ return NO;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NO;
+
+ /* Acquire the runtime lock because the list of protocols for a
+ class may be modified concurrently, for example if another thread
+ calls class_addProtocol(), or dynamically loads from a file a
+ category of the class. */
+ objc_mutex_lock (__objc_runtime_mutex);
+ proto_list = class_->protocols;
+
+ while (proto_list)
+ {
+ size_t i;
+ for (i = 0; i < proto_list->count; i++)
+ {
+ if (proto_list->list[i] == protocol
+ || protocol_conformsToProtocol (proto_list->list[i],
+ protocol))
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return YES;
+ }
+ }
+ proto_list = proto_list->next;
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return NO;
+}
+
+Protocol **
+class_copyProtocolList (Class class_, unsigned int *numberOfReturnedProtocols)
+{
+ unsigned int count = 0;
+ Protocol **returnValue = NULL;
+ struct objc_protocol_list* proto_list;
+
+ if (class_ == Nil)
+ {
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = 0;
+ return NULL;
+ }
+
+ /* Lock the runtime mutex because the class protocols may be
+ concurrently modified. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Count how many protocols we have. */
+ proto_list = class_->protocols;
+
+ while (proto_list)
+ {
+ count = count + proto_list->count;
+ proto_list = proto_list->next;
+ }
+
+ if (count != 0)
+ {
+ unsigned int i = 0;
+
+ /* Allocate enough memory to hold them. */
+ returnValue = (Protocol **)(malloc (sizeof (Protocol *) * (count + 1)));
+
+ /* Copy the protocols. */
+ proto_list = class_->protocols;
+
+ while (proto_list)
+ {
+ size_t j;
+ for (j = 0; j < proto_list->count; j++)
+ {
+ returnValue[i] = proto_list->list[j];
+ i++;
+ }
+ proto_list = proto_list->next;
+ }
+
+ returnValue[i] = NULL;
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = count;
+
+ return returnValue;
+}
+
+BOOL
+protocol_conformsToProtocol (Protocol *protocol, Protocol *anotherProtocol)
+{
+ struct objc_protocol_list* proto_list;
+
+ if (protocol == NULL || anotherProtocol == NULL)
+ return NO;
+
+ if (protocol == anotherProtocol)
+ return YES;
+
+ /* Check that the objects are Protocol objects before casting them
+ to (struct objc_protocol *). */
+ if (protocol->class_pointer != anotherProtocol->class_pointer)
+ return NO;
+
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NO;
+
+ if (strcmp (((struct objc_protocol *)protocol)->protocol_name,
+ ((struct objc_protocol *)anotherProtocol)->protocol_name) == 0)
+ return YES;
+
+ /* We do not acquire any lock because protocols are currently
+ immutable. We can freely iterate over a protocol structure. */
+ proto_list = ((struct objc_protocol *)protocol)->protocol_list;
+ while (proto_list)
+ {
+ size_t i;
+
+ for (i = 0; i < proto_list->count; i++)
+ {
+ if (protocol_conformsToProtocol (proto_list->list[i], anotherProtocol))
+ return YES;
+ }
+ proto_list = proto_list->next;
+ }
+
+ return NO;
+}
+
+BOOL
+protocol_isEqual (Protocol *protocol, Protocol *anotherProtocol)
+{
+ if (protocol == anotherProtocol)
+ return YES;
+
+ if (protocol == NULL || anotherProtocol == NULL)
+ return NO;
+
+ /* Check that the objects are Protocol objects before casting them
+ to (struct objc_protocol *). */
+ if (protocol->class_pointer != anotherProtocol->class_pointer)
+ return NO;
+
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NO;
+
+ /* Equality between formal protocols is only formal (nothing to do
+ with actually checking the list of methods they have!). Two
+ formal Protocols are equal if and only if they have the same
+ name.
+
+ Please note (for comparisons with other implementations) that
+ checking the names is equivalent to checking that Protocol A
+ conforms to Protocol B and Protocol B conforms to Protocol A,
+ because this happens iff they have the same name. If they have
+ different names, A conforms to B if and only if A includes B, but
+ the situation where A includes B and B includes A is a circular
+ dependency between Protocols which is forbidden by the compiler,
+ so A conforms to B and B conforms to A with A and B having
+ different names is an impossible case. */
+ if (strcmp (((struct objc_protocol *)protocol)->protocol_name,
+ ((struct objc_protocol *)anotherProtocol)->protocol_name) == 0)
+ return YES;
+
+ return NO;
+}
+
+const char *
+protocol_getName (Protocol *protocol)
+{
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NULL;
+
+ return ((struct objc_protocol *)protocol)->protocol_name;
+}
+
+struct objc_method_description protocol_getMethodDescription (Protocol *protocol,
+ SEL selector,
+ BOOL requiredMethod,
+ BOOL instanceMethod)
+{
+ struct objc_method_description no_result = { NULL, NULL };
+ struct objc_method_description_list *methods;
+ int i;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on optional protocol methods. */
+ if (! requiredMethod)
+ return no_result;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return no_result;
+
+ if (instanceMethod)
+ methods = ((struct objc_protocol *)protocol)->instance_methods;
+ else
+ methods = ((struct objc_protocol *)protocol)->class_methods;
+
+ if (methods)
+ {
+ for (i = 0; i < methods->count; i++)
+ {
+ if (sel_isEqual (methods->list[i].name, selector))
+ return methods->list[i];
+ /*
+ if (strcmp (sel_getName (methods->list[i].name), selector_name) == 0)
+ return methods->list[i];
+ */
+ }
+ }
+
+ return no_result;
+}
+
+struct objc_method_description *protocol_copyMethodDescriptionList (Protocol *protocol,
+ BOOL requiredMethod,
+ BOOL instanceMethod,
+ unsigned int *numberOfReturnedMethods)
+{
+ struct objc_method_description_list *methods;
+ unsigned int count = 0;
+ struct objc_method_description *returnValue = NULL;
+
+ /* TODO: New ABI */
+ /* The current ABI does not have any information on optional protocol methods. */
+ if (! requiredMethod)
+ {
+ if (numberOfReturnedMethods)
+ *numberOfReturnedMethods = 0;
+
+ return NULL;
+ }
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ {
+ if (numberOfReturnedMethods)
+ *numberOfReturnedMethods = 0;
+
+ return NULL;
+ }
+
+ /* We do not acquire any lock because protocols are currently
+ immutable. We can freely iterate over a protocol structure. */
+
+ if (instanceMethod)
+ methods = ((struct objc_protocol *)protocol)->instance_methods;
+ else
+ methods = ((struct objc_protocol *)protocol)->class_methods;
+
+ if (methods)
+ {
+ unsigned int i;
+ count = methods->count;
+
+ /* Allocate enough memory to hold them. */
+ returnValue = (struct objc_method_description *)(malloc (sizeof (struct objc_method_description) * (count + 1)));
+
+ /* Copy them. */
+ for (i = 0; i < count; i++)
+ {
+ returnValue[i].name = methods->list[i].name;
+ returnValue[i].types = methods->list[i].types;
+ }
+ returnValue[i].name = NULL;
+ returnValue[i].types = NULL;
+ }
+
+ if (numberOfReturnedMethods)
+ *numberOfReturnedMethods = count;
+
+ return returnValue;
+}
+
+Property protocol_getProperty (Protocol *protocol, const char *propertyName,
+ BOOL requiredProperty, BOOL instanceProperty)
+{
+ if (protocol == NULL || propertyName == NULL)
+ return NULL;
+
+ if (!requiredProperty || !instanceProperty)
+ return NULL;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ return NULL;
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on protocol properties. */
+ return NULL;
+}
+
+Property *protocol_copyPropertyList (Protocol *protocol, unsigned int *numberOfReturnedProperties)
+{
+ unsigned int count = 0;
+ Property *returnValue = NULL;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ {
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = 0;
+
+ return NULL;
+ }
+
+ /* We do not acquire any lock because protocols are currently
+ immutable. We can freely iterate over a protocol structure. */
+
+ /* TODO: New ABI. */
+ /* The current ABI does not have any information on protocol properties. */
+ if (numberOfReturnedProperties)
+ *numberOfReturnedProperties = count;
+
+ return returnValue;
+}
+
+Protocol **protocol_copyProtocolList (Protocol *protocol, unsigned int *numberOfReturnedProtocols)
+{
+ unsigned int count = 0;
+ Protocol **returnValue = NULL;
+ struct objc_protocol_list* proto_list;
+
+ /* Check that it is a Protocol object before casting it to (struct
+ objc_protocol *). */
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
+ {
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = 0;
+
+ return NULL;
+ }
+
+ /* We do not acquire any lock because protocols are currently
+ immutable. We can freely iterate over a protocol structure. */
+
+ /* Count how many protocols we have. */
+ proto_list = ((struct objc_protocol *)protocol)->protocol_list;
+
+ while (proto_list)
+ {
+ count = count + proto_list->count;
+ proto_list = proto_list->next;
+ }
+
+ if (count != 0)
+ {
+ unsigned int i = 0;
+
+ /* Allocate enough memory to hold them. */
+ returnValue = (Protocol **)(malloc (sizeof (Protocol *) * (count + 1)));
+
+ /* Copy the protocols. */
+ proto_list = ((struct objc_protocol *)protocol)->protocol_list;
+
+ while (proto_list)
+ {
+ size_t j;
+ for (j = 0; j < proto_list->count; j++)
+ {
+ returnValue[i] = proto_list->list[j];
+ i++;
+ }
+ proto_list = proto_list->next;
+ }
+
+ returnValue[i] = NULL;
+ }
+
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = count;
+
+ return returnValue;
+}
diff --git a/libobjc/sarray.c b/libobjc/sarray.c
new file mode 100644
index 000000000..ea4aa93b7
--- /dev/null
+++ b/libobjc/sarray.c
@@ -0,0 +1,523 @@
+/* Sparse Arrays for Objective C dispatch tables
+ Copyright (C) 1993, 1995, 1996, 2002, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc-private/sarray.h"
+#include "objc/runtime.h" /* For objc_malloc */
+#include "objc/thr.h" /* For objc_mutex_lock */
+#include "objc-private/runtime.h"
+#include <stdio.h>
+#include <string.h> /* For memset */
+#include <assert.h> /* For assert */
+
+int nbuckets = 0; /* !T:MUTEX */
+int nindices = 0; /* !T:MUTEX */
+int narrays = 0; /* !T:MUTEX */
+int idxsize = 0; /* !T:MUTEX */
+
+static void *first_free_data = NULL; /* !T:MUTEX */
+
+#ifdef OBJC_SPARSE2
+const char *__objc_sparse2_id = "2 level sparse indices";
+#endif
+
+#ifdef OBJC_SPARSE3
+const char *__objc_sparse3_id = "3 level sparse indices";
+#endif
+
+/* This function removes any structures left over from free operations
+ that were not safe in a multi-threaded environment. */
+void
+sarray_remove_garbage (void)
+{
+ void **vp;
+ void *np;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ vp = first_free_data;
+ first_free_data = NULL;
+
+ while (vp)
+ {
+ np = *vp;
+ objc_free (vp);
+ vp = np;
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* Free a block of dynamically allocated memory. If we are in
+ multi-threaded mode, it is ok to free it. If not, we add it to the
+ garbage heap to be freed later. */
+static void
+sarray_free_garbage (void *vp)
+{
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ if (__objc_runtime_threads_alive == 1)
+ {
+ objc_free (vp);
+ if (first_free_data)
+ sarray_remove_garbage ();
+ }
+ else
+ {
+ *(void **)vp = first_free_data;
+ first_free_data = vp;
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* sarray_at_put copies data in such a way as to be thread reader
+ safe. */
+void
+sarray_at_put (struct sarray *array, sidx index, void *element)
+{
+#ifdef OBJC_SPARSE3
+ struct sindex **the_index;
+ struct sindex *new_index;
+#endif
+ struct sbucket **the_bucket;
+ struct sbucket *new_bucket;
+#ifdef OBJC_SPARSE3
+ size_t ioffset;
+#endif
+ size_t boffset;
+ size_t eoffset;
+#ifdef PRECOMPUTE_SELECTORS
+ union sofftype xx;
+ xx.idx = index;
+#ifdef OBJC_SPARSE3
+ ioffset = xx.off.ioffset;
+#endif
+ boffset = xx.off.boffset;
+ eoffset = xx.off.eoffset;
+#else /* not PRECOMPUTE_SELECTORS */
+#ifdef OBJC_SPARSE3
+ ioffset = index/INDEX_CAPACITY;
+ boffset = (index/BUCKET_SIZE)%INDEX_SIZE;
+ eoffset = index%BUCKET_SIZE;
+#else
+ boffset = index/BUCKET_SIZE;
+ eoffset = index%BUCKET_SIZE;
+#endif
+#endif /* not PRECOMPUTE_SELECTORS */
+
+ assert (soffset_decode (index) < array->capacity); /* Range check */
+
+#ifdef OBJC_SPARSE3
+ the_index = &(array->indices[ioffset]);
+ the_bucket = &((*the_index)->buckets[boffset]);
+#else
+ the_bucket = &(array->buckets[boffset]);
+#endif
+
+ if ((*the_bucket)->elems[eoffset] == element)
+ return; /* Great! we just avoided a lazy copy. */
+
+#ifdef OBJC_SPARSE3
+
+ /* First, perform lazy copy/allocation of index if needed. */
+
+ if ((*the_index) == array->empty_index)
+ {
+ /* The index was previously empty, allocate a new. */
+ new_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
+ memcpy (new_index, array->empty_index, sizeof (struct sindex));
+ new_index->version.version = array->version.version;
+ *the_index = new_index; /* Prepared for install. */
+ the_bucket = &((*the_index)->buckets[boffset]);
+
+ nindices += 1;
+ }
+ else if ((*the_index)->version.version != array->version.version)
+ {
+ /* This index must be lazy copied. */
+ struct sindex *old_index = *the_index;
+ new_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
+ memcpy (new_index, old_index, sizeof (struct sindex));
+ new_index->version.version = array->version.version;
+ *the_index = new_index; /* Prepared for install. */
+ the_bucket = &((*the_index)->buckets[boffset]);
+
+ nindices += 1;
+ }
+
+#endif /* OBJC_SPARSE3 */
+
+ /* Next, perform lazy allocation/copy of the bucket if needed. */
+ if ((*the_bucket) == array->empty_bucket)
+ {
+ /* The bucket was previously empty (or something like that),
+ allocate a new. This is the effect of `lazy' allocation. */
+ new_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
+ memcpy ((void *) new_bucket, (const void *) array->empty_bucket,
+ sizeof (struct sbucket));
+ new_bucket->version.version = array->version.version;
+ *the_bucket = new_bucket; /* Prepared for install. */
+
+ nbuckets += 1;
+
+ }
+ else if ((*the_bucket)->version.version != array->version.version)
+ {
+ /* Perform lazy copy. */
+ struct sbucket *old_bucket = *the_bucket;
+ new_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
+ memcpy (new_bucket, old_bucket, sizeof (struct sbucket));
+ new_bucket->version.version = array->version.version;
+ *the_bucket = new_bucket; /* Prepared for install. */
+
+ nbuckets += 1;
+ }
+ (*the_bucket)->elems[eoffset] = element;
+}
+
+void
+sarray_at_put_safe (struct sarray *array, sidx index, void *element)
+{
+ if (soffset_decode (index) >= array->capacity)
+ sarray_realloc (array, soffset_decode (index) + 1);
+ sarray_at_put (array, index, element);
+}
+
+struct sarray *
+sarray_new (int size, void *default_element)
+{
+ struct sarray *arr;
+#ifdef OBJC_SPARSE3
+ size_t num_indices = ((size - 1)/(INDEX_CAPACITY)) + 1;
+ struct sindex **new_indices;
+#else /* OBJC_SPARSE2 */
+ size_t num_indices = ((size - 1)/BUCKET_SIZE) + 1;
+ struct sbucket **new_buckets;
+#endif
+ size_t counter;
+
+ assert (size > 0);
+
+ /* Allocate core array. */
+ arr = (struct sarray *) objc_malloc (sizeof (struct sarray));
+ arr->version.version = 0;
+
+ /* Initialize members. */
+#ifdef OBJC_SPARSE3
+ arr->capacity = num_indices*INDEX_CAPACITY;
+ new_indices = (struct sindex **)
+ objc_malloc (sizeof (struct sindex *) * num_indices);
+
+ arr->empty_index = (struct sindex *) objc_malloc (sizeof (struct sindex));
+ arr->empty_index->version.version = 0;
+
+ narrays += 1;
+ idxsize += num_indices;
+ nindices += 1;
+
+#else /* OBJC_SPARSE2 */
+ arr->capacity = num_indices*BUCKET_SIZE;
+ new_buckets = (struct sbucket **)
+ objc_malloc (sizeof (struct sbucket *) * num_indices);
+
+ narrays += 1;
+ idxsize += num_indices;
+
+#endif
+
+ arr->empty_bucket = (struct sbucket *) objc_malloc (sizeof (struct sbucket));
+ arr->empty_bucket->version.version = 0;
+
+ nbuckets += 1;
+
+ arr->ref_count = 1;
+ arr->is_copy_of = (struct sarray *) 0;
+
+ for (counter = 0; counter < BUCKET_SIZE; counter++)
+ arr->empty_bucket->elems[counter] = default_element;
+
+#ifdef OBJC_SPARSE3
+ for (counter = 0; counter < INDEX_SIZE; counter++)
+ arr->empty_index->buckets[counter] = arr->empty_bucket;
+
+ for (counter = 0; counter < num_indices; counter++)
+ new_indices[counter] = arr->empty_index;
+
+#else /* OBJC_SPARSE2 */
+
+ for (counter = 0; counter < num_indices; counter++)
+ new_buckets[counter] = arr->empty_bucket;
+
+#endif
+
+#ifdef OBJC_SPARSE3
+ arr->indices = new_indices;
+#else /* OBJC_SPARSE2 */
+ arr->buckets = new_buckets;
+#endif
+
+ return arr;
+}
+
+
+/* Reallocate the sparse array to hold `newsize' entries Note: We
+ really allocate and then free. We have to do this to ensure that
+ any concurrent readers notice the update. */
+void
+sarray_realloc (struct sarray *array, int newsize)
+{
+#ifdef OBJC_SPARSE3
+ size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
+ size_t new_max_index = ((newsize - 1)/INDEX_CAPACITY);
+ size_t rounded_size = (new_max_index + 1) * INDEX_CAPACITY;
+
+ struct sindex **new_indices;
+ struct sindex **old_indices;
+
+#else /* OBJC_SPARSE2 */
+ size_t old_max_index = (array->capacity - 1)/BUCKET_SIZE;
+ size_t new_max_index = ((newsize - 1)/BUCKET_SIZE);
+ size_t rounded_size = (new_max_index + 1) * BUCKET_SIZE;
+
+ struct sbucket **new_buckets;
+ struct sbucket **old_buckets;
+
+#endif
+
+ size_t counter;
+
+ assert (newsize > 0);
+
+ /* The size is the same, just ignore the request. */
+ if (rounded_size <= array->capacity)
+ return;
+
+ assert (array->ref_count == 1); /* stop if lazy copied... */
+
+ /* We are asked to extend the array -- allocate new bucket table,
+ and insert empty_bucket in newly allocated places. */
+ if (rounded_size > array->capacity)
+ {
+#ifdef OBJC_SPARSE3
+ new_max_index += 4;
+ rounded_size = (new_max_index + 1) * INDEX_CAPACITY;
+#else /* OBJC_SPARSE2 */
+ new_max_index += 4;
+ rounded_size = (new_max_index + 1) * BUCKET_SIZE;
+#endif
+
+ /* Update capacity. */
+ array->capacity = rounded_size;
+
+#ifdef OBJC_SPARSE3
+ /* Alloc to force re-read by any concurrent readers. */
+ old_indices = array->indices;
+ new_indices = (struct sindex **)
+ objc_malloc ((new_max_index + 1) * sizeof (struct sindex *));
+#else /* OBJC_SPARSE2 */
+ old_buckets = array->buckets;
+ new_buckets = (struct sbucket **)
+ objc_malloc ((new_max_index + 1) * sizeof (struct sbucket *));
+#endif
+
+ /* Copy buckets below old_max_index (they are still valid). */
+ for (counter = 0; counter <= old_max_index; counter++ )
+ {
+#ifdef OBJC_SPARSE3
+ new_indices[counter] = old_indices[counter];
+#else /* OBJC_SPARSE2 */
+ new_buckets[counter] = old_buckets[counter];
+#endif
+ }
+
+#ifdef OBJC_SPARSE3
+ /* Reset entries above old_max_index to empty_bucket. */
+ for (counter = old_max_index + 1; counter <= new_max_index; counter++)
+ new_indices[counter] = array->empty_index;
+#else /* OBJC_SPARSE2 */
+ /* Reset entries above old_max_index to empty_bucket. */
+ for (counter = old_max_index + 1; counter <= new_max_index; counter++)
+ new_buckets[counter] = array->empty_bucket;
+#endif
+
+#ifdef OBJC_SPARSE3
+ /* Install the new indices. */
+ array->indices = new_indices;
+#else /* OBJC_SPARSE2 */
+ array->buckets = new_buckets;
+#endif
+
+#ifdef OBJC_SPARSE3
+ /* Free the old indices. */
+ sarray_free_garbage (old_indices);
+#else /* OBJC_SPARSE2 */
+ sarray_free_garbage (old_buckets);
+#endif
+
+ idxsize += (new_max_index-old_max_index);
+ return;
+ }
+}
+
+
+/* Free a sparse array allocated with sarray_new */
+void
+sarray_free (struct sarray *array) {
+#ifdef OBJC_SPARSE3
+ size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
+ struct sindex **old_indices;
+#else
+ size_t old_max_index = (array->capacity - 1)/BUCKET_SIZE;
+ struct sbucket **old_buckets;
+#endif
+ size_t counter = 0;
+
+ assert (array->ref_count != 0); /* Freed multiple times!!! */
+
+ if (--(array->ref_count) != 0) /* There exists copies of me */
+ return;
+
+#ifdef OBJC_SPARSE3
+ old_indices = array->indices;
+#else
+ old_buckets = array->buckets;
+#endif
+
+ /* Free all entries that do not point to empty_bucket. */
+ for (counter = 0; counter <= old_max_index; counter++ )
+ {
+#ifdef OBJC_SPARSE3
+ struct sindex *idx = old_indices[counter];
+ if ((idx != array->empty_index)
+ && (idx->version.version == array->version.version))
+ {
+ int c2;
+ for (c2 = 0; c2 < INDEX_SIZE; c2++)
+ {
+ struct sbucket *bkt = idx->buckets[c2];
+ if ((bkt != array->empty_bucket)
+ && (bkt->version.version == array->version.version))
+ {
+ sarray_free_garbage (bkt);
+ nbuckets -= 1;
+ }
+ }
+ sarray_free_garbage (idx);
+ nindices -= 1;
+ }
+#else /* OBJC_SPARSE2 */
+ struct sbucket *bkt = old_buckets[counter];
+ if ((bkt != array->empty_bucket)
+ && (bkt->version.version == array->version.version))
+ {
+ sarray_free_garbage (bkt);
+ nbuckets -= 1;
+ }
+#endif
+ }
+
+#ifdef OBJC_SPARSE3
+ /* Free empty_index. */
+ if (array->empty_index->version.version == array->version.version)
+ {
+ sarray_free_garbage (array->empty_index);
+ nindices -= 1;
+ }
+#endif
+
+ /* Free empty_bucket. */
+ if (array->empty_bucket->version.version == array->version.version)
+ {
+ sarray_free_garbage (array->empty_bucket);
+ nbuckets -= 1;
+ }
+ idxsize -= (old_max_index + 1);
+ narrays -= 1;
+
+#ifdef OBJC_SPARSE3
+ /* Free bucket table. */
+ sarray_free_garbage (array->indices);
+#else
+ /* Free bucket table. */
+ sarray_free_garbage (array->buckets);
+#endif
+
+ /* If this is a copy of another array, we free it (which might just
+ decrement its reference count so it will be freed when no longer
+ in use). */
+ if (array->is_copy_of)
+ sarray_free (array->is_copy_of);
+
+ /* Free array. */
+ sarray_free_garbage (array);
+}
+
+/* This is a lazy copy. Only the core of the structure is actually
+ copied. */
+struct sarray *
+sarray_lazy_copy (struct sarray *oarr)
+{
+ struct sarray *arr;
+
+#ifdef OBJC_SPARSE3
+ size_t num_indices = ((oarr->capacity - 1)/INDEX_CAPACITY) + 1;
+ struct sindex **new_indices;
+#else /* OBJC_SPARSE2 */
+ size_t num_indices = ((oarr->capacity - 1)/BUCKET_SIZE) + 1;
+ struct sbucket **new_buckets;
+#endif
+
+ /* Allocate core array. */
+ arr = (struct sarray *) objc_malloc (sizeof (struct sarray)); /* !!! */
+ arr->version.version = oarr->version.version + 1;
+#ifdef OBJC_SPARSE3
+ arr->empty_index = oarr->empty_index;
+#endif
+ arr->empty_bucket = oarr->empty_bucket;
+ arr->ref_count = 1;
+ oarr->ref_count += 1;
+ arr->is_copy_of = oarr;
+ arr->capacity = oarr->capacity;
+
+#ifdef OBJC_SPARSE3
+ /* Copy bucket table. */
+ new_indices = (struct sindex **)
+ objc_malloc (sizeof (struct sindex *) * num_indices);
+ memcpy (new_indices, oarr->indices, sizeof (struct sindex *) * num_indices);
+ arr->indices = new_indices;
+#else
+ /* Copy bucket table. */
+ new_buckets = (struct sbucket **)
+ objc_malloc (sizeof (struct sbucket *) * num_indices);
+ memcpy (new_buckets, oarr->buckets, sizeof (struct sbucket *) * num_indices);
+ arr->buckets = new_buckets;
+#endif
+
+ idxsize += num_indices;
+ narrays += 1;
+
+ return arr;
+}
diff --git a/libobjc/selector.c b/libobjc/selector.c
new file mode 100644
index 000000000..628b4f6f4
--- /dev/null
+++ b/libobjc/selector.c
@@ -0,0 +1,753 @@
+/* GNU Objective C Runtime selector related functions
+ Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004, 2009, 2010
+ Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc/runtime.h"
+#include "objc/thr.h"
+#include "objc-private/hash.h"
+#include "objc-private/objc-list.h"
+#include "objc-private/module-abi-8.h"
+#include "objc-private/runtime.h"
+#include "objc-private/sarray.h"
+#include "objc-private/selector.h"
+#include <stdlib.h> /* For malloc. */
+
+/* Initial selector hash table size. Value doesn't matter much. */
+#define SELECTOR_HASH_SIZE 128
+
+/* Tables mapping selector names to uid and opposite. */
+static struct sarray *__objc_selector_array = 0; /* uid -> sel !T:MUTEX */
+static struct sarray *__objc_selector_names = 0; /* uid -> name !T:MUTEX */
+static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */
+
+/* Number of selectors stored in each of the above tables. */
+unsigned int __objc_selector_max_index = 0; /* !T:MUTEX */
+
+/* Forward-declare an internal function. */
+static SEL
+__sel_register_typed_name (const char *name, const char *types,
+ struct objc_selector *orig, BOOL is_const);
+
+void __objc_init_selector_tables (void)
+{
+ __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
+ __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
+ __objc_selector_hash
+ = objc_hash_new (SELECTOR_HASH_SIZE,
+ (hash_func_type) objc_hash_string,
+ (compare_func_type) objc_compare_strings);
+}
+
+/* Register a bunch of selectors from the table of selectors in a
+ module. 'selectors' should not be NULL. The list is terminated by
+ a selectors with a NULL sel_id. The selectors are assumed to
+ contain the 'name' in the sel_id field; this is replaced with the
+ final selector id after they are registered. */
+void
+__objc_register_selectors_from_module (struct objc_selector *selectors)
+{
+ int i;
+
+ for (i = 0; selectors[i].sel_id; ++i)
+ {
+ const char *name, *type;
+ name = (char *) selectors[i].sel_id;
+ type = (char *) selectors[i].sel_types;
+ /* Constructors are constant static data and we can safely store
+ pointers to them in the runtime structures, so we set
+ is_const == YES. */
+ __sel_register_typed_name (name, type, (struct objc_selector *) &(selectors[i]),
+ /* is_const */ YES);
+ }
+}
+
+/* This routine is given a class and records all of the methods in its
+ class structure in the record table. */
+void
+__objc_register_selectors_from_class (Class class)
+{
+ struct objc_method_list * method_list;
+
+ method_list = class->methods;
+ while (method_list)
+ {
+ __objc_register_selectors_from_list (method_list);
+ method_list = method_list->method_next;
+ }
+}
+
+
+/* This routine is given a list of methods and records each of the
+ methods in the record table. This is the routine that does the
+ actual recording work.
+
+ The name and type pointers in the method list must be permanent and
+ immutable. */
+void
+__objc_register_selectors_from_list (struct objc_method_list *method_list)
+{
+ int i = 0;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ while (i < method_list->method_count)
+ {
+ Method method = &method_list->method_list[i];
+ if (method->method_name)
+ {
+ method->method_name
+ = __sel_register_typed_name ((const char *) method->method_name,
+ method->method_types, 0, YES);
+ }
+ i += 1;
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* The same as __objc_register_selectors_from_list, but works on a
+ struct objc_method_description_list* instead of a struct
+ objc_method_list*. This is only used for protocols, which have
+ lists of method descriptions, not methods. */
+void
+__objc_register_selectors_from_description_list
+(struct objc_method_description_list *method_list)
+{
+ int i = 0;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ while (i < method_list->count)
+ {
+ struct objc_method_description *method = &method_list->list[i];
+ if (method->name)
+ {
+ method->name
+ = __sel_register_typed_name ((const char *) method->name,
+ method->types, 0, YES);
+ }
+ i += 1;
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* Register instance methods as class methods for root classes. */
+void __objc_register_instance_methods_to_class (Class class)
+{
+ struct objc_method_list *method_list;
+ struct objc_method_list *class_method_list;
+ int max_methods_no = 16;
+ struct objc_method_list *new_list;
+ Method curr_method;
+
+ /* Only if a root class. */
+ if (class->super_class)
+ return;
+
+ /* Allocate a method list to hold the new class methods. */
+ new_list = objc_calloc (sizeof (struct objc_method_list)
+ + sizeof (struct objc_method[max_methods_no]), 1);
+ method_list = class->methods;
+ class_method_list = class->class_pointer->methods;
+ curr_method = &new_list->method_list[0];
+
+ /* Iterate through the method lists for the class. */
+ while (method_list)
+ {
+ int i;
+
+ /* Iterate through the methods from this method list. */
+ for (i = 0; i < method_list->method_count; i++)
+ {
+ Method mth = &method_list->method_list[i];
+ if (mth->method_name
+ && ! search_for_method_in_list (class_method_list,
+ mth->method_name))
+ {
+ /* This instance method isn't a class method. Add it
+ into the new_list. */
+ *curr_method = *mth;
+
+ /* Reallocate the method list if necessary. */
+ if (++new_list->method_count == max_methods_no)
+ new_list =
+ objc_realloc (new_list, sizeof (struct objc_method_list)
+ + sizeof (struct
+ objc_method[max_methods_no += 16]));
+ curr_method = &new_list->method_list[new_list->method_count];
+ }
+ }
+
+ method_list = method_list->method_next;
+ }
+
+ /* If we created any new class methods then attach the method list
+ to the class. */
+ if (new_list->method_count)
+ {
+ new_list =
+ objc_realloc (new_list, sizeof (struct objc_method_list)
+ + sizeof (struct objc_method[new_list->method_count]));
+ new_list->method_next = class->class_pointer->methods;
+ class->class_pointer->methods = new_list;
+ }
+ else
+ objc_free(new_list);
+
+ __objc_update_dispatch_table_for_class (class->class_pointer);
+}
+
+BOOL
+sel_isEqual (SEL s1, SEL s2)
+{
+ if (s1 == 0 || s2 == 0)
+ return s1 == s2;
+ else
+ return s1->sel_id == s2->sel_id;
+}
+
+/* Return YES iff t1 and t2 have same method types. Ignore the
+ argframe layout. */
+BOOL
+sel_types_match (const char *t1, const char *t2)
+{
+ if (! t1 || ! t2)
+ return NO;
+ while (*t1 && *t2)
+ {
+ if (*t1 == '+') t1++;
+ if (*t2 == '+') t2++;
+ while (isdigit ((unsigned char) *t1)) t1++;
+ while (isdigit ((unsigned char) *t2)) t2++;
+ /* xxx Remove these next two lines when qualifiers are put in
+ all selectors, not just Protocol selectors. */
+ t1 = objc_skip_type_qualifiers (t1);
+ t2 = objc_skip_type_qualifiers (t2);
+ if (! *t1 && ! *t2)
+ return YES;
+ if (*t1 != *t2)
+ return NO;
+ t1++;
+ t2++;
+ }
+ return NO;
+}
+
+/* Return selector representing name. In the Modern API, you'd
+ normally use sel_registerTypedName() for this, which does the same
+ but would register the selector with the runtime if not registered
+ yet (if you only want to check for selectors without registering,
+ use sel_copyTypedSelectorList()). */
+SEL
+sel_get_typed_uid (const char *name, const char *types)
+{
+ struct objc_list *l;
+ sidx i;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (i == 0)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return 0;
+ }
+
+ for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+ l; l = l->tail)
+ {
+ SEL s = (SEL) l->head;
+ if (types == 0 || s->sel_types == 0)
+ {
+ if (s->sel_types == types)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return s;
+ }
+ }
+ else if (sel_types_match (s->sel_types, types))
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return s;
+ }
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return 0;
+}
+
+/* Return selector representing name; prefer a selector with non-NULL
+ type. In the Modern API, sel_getTypedSelector() is similar but
+ returns NULL if a typed selector couldn't be found. */
+SEL
+sel_get_any_typed_uid (const char *name)
+{
+ struct objc_list *l;
+ sidx i;
+ SEL s = NULL;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (i == 0)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return 0;
+ }
+
+ for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+ l; l = l->tail)
+ {
+ s = (SEL) l->head;
+ if (s->sel_types)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return s;
+ }
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return s;
+}
+
+/* Return selector representing name. */
+SEL
+sel_get_any_uid (const char *name)
+{
+ struct objc_list *l;
+ sidx i;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (soffset_decode (i) == 0)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return 0;
+ }
+
+ l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ if (l == 0)
+ return 0;
+
+ return (SEL) l->head;
+}
+
+SEL
+sel_getTypedSelector (const char *name)
+{
+ sidx i;
+
+ if (name == NULL)
+ return NULL;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Look for a typed selector. */
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (i != 0)
+ {
+ struct objc_list *l;
+ SEL returnValue = NULL;
+
+ for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+ l; l = l->tail)
+ {
+ SEL s = (SEL) l->head;
+ if (s->sel_types)
+ {
+ if (returnValue == NULL)
+ {
+ /* First typed selector that we find. Keep it in
+ returnValue, but keep checking as we want to
+ detect conflicts. */
+ returnValue = s;
+ }
+ else
+ {
+ /* We had already found a typed selectors, so we
+ have multiple ones. Double-check that they have
+ different types, just in case for some reason we
+ got duplicates with the same types. If so, it's
+ OK, we'll ignore the duplicate. */
+ if (returnValue->sel_types == s->sel_types)
+ continue;
+ else if (sel_types_match (returnValue->sel_types, s->sel_types))
+ continue;
+ else
+ {
+ /* The types of the two selectors are different;
+ it's a conflict. Too bad. Return NULL. */
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return NULL;
+ }
+ }
+ }
+ }
+
+ if (returnValue != NULL)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return returnValue;
+ }
+ }
+
+ /* No typed selector found. Return NULL. */
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return 0;
+}
+
+SEL *
+sel_copyTypedSelectorList (const char *name, unsigned int *numberOfReturnedSelectors)
+{
+ unsigned int count = 0;
+ SEL *returnValue = NULL;
+ sidx i;
+
+ if (name == NULL)
+ {
+ if (numberOfReturnedSelectors)
+ *numberOfReturnedSelectors = 0;
+ return NULL;
+ }
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Count how many selectors we have. */
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (i != 0)
+ {
+ struct objc_list *selector_list = NULL;
+ selector_list = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
+
+ /* Count how many selectors we have. */
+ {
+ struct objc_list *l;
+ for (l = selector_list; l; l = l->tail)
+ count++;
+ }
+
+ if (count != 0)
+ {
+ /* Allocate enough memory to hold them. */
+ returnValue = (SEL *)(malloc (sizeof (SEL) * (count + 1)));
+
+ /* Copy the selectors. */
+ {
+ unsigned int j;
+ for (j = 0; j < count; j++)
+ {
+ returnValue[j] = (SEL)(selector_list->head);
+ selector_list = selector_list->tail;
+ }
+ returnValue[j] = NULL;
+ }
+ }
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ if (numberOfReturnedSelectors)
+ *numberOfReturnedSelectors = count;
+
+ return returnValue;
+}
+
+/* Get the name of a selector. If the selector is unknown, the empty
+ string "" is returned. */
+const char *sel_getName (SEL selector)
+{
+ const char *ret;
+
+ if (selector == NULL)
+ return "<null selector>";
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ if ((soffset_decode ((sidx)selector->sel_id) > 0)
+ && (soffset_decode ((sidx)selector->sel_id) <= __objc_selector_max_index))
+ ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id);
+ else
+ ret = 0;
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return ret;
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+const char *sel_get_name (SEL selector)
+{
+ if (selector == NULL)
+ return 0;
+
+ return sel_getName (selector);
+}
+
+BOOL
+sel_is_mapped (SEL selector)
+{
+ unsigned int idx = soffset_decode ((sidx)selector->sel_id);
+ return ((idx > 0) && (idx <= __objc_selector_max_index));
+}
+
+const char *sel_getTypeEncoding (SEL selector)
+{
+ if (selector)
+ return selector->sel_types;
+ else
+ return 0;
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+const char *sel_get_type (SEL selector)
+{
+ return sel_getTypeEncoding (selector);
+}
+
+/* The uninstalled dispatch table. */
+extern struct sarray *__objc_uninstalled_dtable;
+
+/* __sel_register_typed_name allocates lots of struct objc_selector:s
+ of 8 (16, if pointers are 64 bits) bytes at startup. To reduce the
+ number of malloc calls and memory lost to malloc overhead, we
+ allocate objc_selector:s in blocks here. This is only called from
+ __sel_register_typed_name, and __sel_register_typed_name may only
+ be called when __objc_runtime_mutex is locked.
+
+ Note that the objc_selector:s allocated from
+ __sel_register_typed_name are never freed.
+
+ 62 because 62 * sizeof (struct objc_selector) = 496 (992). This
+ should let malloc add some overhead and use a nice, round 512
+ (1024) byte chunk. */
+#define SELECTOR_POOL_SIZE 62
+static struct objc_selector *selector_pool;
+static int selector_pool_left;
+
+static struct objc_selector *
+pool_alloc_selector(void)
+{
+ if (!selector_pool_left)
+ {
+ selector_pool = objc_malloc (sizeof (struct objc_selector)
+ * SELECTOR_POOL_SIZE);
+ selector_pool_left = SELECTOR_POOL_SIZE;
+ }
+ return &selector_pool[--selector_pool_left];
+}
+
+/* Store the passed selector name in the selector record and return
+ its selector value (value returned by sel_get_uid). Assume that
+ the calling function has locked down __objc_runtime_mutex. The
+ 'is_const' parameter tells us if the name and types parameters are
+ really constant or not. If YES then they are constant and we can
+ just store the pointers. If NO then we need to copy name and types
+ because the pointers may disappear later on. If the 'orig'
+ parameter is not NULL, then we are registering a selector from a
+ module, and 'orig' is that selector. In this case, we can put the
+ selector in the tables if needed, and orig->sel_id is updated with
+ the selector ID of the registered selector, and 'orig' is
+ returned. */
+static SEL
+__sel_register_typed_name (const char *name, const char *types,
+ struct objc_selector *orig, BOOL is_const)
+{
+ struct objc_selector *j;
+ sidx i;
+ struct objc_list *l;
+
+ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
+ if (soffset_decode (i) != 0)
+ {
+ /* There are already selectors with that name. Examine them to
+ see if the one we're registering already exists. */
+ for (l = (struct objc_list *)sarray_get_safe (__objc_selector_array, i);
+ l; l = l->tail)
+ {
+ SEL s = (SEL)l->head;
+ if (types == 0 || s->sel_types == 0)
+ {
+ if (s->sel_types == types)
+ {
+ if (orig)
+ {
+ orig->sel_id = (void *)i;
+ return orig;
+ }
+ else
+ return s;
+ }
+ }
+ else if (sel_types_match (s->sel_types, types))
+ {
+ if (orig)
+ {
+ orig->sel_id = (void *)i;
+ return orig;
+ }
+ else
+ return s;
+ }
+ }
+ /* A selector with this specific name/type combination does not
+ exist yet. We need to register it. */
+ if (orig)
+ j = orig;
+ else
+ j = pool_alloc_selector ();
+
+ j->sel_id = (void *)i;
+ /* Can we use the pointer or must we copy types ? Don't copy if
+ NULL. */
+ if ((is_const) || (types == 0))
+ j->sel_types = types;
+ else
+ {
+ j->sel_types = (char *)objc_malloc (strlen (types) + 1);
+ strcpy ((char *)j->sel_types, types);
+ }
+ l = (struct objc_list *)sarray_get_safe (__objc_selector_array, i);
+ }
+ else
+ {
+ /* There are no other selectors with this name registered in the
+ runtime tables. */
+ const char *new_name;
+
+ /* Determine i. */
+ __objc_selector_max_index += 1;
+ i = soffset_encode (__objc_selector_max_index);
+
+ /* Prepare the selector. */
+ if (orig)
+ j = orig;
+ else
+ j = pool_alloc_selector ();
+
+ j->sel_id = (void *)i;
+ /* Can we use the pointer or must we copy types ? Don't copy if
+ NULL. */
+ if (is_const || (types == 0))
+ j->sel_types = types;
+ else
+ {
+ j->sel_types = (char *)objc_malloc (strlen (types) + 1);
+ strcpy ((char *)j->sel_types, types);
+ }
+
+ /* Since this is the first selector with this name, we need to
+ register the correspondence between 'i' (the sel_id) and
+ 'name' (the actual string) in __objc_selector_names and
+ __objc_selector_hash. */
+
+ /* Can we use the pointer or must we copy name ? Don't copy if
+ NULL. (FIXME: Can the name really be NULL here ?) */
+ if (is_const || (name == 0))
+ new_name = name;
+ else
+ {
+ new_name = (char *)objc_malloc (strlen (name) + 1);
+ strcpy ((char *)new_name, name);
+ }
+
+ /* This maps the sel_id to the name. */
+ sarray_at_put_safe (__objc_selector_names, i, (void *)new_name);
+
+ /* This maps the name to the sel_id. */
+ objc_hash_add (&__objc_selector_hash, (void *)new_name, (void *)i);
+
+ l = 0;
+ }
+
+ DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types,
+ (long)soffset_decode (i));
+
+ /* Now add the selector to the list of selectors with that id. */
+ l = list_cons ((void *)j, l);
+ sarray_at_put_safe (__objc_selector_array, i, (void *)l);
+
+ sarray_realloc (__objc_uninstalled_dtable, __objc_selector_max_index + 1);
+
+ return (SEL)j;
+}
+
+SEL
+sel_registerName (const char *name)
+{
+ SEL ret;
+
+ if (name == NULL)
+ return NULL;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ /* Assume that name is not constant static memory and needs to be
+ copied before put into a runtime structure. is_const == NO. */
+ ret = __sel_register_typed_name (name, 0, 0, NO);
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return ret;
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+SEL
+sel_register_name (const char *name)
+{
+ return sel_registerName (name);
+}
+
+SEL
+sel_registerTypedName (const char *name, const char *type)
+{
+ SEL ret;
+
+ if (name == NULL)
+ return NULL;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ /* Assume that name and type are not constant static memory and need
+ to be copied before put into a runtime structure. is_const ==
+ NO. */
+ ret = __sel_register_typed_name (name, type, 0, NO);
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return ret;
+}
+
+SEL
+sel_register_typed_name (const char *name, const char *type)
+{
+ return sel_registerTypedName (name, type);
+}
+
+/* Return the selector representing name. */
+SEL
+sel_getUid (const char *name)
+{
+ return sel_registerTypedName (name, 0);
+}
+
+/* Traditional GNU Objective-C Runtime API. */
+SEL
+sel_get_uid (const char *name)
+{
+ return sel_getUid (name);
+}
diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c
new file mode 100644
index 000000000..0cb375db3
--- /dev/null
+++ b/libobjc/sendmsg.c
@@ -0,0 +1,1076 @@
+/* GNU Objective C Runtime message lookup
+ Copyright (C) 1993, 1995, 1996, 1997, 1998,
+ 2001, 2002, 2004, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Kresten Krab Thorup
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Uncommented the following line to enable debug logging. Use this
+ only while debugging the runtime. */
+/* #define DEBUG 1 */
+
+/* FIXME: This file has no business including tm.h. */
+/* FIXME: This should be using libffi instead of __builtin_apply
+ and friends. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "objc/runtime.h"
+#include "objc/message.h" /* For objc_msg_lookup(), objc_msg_lookup_super(). */
+#include "objc/thr.h"
+#include "objc-private/module-abi-8.h"
+#include "objc-private/runtime.h"
+#include "objc-private/sarray.h"
+#include "objc-private/selector.h" /* For sel_is_mapped() */
+#include "runtime-info.h"
+#include <assert.h> /* For assert */
+#include <string.h> /* For strlen */
+
+/* This is how we hack STRUCT_VALUE to be 1 or 0. */
+#define gen_rtx(args...) 1
+#define gen_rtx_MEM(args...) 1
+#define gen_rtx_REG(args...) 1
+/* Already defined in gcc/coretypes.h. So prevent double definition warning. */
+#undef rtx
+#define rtx int
+
+#if ! defined (STRUCT_VALUE) || STRUCT_VALUE == 0
+#define INVISIBLE_STRUCT_RETURN 1
+#else
+#define INVISIBLE_STRUCT_RETURN 0
+#endif
+
+/* The uninstalled dispatch table. */
+struct sarray *__objc_uninstalled_dtable = 0; /* !T:MUTEX */
+
+/* Two hooks for method forwarding. If either is set, it is invoked to
+ * return a function that performs the real forwarding. If both are
+ * set, the result of __objc_msg_forward2 will be preferred over that
+ * of __objc_msg_forward. If both return NULL or are unset, the
+ * libgcc based functions (__builtin_apply and friends) are used. */
+IMP (*__objc_msg_forward) (SEL) = NULL;
+IMP (*__objc_msg_forward2) (id, SEL) = NULL;
+
+/* Send +initialize to class. */
+static void __objc_send_initialize (Class);
+
+static void __objc_install_dispatch_table_for_class (Class);
+
+/* Forward declare some functions. */
+static void __objc_init_install_dtable (id, SEL);
+
+/* Various forwarding functions that are used based upon the
+ return type for the selector.
+ __objc_block_forward for structures.
+ __objc_double_forward for floats/doubles.
+ __objc_word_forward for pointers or types that fit in registers. */
+static double __objc_double_forward (id, SEL, ...);
+static id __objc_word_forward (id, SEL, ...);
+typedef struct { id many[8]; } __big;
+#if INVISIBLE_STRUCT_RETURN
+static __big
+#else
+static id
+#endif
+__objc_block_forward (id, SEL, ...);
+static struct objc_method * search_for_method_in_hierarchy (Class class, SEL sel);
+struct objc_method * search_for_method_in_list (struct objc_method_list * list, SEL op);
+id nil_method (id, SEL);
+
+/* Given a selector, return the proper forwarding implementation. */
+inline
+IMP
+__objc_get_forward_imp (id rcv, SEL sel)
+{
+ /* If a custom forwarding hook was registered, try getting a
+ forwarding function from it. There are two forward routine hooks,
+ one that takes the receiver as an argument and one that does
+ not. */
+ if (__objc_msg_forward2)
+ {
+ IMP result;
+ if ((result = __objc_msg_forward2 (rcv, sel)) != NULL)
+ return result;
+ }
+ if (__objc_msg_forward)
+ {
+ IMP result;
+ if ((result = __objc_msg_forward (sel)) != NULL)
+ return result;
+ }
+
+ /* In all other cases, use the default forwarding functions built
+ using __builtin_apply and friends. */
+ {
+ const char *t = sel->sel_types;
+
+ if (t && (*t == '[' || *t == '(' || *t == '{')
+#ifdef OBJC_MAX_STRUCT_BY_VALUE
+ && objc_sizeof_type (t) > OBJC_MAX_STRUCT_BY_VALUE
+#endif
+ )
+ return (IMP)__objc_block_forward;
+ else if (t && (*t == 'f' || *t == 'd'))
+ return (IMP)__objc_double_forward;
+ else
+ return (IMP)__objc_word_forward;
+ }
+}
+
+/* Selectors for +resolveClassMethod: and +resolveInstanceMethod:.
+ These are set up at startup. */
+static SEL selector_resolveClassMethod = NULL;
+static SEL selector_resolveInstanceMethod = NULL;
+
+/* Internal routines use to resolve a class method using
+ +resolveClassMethod:. 'class' is always a non-Nil class (*not* a
+ meta-class), and 'sel' is the selector that we are trying to
+ resolve. This must be called when class is not Nil, and the
+ dispatch table for class methods has already been installed.
+
+ This routine tries to call +resolveClassMethod: to give an
+ opportunity to resolve the method. If +resolveClassMethod: returns
+ YES, it tries looking up the method again, and if found, it returns
+ it. Else, it returns NULL. */
+static inline
+IMP
+__objc_resolve_class_method (Class class, SEL sel)
+{
+ /* We need to lookup +resolveClassMethod:. */
+ BOOL (*resolveMethodIMP) (id, SEL, SEL);
+
+ /* The dispatch table for class methods is already installed and we
+ don't want any forwarding to happen when looking up this method,
+ so we just look it up directly. Note that if 'sel' is precisely
+ +resolveClassMethod:, this would look it up yet again and find
+ nothing. That's no problem and there's no recursion. */
+ resolveMethodIMP = (BOOL (*) (id, SEL, SEL))sarray_get_safe
+ (class->class_pointer->dtable, (size_t) selector_resolveClassMethod->sel_id);
+
+ if (resolveMethodIMP && resolveMethodIMP ((id)class, selector_resolveClassMethod, sel))
+ {
+ /* +resolveClassMethod: returned YES. Look the method up again.
+ We already know the dtable is installed. */
+
+ /* TODO: There is the case where +resolveClassMethod: is buggy
+ and returned YES without actually adding the method. We
+ could maybe print an error message. */
+ return sarray_get_safe (class->class_pointer->dtable, (size_t) sel->sel_id);
+ }
+
+ return NULL;
+}
+
+/* Internal routines use to resolve a instance method using
+ +resolveInstanceMethod:. 'class' is always a non-Nil class, and
+ 'sel' is the selector that we are trying to resolve. This must be
+ called when class is not Nil, and the dispatch table for instance
+ methods has already been installed.
+
+ This routine tries to call +resolveInstanceMethod: to give an
+ opportunity to resolve the method. If +resolveInstanceMethod:
+ returns YES, it tries looking up the method again, and if found, it
+ returns it. Else, it returns NULL. */
+static inline
+IMP
+__objc_resolve_instance_method (Class class, SEL sel)
+{
+ /* We need to lookup +resolveInstanceMethod:. */
+ BOOL (*resolveMethodIMP) (id, SEL, SEL);
+
+ /* The dispatch table for class methods may not be already installed
+ so we have to install it if needed. */
+ resolveMethodIMP = sarray_get_safe (class->class_pointer->dtable,
+ (size_t) selector_resolveInstanceMethod->sel_id);
+ if (resolveMethodIMP == 0)
+ {
+ /* Try again after installing the dtable. */
+ if (class->class_pointer->dtable == __objc_uninstalled_dtable)
+ {
+ objc_mutex_lock (__objc_runtime_mutex);
+ if (class->class_pointer->dtable == __objc_uninstalled_dtable)
+ __objc_install_dispatch_table_for_class (class->class_pointer);
+ objc_mutex_unlock (__objc_runtime_mutex);
+ }
+ resolveMethodIMP = sarray_get_safe (class->class_pointer->dtable,
+ (size_t) selector_resolveInstanceMethod->sel_id);
+ }
+
+ if (resolveMethodIMP && resolveMethodIMP ((id)class, selector_resolveInstanceMethod, sel))
+ {
+ /* +resolveInstanceMethod: returned YES. Look the method up
+ again. We already know the dtable is installed. */
+
+ /* TODO: There is the case where +resolveInstanceMethod: is
+ buggy and returned YES without actually adding the method.
+ We could maybe print an error message. */
+ return sarray_get_safe (class->dtable, (size_t) sel->sel_id);
+ }
+
+ return NULL;
+}
+
+/* Given a class and selector, return the selector's
+ implementation. */
+inline
+IMP
+get_imp (Class class, SEL sel)
+{
+ /* In a vanilla implementation we would first check if the dispatch
+ table is installed. Here instead, to get more speed in the
+ standard case (that the dispatch table is installed) we first try
+ to get the imp using brute force. Only if that fails, we do what
+ we should have been doing from the very beginning, that is, check
+ if the dispatch table needs to be installed, install it if it's
+ not installed, and retrieve the imp from the table if it's
+ installed. */
+ void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
+ if (res == 0)
+ {
+ /* Not a valid method. */
+ if (class->dtable == __objc_uninstalled_dtable)
+ {
+ /* The dispatch table needs to be installed. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Double-checked locking pattern: Check
+ __objc_uninstalled_dtable again in case another thread
+ installed the dtable while we were waiting for the lock
+ to be released. */
+ if (class->dtable == __objc_uninstalled_dtable)
+ {
+ __objc_install_dispatch_table_for_class (class);
+ }
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+ /* Call ourselves with the installed dispatch table and get
+ the real method. */
+ res = get_imp (class, sel);
+ }
+ else
+ {
+ /* The dispatch table has been installed. */
+
+ /* Get the method from the dispatch table (we try to get it
+ again in case another thread has installed the dtable just
+ after we invoked sarray_get_safe, but before we checked
+ class->dtable == __objc_uninstalled_dtable). */
+ res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
+ if (res == 0)
+ {
+ /* The dispatch table has been installed, and the method
+ is not in the dispatch table. So the method just
+ doesn't exist for the class. */
+
+ /* Try going through the +resolveClassMethod: or
+ +resolveInstanceMethod: process. */
+ if (CLS_ISMETA (class))
+ {
+ /* We have the meta class, but we need to invoke the
+ +resolveClassMethod: method on the class. So, we
+ need to obtain the class from the meta class,
+ which we do using the fact that both the class
+ and the meta-class have the same name. */
+ Class realClass = objc_lookUpClass (class->name);
+ if (realClass)
+ res = __objc_resolve_class_method (realClass, sel);
+ }
+ else
+ res = __objc_resolve_instance_method (class, sel);
+
+ if (res == 0)
+ {
+ /* If that fails, then return the forwarding
+ implementation. We don't know the receiver (only
+ its class), so we have to pass 'nil' as the first
+ argument. Passing the class as first argument is
+ wrong because the class is not the receiver; it
+ can result in us calling a class method when we
+ want an instance method of the same name. */
+ res = __objc_get_forward_imp (nil, sel);
+ }
+ }
+ }
+ }
+ return res;
+}
+
+/* The new name of get_imp(). */
+IMP
+class_getMethodImplementation (Class class_, SEL selector)
+{
+ if (class_ == Nil || selector == NULL)
+ return NULL;
+
+ /* get_imp is inlined, so we're good. */
+ return get_imp (class_, selector);
+}
+
+/* Given a method, return its implementation. This has been replaced
+ by method_getImplementation() in the modern API. */
+IMP
+method_get_imp (struct objc_method * method)
+{
+ return (method != (struct objc_method *)0) ? method->method_imp : (IMP)0;
+}
+
+/* Query if an object can respond to a selector, returns YES if the
+ object implements the selector otherwise NO. Does not check if the
+ method can be forwarded. */
+inline
+BOOL
+__objc_responds_to (id object, SEL sel)
+{
+ void *res;
+
+ /* Install dispatch table if need be. */
+ if (object->class_pointer->dtable == __objc_uninstalled_dtable)
+ {
+ objc_mutex_lock (__objc_runtime_mutex);
+ if (object->class_pointer->dtable == __objc_uninstalled_dtable)
+ {
+ __objc_install_dispatch_table_for_class (object->class_pointer);
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+ }
+
+ /* Get the method from the dispatch table. */
+ res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id);
+ return (res != 0);
+}
+
+BOOL
+class_respondsToSelector (Class class_, SEL selector)
+{
+ void *res;
+
+ if (class_ == Nil || selector == NULL)
+ return NO;
+
+ /* Install dispatch table if need be. */
+ if (class_->dtable == __objc_uninstalled_dtable)
+ {
+ objc_mutex_lock (__objc_runtime_mutex);
+ if (class_->dtable == __objc_uninstalled_dtable)
+ {
+ __objc_install_dispatch_table_for_class (class_);
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+ }
+
+ /* Get the method from the dispatch table. */
+ res = sarray_get_safe (class_->dtable, (size_t) selector->sel_id);
+ return (res != 0);
+}
+
+/* This is the lookup function. All entries in the table are either a
+ valid method *or* zero. If zero then either the dispatch table
+ needs to be installed or it doesn't exist and forwarding is
+ attempted. */
+IMP
+objc_msg_lookup (id receiver, SEL op)
+{
+ IMP result;
+ if (receiver)
+ {
+ result = sarray_get_safe (receiver->class_pointer->dtable,
+ (sidx)op->sel_id);
+ if (result == 0)
+ {
+ /* Not a valid method. */
+ if (receiver->class_pointer->dtable == __objc_uninstalled_dtable)
+ {
+ /* The dispatch table needs to be installed. This
+ happens on the very first method call to the
+ class. */
+ __objc_init_install_dtable (receiver, op);
+
+ /* Get real method for this in newly installed
+ dtable. */
+ result = get_imp (receiver->class_pointer, op);
+ }
+ else
+ {
+ /* The dispatch table has been installed. Check again
+ if the method exists (just in case the dispatch table
+ has been installed by another thread after we did the
+ previous check that the method exists). */
+ result = sarray_get_safe (receiver->class_pointer->dtable,
+ (sidx)op->sel_id);
+ if (result == 0)
+ {
+ /* Try going through the +resolveClassMethod: or
+ +resolveInstanceMethod: process. */
+ if (CLS_ISMETA (receiver->class_pointer))
+ result = __objc_resolve_class_method ((Class)receiver, op);
+ else
+ result = __objc_resolve_instance_method (receiver->class_pointer,
+ op);
+
+ if (result == 0)
+ {
+ /* If the method still just doesn't exist for
+ the class, attempt to forward the method. */
+ result = __objc_get_forward_imp (receiver, op);
+ }
+ }
+ }
+ }
+ return result;
+ }
+ else
+ return (IMP)nil_method;
+}
+
+IMP
+objc_msg_lookup_super (struct objc_super *super, SEL sel)
+{
+ if (super->self)
+ return get_imp (super->super_class, sel);
+ else
+ return (IMP)nil_method;
+}
+
+/* Temporarily defined here until objc_msg_sendv() goes away. */
+char *method_get_first_argument (struct objc_method *,
+ arglist_t argframe,
+ const char **type);
+char *method_get_next_argument (arglist_t argframe,
+ const char **type);
+int method_get_sizeof_arguments (struct objc_method *);
+
+struct objc_method *
+class_get_instance_method (Class class, SEL op);
+
+retval_t
+objc_msg_sendv (id object, SEL op, arglist_t arg_frame)
+{
+ struct objc_method *m = class_get_instance_method (object->class_pointer, op);
+ const char *type;
+ *((id *) method_get_first_argument (m, arg_frame, &type)) = object;
+ *((SEL *) method_get_next_argument (arg_frame, &type)) = op;
+ return __builtin_apply ((apply_t) m->method_imp,
+ arg_frame,
+ method_get_sizeof_arguments (m));
+}
+
+void
+__objc_init_dispatch_tables ()
+{
+ __objc_uninstalled_dtable = sarray_new (200, 0);
+
+ /* TODO: It would be cool to register typed selectors here. */
+ selector_resolveClassMethod = sel_registerName ("resolveClassMethod:");
+ selector_resolveInstanceMethod =sel_registerName ("resolveInstanceMethod:");
+}
+
+/* This function is called by objc_msg_lookup when the dispatch table
+ needs to be installed; thus it is called once for each class,
+ namely when the very first message is sent to it. */
+static void
+__objc_init_install_dtable (id receiver, SEL op __attribute__ ((__unused__)))
+{
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* This may happen, if the programmer has taken the address of a
+ method before the dtable was initialized... too bad for him! */
+ if (receiver->class_pointer->dtable != __objc_uninstalled_dtable)
+ {
+ objc_mutex_unlock (__objc_runtime_mutex);
+ return;
+ }
+
+ if (CLS_ISCLASS (receiver->class_pointer))
+ {
+ /* receiver is an ordinary object. */
+ assert (CLS_ISCLASS (receiver->class_pointer));
+
+ /* Install instance methods table. */
+ __objc_install_dispatch_table_for_class (receiver->class_pointer);
+
+ /* Call +initialize -- this will in turn install the factory
+ dispatch table if not already done. :-) */
+ __objc_send_initialize (receiver->class_pointer);
+ }
+ else
+ {
+ /* receiver is a class object. */
+ assert (CLS_ISCLASS ((Class)receiver));
+ assert (CLS_ISMETA (receiver->class_pointer));
+
+ /* Install real dtable for factory methods. */
+ __objc_install_dispatch_table_for_class (receiver->class_pointer);
+
+ __objc_send_initialize ((Class)receiver);
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* Install dummy table for class which causes the first message to
+ that class (or instances hereof) to be initialized properly. */
+void
+__objc_install_premature_dtable (Class class)
+{
+ assert (__objc_uninstalled_dtable);
+ class->dtable = __objc_uninstalled_dtable;
+}
+
+/* Send +initialize to class if not already done. */
+static void
+__objc_send_initialize (Class class)
+{
+ /* This *must* be a class object. */
+ assert (CLS_ISCLASS (class));
+ assert (! CLS_ISMETA (class));
+
+ if (! CLS_ISINITIALIZED (class))
+ {
+ DEBUG_PRINTF ("+initialize: need to initialize class '%s'\n", class->name);
+ CLS_SETINITIALIZED (class);
+ CLS_SETINITIALIZED (class->class_pointer);
+
+ /* Create the garbage collector type memory description. */
+ __objc_generate_gc_type_description (class);
+
+ if (class->super_class)
+ __objc_send_initialize (class->super_class);
+
+ {
+ SEL op = sel_registerName ("initialize");
+ IMP imp = 0;
+ struct objc_method_list * method_list = class->class_pointer->methods;
+
+ while (method_list)
+ {
+ int i;
+ struct objc_method * method;
+
+ for (i = 0; i < method_list->method_count; i++)
+ {
+ method = &(method_list->method_list[i]);
+ if (method->method_name
+ && method->method_name->sel_id == op->sel_id)
+ {
+ imp = method->method_imp;
+ break;
+ }
+ }
+
+ if (imp)
+ break;
+
+ method_list = method_list->method_next;
+ }
+ if (imp)
+ {
+ DEBUG_PRINTF (" begin of [%s +initialize]\n", class->name);
+ (*imp) ((id) class, op);
+ DEBUG_PRINTF (" end of [%s +initialize]\n", class->name);
+ }
+#ifdef DEBUG
+ else
+ {
+ DEBUG_PRINTF (" class '%s' has no +initialize method\n", class->name);
+ }
+#endif
+ }
+ }
+}
+
+/* Walk on the methods list of class and install the methods in the
+ reverse order of the lists. Since methods added by categories are
+ before the methods of class in the methods list, this allows
+ categories to substitute methods declared in class. However if
+ more than one category replaces the same method nothing is
+ guaranteed about what method will be used. Assumes that
+ __objc_runtime_mutex is locked down. */
+static void
+__objc_install_methods_in_dtable (Class class, struct objc_method_list * method_list)
+{
+ int i;
+
+ if (! method_list)
+ return;
+
+ if (method_list->method_next)
+ __objc_install_methods_in_dtable (class, method_list->method_next);
+
+ for (i = 0; i < method_list->method_count; i++)
+ {
+ struct objc_method * method = &(method_list->method_list[i]);
+ sarray_at_put_safe (class->dtable,
+ (sidx) method->method_name->sel_id,
+ method->method_imp);
+ }
+}
+
+/* Assumes that __objc_runtime_mutex is locked down. */
+static void
+__objc_install_dispatch_table_for_class (Class class)
+{
+ Class super;
+
+ /* If the class has not yet had its class links resolved, we must
+ re-compute all class links. */
+ if (! CLS_ISRESOLV (class))
+ __objc_resolve_class_links ();
+
+ DEBUG_PRINTF ("__objc_install_dispatch_table_for_class (%s)\n", class->name);
+
+ super = class->super_class;
+
+ if (super != 0 && (super->dtable == __objc_uninstalled_dtable))
+ __objc_install_dispatch_table_for_class (super);
+
+ /* Allocate dtable if necessary. */
+ if (super == 0)
+ {
+ objc_mutex_lock (__objc_runtime_mutex);
+ class->dtable = sarray_new (__objc_selector_max_index, 0);
+ objc_mutex_unlock (__objc_runtime_mutex);
+ }
+ else
+ class->dtable = sarray_lazy_copy (super->dtable);
+
+ __objc_install_methods_in_dtable (class, class->methods);
+}
+
+void
+__objc_update_dispatch_table_for_class (Class class)
+{
+ Class next;
+ struct sarray *arr;
+
+ /* Not yet installed -- skip it. */
+ if (class->dtable == __objc_uninstalled_dtable)
+ return;
+
+ DEBUG_PRINTF (" _objc_update_dispatch_table_for_class (%s)\n", class->name);
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ arr = class->dtable;
+ __objc_install_premature_dtable (class); /* someone might require it... */
+ sarray_free (arr); /* release memory */
+
+ /* Could have been lazy... */
+ __objc_install_dispatch_table_for_class (class);
+
+ if (class->subclass_list) /* Traverse subclasses. */
+ for (next = class->subclass_list; next; next = next->sibling_class)
+ __objc_update_dispatch_table_for_class (next);
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* This function adds a method list to a class. This function is
+ typically called by another function specific to the run-time. As
+ such this function does not worry about thread safe issues.
+
+ This one is only called for categories. Class objects have their
+ methods installed right away, and their selectors are made into
+ SEL's by the function __objc_register_selectors_from_class. */
+void
+class_add_method_list (Class class, struct objc_method_list * list)
+{
+ /* Passing of a linked list is not allowed. Do multiple calls. */
+ assert (! list->method_next);
+
+ __objc_register_selectors_from_list(list);
+
+ /* Add the methods to the class's method list. */
+ list->method_next = class->methods;
+ class->methods = list;
+
+ /* Update the dispatch table of class. */
+ __objc_update_dispatch_table_for_class (class);
+}
+
+struct objc_method *
+class_get_instance_method (Class class, SEL op)
+{
+ return search_for_method_in_hierarchy (class, op);
+}
+
+struct objc_method *
+class_get_class_method (MetaClass class, SEL op)
+{
+ return search_for_method_in_hierarchy (class, op);
+}
+
+struct objc_method *
+class_getInstanceMethod (Class class_, SEL selector)
+{
+ struct objc_method *m;
+
+ if (class_ == Nil || selector == NULL)
+ return NULL;
+
+ m = search_for_method_in_hierarchy (class_, selector);
+ if (m)
+ return m;
+
+ /* Try going through +resolveInstanceMethod:, and do the search
+ again if successful. */
+ if (__objc_resolve_instance_method (class_, selector))
+ return search_for_method_in_hierarchy (class_, selector);
+
+ return NULL;
+}
+
+struct objc_method *
+class_getClassMethod (Class class_, SEL selector)
+{
+ struct objc_method *m;
+
+ if (class_ == Nil || selector == NULL)
+ return NULL;
+
+ m = search_for_method_in_hierarchy (class_->class_pointer,
+ selector);
+ if (m)
+ return m;
+
+ /* Try going through +resolveClassMethod:, and do the search again
+ if successful. */
+ if (__objc_resolve_class_method (class_, selector))
+ return search_for_method_in_hierarchy (class_->class_pointer,
+ selector);
+
+ return NULL;
+}
+
+BOOL
+class_addMethod (Class class_, SEL selector, IMP implementation,
+ const char *method_types)
+{
+ struct objc_method_list *method_list;
+ struct objc_method *method;
+ const char *method_name;
+
+ if (class_ == Nil || selector == NULL || implementation == NULL
+ || method_types == NULL || (strcmp (method_types, "") == 0))
+ return NO;
+
+ method_name = sel_getName (selector);
+ if (method_name == NULL)
+ return NO;
+
+ /* If the method already exists in the class, return NO. It is fine
+ if the method already exists in the superclass; in that case, we
+ are overriding it. */
+ if (CLS_IS_IN_CONSTRUCTION (class_))
+ {
+ /* The class only contains a list of methods; they have not been
+ registered yet, ie, the method_name of each of them is still
+ a string, not a selector. Iterate manually over them to
+ check if we have already added the method. */
+ struct objc_method_list * method_list = class_->methods;
+ while (method_list)
+ {
+ int i;
+
+ /* Search the method list. */
+ for (i = 0; i < method_list->method_count; ++i)
+ {
+ struct objc_method * method = &method_list->method_list[i];
+
+ if (method->method_name
+ && strcmp ((char *)method->method_name, method_name) == 0)
+ return NO;
+ }
+
+ /* The method wasn't found. Follow the link to the next list of
+ methods. */
+ method_list = method_list->method_next;
+ }
+ /* The method wasn't found. It's a new one. Go ahead and add
+ it. */
+ }
+ else
+ {
+ /* Do the standard lookup. This assumes the selectors are
+ mapped. */
+ if (search_for_method_in_list (class_->methods, selector))
+ return NO;
+ }
+
+ method_list = (struct objc_method_list *)objc_calloc (1, sizeof (struct objc_method_list));
+ method_list->method_count = 1;
+
+ method = &(method_list->method_list[0]);
+ method->method_name = objc_malloc (strlen (method_name) + 1);
+ strcpy ((char *)method->method_name, method_name);
+
+ method->method_types = objc_malloc (strlen (method_types) + 1);
+ strcpy ((char *)method->method_types, method_types);
+
+ method->method_imp = implementation;
+
+ if (CLS_IS_IN_CONSTRUCTION (class_))
+ {
+ /* We only need to add the method to the list. It will be
+ registered with the runtime when the class pair is registered
+ (if ever). */
+ method_list->method_next = class_->methods;
+ class_->methods = method_list;
+ }
+ else
+ {
+ /* Add the method to a live class. */
+ objc_mutex_lock (__objc_runtime_mutex);
+ class_add_method_list (class_, method_list);
+ objc_mutex_unlock (__objc_runtime_mutex);
+ }
+
+ return YES;
+}
+
+IMP
+class_replaceMethod (Class class_, SEL selector, IMP implementation,
+ const char *method_types)
+{
+ struct objc_method * method;
+
+ if (class_ == Nil || selector == NULL || implementation == NULL
+ || method_types == NULL)
+ return NULL;
+
+ method = search_for_method_in_hierarchy (class_, selector);
+
+ if (method)
+ {
+ return method_setImplementation (method, implementation);
+ }
+ else
+ {
+ class_addMethod (class_, selector, implementation, method_types);
+ return NULL;
+ }
+}
+
+/* Search for a method starting from the current class up its
+ hierarchy. Return a pointer to the method's method structure if
+ found. NULL otherwise. */
+static struct objc_method *
+search_for_method_in_hierarchy (Class cls, SEL sel)
+{
+ struct objc_method * method = NULL;
+ Class class;
+
+ if (! sel_is_mapped (sel))
+ return NULL;
+
+ /* Scan the method list of the class. If the method isn't found in
+ the list then step to its super class. */
+ for (class = cls; ((! method) && class); class = class->super_class)
+ method = search_for_method_in_list (class->methods, sel);
+
+ return method;
+}
+
+
+
+/* Given a linked list of method and a method's name. Search for the
+ named method's method structure. Return a pointer to the method's
+ method structure if found. NULL otherwise. */
+struct objc_method *
+search_for_method_in_list (struct objc_method_list * list, SEL op)
+{
+ struct objc_method_list * method_list = list;
+
+ if (! sel_is_mapped (op))
+ return NULL;
+
+ /* If not found then we'll search the list. */
+ while (method_list)
+ {
+ int i;
+
+ /* Search the method list. */
+ for (i = 0; i < method_list->method_count; ++i)
+ {
+ struct objc_method * method = &method_list->method_list[i];
+
+ if (method->method_name)
+ if (method->method_name->sel_id == op->sel_id)
+ return method;
+ }
+
+ /* The method wasn't found. Follow the link to the next list of
+ methods. */
+ method_list = method_list->method_next;
+ }
+
+ return NULL;
+}
+
+static retval_t __objc_forward (id object, SEL sel, arglist_t args);
+
+/* Forwarding pointers/integers through the normal registers. */
+static id
+__objc_word_forward (id rcv, SEL op, ...)
+{
+ void *args, *res;
+
+ args = __builtin_apply_args ();
+ res = __objc_forward (rcv, op, args);
+ if (res)
+ __builtin_return (res);
+ else
+ return res;
+}
+
+/* Specific routine for forwarding floats/double because of
+ architectural differences on some processors. i386s for example
+ which uses a floating point stack versus general registers for
+ floating point numbers. This forward routine makes sure that GCC
+ restores the proper return values. */
+static double
+__objc_double_forward (id rcv, SEL op, ...)
+{
+ void *args, *res;
+
+ args = __builtin_apply_args ();
+ res = __objc_forward (rcv, op, args);
+ __builtin_return (res);
+}
+
+#if INVISIBLE_STRUCT_RETURN
+static __big
+#else
+static id
+#endif
+__objc_block_forward (id rcv, SEL op, ...)
+{
+ void *args, *res;
+
+ args = __builtin_apply_args ();
+ res = __objc_forward (rcv, op, args);
+ if (res)
+ __builtin_return (res);
+ else
+#if INVISIBLE_STRUCT_RETURN
+ return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}};
+#else
+ return nil;
+#endif
+}
+
+
+/* This function is installed in the dispatch table for all methods
+ which are not implemented. Thus, it is called when a selector is
+ not recognized. */
+static retval_t
+__objc_forward (id object, SEL sel, arglist_t args)
+{
+ IMP imp;
+ static SEL frwd_sel = 0; /* !T:SAFE2 */
+ SEL err_sel;
+
+ /* First try if the object understands forward::. */
+ if (! frwd_sel)
+ frwd_sel = sel_get_any_uid ("forward::");
+
+ if (__objc_responds_to (object, frwd_sel))
+ {
+ imp = get_imp (object->class_pointer, frwd_sel);
+ return (*imp) (object, frwd_sel, sel, args);
+ }
+
+ /* If the object recognizes the doesNotRecognize: method then we're
+ going to send it. */
+ err_sel = sel_get_any_uid ("doesNotRecognize:");
+ if (__objc_responds_to (object, err_sel))
+ {
+ imp = get_imp (object->class_pointer, err_sel);
+ return (*imp) (object, err_sel, sel);
+ }
+
+ /* The object doesn't recognize the method. Check for responding to
+ error:. If it does then sent it. */
+ {
+ char msg[256 + strlen ((const char *) sel_getName (sel))
+ + strlen ((const char *) object->class_pointer->name)];
+
+ sprintf (msg, "(%s) %s does not recognize %s",
+ (CLS_ISMETA (object->class_pointer)
+ ? "class"
+ : "instance" ),
+ object->class_pointer->name, sel_getName (sel));
+
+ /* TODO: support for error: is surely deprecated ? */
+ err_sel = sel_get_any_uid ("error:");
+ if (__objc_responds_to (object, err_sel))
+ {
+ imp = get_imp (object->class_pointer, err_sel);
+ return (*imp) (object, sel_get_any_uid ("error:"), msg);
+ }
+
+ /* The object doesn't respond to doesNotRecognize: or error:;
+ Therefore, a default action is taken. */
+ _objc_abort ("%s\n", msg);
+
+ return 0;
+ }
+}
+
+void
+__objc_print_dtable_stats (void)
+{
+ int total = 0;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+
+#ifdef OBJC_SPARSE2
+ printf ("memory usage: (%s)\n", "2-level sparse arrays");
+#else
+ printf ("memory usage: (%s)\n", "3-level sparse arrays");
+#endif
+
+ printf ("arrays: %d = %ld bytes\n", narrays,
+ (long) ((size_t) narrays * sizeof (struct sarray)));
+ total += narrays * sizeof (struct sarray);
+ printf ("buckets: %d = %ld bytes\n", nbuckets,
+ (long) ((size_t) nbuckets * sizeof (struct sbucket)));
+ total += nbuckets * sizeof (struct sbucket);
+
+ printf ("idxtables: %d = %ld bytes\n",
+ idxsize, (long) ((size_t) idxsize * sizeof (void *)));
+ total += idxsize * sizeof (void *);
+ printf ("-----------------------------------\n");
+ printf ("total: %d bytes\n", total);
+ printf ("===================================\n");
+
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* Returns the uninstalled dispatch table indicator. If a class'
+ dispatch table points to __objc_uninstalled_dtable then that means
+ it needs its dispatch table to be installed. */
+struct sarray *
+objc_get_uninstalled_dtable (void)
+{
+ return __objc_uninstalled_dtable;
+}
diff --git a/libobjc/thr.c b/libobjc/thr.c
new file mode 100644
index 000000000..3f7e5c525
--- /dev/null
+++ b/libobjc/thr.c
@@ -0,0 +1,549 @@
+/* GNU Objective C Runtime Thread Interface
+ Copyright (C) 1996, 1997, 2009, 2010 Free Software Foundation, Inc.
+ Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3, or (at your option) any later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "objc-private/common.h"
+#include "objc-private/error.h"
+#define _LIBOBJC
+/* The line below is needed for declarations of functions such as
+ pthread_mutexattr_settype, without which gthr-posix.h may fail to
+ compile within libobjc. Unfortunately, this breaks compilation on
+ Tru64 UNIX V4.0F, so disable it there. */
+#ifndef __osf__
+#define _XOPEN_SOURCE 500
+#endif
+#include "config.h"
+#include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "defaults.h"
+#include "objc/thr.h"
+#include "objc/message.h" /* For objc_msg_lookup(). */
+#include "objc/runtime.h"
+#include "objc-private/runtime.h"
+#include <gthr.h>
+
+#include <stdlib.h>
+
+/* Global exit status. */
+int __objc_thread_exit_status = 0;
+
+/* Flag which lets us know if we ever became multi threaded. */
+int __objc_is_multi_threaded = 0;
+
+/* The hook function called when the runtime becomes multi
+ threaded. */
+objc_thread_callback _objc_became_multi_threaded = NULL;
+
+/* Use this to set the hook function that will be called when the
+ runtime initially becomes multi threaded. The hook function is
+ only called once, meaning only when the 2nd thread is spawned, not
+ for each and every thread.
+
+ It returns the previous hook function or NULL if there is none.
+
+ A program outside of the runtime could set this to some function so
+ it can be informed; for example, the GNUstep Base Library sets it
+ so it can implement the NSBecomingMultiThreaded notification. */
+objc_thread_callback objc_set_thread_callback (objc_thread_callback func)
+{
+ objc_thread_callback temp = _objc_became_multi_threaded;
+ _objc_became_multi_threaded = func;
+ return temp;
+}
+
+/* Private functions.
+
+ These functions are utilized by the runtime, but they are not
+ considered part of the public interface. */
+
+/* Initialize the threads subsystem. */
+int
+__objc_init_thread_system(void)
+{
+ return __gthread_objc_init_thread_system ();
+}
+
+/* First function called in a thread, starts everything else.
+
+ This function is passed to the backend by objc_thread_detach as the
+ starting function for a new thread. */
+struct __objc_thread_start_state
+{
+ SEL selector;
+ id object;
+ id argument;
+};
+
+static void __attribute__((noreturn))
+__objc_thread_detach_function (struct __objc_thread_start_state *istate)
+{
+ /* Valid state? */
+ if (istate)
+ {
+ id (*imp) (id, SEL, id);
+ SEL selector = istate->selector;
+ id object = istate->object;
+ id argument = istate->argument;
+
+ /* Don't need anymore so free it. */
+ objc_free (istate);
+
+ /* Clear out the thread local storage. */
+ objc_thread_set_data (NULL);
+
+ /* Check to see if we just became multi threaded. */
+ if (! __objc_is_multi_threaded)
+ {
+ __objc_is_multi_threaded = 1;
+
+ /* Call the hook function. */
+ if (_objc_became_multi_threaded != NULL)
+ (*_objc_became_multi_threaded) ();
+ }
+
+ /* Call the method. */
+ if ((imp = (id (*) (id, SEL, id))objc_msg_lookup (object, selector)))
+ (*imp) (object, selector, argument);
+ else
+ {
+ /* FIXME: Should we abort here ? */
+ _objc_abort ("objc_thread_detach called with bad selector.\n");
+ }
+ }
+ else
+ {
+ /* FIXME: Should we abort here ? */
+ _objc_abort ("objc_thread_detach called with NULL state.\n");
+ }
+
+ /* Exit the thread. */
+ objc_thread_exit ();
+
+ /* Make sure compiler detects no return. */
+ __builtin_trap ();
+}
+
+/* Public functions.
+
+ These functions constitute the public interface to the Objective-C
+ thread and mutex functionality. */
+
+/* Detach a new thread of execution and return its id. Returns NULL
+ if fails. Thread is started by sending message with selector to
+ object. Message takes a single argument. */
+objc_thread_t
+objc_thread_detach (SEL selector, id object, id argument)
+{
+ struct __objc_thread_start_state *istate;
+ objc_thread_t thread_id = NULL;
+
+ /* Allocate the state structure. */
+ if (!(istate = (struct __objc_thread_start_state *)objc_malloc
+ (sizeof (*istate))))
+ return NULL;
+
+ /* Initialize the state structure. */
+ istate->selector = selector;
+ istate->object = object;
+ istate->argument = argument;
+
+ /* Lock access. */
+ objc_mutex_lock (__objc_runtime_mutex);
+
+ /* Call the backend to spawn the thread. */
+ if ((thread_id = __gthread_objc_thread_detach ((void *)__objc_thread_detach_function,
+ istate)) == NULL)
+ {
+ /* Failed! */
+ objc_mutex_unlock (__objc_runtime_mutex);
+ objc_free (istate);
+ return NULL;
+ }
+
+ /* Increment our thread counter. */
+ __objc_runtime_threads_alive++;
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ return thread_id;
+}
+
+/* Set the current thread's priority. */
+int
+objc_thread_set_priority (int priority)
+{
+ return __gthread_objc_thread_set_priority (priority);
+}
+
+/* Return the current thread's priority. */
+int
+objc_thread_get_priority (void)
+{
+ return __gthread_objc_thread_get_priority ();
+}
+
+/* Yield our process time to another thread. Any BUSY waiting that is
+ done by a thread should use this function to make sure that other
+ threads can make progress even on a lazy uniprocessor system. */
+void
+objc_thread_yield (void)
+{
+ __gthread_objc_thread_yield ();
+}
+
+/* Terminate the current tread. Doesn't return. Actually, if it
+ failed returns -1. */
+int
+objc_thread_exit (void)
+{
+ /* Decrement our counter of the number of threads alive. */
+ objc_mutex_lock (__objc_runtime_mutex);
+ __objc_runtime_threads_alive--;
+ objc_mutex_unlock (__objc_runtime_mutex);
+
+ /* Call the backend to terminate the thread. */
+ return __gthread_objc_thread_exit ();
+}
+
+/* Returns an integer value which uniquely describes a thread. Must
+ not be NULL which is reserved as a marker for "no thread". */
+objc_thread_t
+objc_thread_id (void)
+{
+ return __gthread_objc_thread_id ();
+}
+
+/* Sets the thread's local storage pointer. Returns 0 if successful
+ or -1 if failed. */
+int
+objc_thread_set_data (void *value)
+{
+ return __gthread_objc_thread_set_data (value);
+}
+
+/* Returns the thread's local storage pointer. Returns NULL on
+ failure. */
+void *
+objc_thread_get_data (void)
+{
+ return __gthread_objc_thread_get_data ();
+}
+
+/* Public mutex functions */
+
+/* Allocate a mutex. Return the mutex pointer if successful or NULL
+ if the allocation failed for any reason. */
+objc_mutex_t
+objc_mutex_allocate (void)
+{
+ objc_mutex_t mutex;
+
+ /* Allocate the mutex structure. */
+ if (! (mutex = (objc_mutex_t)objc_malloc (sizeof (struct objc_mutex))))
+ return NULL;
+
+ /* Call backend to create the mutex. */
+ if (__gthread_objc_mutex_allocate (mutex))
+ {
+ /* Failed! */
+ objc_free (mutex);
+ return NULL;
+ }
+
+ /* Initialize mutex. */
+ mutex->owner = NULL;
+ mutex->depth = 0;
+ return mutex;
+}
+
+/* Deallocate a mutex. Note that this includes an implicit mutex_lock
+ to insure that no one else is using the lock. It is legal to
+ deallocate a lock if we have a lock on it, but illegal to
+ deallocate a lock held by anyone else. Returns the number of locks
+ on the thread. (1 for deallocate). */
+int
+objc_mutex_deallocate (objc_mutex_t mutex)
+{
+ int depth;
+
+ /* Valid mutex? */
+ if (! mutex)
+ return -1;
+
+ /* Acquire lock on mutex. */
+ depth = objc_mutex_lock (mutex);
+
+ /* Call backend to destroy mutex. */
+ if (__gthread_objc_mutex_deallocate (mutex))
+ return -1;
+
+ /* Free the mutex structure. */
+ objc_free (mutex);
+
+ /* Return last depth. */
+ return depth;
+}
+
+/* Grab a lock on a mutex. If this thread already has a lock on this
+ mutex then we increment the lock count. If another thread has a
+ lock on the mutex we block and wait for the thread to release the
+ lock. Returns the lock count on the mutex held by this thread. */
+int
+objc_mutex_lock (objc_mutex_t mutex)
+{
+ objc_thread_t thread_id;
+ int status;
+
+ /* Valid mutex? */
+ if (! mutex)
+ return -1;
+
+ /* If we already own the lock then increment depth. */
+ thread_id = __gthread_objc_thread_id ();
+ if (mutex->owner == thread_id)
+ return ++mutex->depth;
+
+ /* Call the backend to lock the mutex. */
+ status = __gthread_objc_mutex_lock (mutex);
+
+ /* Failed? */
+ if (status)
+ return status;
+
+ /* Successfully locked the thread. */
+ mutex->owner = thread_id;
+ return mutex->depth = 1;
+}
+
+/* Try to grab a lock on a mutex. If this thread already has a lock
+ on this mutex then we increment the lock count and return it. If
+ another thread has a lock on the mutex returns -1. */
+int
+objc_mutex_trylock (objc_mutex_t mutex)
+{
+ objc_thread_t thread_id;
+ int status;
+
+ /* Valid mutex? */
+ if (! mutex)
+ return -1;
+
+ /* If we already own the lock then increment depth. */
+ thread_id = __gthread_objc_thread_id ();
+ if (mutex->owner == thread_id)
+ return ++mutex->depth;
+
+ /* Call the backend to try to lock the mutex. */
+ status = __gthread_objc_mutex_trylock (mutex);
+
+ /* Failed? */
+ if (status)
+ return status;
+
+ /* Successfully locked the thread. */
+ mutex->owner = thread_id;
+ return mutex->depth = 1;
+}
+
+/* Unlocks the mutex by one level. Decrements the lock count on this
+ mutex by one. If the lock count reaches zero, release the lock on
+ the mutex. Returns the lock count on the mutex. It is an error to
+ attempt to unlock a mutex which this thread doesn't hold in which
+ case return -1 and the mutex is unaffected. */
+int
+objc_mutex_unlock (objc_mutex_t mutex)
+{
+ objc_thread_t thread_id;
+ int status;
+
+ /* Valid mutex? */
+ if (! mutex)
+ return -1;
+
+ /* If another thread owns the lock then abort. */
+ thread_id = __gthread_objc_thread_id ();
+ if (mutex->owner != thread_id)
+ return -1;
+
+ /* Decrement depth and return. */
+ if (mutex->depth > 1)
+ return --mutex->depth;
+
+ /* Depth down to zero so we are no longer the owner. */
+ mutex->depth = 0;
+ mutex->owner = NULL;
+
+ /* Have the backend unlock the mutex. */
+ status = __gthread_objc_mutex_unlock (mutex);
+
+ /* Failed? */
+ if (status)
+ return status;
+
+ return 0;
+}
+
+/* Public condition mutex functions */
+
+/* Allocate a condition. Return the condition pointer if successful
+ or NULL if the allocation failed for any reason. */
+objc_condition_t
+objc_condition_allocate (void)
+{
+ objc_condition_t condition;
+
+ /* Allocate the condition mutex structure. */
+ if (! (condition =
+ (objc_condition_t) objc_malloc (sizeof (struct objc_condition))))
+ return NULL;
+
+ /* Call the backend to create the condition mutex. */
+ if (__gthread_objc_condition_allocate (condition))
+ {
+ /* Failed! */
+ objc_free (condition);
+ return NULL;
+ }
+
+ /* Success! */
+ return condition;
+}
+
+/* Deallocate a condition. Note that this includes an implicit
+ condition_broadcast to insure that waiting threads have the
+ opportunity to wake. It is legal to dealloc a condition only if no
+ other thread is/will be using it. Here we do NOT check for other
+ threads waiting but just wake them up. */
+int
+objc_condition_deallocate (objc_condition_t condition)
+{
+ /* Broadcast the condition. */
+ if (objc_condition_broadcast (condition))
+ return -1;
+
+ /* Call the backend to destroy. */
+ if (__gthread_objc_condition_deallocate (condition))
+ return -1;
+
+ /* Free the condition mutex structure. */
+ objc_free (condition);
+
+ return 0;
+}
+
+/* Wait on the condition unlocking the mutex until
+ objc_condition_signal () or objc_condition_broadcast () are called
+ for the same condition. The given mutex *must* have the depth set
+ to 1 so that it can be unlocked here, so that someone else can lock
+ it and signal/broadcast the condition. The mutex is used to lock
+ access to the shared data that make up the "condition"
+ predicate. */
+int
+objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+ objc_thread_t thread_id;
+
+ /* Valid arguments? */
+ if (! mutex || ! condition)
+ return -1;
+
+ /* Make sure we are owner of mutex. */
+ thread_id = __gthread_objc_thread_id ();
+ if (mutex->owner != thread_id)
+ return -1;
+
+ /* Cannot be locked more than once. */
+ if (mutex->depth > 1)
+ return -1;
+
+ /* Virtually unlock the mutex. */
+ mutex->depth = 0;
+ mutex->owner = (objc_thread_t)NULL;
+
+ /* Call the backend to wait. */
+ __gthread_objc_condition_wait (condition, mutex);
+
+ /* Make ourselves owner of the mutex. */
+ mutex->owner = thread_id;
+ mutex->depth = 1;
+
+ return 0;
+}
+
+/* Wake up all threads waiting on this condition. It is recommended
+ that the called would lock the same mutex as the threads in
+ objc_condition_wait before changing the "condition predicate" and
+ make this call and unlock it right away after this call. */
+int
+objc_condition_broadcast (objc_condition_t condition)
+{
+ /* Valid condition mutex? */
+ if (! condition)
+ return -1;
+
+ return __gthread_objc_condition_broadcast (condition);
+}
+
+/* Wake up one thread waiting on this condition. It is recommended
+ that the called would lock the same mutex as the threads in
+ objc_condition_wait before changing the "condition predicate" and
+ make this call and unlock it right away after this call. */
+int
+objc_condition_signal (objc_condition_t condition)
+{
+ /* Valid condition mutex? */
+ if (! condition)
+ return -1;
+
+ return __gthread_objc_condition_signal (condition);
+}
+
+/* Make the objc thread system aware that a thread which is managed
+ (started, stopped) by external code could access objc facilities
+ from now on. This is used when you are interfacing with some
+ external non-objc-based environment/system - you must call
+ objc_thread_add () before an alien thread makes any calls to
+ Objective-C. Do not cause the _objc_became_multi_threaded hook to
+ be executed. */
+void
+objc_thread_add (void)
+{
+ objc_mutex_lock (__objc_runtime_mutex);
+ __objc_is_multi_threaded = 1;
+ __objc_runtime_threads_alive++;
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+
+/* Make the objc thread system aware that a thread managed (started,
+ stopped) by some external code will no longer access objc and thus
+ can be forgotten by the objc thread system. Call
+ objc_thread_remove () when your alien thread is done with making
+ calls to Objective-C. */
+void
+objc_thread_remove (void)
+{
+ objc_mutex_lock (__objc_runtime_mutex);
+ __objc_runtime_threads_alive--;
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
+