summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2004-06-16 05:45:41 +0000
committerobrien <obrien@FreeBSD.org>2004-06-16 05:45:41 +0000
commitabfa7c9435b930b7b0628c3d5aecb3d2bd2939ae (patch)
tree1b1eca723e1299baef96baf728843d50abdf24a8 /contrib/binutils/libiberty
parented2b7f732a9e0add59e9276fb35caeac694ca2c7 (diff)
parent2504df11e1275f63f4c53377bf91eee996360cb5 (diff)
downloadFreeBSD-src-abfa7c9435b930b7b0628c3d5aecb3d2bd2939ae.zip
FreeBSD-src-abfa7c9435b930b7b0628c3d5aecb3d2bd2939ae.tar.gz
This commit was generated by cvs2svn to compensate for changes in r130561,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/binutils/libiberty')
-rw-r--r--contrib/binutils/libiberty/ChangeLog965
-rw-r--r--contrib/binutils/libiberty/Makefile.in841
-rw-r--r--contrib/binutils/libiberty/README5
-rw-r--r--contrib/binutils/libiberty/aclocal.m4122
-rw-r--r--contrib/binutils/libiberty/argv.c6
-rw-r--r--contrib/binutils/libiberty/asprintf.c4
-rw-r--r--contrib/binutils/libiberty/calloc.c3
-rw-r--r--contrib/binutils/libiberty/config.in378
-rw-r--r--contrib/binutils/libiberty/config.table4
-rwxr-xr-xcontrib/binutils/libiberty/configure7991
-rw-r--r--contrib/binutils/libiberty/copysign.c8
-rw-r--r--contrib/binutils/libiberty/cp-demangle.c6842
-rw-r--r--contrib/binutils/libiberty/cp-demangle.h139
-rw-r--r--contrib/binutils/libiberty/cp-demint.c241
-rw-r--r--contrib/binutils/libiberty/cplus-dem.c480
-rw-r--r--contrib/binutils/libiberty/fibheap.c4
-rw-r--r--contrib/binutils/libiberty/floatformat.c303
-rw-r--r--contrib/binutils/libiberty/functions.texi237
-rw-r--r--contrib/binutils/libiberty/getcwd.c2
-rw-r--r--contrib/binutils/libiberty/getopt.c1056
-rw-r--r--contrib/binutils/libiberty/getopt1.c190
-rw-r--r--contrib/binutils/libiberty/getpwd.c3
-rw-r--r--contrib/binutils/libiberty/hashtab.c255
-rw-r--r--contrib/binutils/libiberty/hex.c21
-rw-r--r--contrib/binutils/libiberty/lbasename.c20
-rw-r--r--contrib/binutils/libiberty/libiberty.texi4
-rw-r--r--contrib/binutils/libiberty/lrealpath.c128
-rw-r--r--contrib/binutils/libiberty/maint-tool25
-rw-r--r--contrib/binutils/libiberty/make-relative-prefix.c396
-rw-r--r--contrib/binutils/libiberty/md5.c114
-rw-r--r--contrib/binutils/libiberty/memchr.c2
-rw-r--r--contrib/binutils/libiberty/memcmp.c8
-rw-r--r--contrib/binutils/libiberty/memcpy.c9
-rw-r--r--contrib/binutils/libiberty/memmove.c4
-rw-r--r--contrib/binutils/libiberty/memset.c8
-rw-r--r--contrib/binutils/libiberty/physmem.c305
-rw-r--r--contrib/binutils/libiberty/regex.c118
-rw-r--r--contrib/binutils/libiberty/rename.c5
-rw-r--r--contrib/binutils/libiberty/safe-ctype.c147
-rw-r--r--contrib/binutils/libiberty/sigsetmask.c4
-rw-r--r--contrib/binutils/libiberty/splay-tree.c10
-rw-r--r--contrib/binutils/libiberty/strcasecmp.c2
-rw-r--r--contrib/binutils/libiberty/strdup.c23
-rw-r--r--contrib/binutils/libiberty/strerror.c3
-rw-r--r--contrib/binutils/libiberty/strncasecmp.c2
-rw-r--r--contrib/binutils/libiberty/strncmp.c2
-rw-r--r--contrib/binutils/libiberty/strsignal.c2
-rw-r--r--contrib/binutils/libiberty/strstr.c4
-rw-r--r--contrib/binutils/libiberty/vasprintf.c25
-rw-r--r--contrib/binutils/libiberty/vfprintf.c3
-rw-r--r--contrib/binutils/libiberty/vprintf.c4
-rw-r--r--contrib/binutils/libiberty/vsprintf.c6
-rw-r--r--contrib/binutils/libiberty/xatexit.c2
-rw-r--r--contrib/binutils/libiberty/xmalloc.c2
54 files changed, 14867 insertions, 6620 deletions
diff --git a/contrib/binutils/libiberty/ChangeLog b/contrib/binutils/libiberty/ChangeLog
index a82516e..08b7d5b 100644
--- a/contrib/binutils/libiberty/ChangeLog
+++ b/contrib/binutils/libiberty/ChangeLog
@@ -1,9 +1,958 @@
-2002-10-28 Daniel Jacobowitz <drow@mvista.com>
+2004-02-16 Matt Kraai <kraai@alumni.cmu.edu>
+
+ * regex.c: Include <ansidecl.h>.
+ (regcomp): Cast i to int.
+ (regerror): Add ATTRIBUTE_UNUSED to parameter preg.
+
+2004-01-25 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * configure.ac: Add m4_pattern_allow(LIBOBJS).
+ * configure: Regenerate.
+
+2004-01-22 DJ Delorie <dj@redhat.com>
+
+ * Makefile.in: Convert to ./ throughout. Rebuild dependencies
+ with explicit build rules.
+ (VPATH): Remove.
+ (.c.o): Poison.
+ * configure.ac (pexecute, LIBOBJS): Add ./ .
+ * maint-tool: Build dependencies with explicit rules.
+
+2004-01-15 Kazu Hirata <kazu@cs.umass.edu>
+
+ * strdup.c (strdup): Constify the argument.
+
+2004-01-14 Loren J. Rittle <ljrittle@acm.org>
+
+ * Makefile.in (distclean): Remove config.cache.
+
+2004-01-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * cp-demangle.c (d_make_comp): DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE
+ takes two parameters.
+ * cp-demint.c (cplus_demangle_fill_component): Likewise.
+
+2004-01-12 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c: Include "cp-demangle.h". If IN_GLIBCPP_V3 is
+ defined, rename some functions which are to become static via
+ #define.
+ (CP_STATIC_IF_GLIBCPP_V3): Define.
+ (struct d_operator_info): Move definition to cp-demangle.h, and
+ rename to demangle_operator_info. Change all uses.
+ (enum d_builtin_type_print): Move definition to cp-demangle.h.
+ (struct d_builtin_type_info): Move definition to cp-demangle.h,
+ and rename to demangle_builtin_type_info. Change all uses.
+ (enum d_comp_type): Move definition to include/demangle.h, and
+ rename to demangle_component_type, and change all enums to start
+ with DEMANGLE_COMPONENT_ instead of D_. Change all uses.
+ (struct d_comp): Move definition to include/demangle.h, and rename
+ to demangle_component. Change all uses.
+ (struct d_info): Move definition to cp-demangle.h.
+ (cplus_demangle_fill_name): New function.
+ (cplus_demangle_fill_extended_operator): New function.
+ (cplus_demangle_fill_ctor): New function.
+ (cplus_demangle_fill_dtor): New function.
+ (d_make_empty): Remove type parameter. Change all callers.
+ (d_make_name): Use cplus_demangle_fill_name.
+ (d_make_extended_operator): Use
+ cplus_demangle_fill_extended_operator.
+ (d_make_ctor): Use cplus_demangle_fill_ctor.
+ (d_make_dtor): Use cplus_demangle_fill_dtor.
+ (cplus_demangle_mangled_name): Rename from d_mangled_name. Make
+ non-static by default. Change all callers.
+ (cplus_demangle_operators): Rename from d_operators. Change all
+ uses. Make non-static by default. Add sentinel at end of array.
+ (d_operator_name): Adjust initialization of high for new sentinel
+ in cplus_demangle_operators.
+ (cplus_demangle_builtin_types): Rename from d_builtin_types.
+ Change all uses. Make non-static by default. Change initializer
+ to use D_BUILTIN_TYPE_COUNT instead of magic number 26.
+ (cplus_demangle_type): Rename from d_type. Make non-static by
+ default. Change all callers.
+ (cplus_demangle_init_info): Rename from d_init_info. Make
+ non-static by default. Change all callers.
+ * cp-demangle.h: New file.
+ * cp-demint.c: New file.
+ * Makefile.in: Rebuild dependencies.
+ (CFILES): Add cp-demint.c.
+ (REQUIRED_OFILES): Add cp-demint.o.
+
+2004-01-09 Kelley Cook <kcook@gcc.gnu.org>
+
+ * configure.in: Rename file to ...
+ * configure.ac: ... this.
+ * Makefile.in: Update a comment for above change.
+ * README: Likewise.
+ * config.in: Regenerate.
+
+2004-01-02 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (d_encoding): When DMGL_PARAMS is not set, strip
+ CV-qualifiers from D_COMP_LOCAL_NAME right subtree.
+ * cplus-dem.c (demangle_arm_hp_template): Set DMGL_PARAMS when
+ demangling template parameters.
+ * testsuite/test-demangle.c (fail): New static function.
+ (main): Support new options in input file: --no-params,
+ --is-v3-ctor, and --is-v3-dtor.
+ * testsuite/demangle-expected: Add --no-params to most tests, and
+ add the correct result when parameters are not demangled. Add
+ some simple tests for V3 constructor/destructor recognition.
+
+2003-12-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-demangle.c (is_ctor_or_dtor): Fix error in last change.
+
+2003-12-22 Daniel Jacobowitz <drow@mvista.com>
+
+ PR debug/13272
+ * Makefile.in (lbasename.o): Depend on filenames.h.
+ * lbasename.c: Include "filenames.h" instead of defining
+ its macros locally.
+
+2003-12-22 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (CP_DYNAMIC_ARRAYS): Define if compiler supports
+ dynamic arrays.
+ (struct d_operator_info): Add len field.
+ (struct d_builtin_type_info): Add len and java_len fields.
+ (struct d_standard_sub_info): Add simple_len, full_len, and
+ set_last_name_len fields.
+ (struct d_comp): Add len field to s_string.
+ (struct d_info): Add send, did_subs, and expansion fields.
+ (d_append_string_constant): Define.
+ (d_append_string): Remove. Change all users to use
+ d_append_string_constant or d_append_buffer instead.
+ (d_make_sub): Add len parameter. Change all callers.
+ (d_name): Increase expansion when substituting std::.
+ (d_unqualified_name): Increase expansion for an operator.
+ (d_number): Don't use multiplication for negative numbers.
+ (d_identifier): Make sure there are enough characters in the
+ string for the specified length. Adjust expansion for an
+ anonymous namespace.
+ (d_operators): Initialize len field.
+ (d_special_name, d_ctor_dtor_name): Increase expansion.
+ (d_builtin_types): Initialize len and java_len fields.
+ (d_type): Increase expansion for a builtin type.
+ (d_cv_qualifiers): Increase expansion for each qualifier.
+ (d_bare_function_type): Decrease expansion when removing single
+ void parameter.
+ (d_template_param): Increment did_subs.
+ (d_expression): Increase expansion for an operator.
+ (d_expr_primary): Decrease expansion for a type we will print
+ specially.
+ (standard_subs): Initialize new fields.
+ (d_substitution): Increment did_subs when doing a normal
+ substitution. Increase expansion for a special substitution.
+ (d_print): Add estimate parameter. Change all callers.
+ (d_print_comp) [D_COMP_NAME]: Handle C++ case inline.
+ (d_print_comp) [D_COMP_BINARY]: Use length to avoid strcmp call.
+ (d_print_java_identifier): Rename from d_print_identifier. Handle
+ only Java case. Change caller.
+ (d_init_info): Change return type to void. Change all callers.
+ Initialize send, did_subs, and expansion fields. Do not
+ initialize comps and subs fields.
+ (d_demangle): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and subs
+ arrays on stack. Make an estimate of the length of the demangled
+ name. Ifdef CP_DEMANGLE_DEBUG, print estimation failures.
+ (is_ctor_or_dtor): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and
+ subs arrays on stack.
+
+2003-12-20 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (d_identifier): In Java mode, skip an optional '$'
+ after the identifier.
+ * testsuite/demangle-expected: Add test case.
+
+2003-12-19 Ian Lance Taylor <ian@wasabisystems.com>
+
+ Fix for PR c++/13447:
+ * cp-demangle.c (enum d_comp_type): Add D_COMP_LOCAL_NAME.
+ (d_dump, d_make_comp): Handle D_COMP_LOCAL_NAME.
+ (is_ctor_dtor_or_conversion): Handle D_COMP_LOCAL_NAME like
+ D_COMP_QUAL_NAME.
+ (is_ctor_or_dtor): Likewise.
+ (d_local_name): Use D_COMP_LOCAL_NAME rather than
+ D_COMP_QUAL_NAME.
+ (d_print_comp) [D_COMP_LOCAL_NAME]: New.
+ (d_prinT_comp) [D_COMP_TYPED_NAME]: If the left tree is
+ D_COMP_LOCAL_NAME, pull any qualifiers off its right subtree.
+ (d_print_mod_list): Handle D_COMP_LOCAL_NAME.
+ * testsuite/demangle-expected: Add two test cases.
+
+ * cp-demangle.c (d_print_function_type): Clear the global modifier
+ list when printing the modifiers, not just when printing the
+ function parameters.
+ * testsuite/demangle-expected: Add two test cases.
+
+2003-12-15 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (d_print_function_type): Print the function
+ parameters with no modifiers.
+ * testsuite/demangle-expected: Add test case.
+
+ * cp-demangle.c (d_demangle): If DMGL_PARAMS is not set, don't
+ expect that we've read the entire string.
+ (is_ctor_or_dtor): Don't expect that we've read the entire
+ string--reverse patch of 2003-11-29.
+
+2003-12-15 Brendan Kehoe <brendan@zen.org>
+
+ * libiberty/Makefile.in (floatformat.o): Add dependency on
+ config.h to accompany change of 2003-12-03.
+
+2003-12-15 Ian Lance Taylor <ian@wasabisystems.com>
+
+ Fix handling of constructor/destructor of standard substitution:
+ * cp-demangle.c (struct d_standard_sub_info): Define.
+ (d_substitution): Add prefix argument. Change all callers.
+ Rework handling of standard substitutions to print full name when
+ qualifying a constructor/destructor, or when DMGL_VERBOSE is set.
+ * testsuite/demangle-expected: Add test case.
+
+ Fix handling of negative literal constants:
+ * cp-demangle.c (enum d_comp_type): Add D_COMP_LITERAL_NEG.
+ (d_dump, d_make_comp): Handle D_COMP_LITERAL_NEG.
+ (d_expr_primary): Use D_COMP_LITERAL_NEG for a negative number.
+ (d_print_comp): Handle D_COMP_LITERAL_NEG.
+ * testsuite/demangle-expected: Add test case.
+
+2003-12-04 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (IS_UPPER, IS_LOWER): Define.
+ (d_last_char): Define new macro.
+ (d_make_name): Reject an empty name.
+ (d_prefix, d_unqualified_name, d_type): Use new IS_* macros.
+ (d_substitution, d_print_identifier): Likewise.
+ (d_print_comp) [D_COMP_OPERATOR]: Likewise.
+ (d_print_comp) [D_COMP_TEMPLATE]: Use new d_last_char macro.
+ (d_print_mod) Use new d_last_char macro.
+ (d_print_cast): Use new d_last_char macro.
+ (is_ctor_or_dtor): Don't leak memory.
+
+ Fix handling of member function modifiers:
+ * cp-demangle.c (enum d_comp_type): Add D_COMP_RESTRICT_THIS,
+ D_COMP_VOLATILE_THIS, and D_COMP_CONST_THIS.
+ (d_dump): Dump new d_comp_type values.
+ (d_make_comp): Accept new d_comp_type values.
+ (has_return_type): Only accept _THIS variants of qualifiers.
+ (d_encoding): Without DMGL_PARAMS, only remove _THIS variants of
+ qualifiers.
+ (d_cv_qualifiers): Add member_fn parameter. Change all callers.
+ (d_print_comp) [D_COMP_TYPED_NAME]: Rather than removing
+ qualifiers and printing them at the end, add _THIS qualifiers to
+ the modifier list.
+ (d_print_comp) [D_COMP_*_THIS]: New cases.
+ (d_print_comp) [D_COMP_PTRMEM_TYPE]: Remove special handling of
+ qualifiers.
+ (d_print_mod_list): Add suffix parameter. Change all callers.
+ Keep walking the list even if the current modifier has been
+ printed.
+ (d_print_mod): Handle new _THIS qualifiers.
+ (d_print_function_type): Handle new _THIS qualifiers when deciding
+ whether to print a parenthesis. Put a space before the
+ parenthesis in some cases. Call d_print_mod_list again at the
+ end, passing suffix as 1.
+ (is_ctor_or_dtor): Look for new _THIS qualifiers.
+ * testsuite/demangle-expected: Add test case.
+
+ Fix for PR gcc/13304:
+ * cp-demangle.c (d_print_comp) [D_COMP_TEMPLATE]: If the character
+ before the '<' is itself a '<', insert a space.
+ (d_print_cast): Likewise.
+ * testsuite/demangle-expected: Add test case.
+
+ Fix for PR gcc/13244:
+ * cp-demangle.c (d_print_comp) [D_COMP_BINARY]: Wrap an expression
+ which uses the '>' operator in an extra layer of parens.
+ * testsuite/demangle-expected: Add test case.
+
+2003-12-03 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * floatformat.c: Include "config.h" and <string.h> if available.
+ (INFINITY, NAN): Define if not defined by <math.h>.
+ (floatformat_to_double): Handle NaN, infinity, and denormalized
+ numbers.
+ (floatformat_from_double): Likewise.
+ (ieee_test): In debugging code, use little endian rather than big
+ endian. Correct tests to handle NaN and to check correct sign of
+ zero. Omit m68k extended test.
+ (main): Add more debugging cases.
+
+2003-11-29 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (d_demangle): Only return success if we consumed
+ the entire demangled string.
+ (is_ctor_or_dtor): Likewise.
+
+ * testsuite/demangle-expected: Revert one part of 2003-06-26 patch
+ to restore expected result of EDG test case to original expected
+ result.
+
+2003-11-26 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (struct d_print_mod): Add templates field.
+ (d_make_builtin_type): Check for NULL type.
+ (d_make_extended_operator): Check for NULL name.
+ (d_make_ctor, d_make_dtor): Likewise.
+ (d_mangled_name): Add top_level parameter. Change all callers.
+ (d_encoding): If DMGL_PARAMS is not set, strip off initial
+ CV-qualifiers.
+ (d_type): Check some return values we rely on.
+ (d_bare_function_type, d_array_type): Likewise.
+ (d_pointer_to_member_type, d_template_args): Likewise.
+ (d_add_substitution): Fail if argument is NULL.
+ (d_print_resize): Check whether buf is NULL.
+ (d_print_comp): Save current templates list with each modifier.
+ Don't pass the modifier list down when printing a template.
+ (d_print_cast): Don't pass the modifier list down when printing a
+ template.
+ (d_print_mod_list): Temporarily set templates list while printing
+ a modifier.
+ (d_print_mod): Check that buf is not NULL before using it.
+ (d_print_function_type): Print parens if there is no modifier.
+ (d_init_info): Permit as many substitutions as there are
+ characters in the mangled name.
+ * testsuite/demangle-expected: Add two new test cases.
+
+2003-11-25 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (java_demangle_v3): Pass DMGL_PARAMS to
+ d_demangle.
+
+2003-11-22 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (d_encoding): Add top_level parameter. Change all
+ callers.
+ (print_usage): Display new -p option.
+ (long_options): Add --no-params.
+ (main): Accept and handle -p.
+
+2003-11-21 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (has_return_type): Skip qualifiers when checking
+ whether we have a template.
+ * testsuite/demangle-expected: Add four new tests.
+
+2003-11-20 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * testsuite/demangle-expected: Minor changes to match output of
+ new demangler: adjust whitespace in four tests, and change order
+ of qualifiers in one test.
+
+ * cp-demangle.c: Complete rewrite.
+
+2003-11-19 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-demangle.c (demangle_type): Correct thinko in substitution
+ processing.
+
+2003-11-18 Ian Lance Taylor <ian@wasabisystems.com>
+
+ * cp-demangle.c (demangle_operator_name): Remove space before
+ "sizeof".
+ (demangle_type_ptr): Put qualifiers in the right place. Handle
+ qualifiers in pointer to member specially.
+ (demangle_type): Handle qualifiers for pointer or reference
+ specially. Handle function type.
+ (demangle_local_name): Save and restore caret around demangling of
+ initial encoding.
+
+ * testsuite/test-demangle.c (main): Don't pass DMGL_VERBOSE to
+ cplus_demangle.
+
+ * testsuite/Makefile.in (test-demangle): Depend upon libiberty.a.
+
+2003-10-31 Andreas Jaeger <aj@suse.de>
+
+ * floatformat.c (floatformat_always_valid): Add unused attribute.
+
+2003-10-30 Josef Zlomek <zlomekj@suse.cz>
+
+ Jan Hubicka <jh@suse.cz>
+ * vasprintf.c (int_vasprintf): Pass va_list by value.
+ Use va_copy for copying va_list.
+ (vasprintf): Pass va_list by value.
+
+2003-10-30 Josef Zlomek <zlomekj@suse.cz>
+
+ * hashtab.c (htab_find_slot_with_hash): Decrease n_deleted
+ instead of increasing n_elements when inserting to deleted slot.
+
+2003-10-20 J. Brobecker <brobecker@gnat.com>
+
+ * cplus-dem.c (demangle_template): Register a new Btype only
+ when needed.
+ * testsuite/demangle-expected: Add a new test.
+
+2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/demangle-expected: Update the expected output of
+ _GLOBAL__I__Z2fnv.
+
+2003-10-02 Daniel Jacobowitz <drow@mvista.com>
+
+ * strerror.c: Revert last change. Declare static sys_nerr
+ and sys_errlist using different names.
+
+2003-10-01 Daniel Jacobowitz <drow@mvista.com>
+
+ * strerror.c: Don't provide or reference sys_errlist if
+ strerror is available.
+
+2003-10-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure.in: Check if $MAKEINFO is missing.
+ * configure: Regenerated.
+
+2003-09-24 Daniel Jacobowitz <drow@mvista.com>
+
+ * configure.in: Use AC_PROG_CPP_WERROR.
+ * configure: Regenerated.
+
+2003-09-22 Andrew Cagney <cagney@redhat.com>
+
+ * floatformat.c (floatformat_i387_ext_is_valid): New function.
+ (floatformat_always_valid): New function.
+ (floatformat_i387_ext): Initialize new "is_valid" field to
+ "floatformat_i387_ext_is_valid".
+ (floatformat_ieee_single_little): Initialize "is_valid" field to
+ floatformat_always_valid.
+ (floatformat_ieee_double_big): Ditto.
+ (floatformat_ieee_double_little): Ditto.
+ (floatformat_ieee_double_little): Ditto.
+ (floatformat_ieee_double_littlebyte_bigword): Ditto.
+ (floatformat_i960_ext): Ditto.
+ (floatformat_m88110_ext): Ditto.
+ (floatformat_m88110_harris_ext): Ditto.
+ (floatformat_arm_ext_big): Ditto.
+ (floatformat_arm_ext_littlebyte_bigword): Ditto.
+ (floatformat_ia64_spill_big): Ditto.
+ (floatformat_ia64_spill_little): Ditto.
+ (floatformat_ia64_quad_big): Ditto.
+ (floatformat_ia64_quad_little): Ditto.
+ (floatformat_ia64_quad_little): Ditto.
+ (floatformat_is_valid): Call "is_valid".
+
+2003-09-15 Andrew Cagney <cagney@redhat.com>
+
+ * floatformat.c (get_field): Make "data" constant.
+ (floatformat_is_valid, floatformat_to_double): Make "from"
+ constant, fix casts.
+ (floatformat_from_double): Make "from" constant.
+
+2003-09-15 Daniel Jacobowitz <drow@mvista.com>
+
+ * floatformat.c (floatformat_is_valid): New function.
+ (get_field, put_field): Correct comments.
+
+2003-09-06 Josef Zlomek <zlomekj@suse.cz>
+
+ * fibheap.c (fibheap_replace_key_data): Change type of OKEY to
+ FIBHEAPKEY_T.
+
+2003-09-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR bootstrap/12100
+ * aclocal.m4 (AC_LANG_FUNC_LINK_TRY): Define.
+ * configure: Rebuilt.
+
+2003-08-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * aclocal.m4: Include acx.m4 and no-executables.m4.
+ (libiberty_AC_FUNC_STRNCMP): Use AC_LIBOBJ.
+ (LIB_AC_PROG_CC): Remove.
+ * configure.in: Update AC_PREREQ to 2.57. Use GCC_NO_EXECUTABLES.
+ Use AC_PROG_CC and set ac_libiberty_warn_cflags instead of using
+ LIB_AC_PROG_CC. Use AC_LIBOBJ. Call AC_ISC_POSIX later, only if
+ performing link tests.
+ * configure: Regenerated.
+
+2003-08-12 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * cp-demangle.c: Clarify what package(s) this is part of.
+
+2003-07-05 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * pex-win32.c (pexecute): Mark parameters this_pname and
+ temp_base as unused. Remove unused variables retries,
+ sleep_interval. Initialize org_stdin, org_stdout.
+ (pwait): Mark parameter flags as unused.
+
+2003-07-02 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * pex-win32.c (fix_argv): Ensure that the executable pathname
+ uses Win32 backslashes.
+ (pexecute): Cast away constness when assigning *errmsg_arg.
+
+2003-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/demangle-expected: Add more GNU V3 testcases.
+
+2003-06-22 Zack Weinberg <zack@codesourcery.com>
+
+ * safe-ctype.c: Use HOST_CHARSET_ASCII and HOST_CHARSET_EBCDIC,
+ not HC_ASCII and HC_EBCDIC.
+ Add documentation in form expected by gather-docs.
+ * hex.c: Use HOST_CHARSET, not hand-coded check of character set.
+ * Makefile.in, functions.texi: Regenerate.
+
+2003-06-21 Zack Weinberg <zack@codesourcery.com>
+
+ * safe-ctype.c: Separate out EOF==-1 check. Use HOST_CHARSET
+ for charset determination.
+
+2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com>
+
+ * configure.in: Add check for malloc.h needed by
+ m68k for function free().
+ * configure: Regenerated.
+ * config.in: Add HAVE_MALLOC_H.
+ * hashtab.c: include malloc.h were available for
+ free().
+
+2003-06-09 Albert Chin-A-Young <china@thewrittenword.com>
+
+ PR bootstrap/10974
+ * physmem.c: Update comment.
+ * configure.in: Modify test for _system_configuration for older
+ AIX systems.
+
+ * config.in, configure: Regenerated.
+
+2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR other/10810
+ * test-demangle.c (getline): Fix fence-post error.
+
+2003-06-03 Nick Clifton <nickc@redhat.com>
+
+ * asprintf.c: Change comment to note that -1 is returned upon
+ error.
+ * vasprintf.c: Likewise.
+ (vasprintf): Return -1 upon error.
+ * functions.texi: Document changes to asprintf and vasprintf.
+
+2003-05-19 Kelley Cook <kelleycook@wideopenwest.com>
+
+ * config.table: Accept i[345867]86 variant.
+
+2003-05-15 Jim Blandy <jimb@redhat.com>
+
+ * hex.c (_hex_value): Make this unsigned.
+ (hex_value): Update documentation for new return type. hex_value
+ now expands to an unsigned int expression, to avoid unexpected
+ sign extension when we store it in a bfd_vma, which is larger than
+ int on some platforms.
+ * functions.texi: Regenerated.
+
+2003-05-07 Josef Zlomek <zlomekj@suse.cz>
+
+ * splay-tree.c (splay_tree_predecessor): Fix comment.
+ (splay_tree_successor): Fix comment.
+
+2003-05-07 Jason Merrill <jason@redhat.com>
+
+ * hashtab.c (iterative_hash): New fn.
+ * configure.in: Add AC_C_BIGENDIAN_CROSS.
+ * aclocal.m4: Include accross.m4.
+ * configure, config.in: Regenerate.
+
+2003-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in (AC_CHECK_FUNCS): Don't make multiple calls.
+ * configure: Regenerate.
+
+2003-05-03 Carlo Wood <carlo@alinoe.com>
+
+ * cp-demangle.c: Fix typo in "char_traints" string-literal.
+
+2003-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * vsnprintf.c (vsnprintf): Don't pad string with extra nulls.
+ (main): Test that we don't write too much data.
+
+2003-04-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in (funcs, AC_CHECK_FUNCS): Add snprintf and
+ vsnprintf.
+ * snprintf.c, vsnprintf.c: New files.
+ * Makefile.in (CFILES): Add snprintf.c and vsnprintf.c.
+ (CONFIGURED_OFILES): Add snprintf.o and vsnprintf.o.
+ Regenerate dependencies.
+
+ * functions.texi, configure, config.in: Regenerated.
+
+2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * mempcpy.c, stpcpy.c, stpncpy.c: New files.
+ * configure.in (funcs, AC_CHECK_FUNCS): Add mempcpy, stpcpy
+ and stpncpy.
+ * Makefile.in (CFILES): Add mempcpy.c, stpcpy.c and stpncpy.c.
+ (CONFIGURED_OFILES): Add mempcpy.o, stpcpy.o and stpncpy.o.
+ Regenerate dependencies.
+
+ * functions.texi, configure, config.in: Regenerated.
+
+2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * argv.c: Fix comments.
+ * calloc.c: Don't unnecessarily include "libiberty.h".
+ (bzero): Add prototype.
+ * floatformat.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES.
+ * getcwd.c (getcwd): Use standard definition to avoid conflicts
+ with system headers.
+ * hashtab.c (htab_traverse): Delete unused variables.
+ * rename.c: Include "ansidecl.h".
+ (rename): Use standard definition to avoid conflicts with system
+ headers.
+ * strsignal.c: Rely on ANSI_PROTOTYPES.
+ * strstr.c: Check GNUC >= 2, not GNUC == 2.
+ * vfprintf.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES.
+ * vprintf.c: Include "ansidecl.h" earlier, rely on
+ ANSI_PROTOTYPES.
+ * vsprintf.c: Include "ansidecl.h" earlier, rely on
+ ANSI_PROTOTYPES and possibly include <stdarg.h>.
+
+ * Makefile.in: Regenerate dependencies.
+
+2003-04-15 DJ Delorie <dj@redhat.com>
+
+ * maint-tool (deps): Scan for headers in $srcdir also.
+
+2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ PR target/10338
+ PR bootstrap/10198
+ PR bootstrap/10140
+ * getopt.c (exchange, _getopt_initialize): Use mempcpy not
+ __mempcpy.
+ * regex.c (regerror): Likewise.
+
+2003-04-14 Roger Sayle <roger@eyesopen.com>
+
+ * argv.c: Use ANSI_PROTOTYPES instead of __STDC__.
+ * memchr.c: Likewise.
+ * strcasecmp.c: Likewise.
+ * strncasecmp.c: Likewise.
+ * strncmp.c: Likewise.
+ * xatexit.c: Likewise.
+ * xmalloc.c: Likewise.
+
+ * copysign.c: Use traditional function declaration instead of DEFUN.
+ * sigsetmask.c: Likewise.
+
+ * memcmp.c: Both of the above, ANSI_PROTOTYPES and DEFUN.
+ * memset.c: Likewise.
+
+ * memcpy.c: ANSI_PROTOTYPES, DEFUN and prototype bcopy.
+ * memmove.c: Likewise.
+
+2003-04-14 Roger Sayle <roger@eyesopen.com>
+
+ * strdup.c (strdup): Tweak implementation to use memcpy.
+
+2003-04-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in (HAVE_UINTPTR_T): Always define.
+ * configure: Regenerated.
+
+2003-03-23 Alexandre Oliva <aoliva@redhat.com>
+
+ * Makefile.in (MULTIOSDIR): New macro. Use $(CC) $(LIBCFLAGS)
+ instead of $$CC alone.
+ (install_to_tooldir): Use it.
+
+2003-17-03 Jan Hubicka <jh@suse.cz>
+
+ * hashtab.c (htab_traverse_noresize): Break out from ...
+ * hashtab.c (htab_traverse): ... here.
+
+2003-12-03 Jan Hubicka <jh@suse.cz>
+
+ * hashtab.c (htab_expand): Fix warning.
+
+ * hashtab.c (htab_expand): Compute the size of hashtable based
+ on the number of elements actually used.
+ (htab_traverse): Call htab_expand when table is too empty.
+
+2003-03-11 Carlo Wood <carlo@gnu.org>
+
+ * cplus-dem.c (demangle_integral_value): Correction to reflect
+ patch of 2002-01-10 in order to also make negative multi-digits
+ without leading underscore work.
+
+2003-03-03 Mark Mitchell <mark@codesourcery.com>
+
+ * cplus-dem.c: Add license exception to copyright notice.
+
+2003-02-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * physmem.c: Formatting changes from upstream.
+
+2003-02-24 Danny Smith <dannysmith@users.source.forge.net>
+
+ * physmem.c (physmem_total): Add _WIN32 support.
+ (physmem_available): Likewise.
+
+2003-02-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Test for
+ GSI_PHYSMEM.
+ (physmem_available) [HAVE_TABLE]: Test for TBL_VMSTATS.
+
+2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Check for sys/systemcfg.h and
+ _system_configuration.
+ * physmem.c: Add support for AIX. Tweek formatting as per
+ upstream coreutils beta.
+
+2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ Richard Earnshaw <rearnsha@arm.com>
+ Geoffrey Keating <geoffk@apple.com>
+
+ * configure.in: Check for sys/sysctl.h and sysctl.
+ * physmem.c: Add support for *bsd and darwin.
+ * Makefile.in: Generate depedency for physmem.o.
+
+2003-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on
+ Tru64 UNIX.
+ (physmem_available) [HAVE_TABLE && HAVE_SYS_TABLE_H]: Use table on
+ Tru64 UNIX.
+
+ * configure.in (AC_CHECK_HEADERS): Check for sys/sysinfo.h,
+ machine/hal_sysinfo.h, sys/table.h.
+ (checkfuncs, AC_CHECKFUNCS): Check for getsysinfo, table.
+ * configure, config.in: Regenerate.
+
+2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Check for sys/sysmp.h and sysmp.
+ * physmem.c: Pull upstream copy, add support for irix6.
+
+ * config.in, configure: Regenerated.
+
+2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * physmem.c (physmem_total, physmem_available): De-ANSI-fy.
+ * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
+ pstat_getdynamic.
+
+2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (CFILES): Add physmem.c.
+ (REQUIRED_OFILES): Add physmem.o.
+ * configure.in: Check for sys/pstat.h.
+ (checkfuncs): Add pstat_getstatic and pstat_getdynamic.
+ * physmem.c: New file, copied from textutils.
+
+ * config.in, configure: Regenerated.
+
+2003-02-20 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in (CFILES): Add lrealpath.c.
+ (REQUIRED_OFILES): Add lrealpath.o.
+ (lrealpath.o): Add rule.
+ * aclocal.m4 (libiberty_NEED_DECLARATION): Add.
+ * configure.in: Add realpath and canonicalize_file_name to
+ checkfuncs and AC_CHECK_FUNCS. Use libiberty_NEED_DECLARATION
+ for canonicalize_file_name.
+ * lrealpath.c: New file.
+ * make-relative-prefix.c: Update documentation.
+ (make_relative_prefix): Simplify. Use lbasename and lrealpath.
+ * config.in: Regenerated.
+ * configure: Regenerated.
+ * functions.texi: Regenerated.
+
+2003-02-20 jmc <jmc@prioris.mini.pw.edu.pl>
+
+ * cplus_dem.c: Fix typo: intializes -> initializes.
+
+2003-02-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
+ config.status.
+ * configure: Rebuilt.
+
+2003-02-13 Daniel Jacobowitz <drow@mvista.com>
+
+ Fix PR c++/7612.
+ * cplus-dem.c (demangle_signature): Call string_delete.
+ Remove extra string_init.
+ (demangle_arm_hp_template): Call string_delete instead of
+ string_clear. Add missing string_delete call.
+ (demangle_qualified): Add missing string_delete call.
+ (do_type): Remove unused variable btype. Add missing string_delete
+ call. Call string_delete instead of string_clear.
+ (demangle_fund_type): Move variable btype inside of the switch
+ statement. Add missing string_delete call.
+ (do_arg): Call string_delete instead of string_clear. Remove extra
+ string_init.
+ (demangle_nested_args): Free work->previous_argument.
+
+2003-02-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * acconfig.h: New file. Add uintptr_t.
+ * config.in: Regenerated.
+
+2003-02-04 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * libiberty.texi: Update to GFDL 1.2.
+
+2003-01-30 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+
+ * Makefile.in (libiberty_topdir): New subst.
+ (mkinstalldirs): Redefine in terms of the above.
+ * configure.in: AC_SUBST it.
+ * configure: Regenerate.
+
+2003-01-28 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+
+ * Makefile.in (all-subdir, check-subdir, installcheck-subdir)
+ (info-subdir, install-info-subdir, clean-info-subdir)
+ (dvi-subdir, install-subdir, etags-subdir, mostlyclean-subdir)
+ (clean-subdir, distclean-subdir, maintainer-clean-subdir):
+ Pass $(FLAGS_TO_PASS).
+
+2003-01-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * Makefile.in (install_to_tooldir): Instead of $(MULTISUBDIR), use
+ /`$$CC -print-multi-os-directory`.
+
+2003-01-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * hashtab.c (htab_create_alloc_ex): New function.
+ (hatab_set_functions_ex): New function.
+ (htab_delete, htab_expand): Support alternate allocation functions.
+
+2003-01-24 Christopher Faylor <cgf@redhat.com>
+
+ * configure.in: Remove special pex-cygwin consideration.
+ * configure: Regenerate.
+ * pex-cygwin.c: Remove.
+ * Makefile.in: Remove pex-cygwin.[co] lines.
+
+2003-01-24 Zack Weinberg <zack@codesourcery.com>
+
+ * Makefile.in (CFILES): Add pex-*.c.
+ (REQUIRED_OFILES): Change pexecute.o to @pexecute@
+ (CONFIGURED_OFILES): Add pex-*.o.
+ (TEXIFILES): Add pexecute.txh.
+ (pexecute.o): Delete rule.
+ (pex-cygwin.o, pex-djgpp.o, pex-mpw.o, pex-msdos.o, pex-os2.o,
+ pex-unix.o, pex-win32.o): New rules.
+ * configure.in: Change AC_INIT argument to xmalloc.c.
+ Compute appropriate pexecute implementation and substitute it
+ as @pexecute@.
+
+ * pexecute.c: Split up into...
+ * pex-cygwin.c, pex-djgpp.c, pex-mpw.c, pex-msdos.c, pex-os2.c,
+ pex-unix.c, pex-win32.c, pex-common.h, pexecute.txh: ... these
+ new files.
+
+ * functions.texi: Regenerate.
+ * configure: Regenerate.
+
+2003-01-20 Josef Zlomek <zlomekj@suse.cz>
+
+ * hashtab.c (htab_expand): Fix allocation of new entries.
+
+2003-01-09 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+
+ * Makefile.in (FLAGS_TO_PASS): Also pass DESTDIR.
+
+ * Makefile.in (install_to_libdir, install_to_tooldir): Add a
+ mkinstalldirs command.
+
+2002-12-04 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * make-relative-prefix.c (HAVE_HOST_EXECUTABLE_SUFFIX):
+ Define for hosts with HOST_EXECUTABLE_SUFFIX.
+
+2002-11-24 Nick Clifton <nickc@redhat.com>
+
+ * make-relative-prefix.c (make_relative_prefix): Ensure return
+ string is empty before using strcat to construct it.
+
+2002-11-22 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in: Add make-relative-prefix.c.
+ * make-relative-prefix.c: New file.
+ * functions.texi: Rebuilt.
+
+2002-11-16 Jakub Jelinek <jakub@redhat.com>
+
+ * md5.c (md5_process_block): Avoid `function-like macro "F{G,H,I}" must be
+ used with arguments in traditional C' warnings.
+
+2002-10-16 Jakub Jelinek <jakub@redhat.com>
- Merge from mainline:
- 2002-10-16 Jakub Jelinek <jakub@redhat.com>
* config.table: Use mh-s390pic for s390x too.
+2002-10-06 Andreas Jaeger <aj@suse.de>
+
+ * libiberty/cplus-dem.c (ada_demangle): Get rid of unneeded
+ variable and of strict-aliasing warning.
+ (grow_vect): Use char as first parameter.
+
+2002-09-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (all): Fix multilib parallel build.
+
+2002-09-19 John David Anglin <dave@hiuly1.hia.nrc.ca>
+
+ * cp-demangle.c (demangling_new): Cast 0 to enum.
+ (demangle_char): Cast return of strdup to char *.
+ (is_gnu_v3_mangled_ctor): Cast 0 to enum.
+ (is_gnu_v3_mangled_dtor): Likewise.
+ * cplus-dem.c (grow_vect): Cast return of xrealloc to void *.
+ (work_stuff_copy_to_from): Cast return of xmalloc to char **.
+ * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t.
+ * md5.c (md5_process_bytes): Cast results back to const void *.
+ (md5_process_block): Add cast to const md5_uint32 *.
+ * regex.c (re_compile_fastmap): Cast enum to UCHAR_T.
+ * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to
+ unsigned short.
+ * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc
+ to void *.
+ * vasprintf.c (int_vasprintf): Cast return of malloc to char *.
+
+2002-09-19 Nick Clifton <nickc@redhat.com>
+
+ * README: Update email addresses for bugs and patches.
+
+2002-09-10 Mike Stump <mrs@apple.com>
+
+ * splay-tree.c (splay_tree_successor): Fix comments.
+
+2002-09-11 Zack Weinberg <zack@codesourcery.com>
+
+ * cplus-dem.c: Code under #ifdef MAIN moved to gcc/cp/cxxfilt.c.
+ * testsuite/Makefile.in: Adjust for test-demangle.
+ * testsuite/regress-demangle: Deleted.
+ * testsuite/test-demangle.c: New file.
+ * testsuite/demangle-expected: Change \$ to $ throughout, now that
+ this file is not being read by a shell script.
+
+2002-09-05 Roger Sayle <roger@eyesopen.com>
+
+ * regex.c: Only use "#pragma alloca" on AIX when not using gcc.
+
+2002-08-07 DJ Delorie <dj@redhat.com>
+
+ * regex.c (re_error_msgid): Just use a simple array of strings.
+ (re_compile_pattern): Compensate.
+ (re_comp): Likewise.
+ (re_comp): Likewise.
+ (regerror): Likewise.
+
+2002-07-29 Neil Booth <neil@daikokuya.co.uk>
+
+ * cplus-dem.c (PREPEND_BLANK): Remove.
+
2002-07-10 Jason Merrill <jason@redhat.com>
* cp-demangle.c (demangle_identifier): Support extended Unicode
@@ -86,7 +1035,7 @@
2002-03-30 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
- * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
+ * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
if it is NULL.
2002-03-27 DJ Delorie <dj@redhat.com>
@@ -500,10 +1449,10 @@ Thu Nov 15 11:06:25 2001 Jeffrey A Law (law@cygnus.com)
2001-08-22 Matt Kraai <kraai@alumni.carnegiemellon.edu>
- * fibheap.c (fibheap_init, fibnode_init): Remove.
- (fibheap_new, fibnode_new): Use xcalloc to allocate and
- initialize memory.
- (fibheap_insert): Remove check for node allocation failure.
+ * fibheap.c (fibheap_init, fibnode_init): Remove.
+ (fibheap_new, fibnode_new): Use xcalloc to allocate and
+ initialize memory.
+ (fibheap_insert): Remove check for node allocation failure.
2001-08-21 Richard Henderson <rth@redhat.com>
diff --git a/contrib/binutils/libiberty/Makefile.in b/contrib/binutils/libiberty/Makefile.in
index 5a25987..bbb5c2a 100644
--- a/contrib/binutils/libiberty/Makefile.in
+++ b/contrib/binutils/libiberty/Makefile.in
@@ -1,6 +1,6 @@
#
# Makefile
-# Copyright (C) 1990, 91-99, 2000, 2001, 2002
+# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation
#
# This file is part of the libiberty library.
@@ -26,8 +26,8 @@
# Makefile for libiberty directory
#
+libiberty_topdir = @libiberty_topdir@
srcdir = @srcdir@
-VPATH = @srcdir@
prefix = @prefix@
@@ -50,7 +50,7 @@ MULTICLEAN = true
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
+mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
# Some compilers can't handle cc -c blah.c -o foo/blah.o.
OUTPUT_OPTION = @OUTPUT_OPTION@
@@ -69,8 +69,8 @@ PICFLAG =
MAKEOVERRIDES =
-TARGETLIB = libiberty.a
-TESTLIB = testlib.a
+TARGETLIB = ./libiberty.a
+TESTLIB = ./testlib.a
LIBOBJS = @LIBOBJS@
@@ -84,6 +84,7 @@ FLAGS_TO_PASS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
+ "DESTDIR=$(DESTDIR)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"EXTRA_OFILES=$(EXTRA_OFILES)" \
"HDEFINES=$(HDEFINES)" \
@@ -105,7 +106,7 @@ SUBDIRS = testsuite
# FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
- @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
+ @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
.PHONY: check installcheck
check: check-subdir
@@ -116,76 +117,85 @@ installcheck: installcheck-subdir
INCDIR=$(srcdir)/$(MULTISRCTOP)../include
COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
+
+# Just to make sure we don't use a built-in rule with VPATH
.c.o:
- if [ x"$(PICFLAG)" != x ]; then \
- $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
- else true; fi
- $(COMPILE.c) $< $(OUTPUT_OPTION)
+ false
# NOTE: If you add new files to the library, add them to this list
# (alphabetical), and add them to REQUIRED_OFILES, or
-# CONFIGURED_OFILES and funcs in configure.in.
+# CONFIGURED_OFILES and funcs in configure.ac. Also run "make maint-deps"
+# to build the new rules.
CFILES = alloca.c argv.c asprintf.c atexit.c \
basename.c bcmp.c bcopy.c bsearch.c bzero.c \
calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
- cplus-dem.c \
+ cp-demint.c cplus-dem.c \
dyn-string.c \
fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
hashtab.c hex.c \
index.c insque.c \
lbasename.c \
+ lrealpath.c \
+ make-relative-prefix.c \
make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \
- memset.c mkstemps.c \
+ mempcpy.c memset.c mkstemps.c \
objalloc.c obstack.c \
- partition.c pexecute.c putenv.c \
+ partition.c \
+ pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c \
+ pex-unix.c pex-win32.c \
+ physmem.c putenv.c \
random.c regex.c rename.c rindex.c \
- safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
- splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \
- strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \
- strtod.c strtol.c strtoul.c \
+ safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \
+ splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \
+ strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c \
+ strstr.c strtod.c strtol.c strtoul.c \
ternary.c tmpnam.c \
- vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
+ vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \
waitpid.c \
xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
# These are always included in the library. The first four are listed
# first and by compile time to optimize parallel builds.
-REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \
- alloca.o argv.o \
- choose-temp.o concat.o \
- dyn-string.o \
- fdmatch.o fibheap.o floatformat.o fnmatch.o \
- getopt.o getopt1.o getpwd.o getruntime.o \
- hashtab.o hex.o \
- lbasename.o \
- make-temp-file.o \
- objalloc.o obstack.o \
- partition.o pexecute.o \
- safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \
- strsignal.o \
- ternary.o \
- xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
+REQUIRED_OFILES = ./regex.o ./cplus-dem.o ./cp-demangle.o ./cp-demint.o ./md5.o \
+ ./alloca.o ./argv.o \
+ ./choose-temp.o ./concat.o \
+ ./dyn-string.o \
+ ./fdmatch.o ./fibheap.o ./floatformat.o ./fnmatch.o \
+ ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o \
+ ./hashtab.o ./hex.o \
+ ./lbasename.o \
+ ./lrealpath.o \
+ ./make-relative-prefix.o \
+ ./make-temp-file.o \
+ ./objalloc.o ./obstack.o \
+ ./partition.o ./physmem.o @pexecute@ \
+ ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o \
+ ./strsignal.o \
+ ./ternary.o \
+ ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o
# These are all the objects that configure may add to the library via
# $funcs or EXTRA_OFILES. This list exists here only for "make
# maint-missing" and "make check".
-CONFIGURED_OFILES = asprintf.o atexit.o \
- basename.o bcmp.o bcopy.o bsearch.o bzero.o \
- calloc.o clock.o copysign.o \
- _doprnt.o \
- ffs.o \
- getcwd.o getpagesize.o \
- index.o insque.o \
- memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \
- putenv.o \
- random.o rename.o rindex.o \
- setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
- strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
- strtoul.o \
- tmpnam.o \
- vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \
- waitpid.o
+CONFIGURED_OFILES = ./asprintf.o ./atexit.o \
+ ./basename.o ./bcmp.o ./bcopy.o ./bsearch.o ./bzero.o \
+ ./calloc.o ./clock.o ./copysign.o \
+ ./_doprnt.o \
+ ./ffs.o \
+ ./getcwd.o ./getpagesize.o \
+ ./index.o ./insque.o \
+ ./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o ./memset.o ./mkstemps.o \
+ ./pex-djgpp.o ./pex-mpw.o ./pex-msdos.o ./pex-os2.o \
+ ./pex-unix.o ./pex-win32.o \
+ ./putenv.o \
+ ./random.o ./rename.o ./rindex.o \
+ ./setenv.o ./sigsetmask.o ./snprintf.o ./stpcpy.o ./stpncpy.o ./strcasecmp.o \
+ ./strchr.o ./strdup.o ./strncasecmp.o ./strncmp.o ./strrchr.o ./strstr.o \
+ ./strtod.o ./strtol.o ./strtoul.o \
+ ./tmpnam.o \
+ ./vasprintf.o ./vfork.o ./vfprintf.o ./vprintf.o ./vsnprintf.o ./vsprintf.o \
+ ./waitpid.o
# These files are installed if the library has been configured to do so.
INSTALLED_HEADERS = \
@@ -237,7 +247,7 @@ TEXISRC = \
# Additional files that have texi snippets that need to be collected
# and sorted. Some are here because the sources are imported from
# elsewhere. Others represent headers in ../include.
-TEXIFILES = fnmatch.txh
+TEXIFILES = fnmatch.txh pexecute.txh
libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
$(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
@@ -259,6 +269,7 @@ INSTALL_DEST = @INSTALL_DEST@
install: install_to_$(INSTALL_DEST) install-subdir
install_to_libdir: all
+ ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
@@ -274,10 +285,16 @@ install_to_libdir: all
fi
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
+# This is tricky. Even though CC in the Makefile contains
+# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
+# default multilib, so we have to take LIBCFLAGS into account as well,
+# since it will be passed the multilib flags.
+MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
install_to_tooldir: all
- $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
- ( cd $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
- mv -f $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
+ ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)
+ $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n
+ ( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; $(RANLIB) $(TARGETLIB)n )
+ mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
# needed-list is used by libstdc++. NEEDED is the list of functions
@@ -358,7 +375,7 @@ clean: clean-subdir
distclean: distclean-subdir
$(MAKE) SUBDIRS="" clean
@$(MULTICLEAN) multi-clean DO=distclean
- -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
+ -rm -f *~ Makefile config.cache config.status xhost-mkfrag TAGS multilib.out
-rm -f config.log
-rmdir testsuite 2>/dev/null
maintainer-clean realclean: maintainer-clean-subdir
@@ -372,8 +389,8 @@ Makefile: $(srcdir)/Makefile.in config.status
# Depending on Makefile makes sure that config.status has been re-run
# if needed. This prevents problems with parallel builds.
config.h: stamp-h ; @true
-stamp-h: config.in config.status Makefile
- CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
+stamp-h: $(srcdir)/config.in config.status Makefile
+ CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
config.status: $(srcdir)/configure $(srcdir)/config.table
$(SHELL) ./config.status --recheck
@@ -388,7 +405,7 @@ maintainer-clean-subdir: config.h
@subdirs='$(SUBDIRS)'; \
target=`echo $@ | sed -e 's/-subdir//'`; \
for dir in $$subdirs ; do \
- cd $$dir && $(MAKE) $$target; \
+ cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $$target; \
done
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
@@ -397,87 +414,643 @@ $(CONFIGURED_OFILES): stamp-picdir
# The dependencies in the remainder of this file are automatically
# generated by "make maint-deps". Manual edits will be lost.
-_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-atexit.o: config.h
-basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+./_doprnt.o: $(srcdir)/_doprnt.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/_doprnt.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
+
+./alloca.o: $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/alloca.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION)
+
+./argv.o: $(srcdir)/argv.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/argv.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION)
+
+./asprintf.o: $(srcdir)/asprintf.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/asprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/asprintf.c $(OUTPUT_OPTION)
+
+./atexit.o: $(srcdir)/atexit.c config.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/atexit.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/atexit.c $(OUTPUT_OPTION)
+
+./basename.o: $(srcdir)/basename.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
-bsearch.o: config.h $(INCDIR)/ansidecl.h
-calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-clock.o: config.h
-concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-copysign.o: $(INCDIR)/ansidecl.h
-cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/basename.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/basename.c $(OUTPUT_OPTION)
+
+./bcmp.o: $(srcdir)/bcmp.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/bcmp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/bcmp.c $(OUTPUT_OPTION)
+
+./bcopy.o: $(srcdir)/bcopy.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/bcopy.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/bcopy.c $(OUTPUT_OPTION)
+
+./bsearch.o: $(srcdir)/bsearch.c config.h $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/bsearch.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/bsearch.c $(OUTPUT_OPTION)
+
+./bzero.o: $(srcdir)/bzero.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/bzero.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/bzero.c $(OUTPUT_OPTION)
+
+./calloc.o: $(srcdir)/calloc.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/calloc.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/calloc.c $(OUTPUT_OPTION)
+
+./choose-temp.o: $(srcdir)/choose-temp.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/choose-temp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/choose-temp.c $(OUTPUT_OPTION)
+
+./clock.o: $(srcdir)/clock.c config.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/clock.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/clock.c $(OUTPUT_OPTION)
+
+./concat.o: $(srcdir)/concat.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/concat.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/concat.c $(OUTPUT_OPTION)
+
+./copysign.o: $(srcdir)/copysign.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/copysign.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/copysign.c $(OUTPUT_OPTION)
+
+./cp-demangle.o: $(srcdir)/cp-demangle.c config.h $(INCDIR)/ansidecl.h \
+ $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \
$(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
-cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
- $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
-dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demangle.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/cp-demangle.c $(OUTPUT_OPTION)
+
+./cp-demint.o: $(srcdir)/cp-demint.c config.h $(INCDIR)/ansidecl.h \
+ $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demint.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/cp-demint.c $(OUTPUT_OPTION)
+
+./cplus-dem.o: $(srcdir)/cplus-dem.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/cplus-dem.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/cplus-dem.c $(OUTPUT_OPTION)
+
+./dyn-string.o: $(srcdir)/dyn-string.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/dyn-string.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/dyn-string.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/dyn-string.c $(OUTPUT_OPTION)
+
+./fdmatch.o: $(srcdir)/fdmatch.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/fdmatch.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/fdmatch.c $(OUTPUT_OPTION)
+
+./ffs.o: $(srcdir)/ffs.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/ffs.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/ffs.c $(OUTPUT_OPTION)
+
+./fibheap.o: $(srcdir)/fibheap.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/fibheap.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/fibheap.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)
+
+./floatformat.o: $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/floatformat.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/floatformat.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/floatformat.c $(OUTPUT_OPTION)
+
+./fnmatch.o: $(srcdir)/fnmatch.c config.h $(INCDIR)/fnmatch.h \
+ $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/fnmatch.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/fnmatch.c $(OUTPUT_OPTION)
+
+./getcwd.o: $(srcdir)/getcwd.c config.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getcwd.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getcwd.c $(OUTPUT_OPTION)
+
+./getopt.o: $(srcdir)/getopt.c config.h $(INCDIR)/getopt.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getopt.c $(OUTPUT_OPTION)
+
+./getopt1.o: $(srcdir)/getopt1.c config.h $(INCDIR)/getopt.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt1.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getopt1.c $(OUTPUT_OPTION)
+
+./getpagesize.o: $(srcdir)/getpagesize.c config.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getpagesize.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getpagesize.c $(OUTPUT_OPTION)
+
+./getpwd.o: $(srcdir)/getpwd.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getpwd.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getpwd.c $(OUTPUT_OPTION)
+
+./getruntime.o: $(srcdir)/getruntime.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
-fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/getruntime.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION)
+
+./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/hashtab.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION)
+
+./hex.o: $(srcdir)/hex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/hex.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/hex.c $(OUTPUT_OPTION)
+
+./index.o: $(srcdir)/index.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/index.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/index.c $(OUTPUT_OPTION)
+
+./insque.o: $(srcdir)/insque.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/insque.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/insque.c $(OUTPUT_OPTION)
+
+./lbasename.o: $(srcdir)/lbasename.c $(INCDIR)/ansidecl.h $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/lbasename.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/lbasename.c $(OUTPUT_OPTION)
+
+./lrealpath.o: $(srcdir)/lrealpath.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
-floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h
-fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
-getcwd.o: config.h
-getopt.o: config.h $(INCDIR)/getopt.h
-getopt1.o: config.h $(INCDIR)/getopt.h
-getpagesize.o: config.h
-getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/lrealpath.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/lrealpath.c $(OUTPUT_OPTION)
+
+./make-relative-prefix.o: $(srcdir)/make-relative-prefix.c config.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/make-relative-prefix.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/make-relative-prefix.c $(OUTPUT_OPTION)
+
+./make-temp-file.o: $(srcdir)/make-temp-file.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
-hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/make-temp-file.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/make-temp-file.c $(OUTPUT_OPTION)
+
+./md5.o: $(srcdir)/md5.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/md5.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/md5.c $(OUTPUT_OPTION)
+
+./memchr.o: $(srcdir)/memchr.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/memchr.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/memchr.c $(OUTPUT_OPTION)
+
+./memcmp.o: $(srcdir)/memcmp.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/memcmp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/memcmp.c $(OUTPUT_OPTION)
+
+./memcpy.o: $(srcdir)/memcpy.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/memcpy.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/memcpy.c $(OUTPUT_OPTION)
+
+./memmove.o: $(srcdir)/memmove.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/memmove.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/memmove.c $(OUTPUT_OPTION)
+
+./mempcpy.o: $(srcdir)/mempcpy.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/mempcpy.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/mempcpy.c $(OUTPUT_OPTION)
+
+./memset.o: $(srcdir)/memset.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/memset.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/memset.c $(OUTPUT_OPTION)
+
+./mkstemps.o: $(srcdir)/mkstemps.c config.h $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/mkstemps.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/mkstemps.c $(OUTPUT_OPTION)
+
+./mpw.o: $(srcdir)/mpw.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/mpw.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/mpw.c $(OUTPUT_OPTION)
+
+./msdos.o: $(srcdir)/msdos.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/msdos.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/msdos.c $(OUTPUT_OPTION)
+
+./objalloc.o: $(srcdir)/objalloc.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/objalloc.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/objalloc.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/objalloc.c $(OUTPUT_OPTION)
+
+./obstack.o: $(srcdir)/obstack.c config.h $(INCDIR)/obstack.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/obstack.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/obstack.c $(OUTPUT_OPTION)
+
+./partition.o: $(srcdir)/partition.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/partition.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/partition.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/partition.c $(OUTPUT_OPTION)
+
+./pex-djgpp.o: $(srcdir)/pex-djgpp.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-djgpp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION)
+
+./pex-mpw.o: $(srcdir)/pex-mpw.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-mpw.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-mpw.c $(OUTPUT_OPTION)
+
+./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h \
$(INCDIR)/safe-ctype.h
-make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
-memchr.o: $(INCDIR)/ansidecl.h
-memcmp.o: $(INCDIR)/ansidecl.h
-memcpy.o: $(INCDIR)/ansidecl.h
-memmove.o: $(INCDIR)/ansidecl.h
-memset.o: $(INCDIR)/ansidecl.h
-mkstemps.o: config.h $(INCDIR)/ansidecl.h
-objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
-obstack.o: config.h $(INCDIR)/obstack.h
-partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/partition.h
-pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-msdos.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-msdos.c $(OUTPUT_OPTION)
+
+./pex-os2.o: $(srcdir)/pex-os2.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-os2.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-os2.c $(OUTPUT_OPTION)
+
+./pex-unix.o: $(srcdir)/pex-unix.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-unix.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-unix.c $(OUTPUT_OPTION)
+
+./pex-win32.o: $(srcdir)/pex-win32.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION)
+
+./physmem.o: $(srcdir)/physmem.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/physmem.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/physmem.c $(OUTPUT_OPTION)
+
+./putenv.o: $(srcdir)/putenv.c config.h $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/putenv.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/putenv.c $(OUTPUT_OPTION)
+
+./random.o: $(srcdir)/random.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/random.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/random.c $(OUTPUT_OPTION)
+
+./regex.o: $(srcdir)/regex.c config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/regex.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/regex.c $(OUTPUT_OPTION)
+
+./rename.o: $(srcdir)/rename.c config.h $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/rename.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/rename.c $(OUTPUT_OPTION)
+
+./rindex.o: $(srcdir)/rindex.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/rindex.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/rindex.c $(OUTPUT_OPTION)
+
+./safe-ctype.o: $(srcdir)/safe-ctype.c $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h
-putenv.o: config.h $(INCDIR)/ansidecl.h
-random.o: $(INCDIR)/ansidecl.h
-regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
-rename.o: config.h
-safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-setenv.o: config.h $(INCDIR)/ansidecl.h
-sigsetmask.o: $(INCDIR)/ansidecl.h
-sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/safe-ctype.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/safe-ctype.c $(OUTPUT_OPTION)
+
+./setenv.o: $(srcdir)/setenv.c config.h $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/setenv.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION)
+
+./sigsetmask.o: $(srcdir)/sigsetmask.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/sigsetmask.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/sigsetmask.c $(OUTPUT_OPTION)
+
+./snprintf.o: $(srcdir)/snprintf.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/snprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/snprintf.c $(OUTPUT_OPTION)
+
+./sort.o: $(srcdir)/sort.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/sort.h
-spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/splay-tree.h
-strcasecmp.o: $(INCDIR)/ansidecl.h
-strchr.o: $(INCDIR)/ansidecl.h
-strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-strncasecmp.o: $(INCDIR)/ansidecl.h
-strncmp.o: $(INCDIR)/ansidecl.h
-strrchr.o: $(INCDIR)/ansidecl.h
-strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-strtol.o: config.h $(INCDIR)/safe-ctype.h
-strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
-ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ternary.h
-vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-vfork.o: $(INCDIR)/ansidecl.h
-vprintf.o: $(INCDIR)/ansidecl.h
-vsprintf.o: $(INCDIR)/ansidecl.h
-waitpid.o: config.h
-xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/sort.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/sort.c $(OUTPUT_OPTION)
+
+./spaces.o: $(srcdir)/spaces.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/spaces.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION)
+
+./splay-tree.o: $(srcdir)/splay-tree.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/splay-tree.c $(OUTPUT_OPTION)
+
+./stpcpy.o: $(srcdir)/stpcpy.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/stpcpy.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/stpcpy.c $(OUTPUT_OPTION)
+
+./stpncpy.o: $(srcdir)/stpncpy.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/stpncpy.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/stpncpy.c $(OUTPUT_OPTION)
+
+./strcasecmp.o: $(srcdir)/strcasecmp.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strcasecmp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strcasecmp.c $(OUTPUT_OPTION)
+
+./strchr.o: $(srcdir)/strchr.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strchr.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strchr.c $(OUTPUT_OPTION)
+
+./strdup.o: $(srcdir)/strdup.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strdup.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strdup.c $(OUTPUT_OPTION)
+
+./strerror.o: $(srcdir)/strerror.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strerror.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strerror.c $(OUTPUT_OPTION)
+
+./strncasecmp.o: $(srcdir)/strncasecmp.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strncasecmp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strncasecmp.c $(OUTPUT_OPTION)
+
+./strncmp.o: $(srcdir)/strncmp.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strncmp.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strncmp.c $(OUTPUT_OPTION)
+
+./strrchr.o: $(srcdir)/strrchr.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strrchr.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strrchr.c $(OUTPUT_OPTION)
+
+./strsignal.o: $(srcdir)/strsignal.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strsignal.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strsignal.c $(OUTPUT_OPTION)
+
+./strstr.o: $(srcdir)/strstr.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strstr.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strstr.c $(OUTPUT_OPTION)
+
+./strtod.o: $(srcdir)/strtod.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtod.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strtod.c $(OUTPUT_OPTION)
+
+./strtol.o: $(srcdir)/strtol.c config.h $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtol.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strtol.c $(OUTPUT_OPTION)
+
+./strtoul.o: $(srcdir)/strtoul.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/safe-ctype.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/strtoul.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/strtoul.c $(OUTPUT_OPTION)
+
+./ternary.o: $(srcdir)/ternary.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/ternary.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/ternary.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/ternary.c $(OUTPUT_OPTION)
+
+./tmpnam.o: $(srcdir)/tmpnam.c
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/tmpnam.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION)
+
+./vasprintf.o: $(srcdir)/vasprintf.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vasprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vasprintf.c $(OUTPUT_OPTION)
+
+./vfork.o: $(srcdir)/vfork.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vfork.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vfork.c $(OUTPUT_OPTION)
+
+./vfprintf.o: $(srcdir)/vfprintf.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vfprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vfprintf.c $(OUTPUT_OPTION)
+
+./vprintf.o: $(srcdir)/vprintf.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vprintf.c $(OUTPUT_OPTION)
+
+./vsnprintf.o: $(srcdir)/vsnprintf.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vsnprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vsnprintf.c $(OUTPUT_OPTION)
+
+./vsprintf.o: $(srcdir)/vsprintf.c $(INCDIR)/ansidecl.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/vsprintf.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/vsprintf.c $(OUTPUT_OPTION)
+
+./waitpid.o: $(srcdir)/waitpid.c config.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/waitpid.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION)
+
+./xatexit.o: $(srcdir)/xatexit.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xatexit.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xatexit.c $(OUTPUT_OPTION)
+
+./xexit.o: $(srcdir)/xexit.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xexit.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xexit.c $(OUTPUT_OPTION)
+
+./xmalloc.o: $(srcdir)/xmalloc.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xmalloc.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xmalloc.c $(OUTPUT_OPTION)
+
+./xmemdup.o: $(srcdir)/xmemdup.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xmemdup.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xmemdup.c $(OUTPUT_OPTION)
+
+./xstrdup.o: $(srcdir)/xstrdup.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrdup.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xstrdup.c $(OUTPUT_OPTION)
+
+./xstrerror.o: $(srcdir)/xstrerror.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrerror.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION)
+
diff --git a/contrib/binutils/libiberty/README b/contrib/binutils/libiberty/README
index 9f5226a..886bd67 100644
--- a/contrib/binutils/libiberty/README
+++ b/contrib/binutils/libiberty/README
@@ -15,7 +15,8 @@ The library must be configured from the top source directory. Don't
try to run configure in this directory. Follow the configuration
instructions in ../README.
-Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you.
+Please report bugs to "gcc-bugs@gcc.gnu.org" and send fixes to
+"gcc-patches@gcc.gnu.org". Thank you.
ADDING A NEW FILE
=================
@@ -33,7 +34,7 @@ name of the function must be the same as the name of the file.
* Add the source file name to CFILES.
* Add the function to name to the funcs shell variable in
- configure.in.
+ configure.ac.
* Add the function to the AC_CHECK_FUNCS lists just after the
setting of the funcs shell variable. These AC_CHECK_FUNCS calls
diff --git a/contrib/binutils/libiberty/aclocal.m4 b/contrib/binutils/libiberty/aclocal.m4
index 103e246..f33e0c6 100644
--- a/contrib/binutils/libiberty/aclocal.m4
+++ b/contrib/binutils/libiberty/aclocal.m4
@@ -1,3 +1,7 @@
+sinclude(../config/accross.m4)
+sinclude(../config/acx.m4)
+sinclude(../config/no-executables.m4)
+
dnl See whether strncmp reads past the end of its string parameters.
dnl On some versions of SunOS4 at least, strncmp reads a word at a time
dnl but erroneously reads past the end of strings. This can cause
@@ -69,7 +73,7 @@ main ()
ac_cv_func_strncmp_works=no)
rm -f core core.* *.core])
if test $ac_cv_func_strncmp_works = no ; then
- LIBOBJS="$LIBOBJS strncmp.o"
+ AC_LIBOBJ([strncmp])
fi
])
@@ -87,47 +91,34 @@ then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
fi
])
-# FIXME: We temporarily define our own version of AC_PROG_CC. This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable. This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_PROVIDE([AC_PROG_CC])
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- ac_libiberty_warn_cflags=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+dnl See whether we need a declaration for a function.
+AC_DEFUN(libiberty_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include "confdefs.h"
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif],
+[char *(*pfn) = (char *(*)) $1],
+libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
+AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
+if test $libiberty_cv_decl_needed_$1 = yes; then
+ AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
+ [Define if $1 is not declared in system header files.])
fi
-AC_SUBST(ac_libiberty_warn_cflags)
-])
+])dnl
# Work around a bug in autoheader. This can go away when we switch to
# autoconf >2.50. The use of define instead of AC_DEFUN is
@@ -189,3 +180,52 @@ AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown])
])
+
+# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select. Similarly for bzero.
+#
+# This test used to merely assign f=$1 in main(), but that was
+# optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
+# presumably on the basis that there's no need to do that store if the
+# program is about to exit. Conversely, the AIX linker optimizes an
+# unused external declaration that initializes f=$1. So this test
+# program has both an external initialization of f, and a use of f in
+# main that affects the exit status.
+#
+m4_define([AC_LANG_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $1 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $1 ();
+/* 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_$1) || defined (__stub___$1)
+choke me
+#else
+char (*f) () = $1;
+#endif
+#ifdef __cplusplus
+}
+#endif
+], [return f != $1;])])
+
diff --git a/contrib/binutils/libiberty/argv.c b/contrib/binutils/libiberty/argv.c
index 4205579..31d8ef5 100644
--- a/contrib/binutils/libiberty/argv.c
+++ b/contrib/binutils/libiberty/argv.c
@@ -29,13 +29,13 @@ Boston, MA 02111-1307, USA. */
/* Routines imported from standard C runtime libraries. */
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
-#else /* !__STDC__ */
+#else /* !ANSI_PROTOTYPES */
#if !defined _WIN32 || defined __GNUC__
extern char *memcpy (); /* Copy memory region */
@@ -46,7 +46,7 @@ extern void free (); /* Free malloc'd memory */
extern char *strdup (); /* Duplicate a string */
#endif
-#endif /* __STDC__ */
+#endif /* ANSI_PROTOTYPES */
#ifndef NULL
diff --git a/contrib/binutils/libiberty/asprintf.c b/contrib/binutils/libiberty/asprintf.c
index 5de7756..cd0543a 100644
--- a/contrib/binutils/libiberty/asprintf.c
+++ b/contrib/binutils/libiberty/asprintf.c
@@ -1,6 +1,6 @@
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of the libiberty library.
@@ -37,7 +37,7 @@ pass a pointer to a pointer. This function will compute the size of
the buffer needed, allocate memory with @code{malloc}, and store a
pointer to the allocated memory in @code{*@var{resptr}}. The value
returned is the same as @code{sprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
+not be allocated, minus one is returned and @code{NULL} is stored in
@code{*@var{resptr}}.
@end deftypefn
diff --git a/contrib/binutils/libiberty/calloc.c b/contrib/binutils/libiberty/calloc.c
index b342f6c..5073682 100644
--- a/contrib/binutils/libiberty/calloc.c
+++ b/contrib/binutils/libiberty/calloc.c
@@ -13,8 +13,6 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of
*/
#include "ansidecl.h"
-#include "libiberty.h"
-
#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
@@ -23,6 +21,7 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of
/* For systems with larger pointers than ints, this must be declared. */
PTR malloc PARAMS ((size_t));
+void bzero PARAMS ((PTR, size_t));
PTR
calloc (nelem, elsize)
diff --git a/contrib/binutils/libiberty/config.in b/contrib/binutils/libiberty/config.in
index e06bbce..8e5071a 100644
--- a/contrib/binutils/libiberty/config.in
+++ b/contrib/binutils/libiberty/config.in
@@ -1,254 +1,376 @@
-/* config.in. Generated automatically from configure.in by autoheader 2.13. */
+/* config.in. Generated from configure.ac by autoheader. */
+/* Define to `unsigned long' if <sys/types.h> doesn't define. */
+#undef uintptr_t
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have <vfork.h>. */
-#undef HAVE_VFORK_H
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef pid_t
-
-/* Define if you need to in order for stat and other things to work. */
-#undef _POSIX_SOURCE
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#undef BYTEORDER
-/* Define vfork as fork if vfork does not work. */
-#undef vfork
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
-/* Define if you have the _doprnt function. */
-#undef HAVE__DOPRNT
+/* Define to 1 if you have the <alloca.h> header file. */
+#undef HAVE_ALLOCA_H
-/* Define if you have the asprintf function. */
+/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
-/* Define if you have the atexit function. */
+/* Define to 1 if you have the `atexit' function. */
#undef HAVE_ATEXIT
-/* Define if you have the basename function. */
+/* Define to 1 if you have the `basename' function. */
#undef HAVE_BASENAME
-/* Define if you have the bcmp function. */
+/* Define to 1 if you have the `bcmp' function. */
#undef HAVE_BCMP
-/* Define if you have the bcopy function. */
+/* Define to 1 if you have the `bcopy' function. */
#undef HAVE_BCOPY
-/* Define if you have the bsearch function. */
+/* Define to 1 if you have the `bsearch' function. */
#undef HAVE_BSEARCH
-/* Define if you have the bzero function. */
+/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
-/* Define if you have the calloc function. */
+/* Define to 1 if you have the `calloc' function. */
#undef HAVE_CALLOC
-/* Define if you have the clock function. */
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
+/* Define to 1 if you have the `clock' function. */
#undef HAVE_CLOCK
-/* Define if you have the ffs function. */
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `ffs' function. */
#undef HAVE_FFS
-/* Define if you have the getcwd function. */
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
-/* Define if you have the getpagesize function. */
+/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
-/* Define if you have the getrusage function. */
+/* Define to 1 if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
-/* Define if you have the gettimeofday function. */
+/* Define to 1 if you have the `getsysinfo' function. */
+#undef HAVE_GETSYSINFO
+
+/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
-/* Define if you have the index function. */
+/* Define to 1 if you have the `index' function. */
#undef HAVE_INDEX
-/* Define if you have the insque function. */
+/* Define to 1 if you have the `insque' function. */
#undef HAVE_INSQUE
-/* Define if you have the memchr function. */
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <machine/hal_sysinfo.h> header file. */
+#undef HAVE_MACHINE_HAL_SYSINFO_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the `memchr' function. */
#undef HAVE_MEMCHR
-/* Define if you have the memcmp function. */
+/* Define to 1 if you have the `memcmp' function. */
#undef HAVE_MEMCMP
-/* Define if you have the memcpy function. */
+/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
-/* Define if you have the memmove function. */
+/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
-/* Define if you have the memset function. */
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mempcpy' function. */
+#undef HAVE_MEMPCPY
+
+/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
-/* Define if you have the mkstemps function. */
+/* Define to 1 if you have the `mkstemps' function. */
#undef HAVE_MKSTEMPS
-/* Define if you have the on_exit function. */
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `on_exit' function. */
#undef HAVE_ON_EXIT
-/* Define if you have the psignal function. */
+/* Define to 1 if you have the `psignal' function. */
#undef HAVE_PSIGNAL
-/* Define if you have the putenv function. */
+/* Define to 1 if you have the `pstat_getdynamic' function. */
+#undef HAVE_PSTAT_GETDYNAMIC
+
+/* Define to 1 if you have the `pstat_getstatic' function. */
+#undef HAVE_PSTAT_GETSTATIC
+
+/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV
-/* Define if you have the random function. */
+/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
-/* Define if you have the rename function. */
+/* Define to 1 if you have the `realpath' function. */
+#undef HAVE_REALPATH
+
+/* Define to 1 if you have the `rename' function. */
#undef HAVE_RENAME
-/* Define if you have the rindex function. */
+/* Define to 1 if you have the `rindex' function. */
#undef HAVE_RINDEX
-/* Define if you have the sbrk function. */
+/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
-/* Define if you have the setenv function. */
+/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
-/* Define if you have the sigsetmask function. */
+/* Define to 1 if you have the `sigsetmask' function. */
#undef HAVE_SIGSETMASK
-/* Define if you have the strcasecmp function. */
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* 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 `stpcpy' function. */
+#undef HAVE_STPCPY
+
+/* Define to 1 if you have the `stpncpy' function. */
+#undef HAVE_STPNCPY
+
+/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
-/* Define if you have the strchr function. */
+/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
-/* Define if you have the strdup function. */
+/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
-/* Define if you have the strerror function. */
+/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
-/* Define if you have the strncasecmp function. */
+/* 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 `strncasecmp' function. */
#undef HAVE_STRNCASECMP
-/* Define if you have the strrchr function. */
+/* Define to 1 if you have the `strrchr' function. */
#undef HAVE_STRRCHR
-/* Define if you have the strsignal function. */
+/* Define to 1 if you have the `strsignal' function. */
#undef HAVE_STRSIGNAL
-/* Define if you have the strstr function. */
+/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
-/* Define if you have the strtod function. */
+/* Define to 1 if you have the `strtod' function. */
#undef HAVE_STRTOD
-/* Define if you have the strtol function. */
+/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
-/* Define if you have the strtoul function. */
+/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
-/* Define if you have the sysconf function. */
+/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
-/* Define if you have the times function. */
+/* Define to 1 if you have the `sysctl' function. */
+#undef HAVE_SYSCTL
+
+/* Define to 1 if you have the `sysmp' function. */
+#undef HAVE_SYSMP
+
+/* Define if you have the sys_errlist variable. */
+#undef HAVE_SYS_ERRLIST
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define if you have the sys_nerr variable. */
+#undef HAVE_SYS_NERR
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/pstat.h> header file. */
+#undef HAVE_SYS_PSTAT_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define if you have the sys_siglist variable. */
+#undef HAVE_SYS_SIGLIST
+
+/* 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/sysctl.h> header file. */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define to 1 if you have the <sys/sysinfo.h> header file. */
+#undef HAVE_SYS_SYSINFO_H
+
+/* Define to 1 if you have the <sys/sysmp.h> header file. */
+#undef HAVE_SYS_SYSMP_H
+
+/* Define to 1 if you have the <sys/systemcfg.h> header file. */
+#undef HAVE_SYS_SYSTEMCFG_H
+
+/* Define to 1 if you have the <sys/table.h> header file. */
+#undef HAVE_SYS_TABLE_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the `table' function. */
+#undef HAVE_TABLE
+
+/* Define to 1 if you have the `times' function. */
#undef HAVE_TIMES
-/* Define if you have the tmpnam function. */
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the `tmpnam' function. */
#undef HAVE_TMPNAM
-/* Define if you have the vasprintf function. */
+/* Define if you have the \`uintptr_t' type. */
+#undef HAVE_UINTPTR_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
-/* Define if you have the vfprintf function. */
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the `vfprintf' function. */
#undef HAVE_VFPRINTF
-/* Define if you have the vprintf function. */
+/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
-/* Define if you have the vsprintf function. */
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF
-/* Define if you have the waitpid function. */
+/* Define to 1 if you have the `waitpid' function. */
#undef HAVE_WAITPID
-/* Define if you have the <alloca.h> header file. */
-#undef HAVE_ALLOCA_H
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
+/* Define to 1 if you have the `_doprnt' function. */
+#undef HAVE__DOPRNT
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
+/* Define if you have the _system_configuration variable. */
+#undef HAVE__SYSTEM_CONFIGURATION
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
+/* Define if the host machine stores words of multi-word integers in
+ big-endian order. */
+#undef HOST_WORDS_BIG_ENDIAN
-/* Define if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
+/* Define if canonicalize_file_name is not declared in system header files. */
+#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
+/* Define if errno must be declared even when <errno.h> is included. */
+#undef NEED_DECLARATION_ERRNO
-/* Define if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
-/* Define if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
-/* Define if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
-/* Define if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
-/* Define if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
-/* Define if you have the <time.h> header file. */
-#undef HAVE_TIME_H
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
+/* Define if you know the direction of stack growth for your system; otherwise
+ it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows
+ toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
-/* Define if errno must be declared even when <errno.h> is included. */
-#undef NEED_DECLARATION_ERRNO
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
-/* Define if you have the `uintptr_t' type. */
-#undef HAVE_UINTPTR_T
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
-/* Define if you have the sys_errlist variable. */
-#undef HAVE_SYS_ERRLIST
+/* whether byteorder is bigendian */
+#undef WORDS_BIGENDIAN
-/* Define if you have the sys_nerr variable. */
-#undef HAVE_SYS_NERR
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
-/* Define if you have the sys_siglist variable. */
-#undef HAVE_SYS_SIGLIST
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+#undef inline
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
- systems. This function is required for alloca.c support on those
- systems. */
-#undef CRAY_STACKSEG_END
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
-/* Define if you know the direction of stack growth for your system;
- otherwise it will be automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#undef uintptr_t
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/contrib/binutils/libiberty/config.table b/contrib/binutils/libiberty/config.table
index df48ce9..1867cfea 100644
--- a/contrib/binutils/libiberty/config.table
+++ b/contrib/binutils/libiberty/config.table
@@ -11,7 +11,7 @@ case "${host}" in
*-*-freebsd2.1.*) frag=mh-fbsd21 ;;
*-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
i370-*-opened*) frag=mh-openedition ;;
- i[345]86-*-windows*) frag=mh-windows ;;
+ i[34567]86-*-windows*) frag=mh-windows ;;
esac
if [ -n "${frag}" ]; then
@@ -34,7 +34,7 @@ if [ "${shared}" = "yes" ]; then
alpha*-*-linux*) frag=mh-elfalphapic ;;
arm*-*-*) frag=mh-armpic ;;
hppa*-*-*) frag=mh-papic ;;
- i[3456]86-*-* | x86_64-*-*)
+ i[34567]86-*-* | x86_64-*-*)
frag=mh-x86pic ;;
powerpc*-*-aix*) ;;
powerpc*-*-*) frag=mh-ppcpic ;;
diff --git a/contrib/binutils/libiberty/configure b/contrib/binutils/libiberty/configure
index cac9f56..2f65976 100755
--- a/contrib/binutils/libiberty/configure
+++ b/contrib/binutils/libiberty/configure
@@ -1,40 +1,324 @@
#! /bin/sh
-
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.57.
#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# 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 Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; 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
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ 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
+
+ ;;
+ 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
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); 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 sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
-# Defaults:
-ac_help=
+
+# 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`
+
+exec 6>&1
+
+#
+# Initializations.
+#
ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-target-subdir=SUBDIR Configuring in a subdirectory for target"
-ac_help="$ac_help
- --with-build-subdir=SUBDIR Configuring in a subdirectory for build"
-ac_help="$ac_help
- --with-cross-host=HOST Configuring with a cross compiler"
-ac_help="$ac_help
- --with-newlib Configuring with newlib"
-ac_help="$ac_help
- --enable-maintainer-mode
- enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer"
-ac_help="$ac_help
- --enable-install-libiberty Install headers for end users"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="xmalloc.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libiberty_topdir MAINT NOTMAINT MAKEINFO BUILD_INFO PERL HAVE_PERL build build_cpu build_vendor build_os host host_cpu host_vendor host_os AR ac_ct_AR RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP ac_libiberty_warn_cflags NO_MINUS_C_MINUS_O OUTPUT_OPTION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP LIBOBJS CHECK target_header_dir pexecute INSTALL_DEST LTLIBOBJS'
+ac_subst_files='host_makefile_frag'
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -43,10 +327,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
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.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -60,17 +349,9 @@ oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
ac_prev=
for ac_option
do
-
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
@@ -78,59 +359,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ 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" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -139,95 +420,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
- -help | --help | --hel | --he)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
+ -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 ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$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" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ 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" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -236,19 +469,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ 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)
+ | --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -262,26 +495,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ 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_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_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -298,7 +531,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -308,7 +541,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -319,58 +552,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ 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" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -381,99 +613,110 @@ EOF
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_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" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ 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
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
done
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+# 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
+ 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
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=pexecute.c
# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ 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=..
@@ -483,13 +726,442 @@ else
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# 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 this package 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 \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+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]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --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]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_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]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode
+ enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --enable-install-libiberty Install headers for end users
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-target-subdir=SUBDIR Configuring in a subdirectory for target
+ --with-build-subdir=SUBDIR Configuring in a subdirectory for build
+ --with-cross-host=HOST Configuring with a cross compiler
+ --with-newlib Configuring with newlib
+
+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>
+ CPPFLAGS C/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.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style 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
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+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 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+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`
+hostinfo = `(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=.
+ echo "PATH: $as_dir"
+done
+
+} >&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_sep=
+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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$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
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+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,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core core.* *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >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
+
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -500,39 +1172,103 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+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
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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 `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`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.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
fi
ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -542,30 +1278,30 @@ fi
# exported. We don't use libtool yet, but some day we might, so...
ORIGINAL_LD_FOR_MULTILIBS=$LD
+
# Check whether --with-target-subdir or --without-target-subdir was given.
if test "${with_target_subdir+set}" = set; then
withval="$with_target_subdir"
- :
-fi
+
+fi;
# Check whether --with-build-subdir or --without-build-subdir was given.
if test "${with_build_subdir+set}" = set; then
withval="$with_build_subdir"
- :
-fi
+
+fi;
# Check whether --with-cross-host or --without-cross-host was given.
if test "${with_cross_host+set}" = set; then
withval="$with_cross_host"
- :
-fi
+
+fi;
# Check whether --with-newlib or --without-newlib was given.
if test "${with_newlib+set}" = set; then
withval="$with_newlib"
- :
-fi
+fi;
if test "${srcdir}" = "."; then
if test -n "${with_build_subdir}"; then
@@ -583,6 +1319,7 @@ if test "${srcdir}" = "."; then
else
libiberty_topdir="${srcdir}/.."
fi
+
ac_aux_dir=
for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do
if test -f $ac_dir/install-sh; then
@@ -593,29 +1330,35 @@ for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
fi
done
if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; }
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" >&2;}
+ { (exit 1); exit 1; }; }
fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:609: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
maintainer_mode=$enableval
else
maintainer_mode=no
-fi
+fi;
-
-echo "$ac_t""$maintainer_mode" 1>&6
+echo "$as_me:$LINENO: result: $maintainer_mode" >&5
+echo "${ECHO_T}$maintainer_mode" >&6
if test "$maintainer_mode" = "yes"; then
MAINT=''
@@ -629,31 +1372,37 @@ fi
# rely on it - libiberty is built before texinfo.
# Extract the first word of "makeinfo", so it can be a program name with args.
set dummy makeinfo; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:634: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MAKEINFO+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$MAKEINFO"; then
ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_MAKEINFO="makeinfo"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MAKEINFO="makeinfo"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-MAKEINFO="$ac_cv_prog_MAKEINFO"
+MAKEINFO=$ac_cv_prog_MAKEINFO
if test -n "$MAKEINFO"; then
- echo "$ac_t""$MAKEINFO" 1>&6
+ echo "$as_me:$LINENO: result: $MAKEINFO" >&5
+echo "${ECHO_T}$MAKEINFO" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
if test "x$MAKEINFO" = "x"; then
@@ -661,12 +1410,25 @@ if test "x$MAKEINFO" = "x"; then
BUILD_INFO=
else
BUILD_INFO=info
- case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
- x*\ [1-3].* )
- MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
+ case "$MAKEINFO" in
+ */missing\ makeinfo*)
BUILD_INFO=
- echo "configure: warning:
-*** Makeinfo is too old. Info documentation will not be built." 1>&2
+ { echo "$as_me:$LINENO: WARNING:
+*** Makeinfo is missing. Info documentation will not be built." >&5
+echo "$as_me: WARNING:
+*** Makeinfo is missing. Info documentation will not be built." >&2;}
+ ;;
+ *)
+ case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
+ x*\ [1-3].* )
+ MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
+ BUILD_INFO=
+ { echo "$as_me:$LINENO: WARNING:
+*** Makeinfo is too old. Info documentation will not be built." >&5
+echo "$as_me: WARNING:
+*** Makeinfo is too old. Info documentation will not be built." >&2;}
+ ;;
+ esac
;;
esac
fi
@@ -675,31 +1437,37 @@ fi
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:680: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_PERL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$PERL"; then
ac_cv_prog_PERL="$PERL" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_PERL="perl"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PERL="perl"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-PERL="$ac_cv_prog_PERL"
+PERL=$ac_cv_prog_PERL
if test -n "$PERL"; then
- echo "$ac_t""$PERL" 1>&6
+ echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
if test x"$PERL" = x""; then
@@ -709,324 +1477,1431 @@ else
fi
-
# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:720: checking host system type" >&5
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:743: checking build system type" >&5
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:769: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:801: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
+fi
if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:833: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+ RANLIB=$ac_ct_RANLIB
else
- RANLIB=":"
-fi
+ RANLIB="$ac_cv_prog_RANLIB"
fi
-# Extract the first word of "gcc", so it can be a program name with args.
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:870: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
else
- echo "$ac_t""no" 1>&6
+ CC="$ac_cv_prog_CC"
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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:900: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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 $as_executable_p "$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"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
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 $# -gt 0; then
+ 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:949: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# FIXME: Cleanup?
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.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.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
else
- ac_cv_prog_gcc=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:974: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+fi
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_g=no
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
-rm -f conftest*
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$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
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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;
+}
+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
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext 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
+
+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
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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
+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # 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
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
fi
else
- GCC=
- ac_libiberty_warn_cflags=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ ac_cpp_err=yes
fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ # 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
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+ac_c_preproc_warn_flag=yes
+
+if test x$GCC = xyes; then
+ ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
+fi
if test "x$CC" != xcc; then
- echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
-echo "configure:1006: checking whether $CC and cc understand -c and -o together" >&5
+ echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6
else
- echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
-echo "configure:1009: checking whether cc understands -c and -o together" >&5
+ echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6
fi
-set dummy $CC; ac_cc="`echo $2 |
- sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
-if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+set dummy $CC; ac_cc=`echo $2 |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo 'foo(){}' > conftest.c
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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-cc} -c conftest.c -o conftest.o 1>&5'
-if { (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
- test -f conftest.o && { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); };
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.c 1>&5'; { (eval echo configure:1027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
- ac_try='cc -c conftest.c -o conftest.o 1>&5'
- if { (eval echo configure:1029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
- test -f conftest.o && { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+ if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); };
then
# cc works too.
:
@@ -1043,12 +2918,15 @@ rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "$ac_t""no" 1>&6
- cat >> confdefs.h <<\EOF
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+cat >>confdefs.h <<\_ACEOF
#define NO_MINUS_C_MINUS_O 1
-EOF
+_ACEOF
fi
@@ -1061,147 +2939,362 @@ fi
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1066: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
- echo "$ac_t""yes" 1>&6
- ISC=yes # If later tests want to check for ISC.
- cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
- if test "$GCC" = yes; then
- CC="$CC -posix"
- else
- CC="$CC -Xp"
- fi
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
- ISC=
-fi
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1087: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1092 "configure"
-#include "confdefs.h"
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
+ ;
+ return 0;
}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_const=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
fi
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1162: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
- cat > conftest.$ac_ext <<EOF
-#line 1169 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:1176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_inline=$ac_kw; break
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
done
fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+case $ac_cv_c_inline in
inline | yes) ;;
- no) cat >> confdefs.h <<\EOF
-#define inline
-EOF
+ no)
+cat >>confdefs.h <<\_ACEOF
+#define inline
+_ACEOF
;;
- *) cat >> confdefs.h <<EOF
+ *) cat >>confdefs.h <<_ACEOF
#define inline $ac_cv_c_inline
-EOF
+_ACEOF
;;
esac
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+int
+main ()
+{
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+int
+main ()
+{
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+ echo $ac_n "cross-compiling... " 2>&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+if test $ac_cv_c_bigendian = unknown; then
+echo "$as_me:$LINENO: checking to probe for byte ordering" >&5
+echo $ECHO_N "checking to probe for byte ordering... $ECHO_C" >&6
+
+cat >conftest.c <<EOF
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
+int main() { _ascii (); _ebcdic (); return 0; }
+EOF
+ if test -f conftest.c ; then
+ if ${CC-cc} ${CFLAGS} conftest.c -o conftest.o && test -f conftest.o ; then
+ if test `grep -l BIGenDianSyS conftest.o` ; then
+ echo $ac_n ' big endian probe OK, ' 1>&6
+ ac_cv_c_bigendian=yes
+ fi
+ if test `grep -l LiTTleEnDian conftest.o` ; then
+ echo $ac_n ' little endian probe OK, ' 1>&6
+ if test $ac_cv_c_bigendian = yes ; then
+ ac_cv_c_bigendian=unknown;
+ else
+ ac_cv_c_bigendian=no
+ fi
+ fi
+ echo $ac_n 'guessing bigendian ... ' >&6
+ fi
+ fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+fi
+if test $ac_cv_c_bigendian = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+cat >>confdefs.h <<\_ACEOF
+#define HOST_WORDS_BIG_ENDIAN 1
+_ACEOF
+
+ BYTEORDER=4321
+else
+ BYTEORDER=1234
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define BYTEORDER $BYTEORDER
+_ACEOF
+
+if test $ac_cv_c_bigendian = unknown; then
+ { { echo "$as_me:$LINENO: error: unknown endianess - sorry" >&5
+echo "$as_me: error: unknown endianess - sorry" >&2;}
+ { (exit please pre-set ac_cv_c_bigendian); exit please pre-set ac_cv_c_bigendian; }; }
+fi
+
+ ac_config_headers="$ac_config_headers config.h:config.in"
+
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -1210,60 +3303,73 @@ esac
# 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"
# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1219: checking for a BSD compatible install" >&5
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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/* | \
+ /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 $as_executable_p "$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
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
+ done
+ ;;
+esac
+done
+
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
- INSTALL="$ac_install_sh"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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_PROGRAM}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
@@ -1275,278 +3381,331 @@ host_makefile_frag=${frag}
# It's OK to check for header files. Although the compiler may not be
# able to link anything, it had better be able to at least compile
# something.
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1280: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1295 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1312 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1329 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ ac_cpp_err=yes
fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1363: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1368 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ eval "$as_ac_Header=no"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
done
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1400: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1405 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
-int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-; return 0; }
-EOF
-if { (eval echo configure:1421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_sys_wait_h=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_sys_wait_h=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_sys_wait_h=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
if test $ac_cv_header_sys_wait_h = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_WAIT_H 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1442: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1447 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:1456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_time=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TIME_WITH_SYS_TIME 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
-echo "configure:1478: checking whether errno must be declared" >&5
-if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether errno must be declared" >&5
+echo $ECHO_N "checking whether errno must be declared... $ECHO_C" >&6
+if test "${libiberty_cv_declare_errno+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1483 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <errno.h>
-int main() {
+int
+main ()
+{
int x = errno;
-; return 0; }
-EOF
-if { (eval echo configure:1490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
libiberty_cv_declare_errno=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- libiberty_cv_declare_errno=yes
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libiberty_cv_declare_errno=yes
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$libiberty_cv_declare_errno" 1>&6
+echo "$as_me:$LINENO: result: $libiberty_cv_declare_errno" >&5
+echo "${ECHO_T}$libiberty_cv_declare_errno" >&6
if test $libiberty_cv_declare_errno = yes
-then cat >> confdefs.h <<\EOF
+then
+cat >>confdefs.h <<\_ACEOF
#define NEED_DECLARATION_ERRNO 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1512: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1517 "configure"
-#include "confdefs.h"
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f 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 > conftest.$ac_ext <<EOF
-#line 1542 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
@@ -1555,16 +3714,20 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1560 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+ $EGREP "free" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
@@ -1573,116 +3736,259 @@ 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
+ if test "$cross_compiling" = yes; then
:
else
- cat > conftest.$ac_ext <<EOF
-#line 1581 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#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)) exit(2);
-exit (0); }
+#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
-EOF
-if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+#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))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
-EOF
+_ACEOF
fi
-echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6
-echo "configure:1616: checking for uintptr_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1621 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])uintptr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_uintptr_t=yes
+# 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=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- rm -rf conftest*
- ac_cv_type_uintptr_t=no
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
fi
-echo "$ac_t""$ac_cv_type_uintptr_t" 1>&6
-if test $ac_cv_type_uintptr_t = no; then
- cat >> confdefs.h <<\EOF
-#define uintptr_t unsigned long
-EOF
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
fi
+done
-if test $ac_cv_type_uintptr_t = yes
-then
- cat >> confdefs.h <<\EOF
-#define HAVE_UINTPTR_T 1
-EOF
+echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_uintptr_t=no
fi
-
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1658: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+if test $ac_cv_type_uintptr_t = yes; then
+ :
else
- cat > conftest.$ac_ext <<EOF
-#line 1663 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t unsigned long
+_ACEOF
+
+fi
+
+# Given the above check, we always have uintptr_t or a fallback
+# definition. So define HAVE_UINTPTR_T in case any imported code
+# relies on it.
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((pid_t *) 0)
+ return 0;
+if (sizeof (pid_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_type_pid_t=yes
else
- rm -rf conftest*
- ac_cv_type_pid_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_pid_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
- cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+if test $ac_cv_type_pid_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
#define pid_t int
-EOF
+_ACEOF
fi
@@ -1708,6 +4014,7 @@ funcs="$funcs memchr"
funcs="$funcs memcmp"
funcs="$funcs memcpy"
funcs="$funcs memmove"
+funcs="$funcs mempcpy"
funcs="$funcs memset"
funcs="$funcs mkstemps"
funcs="$funcs putenv"
@@ -1715,7 +4022,10 @@ funcs="$funcs random"
funcs="$funcs rename"
funcs="$funcs rindex"
funcs="$funcs setenv"
+funcs="$funcs snprintf"
funcs="$funcs sigsetmask"
+funcs="$funcs stpcpy"
+funcs="$funcs stpncpy"
funcs="$funcs strcasecmp"
funcs="$funcs strchr"
funcs="$funcs strdup"
@@ -1729,6 +4039,7 @@ funcs="$funcs tmpnam"
funcs="$funcs vasprintf"
funcs="$funcs vfprintf"
funcs="$funcs vprintf"
+funcs="$funcs vsnprintf"
funcs="$funcs vsprintf"
funcs="$funcs waitpid"
@@ -1737,406 +4048,187 @@ funcs="$funcs waitpid"
vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
+checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
+checkfuncs="$checkfuncs getsysinfo table sysctl"
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
if test "x" = "y"; then
- for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1748: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1753 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1803: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1808 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in memmove memset putenv random rename rindex sigsetmask
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1858: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1863 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1913: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1918 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1968: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1973 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2023: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2028 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-int main() {
-/* 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_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
- for ac_func in sysconf times sbrk gettimeofday ffs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \
+ getcwd getpagesize index insque mkstemps memchr memcmp memcpy \
+ memmove mempcpy memset putenv random rename rindex sigsetmask \
+ strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr \
+ strtod strtol strtoul tmpnam vasprintf vfprintf vprintf \
+ vsprintf waitpid getrusage on_exit psignal strerror strsignal \
+ sysconf times sbrk gettimeofday ffs snprintf vsnprintf \
+ pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl \
+ realpath canonicalize_file_name
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2078: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2083 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_ERRLIST 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_NERR 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_SIGLIST 1
-EOF
+_ACEOF
fi
@@ -2158,7 +4250,12 @@ if test -n "${with_target_subdir}"; then
# newlib provide and which ones we will be expected to provide.
if test "x${with_newlib}" = "xyes"; then
- LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
+ LIBOBJS="$LIBOBJS asprintf.$ac_objext"
+ LIBOBJS="$LIBOBJS basename.$ac_objext"
+ LIBOBJS="$LIBOBJS insque.$ac_objext"
+ LIBOBJS="$LIBOBJS random.$ac_objext"
+ LIBOBJS="$LIBOBJS strdup.$ac_objext"
+ LIBOBJS="$LIBOBJS vasprintf.$ac_objext"
for f in $funcs; do
case "$f" in
@@ -2166,9 +4263,9 @@ if test -n "${with_target_subdir}"; then
;;
*)
n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define $n 1
-EOF
+_ACEOF
;;
esac
@@ -2194,17 +4291,16 @@ if test "${enable_install_libiberty+set}" = set; then
enable_install_libiberty=$enableval
else
enable_install_libiberty=no
-fi
-
+fi;
# Option parsed, now set things appropriately.
case x"$enable_install_libiberty" in
xyes|x)
target_header_dir=libiberty
;;
- xno)
+ xno)
target_header_dir=
;;
- *)
+ *)
# This could be sanity-checked in various ways...
target_header_dir="${enable_install_libiberty}"
;;
@@ -2241,8 +4337,16 @@ if test -z "${setobjs}"; then
# Handle VxWorks configuration specially, since on VxWorks the
# libraries are actually on the target board, not in the file
# system.
- LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
- LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
+ LIBOBJS="$LIBOBJS basename.$ac_objext"
+ LIBOBJS="$LIBOBJS getpagesize.$ac_objext"
+ LIBOBJS="$LIBOBJS insque.$ac_objext"
+ LIBOBJS="$LIBOBJS random.$ac_objext"
+ LIBOBJS="$LIBOBJS strcasecmp.$ac_objext"
+ LIBOBJS="$LIBOBJS strncasecmp.$ac_objext"
+ LIBOBJS="$LIBOBJS strdup.$ac_objext"
+ LIBOBJS="$LIBOBJS vfork.$ac_objext"
+ LIBOBJS="$LIBOBJS waitpid.$ac_objext"
+ LIBOBJS="$LIBOBJS vasprintf.$ac_objext"
for f in $funcs; do
case "$f" in
basename | getpagesize | insque | random | strcasecmp)
@@ -2251,9 +4355,9 @@ if test -z "${setobjs}"; then
;;
*)
n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define $n 1
-EOF
+_ACEOF
;;
esac
@@ -2291,11 +4395,11 @@ if test -z "${setobjs}"; then
# missing.
# DJ - only if we're *building* cygwin, not just building *with* cygwin
-
+
if test -n "${with_target_subdir}"
then
funcs="`echo $funcs | sed -e 's/random//'`"
- LIBOBJS="$LIBOBJS random.o"
+ LIBOBJS="$LIBOBJS random.$ac_objext"
vars="`echo $vars | sed -e 's/sys_siglist//'`"
checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
fi
@@ -2309,19 +4413,19 @@ if test -z "${setobjs}"; then
;;
*-*-uwin*)
- # Under some versions of uwin, vfork is notoriously buggy and the test
+ # Under some versions of uwin, vfork is notoriously buggy and the test
# can hang configure; on other versions, vfork exists just as a stub.
# FIXME: This should be removed once vfork in uwin's runtime is fixed.
ac_cv_func_vfork_works=no
# Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
- # macros (actually, these are imported from a DLL, but the end effect
+ # macros (actually, these are imported from a DLL, but the end effect
# is the same), so the test below won't find them.
libiberty_cv_var_sys_nerr=yes
libiberty_cv_var_sys_errlist=yes
;;
*-*-*vms*)
- # Under VMS, vfork works very different than on Unix. The standard test
+ # Under VMS, vfork works very different than on Unix. The standard test
# won't work, and it isn't easily adaptable. It makes more sense to
# just force it.
ac_cv_func_vfork_works=yes
@@ -2331,205 +4435,354 @@ if test -z "${setobjs}"; then
# We haven't set the list of objects yet. Use the standard autoconf
# tests. This will only work if the compiler works.
- echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2336: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
+ echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
+if test "${ac_cv_search_strerror+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_strerror=no
+if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#line 2347 "configure"
-#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strerror ();
+int
+main ()
+{
+strerror ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_strerror="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_strerror" = no; then
+ for ac_lib in cposix; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-main(){return(0);}
-EOF
-if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strerror ();
+int
+main ()
+{
+strerror ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_strerror="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ done
fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6
+if test "$ac_cv_search_strerror" != no; then
+ test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2378: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
- for ac_func in $funcs
+
+for ac_func in $funcs
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2385: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
fi
done
- echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2440: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking whether alloca needs Cray hooks" >&5
+echo $ECHO_N "checking whether alloca needs Cray hooks... $ECHO_C" >&6
+if test "${ac_cv_os_cray+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2445 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#if defined(CRAY) && ! defined(CRAY2)
webecray
#else
wenotbecray
#endif
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "webecray" >/dev/null 2>&1; then
ac_cv_os_cray=yes
else
- rm -rf conftest*
ac_cv_os_cray=no
fi
rm -f conftest*
fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2470: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2475 "configure"
-#include "confdefs.h"
+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+
+cat >>confdefs.h <<_ACEOF
#define CRAY_STACKSEG_END $ac_func
-EOF
+_ACEOF
break
-else
- echo "$ac_t""no" 1>&6
fi
done
fi
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2524: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
+if test "${ac_cv_c_stack_direction+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_c_stack_direction=0
else
- cat > conftest.$ac_ext <<EOF
-#line 2532 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
find_stack_direction ()
{
static char *addr = 0;
@@ -2546,142 +4799,289 @@ main ()
{
exit (find_stack_direction() < 0);
}
-EOF
-if { (eval echo configure:2551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_stack_direction=1
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_stack_direction=-1
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
+echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
+cat >>confdefs.h <<_ACEOF
#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
+_ACEOF
+
+
- ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2573: checking for vfork.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+for ac_header in unistd.h vfork.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- cat > conftest.$ac_ext <<EOF
-#line 2578 "configure"
-#include "confdefs.h"
-#include <vfork.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_VFORK_H 1
-EOF
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
-else
- echo "$ac_t""no" 1>&6
fi
+done
-echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2608: checking for working vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2614: checking for vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2619 "configure"
-#include "confdefs.h"
+
+
+for ac_func in fork vfork
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char vfork(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char vfork();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_vfork) || defined (__stub___vfork)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-vfork();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_vfork=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_vfork=no"
-fi
-rm -f conftest*
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
fi
+done
-if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
+if test "x$ac_cv_func_fork" = xyes; then
+ echo "$as_me:$LINENO: checking for working fork" >&5
+echo $ECHO_N "checking for working fork... $ECHO_C" >&6
+if test "${ac_cv_func_fork_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_fork_works=cross
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* By Ruediger Kuhlmann. */
+ #include <sys/types.h>
+ #if HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+ /* Some systems only have a dummy stub for fork() */
+ int main ()
+ {
+ if (fork() < 0)
+ exit (1);
+ exit (0);
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_fork_works=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_fork_works=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
+echo "${ECHO_T}$ac_cv_func_fork_works" >&6
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
fi
-
ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ echo "$as_me:$LINENO: checking for working vfork" >&5
+echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
+if test "${ac_cv_func_vfork_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
-#include "confdefs.h"
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_vfork_works=cross
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#include <sys/wait.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
#endif
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
+#if HAVE_VFORK_H
+# include <vfork.h>
#endif
/* On some sparc systems, changes by the child to local and incoming
- argument registers are propagated back to the parent.
- The compiler is told about this with #include <vfork.h>,
- but some compilers (e.g. gcc -O) don't grok <vfork.h>.
- Test for this by using a static variable whose address
- is put into a register that is clobbered by the vfork. */
-static
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
#ifdef __cplusplus
sparc_address_test (int arg)
-#else
+# else
sparc_address_test (arg) int arg;
#endif
{
@@ -2699,25 +5099,27 @@ sparc_address_test (arg) int arg;
}
}
}
-main() {
+
+int
+main ()
+{
pid_t parent = getpid ();
pid_t child;
- sparc_address_test ();
+ sparc_address_test (0);
child = vfork ();
if (child == 0) {
- /* Here is another test for sparc vfork register problems.
- This test uses lots of local variables, at least
- as many local variables as main has allocated so far
- including compiler temporaries. 4 locals are enough for
- gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
- A buggy compiler should reuse the register of parent
- for one of the local variables, since it will think that
- parent can't possibly be used any more in this routine.
- Assigning to the local variable will thus munge parent
- in the parent process. */
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
pid_t
p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
@@ -2727,11 +5129,10 @@ main() {
|| p != p5 || p != p6 || p != p7)
_exit(1);
- /* On some systems (e.g. IRIX 3.3),
- vfork doesn't separate parent from child file descriptors.
- If the child closes a descriptor before it execs or exits,
- this munges the parent's descriptor as well.
- Test for this by closing stdout in the child. */
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
_exit(close(fileno(stdout)) != 0);
} else {
int status;
@@ -2754,351 +5155,708 @@ main() {
);
}
}
-EOF
-if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_vfork_works=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_vfork_works=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_vfork_works=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-rm -fr conftest*
fi
+echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
+echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=ac_cv_func_vfork
+ { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
fi
-echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
-if test $ac_cv_func_vfork_works = no; then
- cat >> confdefs.h <<\EOF
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_VFORK 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
#define vfork fork
-EOF
+_ACEOF
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_FORK 1
+_ACEOF
fi
if test $ac_cv_func_vfork_works = no; then
- LIBOBJS="$LIBOBJS vfork.o"
+ LIBOBJS="$LIBOBJS vfork.$ac_objext"
fi
# We only need _doprnt if we might use it to implement v*printf.
if test $ac_cv_func_vprintf != yes \
|| test $ac_cv_func_vfprintf != yes \
|| test $ac_cv_func_vsprintf != yes; then
- for ac_func in _doprnt
+
+for ac_func in _doprnt
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2791: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2796 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
fi
done
else
- for ac_func in _doprnt
+
+for ac_func in _doprnt
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2849: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2854 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
fi
for v in $vars; do
- echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:2905: checking for $v" >&5
- if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2910 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for $v" >&5
+echo $ECHO_N "checking for $v... $ECHO_C" >&6
+ if eval "test \"\${libiberty_cv_var_$v+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int *p;
-int main() {
+int
+main ()
+{
extern int $v []; p = $v;
-; return 0; }
-EOF
-if { (eval echo configure:2917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
eval "libiberty_cv_var_$v=yes"
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "libiberty_cv_var_$v=no"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "libiberty_cv_var_$v=no"
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
+ cat >>confdefs.h <<_ACEOF
#define $n 1
-EOF
+_ACEOF
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
done
- for ac_func in $checkfuncs
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2943: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ # special check for _system_configuration because AIX <4.3.2 do not
+ # contain the `physmem' member.
+ echo "$as_me:$LINENO: checking for external symbol _system_configuration" >&5
+echo $ECHO_N "checking for external symbol _system_configuration... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/systemcfg.h>
+int
+main ()
+{
+double x = _system_configuration.physmem;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE__SYSTEM_CONFIGURATION 1
+_ACEOF
+
else
- cat > conftest.$ac_ext <<EOF
-#line 2948 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+for ac_func in $checkfuncs
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ echo "$as_me:$LINENO: checking whether canonicalize_file_name must be declared" >&5
+echo $ECHO_N "checking whether canonicalize_file_name must be declared... $ECHO_C" >&6
+if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include "confdefs.h"
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int
+main ()
+{
+char *(*pfn) = (char *(*)) canonicalize_file_name
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libiberty_cv_decl_needed_canonicalize_file_name=no
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libiberty_cv_decl_needed_canonicalize_file_name=yes
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
+echo "$as_me:$LINENO: result: $libiberty_cv_decl_needed_canonicalize_file_name" >&5
+echo "${ECHO_T}$libiberty_cv_decl_needed_canonicalize_file_name" >&6
+if test $libiberty_cv_decl_needed_canonicalize_file_name = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1
+_ACEOF
+
fi
-done
fi
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3001: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3006 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+# Figure out which version of pexecute to use.
+case "${host}" in
+ *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;;
+ *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;;
+ *-*-msdos*) pexecute=./pex-msdos.o ;;
+ *-*-os2-emx*) pexecute=./pex-os2.o ;;
+ *) pexecute=./pex-unix.o ;;
+esac
+
+
+if test x$gcc_no_link = xyes; then
+ if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
+ ac_cv_func_mmap_fixed_mapped=no
+ fi
fi
-rm -f conftest*
+if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
+
+
+for ac_header in stdlib.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
fi
done
+
for ac_func in getpagesize
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3040: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3045 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. Under hpux,
+ including <limits.h> includes <sys/time.h> and causes problems
+ checking for functions defined therein. */
+#if defined (__STDC__) && !defined (_HPUX_SOURCE)
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* 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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3093: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for working mmap" >&5
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_mmap_fixed_mapped=no
else
- cat > conftest.$ac_ext <<EOF
-#line 3101 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
/* Thanks to Mike Haertel and Jim Avera for this test.
Here is a matrix of mmap possibilities:
@@ -3112,47 +5870,34 @@ else
back from the file, nor mmap's back from the file at a different
address. (There have been systems where private was not correctly
implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
+ VM page cache was not coherent with the file system buffer cache
like early versions of FreeBSD and possibly contemporary NetBSD.)
For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
+ propagated back to all the places they're supposed to be.
Grep wants private fixed already mapped.
The main things grep needs to know about mmap are:
* does it exist and is it safe to write into the mmap'd area
* how to use it (BSD variants) */
-#include <sys/types.h>
+
#include <fcntl.h>
#include <sys/mman.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
+#if !STDC_HEADERS && !HAVE_STDLIB_H
+char *malloc ();
#endif
/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-
+#if !HAVE_GETPAGESIZE
/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
+# if !HAVE_SYS_PARAM_H
# define HAVE_SYS_PARAM_H 1
# endif
# ifdef _SC_PAGESIZE
# define getpagesize() sysconf(_SC_PAGESIZE)
# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
+# if HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
@@ -3179,111 +5924,114 @@ else
#endif /* no HAVE_GETPAGESIZE */
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
int
-main()
+main ()
{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
-
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
-EOF
-if { (eval echo configure:3254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+ pagesize = getpagesize ();
+
+ /* First, make a file with some known garbage in it. */
+ data = (char *) malloc (pagesize);
+ if (!data)
+ exit (1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand ();
+ umask (0);
+ fd = creat ("conftest.mmap", 0600);
+ if (fd < 0)
+ exit (1);
+ if (write (fd, data, pagesize) != pagesize)
+ exit (1);
+ close (fd);
+
+ /* Next, try to mmap the file at a fixed address which already has
+ something else allocated at it. If we can, also make sure that
+ we see the same garbage. */
+ fd = open ("conftest.mmap", O_RDWR);
+ if (fd < 0)
+ exit (1);
+ data2 = (char *) malloc (2 * pagesize);
+ if (!data2)
+ exit (1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit (1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit (1);
+
+ /* Finally, make sure that changes to the mapped area do not
+ percolate back to the file as seen by read(). (This is a bug on
+ some variants of i386 svr4.0.) */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = (char *) malloc (pagesize);
+ if (!data3)
+ exit (1);
+ if (read (fd, data3, pagesize) != pagesize)
+ exit (1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit (1);
+ close (fd);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_mmap_fixed_mapped=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_mmap_fixed_mapped=no
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_MMAP 1
-EOF
+_ACEOF
fi
+rm -f conftest.mmap
+fi
-echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3278: checking for working strncmp" >&5
-if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for working strncmp" >&5
+echo $ECHO_N "checking for working strncmp... $ECHO_C" >&6
+if test "${ac_cv_func_strncmp_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_strncmp_works=no
else
- cat > conftest.$ac_ext <<EOF
-#line 3286 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Test by Jim Wilson and Kaveh Ghazi.
Check whether strncmp reads past the end of its string parameters. */
@@ -3323,7 +6071,7 @@ main ()
dev_zero = open ("/dev/zero", O_RDONLY);
if (dev_zero < 0)
exit (1);
-
+
p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, dev_zero, 0);
if (p == (char *)-1)
@@ -3345,25 +6093,35 @@ main ()
exit (0);
}
-EOF
-if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_strncmp_works=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_strncmp_works=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_strncmp_works=no
fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core core.* *.core
fi
-
-echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_func_strncmp_works" >&5
+echo "${ECHO_T}$ac_cv_func_strncmp_works" >&6
if test $ac_cv_func_strncmp_works = no ; then
- LIBOBJS="$LIBOBJS strncmp.o"
+ LIBOBJS="$LIBOBJS strncmp.$ac_objext"
fi
@@ -3376,394 +6134,1178 @@ else
fi
+
+L=""
+for l in x $LIBOBJS; do
+ case $l in
+ x) ;;
+ *) L="$L ./$l" ;;
+ esac
+done
+LIBOBJS="$L"
+
# We need multilib support, but only if configuring for the target.
-trap '' 1 2 15
-cat > confcache <<\EOF
+ ac_config_files="$ac_config_files Makefile testsuite/Makefile"
+ ac_config_commands="$ac_config_commands default"
+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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# 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.
#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `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, don't put newlines in cache variables' values.
# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *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 \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# 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[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
fi
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
DEFS=-DHAVE_CONFIG_H
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+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_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
done
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@MAINT@%$MAINT%g
-s%@NOTMAINT@%$NOTMAINT%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@BUILD_INFO@%$BUILD_INFO%g
-s%@PERL@%$PERL%g
-s%@HAVE_PERL@%$HAVE_PERL%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@CC@%$CC%g
-s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
-s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g
-s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-/@host_makefile_frag@/r $host_makefile_frag
-s%@host_makefile_frag@%%g
-s%@CPP@%$CPP%g
-s%@CHECK@%$CHECK%g
-s%@target_header_dir@%$target_header_dir%g
-s%@LIBOBJS@%$LIBOBJS%g
-s%@INSTALL_DEST@%$INSTALL_DEST%g
-CEOF
-EOF
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ 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
+
+ ;;
+ 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
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); 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 sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet 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 <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.57,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+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
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
-CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+srcdir=${srcdir}
+host=${host}
+target=${target}
+with_target_subdir=${with_target_subdir}
+with_build_subdir=${with_build_subdir}
+with_multisubdir=${with_multisubdir}
+ac_configure_args="--enable-multilib ${ac_configure_args}"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
+libiberty_topdir=${libiberty_topdir}
+
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "testsuite/Makefile" ) CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+ "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
+done
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+# 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 to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@libiberty_topdir@,$libiberty_topdir,;t t
+s,@MAINT@,$MAINT,;t t
+s,@NOTMAINT@,$NOTMAINT,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@BUILD_INFO@,$BUILD_INFO,;t t
+s,@PERL@,$PERL,;t t
+s,@HAVE_PERL@,$HAVE_PERL,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@ac_libiberty_warn_cflags@,$ac_libiberty_warn_cflags,;t t
+s,@NO_MINUS_C_MINUS_O@,$NO_MINUS_C_MINUS_O,;t t
+s,@OUTPUT_OPTION@,$OUTPUT_OPTION,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@CHECK@,$CHECK,;t t
+s,@target_header_dir@,$target_header_dir,;t t
+s,@pexecute@,$pexecute,;t t
+s,@INSTALL_DEST@,$INSTALL_DEST,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+/@host_makefile_frag@/r $host_makefile_frag
+s,@host_makefile_frag@,,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
+fi # test -n "$CONFIG_FILES"
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # 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. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h:config.in"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
# This sed command replaces #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.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
-while :
+while grep . conftest.undefs >/dev/null
do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # 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. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
fi
-fi; done
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
-EOF
-cat >> $CONFIG_STATUS <<EOF
-srcdir=${srcdir}
-host=${host}
-target=${target}
-with_target_subdir=${with_target_subdir}
-with_build_subdir=${with_build_subdir}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="--enable-multilib ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-libiberty_topdir=${libiberty_topdir}
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ default ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
if test -n "$CONFIG_FILES"; then
if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
# FIXME: We shouldn't need to set ac_file
@@ -3771,10 +7313,37 @@ if test -n "$CONFIG_FILES"; then
LD="${ORIGINAL_LD_FOR_MULTILIBS}"
. ${libiberty_topdir}/config-ml.in
fi
-fi
-exit 0
-EOF
+fi ;;
+ esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# 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 || { (exit 1); exit 1; }
+fi
diff --git a/contrib/binutils/libiberty/copysign.c b/contrib/binutils/libiberty/copysign.c
index 5c48a54..d288be2 100644
--- a/contrib/binutils/libiberty/copysign.c
+++ b/contrib/binutils/libiberty/copysign.c
@@ -131,7 +131,9 @@ typedef union
#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
-double DEFUN(copysign, (x, y), double x AND double y)
+double
+copysign (x, y)
+ double x, y;
{
__ieee_double_shape_type a,b;
b.value = y;
@@ -142,7 +144,9 @@ double DEFUN(copysign, (x, y), double x AND double y)
#else
-double DEFUN(copysign, (x, y), double x AND double y)
+double
+copysign (x, y)
+ double x, y;
{
if ((x < 0 && y > 0) || (x > 0 && y < 0))
return -x;
diff --git a/contrib/binutils/libiberty/cp-demangle.c b/contrib/binutils/libiberty/cp-demangle.c
index eece533..19f191e 100644
--- a/contrib/binutils/libiberty/cp-demangle.c
+++ b/contrib/binutils/libiberty/cp-demangle.c
@@ -1,10 +1,10 @@
-/* Demangler for IA64 / g++ V3 ABI.
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
- Written by Alex Samuel <samuel@codesourcery.com>.
+/* Demangler for g++ V3 ABI.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <ian@wasabisystems.com>.
- This file is part of GNU CC.
+ This file is part of the libiberty library, which is part of GCC.
- This program is free software; you can redistribute it and/or modify
+ This file 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.
@@ -28,3643 +28,3910 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/* This file implements demangling of C++ names mangled according to
- the IA64 / g++ V3 ABI. Use the cp_demangle function to
- demangle a mangled name, or compile with the preprocessor macro
- STANDALONE_DEMANGLER defined to create a demangling filter
- executable (functionally similar to c++filt, but includes this
- demangler only). */
+/* This code implements a demangler for the g++ V3 ABI. The ABI is
+ described on this web page:
+ http://www.codesourcery.com/cxx-abi/abi.html#mangling
+
+ This code was written while looking at the demangler written by
+ Alex Samuel <samuel@codesourcery.com>.
+
+ This code first pulls the mangled name apart into a list of
+ components, and then walks the list generating the demangled
+ name.
+
+ This file will normally define the following functions, q.v.:
+ char *cplus_demangle_v3(const char *mangled, int options)
+ char *java_demangle_v3(const char *mangled)
+ enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (const char *name)
+ enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (const char *name)
+
+ Also, the interface to the component list is public, and defined in
+ demangle.h. The interface consists of these types, which are
+ defined in demangle.h:
+ enum demangle_component_type
+ struct demangle_component
+ and these functions defined in this file:
+ cplus_demangle_fill_name
+ cplus_demangle_fill_extended_operator
+ cplus_demangle_fill_ctor
+ cplus_demangle_fill_dtor
+ cplus_demangle_print
+ and other functions defined in the file cp-demint.c.
+
+ This file also defines some other functions and variables which are
+ only to be used by the file cp-demint.c.
+
+ Preprocessor macros you can define while compiling this file:
+
+ IN_LIBGCC2
+ If defined, this file defines the following function, q.v.:
+ char *__cxa_demangle (const char *mangled, char *buf, size_t *len,
+ int *status)
+ instead of cplus_demangle_v3() and java_demangle_v3().
+
+ IN_GLIBCPP_V3
+ If defined, this file defines only __cxa_demangle(), and no other
+ publically visible functions or variables.
+
+ STANDALONE_DEMANGLER
+ If defined, this file defines a main() function which demangles
+ any arguments, or, if none, demangles stdin.
+
+ CP_DEMANGLE_DEBUG
+ If defined, turns on debugging mode, which prints information on
+ stdout about the mangled string. This is not generally useful.
+*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <sys/types.h>
+#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-
-#include <stdio.h>
-
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#include <ctype.h>
-
#include "ansidecl.h"
#include "libiberty.h"
-#include "dyn-string.h"
#include "demangle.h"
+#include "cp-demangle.h"
-/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation,
- and other debugging output, will be generated. */
-#ifdef CP_DEMANGLE_DEBUG
-#define DEMANGLE_TRACE(PRODUCTION, DM) \
- fprintf (stderr, " -> %-24s at position %3d\n", \
- (PRODUCTION), current_position (DM));
-#else
-#define DEMANGLE_TRACE(PRODUCTION, DM)
-#endif
+/* If IN_GLIBCPP_V3 is defined, some functions are made static. We
+ also rename them via #define to avoid compiler errors when the
+ static definition conflicts with the extern declaration in a header
+ file. */
+#ifdef IN_GLIBCPP_V3
-/* Don't include <ctype.h>, to prevent additional unresolved symbols
- from being dragged into the C++ runtime library. */
-#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9')
-#define IS_ALPHA(CHAR) \
- (((CHAR) >= 'a' && (CHAR) <= 'z') \
- || ((CHAR) >= 'A' && (CHAR) <= 'Z'))
+#define CP_STATIC_IF_GLIBCPP_V3 static
-/* The prefix prepended by GCC to an identifier represnting the
- anonymous namespace. */
-#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
+#define cplus_demangle_fill_name d_fill_name
+static int
+d_fill_name PARAMS ((struct demangle_component *, const char *, int));
-/* Character(s) to use for namespace separation in demangled output */
-#define NAMESPACE_SEPARATOR (dm->style == DMGL_JAVA ? "." : "::")
+#define cplus_demangle_fill_extended_operator d_fill_extended_operator
+static int
+d_fill_extended_operator PARAMS ((struct demangle_component *, int,
+ struct demangle_component *));
-/* If flag_verbose is zero, some simplifications will be made to the
- output to make it easier to read and supress details that are
- generally not of interest to the average C++ programmer.
- Otherwise, the demangled representation will attempt to convey as
- much information as the mangled form. */
-static int flag_verbose;
+#define cplus_demangle_fill_ctor d_fill_ctor
+static int
+d_fill_ctor PARAMS ((struct demangle_component *, enum gnu_v3_ctor_kinds,
+ struct demangle_component *));
-/* If flag_strict is non-zero, demangle strictly according to the
- specification -- don't demangle special g++ manglings. */
-static int flag_strict;
+#define cplus_demangle_fill_dtor d_fill_dtor
+static int
+d_fill_dtor PARAMS ((struct demangle_component *, enum gnu_v3_dtor_kinds,
+ struct demangle_component *));
-/* String_list_t is an extended form of dyn_string_t which provides a
- link field and a caret position for additions to the string. A
- string_list_t may safely be cast to and used as a dyn_string_t. */
+#define cplus_demangle_mangled_name d_mangled_name
+static struct demangle_component *
+d_mangled_name PARAMS ((struct d_info *, int));
-struct string_list_def
-{
- /* The dyn_string; must be first. */
- struct dyn_string string;
+#define cplus_demangle_type d_type
+static struct demangle_component *
+d_type PARAMS ((struct d_info *));
- /* The position at which additional text is added to this string
- (using the result_add* macros). This value is an offset from the
- end of the string, not the beginning (and should be
- non-positive). */
- int caret_position;
+#define cplus_demangle_print d_print
+static char *
+d_print PARAMS ((int, const struct demangle_component *, int, size_t *));
- /* The next string in the list. */
- struct string_list_def *next;
-};
+#define cplus_demangle_init_info d_init_info
+static void
+d_init_info PARAMS ((const char *, int, size_t, struct d_info *));
+
+#else /* ! defined(IN_GLIBCPP_V3) */
+#define CP_STATIC_IF_GLIBCPP_V3
+#endif /* ! defined(IN_GLIBCPP_V3) */
+
+/* See if the compiler supports dynamic arrays. */
-typedef struct string_list_def *string_list_t;
+#ifdef __GNUC__
+#define CP_DYNAMIC_ARRAYS
+#else
+#ifdef __STDC__
+#ifdef __STDC_VERSION__
+#if __STDC_VERSION__ >= 199901L
+#define CP_DYNAMIC_ARRAYS
+#endif /* __STDC__VERSION >= 199901L */
+#endif /* defined (__STDC_VERSION__) */
+#endif /* defined (__STDC__) */
+#endif /* ! defined (__GNUC__) */
+
+/* We avoid pulling in the ctype tables, to prevent pulling in
+ additional unresolved symbols when this code is used in a library.
+ FIXME: Is this really a valid reason? This comes from the original
+ V3 demangler code.
+
+ As of this writing this file has the following undefined references
+ when compiled with -DIN_GLIBCPP_V3: malloc, realloc, free, memcpy,
+ strcpy, strcat, strlen. */
+
+#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
+#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
+#define IS_LOWER(c) ((c) >= 'a' && (c) <= 'z')
+
+/* The prefix prepended by GCC to an identifier represnting the
+ anonymous namespace. */
+#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
+#define ANONYMOUS_NAMESPACE_PREFIX_LEN \
+ (sizeof (ANONYMOUS_NAMESPACE_PREFIX) - 1)
-/* Data structure representing a potential substitution. */
+/* Information we keep for the standard substitutions. */
-struct substitution_def
+struct d_standard_sub_info
{
- /* The demangled text of the substitution. */
- dyn_string_t text;
+ /* The code for this substitution. */
+ char code;
+ /* The simple string it expands to. */
+ const char *simple_expansion;
+ /* The length of the simple expansion. */
+ int simple_len;
+ /* The results of a full, verbose, expansion. This is used when
+ qualifying a constructor/destructor, or when in verbose mode. */
+ const char *full_expansion;
+ /* The length of the full expansion. */
+ int full_len;
+ /* What to set the last_name field of d_info to; NULL if we should
+ not set it. This is only relevant when qualifying a
+ constructor/destructor. */
+ const char *set_last_name;
+ /* The length of set_last_name. */
+ int set_last_name_len;
+};
+
+/* Accessors for subtrees of struct demangle_component. */
+
+#define d_left(dc) ((dc)->u.s_binary.left)
+#define d_right(dc) ((dc)->u.s_binary.right)
- /* Whether this substitution represents a template item. */
- int template_p : 1;
+/* A list of templates. This is used while printing. */
+
+struct d_print_template
+{
+ /* Next template on the list. */
+ struct d_print_template *next;
+ /* This template. */
+ const struct demangle_component *template;
};
-/* Data structure representing a template argument list. */
+/* A list of type modifiers. This is used while printing. */
-struct template_arg_list_def
+struct d_print_mod
{
- /* The next (lower) template argument list in the stack of currently
- active template arguments. */
- struct template_arg_list_def *next;
+ /* Next modifier on the list. These are in the reverse of the order
+ in which they appeared in the mangled string. */
+ struct d_print_mod *next;
+ /* The modifier. */
+ const struct demangle_component *mod;
+ /* Whether this modifier was printed. */
+ int printed;
+ /* The list of templates which applies to this modifier. */
+ struct d_print_template *templates;
+};
- /* The first element in the list of template arguments in
- left-to-right order. */
- string_list_t first_argument;
+/* We use this structure to hold information during printing. */
- /* The last element in the arguments lists. */
- string_list_t last_argument;
+struct d_print_info
+{
+ /* The options passed to the demangler. */
+ int options;
+ /* Buffer holding the result. */
+ char *buf;
+ /* Current length of data in buffer. */
+ size_t len;
+ /* Allocated size of buffer. */
+ size_t alc;
+ /* The current list of templates, if any. */
+ struct d_print_template *templates;
+ /* The current list of modifiers (e.g., pointer, reference, etc.),
+ if any. */
+ struct d_print_mod *modifiers;
+ /* Set to 1 if we had a memory allocation failure. */
+ int allocation_failure;
};
-typedef struct template_arg_list_def *template_arg_list_t;
+#define d_print_saw_error(dpi) ((dpi)->buf == NULL)
-/* Data structure to maintain the state of the current demangling. */
+#define d_append_char(dpi, c) \
+ do \
+ { \
+ if ((dpi)->buf != NULL && (dpi)->len < (dpi)->alc) \
+ (dpi)->buf[(dpi)->len++] = (c); \
+ else \
+ d_print_append_char ((dpi), (c)); \
+ } \
+ while (0)
-struct demangling_def
-{
- /* The full mangled name being mangled. */
- const char *name;
+#define d_append_buffer(dpi, s, l) \
+ do \
+ { \
+ if ((dpi)->buf != NULL && (dpi)->len + (l) <= (dpi)->alc) \
+ { \
+ memcpy ((dpi)->buf + (dpi)->len, (s), (l)); \
+ (dpi)->len += l; \
+ } \
+ else \
+ d_print_append_buffer ((dpi), (s), (l)); \
+ } \
+ while (0)
- /* Pointer into name at the current position. */
- const char *next;
+#define d_append_string_constant(dpi, s) \
+ d_append_buffer (dpi, (s), sizeof (s) - 1)
- /* Stack for strings containing demangled result generated so far.
- Text is emitted to the topmost (first) string. */
- string_list_t result;
+#define d_last_char(dpi) \
+ ((dpi)->buf == NULL || (dpi)->len == 0 ? '\0' : (dpi)->buf[(dpi)->len - 1])
- /* The number of presently available substitutions. */
- int num_substitutions;
+#ifdef CP_DEMANGLE_DEBUG
+static void
+d_dump PARAMS ((struct demangle_component *, int));
+#endif
- /* The allocated size of the substitutions array. */
- int substitutions_allocated;
+static struct demangle_component *
+d_make_empty PARAMS ((struct d_info *));
- /* An array of available substitutions. The number of elements in
- the array is given by num_substitions, and the allocated array
- size in substitutions_size.
+static struct demangle_component *
+d_make_comp PARAMS ((struct d_info *, enum demangle_component_type,
+ struct demangle_component *,
+ struct demangle_component *));
- The most recent substition is at the end, so
+static struct demangle_component *
+d_make_name PARAMS ((struct d_info *, const char *, int));
- - `S_' corresponds to substititutions[num_substitutions - 1]
- - `S0_' corresponds to substititutions[num_substitutions - 2]
+static struct demangle_component *
+d_make_builtin_type PARAMS ((struct d_info *,
+ const struct demangle_builtin_type_info *));
- etc. */
- struct substitution_def *substitutions;
+static struct demangle_component *
+d_make_operator PARAMS ((struct d_info *,
+ const struct demangle_operator_info *));
- /* The stack of template argument lists. */
- template_arg_list_t template_arg_lists;
+static struct demangle_component *
+d_make_extended_operator PARAMS ((struct d_info *, int,
+ struct demangle_component *));
- /* The most recently demangled source-name. */
- dyn_string_t last_source_name;
-
- /* Language style to use for demangled output. */
- int style;
+static struct demangle_component *
+d_make_ctor PARAMS ((struct d_info *, enum gnu_v3_ctor_kinds,
+ struct demangle_component *));
- /* Set to non-zero iff this name is a constructor. The actual value
- indicates what sort of constructor this is; see demangle.h. */
- enum gnu_v3_ctor_kinds is_constructor;
+static struct demangle_component *
+d_make_dtor PARAMS ((struct d_info *, enum gnu_v3_dtor_kinds,
+ struct demangle_component *));
- /* Set to non-zero iff this name is a destructor. The actual value
- indicates what sort of destructor this is; see demangle.h. */
- enum gnu_v3_dtor_kinds is_destructor;
+static struct demangle_component *
+d_make_template_param PARAMS ((struct d_info *, long));
-};
+static struct demangle_component *
+d_make_sub PARAMS ((struct d_info *, const char *, int));
-typedef struct demangling_def *demangling_t;
-
-/* This type is the standard return code from most functions. Values
- other than STATUS_OK contain descriptive messages. */
-typedef const char *status_t;
-
-/* Special values that can be used as a status_t. */
-#define STATUS_OK NULL
-#define STATUS_ERROR "Error."
-#define STATUS_UNIMPLEMENTED "Unimplemented."
-#define STATUS_INTERNAL_ERROR "Internal error."
-
-/* This status code indicates a failure in malloc or realloc. */
-static const char *const status_allocation_failed = "Allocation failed.";
-#define STATUS_ALLOCATION_FAILED status_allocation_failed
-
-/* Non-zero if STATUS indicates that no error has occurred. */
-#define STATUS_NO_ERROR(STATUS) ((STATUS) == STATUS_OK)
-
-/* Evaluate EXPR, which must produce a status_t. If the status code
- indicates an error, return from the current function with that
- status code. */
-#define RETURN_IF_ERROR(EXPR) \
- do \
- { \
- status_t s = EXPR; \
- if (!STATUS_NO_ERROR (s)) \
- return s; \
- } \
- while (0)
+static int
+has_return_type PARAMS ((struct demangle_component *));
-static status_t int_to_dyn_string
- PARAMS ((int, dyn_string_t));
-static string_list_t string_list_new
- PARAMS ((int));
-static void string_list_delete
- PARAMS ((string_list_t));
-static status_t result_add_separated_char
- PARAMS ((demangling_t, int));
-static status_t result_push
- PARAMS ((demangling_t));
-static string_list_t result_pop
- PARAMS ((demangling_t));
-static int substitution_start
- PARAMS ((demangling_t));
-static status_t substitution_add
- PARAMS ((demangling_t, int, int));
-static dyn_string_t substitution_get
- PARAMS ((demangling_t, int, int *));
-#ifdef CP_DEMANGLE_DEBUG
-static void substitutions_print
- PARAMS ((demangling_t, FILE *));
-#endif
-static template_arg_list_t template_arg_list_new
- PARAMS ((void));
-static void template_arg_list_delete
- PARAMS ((template_arg_list_t));
-static void template_arg_list_add_arg
- PARAMS ((template_arg_list_t, string_list_t));
-static string_list_t template_arg_list_get_arg
- PARAMS ((template_arg_list_t, int));
-static void push_template_arg_list
- PARAMS ((demangling_t, template_arg_list_t));
-static void pop_to_template_arg_list
- PARAMS ((demangling_t, template_arg_list_t));
-#ifdef CP_DEMANGLE_DEBUG
-static void template_arg_list_print
- PARAMS ((template_arg_list_t, FILE *));
-#endif
-static template_arg_list_t current_template_arg_list
- PARAMS ((demangling_t));
-static demangling_t demangling_new
- PARAMS ((const char *, int));
-static void demangling_delete
- PARAMS ((demangling_t));
-
-/* The last character of DS. Warning: DS is evaluated twice. */
-#define dyn_string_last_char(DS) \
- (dyn_string_buf (DS)[dyn_string_length (DS) - 1])
-
-/* Append a space character (` ') to DS if it does not already end
- with one. Evaluates to 1 on success, or 0 on allocation failure. */
-#define dyn_string_append_space(DS) \
- ((dyn_string_length (DS) > 0 \
- && dyn_string_last_char (DS) != ' ') \
- ? dyn_string_append_char ((DS), ' ') \
- : 1)
-
-/* Returns the index of the current position in the mangled name. */
-#define current_position(DM) ((DM)->next - (DM)->name)
-
-/* Returns the character at the current position of the mangled name. */
-#define peek_char(DM) (*((DM)->next))
-
-/* Returns the character one past the current position of the mangled
- name. */
-#define peek_char_next(DM) \
- (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1)))
-
-/* Returns the character at the current position, and advances the
- current position to the next character. */
-#define next_char(DM) (*((DM)->next)++)
-
-/* Returns non-zero if the current position is the end of the mangled
- name, i.e. one past the last character. */
-#define end_of_name_p(DM) (peek_char (DM) == '\0')
-
-/* Advances the current position by one character. */
-#define advance_char(DM) (++(DM)->next)
-
-/* Returns the string containing the current demangled result. */
-#define result_string(DM) (&(DM)->result->string)
-
-/* Returns the position at which new text is inserted into the
- demangled result. */
-#define result_caret_pos(DM) \
- (result_length (DM) + \
- ((string_list_t) result_string (DM))->caret_position)
-
-/* Adds a dyn_string_t to the demangled result. */
-#define result_add_string(DM, STRING) \
- (dyn_string_insert (&(DM)->result->string, \
- result_caret_pos (DM), (STRING)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Adds NUL-terminated string CSTR to the demangled result. */
-#define result_add(DM, CSTR) \
- (dyn_string_insert_cstr (&(DM)->result->string, \
- result_caret_pos (DM), (CSTR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Adds character CHAR to the demangled result. */
-#define result_add_char(DM, CHAR) \
- (dyn_string_insert_char (&(DM)->result->string, \
- result_caret_pos (DM), (CHAR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts a dyn_string_t to the demangled result at position POS. */
-#define result_insert_string(DM, POS, STRING) \
- (dyn_string_insert (&(DM)->result->string, (POS), (STRING)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts NUL-terminated string CSTR to the demangled result at
- position POS. */
-#define result_insert(DM, POS, CSTR) \
- (dyn_string_insert_cstr (&(DM)->result->string, (POS), (CSTR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* Inserts character CHAR to the demangled result at position POS. */
-#define result_insert_char(DM, POS, CHAR) \
- (dyn_string_insert_char (&(DM)->result->string, (POS), (CHAR)) \
- ? STATUS_OK : STATUS_ALLOCATION_FAILED)
-
-/* The length of the current demangled result. */
-#define result_length(DM) \
- dyn_string_length (&(DM)->result->string)
-
-/* Appends a (less-than, greater-than) character to the result in DM
- to (open, close) a template argument or parameter list. Appends a
- space first if necessary to prevent spurious elision of angle
- brackets with the previous character. */
-#define result_open_template_list(DM) result_add_separated_char(DM, '<')
-#define result_close_template_list(DM) result_add_separated_char(DM, '>')
-
-/* Appends a base 10 representation of VALUE to DS. STATUS_OK on
- success. On failure, deletes DS and returns an error code. */
-
-static status_t
-int_to_dyn_string (value, ds)
- int value;
- dyn_string_t ds;
-{
- int i;
- int mask = 1;
+static int
+is_ctor_dtor_or_conversion PARAMS ((struct demangle_component *));
- /* Handle zero up front. */
- if (value == 0)
- {
- if (!dyn_string_append_char (ds, '0'))
- return STATUS_ALLOCATION_FAILED;
- return STATUS_OK;
- }
+static struct demangle_component *
+d_encoding PARAMS ((struct d_info *, int));
- /* For negative numbers, emit a minus sign. */
- if (value < 0)
- {
- if (!dyn_string_append_char (ds, '-'))
- return STATUS_ALLOCATION_FAILED;
- value = -value;
- }
-
- /* Find the power of 10 of the first digit. */
- i = value;
- while (i > 9)
- {
- mask *= 10;
- i /= 10;
- }
+static struct demangle_component *
+d_name PARAMS ((struct d_info *));
- /* Write the digits. */
- while (mask > 0)
- {
- int digit = value / mask;
+static struct demangle_component *
+d_nested_name PARAMS ((struct d_info *));
- if (!dyn_string_append_char (ds, '0' + digit))
- return STATUS_ALLOCATION_FAILED;
+static struct demangle_component *
+d_prefix PARAMS ((struct d_info *));
- value -= digit * mask;
- mask /= 10;
- }
+static struct demangle_component *
+d_unqualified_name PARAMS ((struct d_info *));
- return STATUS_OK;
-}
+static struct demangle_component *
+d_source_name PARAMS ((struct d_info *));
-/* Creates a new string list node. The contents of the string are
- empty, but the initial buffer allocation is LENGTH. The string
- list node should be deleted with string_list_delete. Returns NULL
- if allocation fails. */
+static long
+d_number PARAMS ((struct d_info *));
-static string_list_t
-string_list_new (length)
- int length;
-{
- string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def));
- s->caret_position = 0;
- if (s == NULL)
- return NULL;
- if (!dyn_string_init ((dyn_string_t) s, length))
- return NULL;
- return s;
-}
+static struct demangle_component *
+d_identifier PARAMS ((struct d_info *, int));
-/* Deletes the entire string list starting at NODE. */
+static struct demangle_component *
+d_operator_name PARAMS ((struct d_info *));
-static void
-string_list_delete (node)
- string_list_t node;
-{
- while (node != NULL)
- {
- string_list_t next = node->next;
- dyn_string_delete ((dyn_string_t) node);
- node = next;
- }
-}
+static struct demangle_component *
+d_special_name PARAMS ((struct d_info *));
-/* Appends CHARACTER to the demangled result. If the current trailing
- character of the result is CHARACTER, a space is inserted first. */
+static int
+d_call_offset PARAMS ((struct d_info *, int));
-static status_t
-result_add_separated_char (dm, character)
- demangling_t dm;
- int character;
-{
- char *result = dyn_string_buf (result_string (dm));
- int caret_pos = result_caret_pos (dm);
+static struct demangle_component *
+d_ctor_dtor_name PARAMS ((struct d_info *));
- /* Add a space if the last character is already the character we
- want to add. */
- if (caret_pos > 0 && result[caret_pos - 1] == character)
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- /* Add the character. */
- RETURN_IF_ERROR (result_add_char (dm, character));
+static struct demangle_component **
+d_cv_qualifiers PARAMS ((struct d_info *, struct demangle_component **, int));
- return STATUS_OK;
-}
+static struct demangle_component *
+d_function_type PARAMS ((struct d_info *));
-/* Allocates and pushes a new string onto the demangled results stack
- for DM. Subsequent demangling with DM will emit to the new string.
- Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on
- allocation failure. */
+static struct demangle_component *
+d_bare_function_type PARAMS ((struct d_info *, int));
-static status_t
-result_push (dm)
- demangling_t dm;
-{
- string_list_t new_string = string_list_new (0);
- if (new_string == NULL)
- /* Allocation failed. */
- return STATUS_ALLOCATION_FAILED;
-
- /* Link the new string to the front of the list of result strings. */
- new_string->next = (string_list_t) dm->result;
- dm->result = new_string;
- return STATUS_OK;
-}
+static struct demangle_component *
+d_class_enum_type PARAMS ((struct d_info *));
-/* Removes and returns the topmost element on the demangled results
- stack for DM. The caller assumes ownership for the returned
- string. */
+static struct demangle_component *
+d_array_type PARAMS ((struct d_info *));
-static string_list_t
-result_pop (dm)
- demangling_t dm;
-{
- string_list_t top = dm->result;
- dm->result = top->next;
- return top;
-}
+static struct demangle_component *
+d_pointer_to_member_type PARAMS ((struct d_info *));
-/* Returns the current value of the caret for the result string. The
- value is an offet from the end of the result string. */
+static struct demangle_component *
+d_template_param PARAMS ((struct d_info *));
-static int
-result_get_caret (dm)
- demangling_t dm;
-{
- return ((string_list_t) result_string (dm))->caret_position;
-}
+static struct demangle_component *
+d_template_args PARAMS ((struct d_info *));
-/* Sets the value of the caret for the result string, counted as an
- offet from the end of the result string. */
+static struct demangle_component *
+d_template_arg PARAMS ((struct d_info *));
-static void
-result_set_caret (dm, position)
- demangling_t dm;
- int position;
-{
- ((string_list_t) result_string (dm))->caret_position = position;
-}
+static struct demangle_component *
+d_expression PARAMS ((struct d_info *));
-/* Shifts the position of the next addition to the result by
- POSITION_OFFSET. A negative value shifts the caret to the left. */
+static struct demangle_component *
+d_expr_primary PARAMS ((struct d_info *));
-static void
-result_shift_caret (dm, position_offset)
- demangling_t dm;
- int position_offset;
-{
- ((string_list_t) result_string (dm))->caret_position += position_offset;
-}
+static struct demangle_component *
+d_local_name PARAMS ((struct d_info *));
-/* Returns non-zero if the character that comes right before the place
- where text will be added to the result is a space. In this case,
- the caller should supress adding another space. */
+static int
+d_discriminator PARAMS ((struct d_info *));
static int
-result_previous_char_is_space (dm)
- demangling_t dm;
-{
- char *result = dyn_string_buf (result_string (dm));
- int pos = result_caret_pos (dm);
- return pos > 0 && result[pos - 1] == ' ';
-}
+d_add_substitution PARAMS ((struct d_info *, struct demangle_component *));
-/* Returns the start position of a fragment of the demangled result
- that will be a substitution candidate. Should be called at the
- start of productions that can add substitutions. */
+static struct demangle_component *
+d_substitution PARAMS ((struct d_info *, int));
-static int
-substitution_start (dm)
- demangling_t dm;
-{
- return result_caret_pos (dm);
-}
+static void
+d_print_resize PARAMS ((struct d_print_info *, size_t));
-/* Adds the suffix of the current demangled result of DM starting at
- START_POSITION as a potential substitution. If TEMPLATE_P is
- non-zero, this potential substitution is a template-id. */
+static void
+d_print_append_char PARAMS ((struct d_print_info *, int));
-static status_t
-substitution_add (dm, start_position, template_p)
- demangling_t dm;
- int start_position;
- int template_p;
-{
- dyn_string_t result = result_string (dm);
- dyn_string_t substitution = dyn_string_new (0);
- int i;
+static void
+d_print_append_buffer PARAMS ((struct d_print_info *, const char *, size_t));
- if (substitution == NULL)
- return STATUS_ALLOCATION_FAILED;
+static void
+d_print_error PARAMS ((struct d_print_info *));
- /* Extract the substring of the current demangling result that
- represents the subsitution candidate. */
- if (!dyn_string_substring (substitution,
- result, start_position, result_caret_pos (dm)))
- {
- dyn_string_delete (substitution);
- return STATUS_ALLOCATION_FAILED;
- }
+static void
+d_print_comp PARAMS ((struct d_print_info *,
+ const struct demangle_component *));
- /* If there's no room for the new entry, grow the array. */
- if (dm->substitutions_allocated == dm->num_substitutions)
- {
- size_t new_array_size;
- if (dm->substitutions_allocated > 0)
- dm->substitutions_allocated *= 2;
- else
- dm->substitutions_allocated = 2;
- new_array_size =
- sizeof (struct substitution_def) * dm->substitutions_allocated;
-
- dm->substitutions = (struct substitution_def *)
- realloc (dm->substitutions, new_array_size);
- if (dm->substitutions == NULL)
- /* Realloc failed. */
- {
- dyn_string_delete (substitution);
- return STATUS_ALLOCATION_FAILED;
- }
- }
+static void
+d_print_java_identifier PARAMS ((struct d_print_info *, const char *, int));
- /* Add the substitution to the array. */
- i = dm->num_substitutions++;
- dm->substitutions[i].text = substitution;
- dm->substitutions[i].template_p = template_p;
+static void
+d_print_mod_list PARAMS ((struct d_print_info *, struct d_print_mod *, int));
-#ifdef CP_DEMANGLE_DEBUG
- substitutions_print (dm, stderr);
-#endif
+static void
+d_print_mod PARAMS ((struct d_print_info *,
+ const struct demangle_component *));
- return STATUS_OK;
-}
+static void
+d_print_function_type PARAMS ((struct d_print_info *,
+ const struct demangle_component *,
+ struct d_print_mod *));
-/* Returns the Nth-most-recent substitution. Sets *TEMPLATE_P to
- non-zero if the substitution is a template-id, zero otherwise.
- N is numbered from zero. DM retains ownership of the returned
- string. If N is negative, or equal to or greater than the current
- number of substitution candidates, returns NULL. */
-
-static dyn_string_t
-substitution_get (dm, n, template_p)
- demangling_t dm;
- int n;
- int *template_p;
-{
- struct substitution_def *sub;
+static void
+d_print_array_type PARAMS ((struct d_print_info *,
+ const struct demangle_component *,
+ struct d_print_mod *));
- /* Make sure N is in the valid range. */
- if (n < 0 || n >= dm->num_substitutions)
- return NULL;
+static void
+d_print_expr_op PARAMS ((struct d_print_info *,
+ const struct demangle_component *));
- sub = &(dm->substitutions[n]);
- *template_p = sub->template_p;
- return sub->text;
-}
+static void
+d_print_cast PARAMS ((struct d_print_info *,
+ const struct demangle_component *));
+
+static char *
+d_demangle PARAMS ((const char *, int, size_t *));
#ifdef CP_DEMANGLE_DEBUG
-/* Debugging routine to print the current substitutions to FP. */
static void
-substitutions_print (dm, fp)
- demangling_t dm;
- FILE *fp;
+d_dump (dc, indent)
+ struct demangle_component *dc;
+ int indent;
{
- int seq_id;
- int num = dm->num_substitutions;
+ int i;
- fprintf (fp, "SUBSTITUTIONS:\n");
- for (seq_id = -1; seq_id < num - 1; ++seq_id)
- {
- int template_p;
- dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p);
+ if (dc == NULL)
+ return;
- if (seq_id == -1)
- fprintf (fp, " S_ ");
- else
- fprintf (fp, " S%d_", seq_id);
- fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text));
+ for (i = 0; i < indent; ++i)
+ putchar (' ');
+
+ switch (dc->type)
+ {
+ case DEMANGLE_COMPONENT_NAME:
+ printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s);
+ return;
+ case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
+ printf ("template parameter %ld\n", dc->u.s_number.number);
+ return;
+ case DEMANGLE_COMPONENT_CTOR:
+ printf ("constructor %d\n", (int) dc->u.s_ctor.kind);
+ d_dump (dc->u.s_ctor.name, indent + 2);
+ return;
+ case DEMANGLE_COMPONENT_DTOR:
+ printf ("destructor %d\n", (int) dc->u.s_dtor.kind);
+ d_dump (dc->u.s_dtor.name, indent + 2);
+ return;
+ case DEMANGLE_COMPONENT_SUB_STD:
+ printf ("standard substitution %s\n", dc->u.s_string.string);
+ return;
+ case DEMANGLE_COMPONENT_BUILTIN_TYPE:
+ printf ("builtin type %s\n", dc->u.s_builtin.type->name);
+ return;
+ case DEMANGLE_COMPONENT_OPERATOR:
+ printf ("operator %s\n", dc->u.s_operator.op->name);
+ return;
+ case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
+ printf ("extended operator with %d args\n",
+ dc->u.s_extended_operator.args);
+ d_dump (dc->u.s_extended_operator.name, indent + 2);
+ return;
+
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ printf ("qualified name\n");
+ break;
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ printf ("local name\n");
+ break;
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ printf ("typed name\n");
+ break;
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ printf ("template\n");
+ break;
+ case DEMANGLE_COMPONENT_VTABLE:
+ printf ("vtable\n");
+ break;
+ case DEMANGLE_COMPONENT_VTT:
+ printf ("VTT\n");
+ break;
+ case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
+ printf ("construction vtable\n");
+ break;
+ case DEMANGLE_COMPONENT_TYPEINFO:
+ printf ("typeinfo\n");
+ break;
+ case DEMANGLE_COMPONENT_TYPEINFO_NAME:
+ printf ("typeinfo name\n");
+ break;
+ case DEMANGLE_COMPONENT_TYPEINFO_FN:
+ printf ("typeinfo function\n");
+ break;
+ case DEMANGLE_COMPONENT_THUNK:
+ printf ("thunk\n");
+ break;
+ case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
+ printf ("virtual thunk\n");
+ break;
+ case DEMANGLE_COMPONENT_COVARIANT_THUNK:
+ printf ("covariant thunk\n");
+ break;
+ case DEMANGLE_COMPONENT_JAVA_CLASS:
+ printf ("java class\n");
+ break;
+ case DEMANGLE_COMPONENT_GUARD:
+ printf ("guard\n");
+ break;
+ case DEMANGLE_COMPONENT_REFTEMP:
+ printf ("reference temporary\n");
+ break;
+ case DEMANGLE_COMPONENT_RESTRICT:
+ printf ("restrict\n");
+ break;
+ case DEMANGLE_COMPONENT_VOLATILE:
+ printf ("volatile\n");
+ break;
+ case DEMANGLE_COMPONENT_CONST:
+ printf ("const\n");
+ break;
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ printf ("restrict this\n");
+ break;
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ printf ("volatile this\n");
+ break;
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ printf ("const this\n");
+ break;
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ printf ("vendor type qualifier\n");
+ break;
+ case DEMANGLE_COMPONENT_POINTER:
+ printf ("pointer\n");
+ break;
+ case DEMANGLE_COMPONENT_REFERENCE:
+ printf ("reference\n");
+ break;
+ case DEMANGLE_COMPONENT_COMPLEX:
+ printf ("complex\n");
+ break;
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ printf ("imaginary\n");
+ break;
+ case DEMANGLE_COMPONENT_VENDOR_TYPE:
+ printf ("vendor type\n");
+ break;
+ case DEMANGLE_COMPONENT_FUNCTION_TYPE:
+ printf ("function type\n");
+ break;
+ case DEMANGLE_COMPONENT_ARRAY_TYPE:
+ printf ("array type\n");
+ break;
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ printf ("pointer to member type\n");
+ break;
+ case DEMANGLE_COMPONENT_ARGLIST:
+ printf ("argument list\n");
+ break;
+ case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
+ printf ("template argument list\n");
+ break;
+ case DEMANGLE_COMPONENT_CAST:
+ printf ("cast\n");
+ break;
+ case DEMANGLE_COMPONENT_UNARY:
+ printf ("unary operator\n");
+ break;
+ case DEMANGLE_COMPONENT_BINARY:
+ printf ("binary operator\n");
+ break;
+ case DEMANGLE_COMPONENT_BINARY_ARGS:
+ printf ("binary operator arguments\n");
+ break;
+ case DEMANGLE_COMPONENT_TRINARY:
+ printf ("trinary operator\n");
+ break;
+ case DEMANGLE_COMPONENT_TRINARY_ARG1:
+ printf ("trinary operator arguments 1\n");
+ break;
+ case DEMANGLE_COMPONENT_TRINARY_ARG2:
+ printf ("trinary operator arguments 1\n");
+ break;
+ case DEMANGLE_COMPONENT_LITERAL:
+ printf ("literal\n");
+ break;
+ case DEMANGLE_COMPONENT_LITERAL_NEG:
+ printf ("negative literal\n");
+ break;
}
+
+ d_dump (d_left (dc), indent + 2);
+ d_dump (d_right (dc), indent + 2);
}
#endif /* CP_DEMANGLE_DEBUG */
-/* Creates a new template argument list. Returns NULL if allocation
- fails. */
+/* Fill in a DEMANGLE_COMPONENT_NAME. */
-static template_arg_list_t
-template_arg_list_new ()
+CP_STATIC_IF_GLIBCPP_V3
+int
+cplus_demangle_fill_name (p, s, len)
+ struct demangle_component *p;
+ const char *s;
+ int len;
{
- template_arg_list_t new_list =
- (template_arg_list_t) malloc (sizeof (struct template_arg_list_def));
- if (new_list == NULL)
- return NULL;
- /* Initialize the new list to have no arguments. */
- new_list->first_argument = NULL;
- new_list->last_argument = NULL;
- /* Return the new list. */
- return new_list;
+ if (p == NULL || s == NULL || len == 0)
+ return 0;
+ p->type = DEMANGLE_COMPONENT_NAME;
+ p->u.s_name.s = s;
+ p->u.s_name.len = len;
+ return 1;
}
-/* Deletes a template argument list and the template arguments it
- contains. */
+/* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR. */
-static void
-template_arg_list_delete (list)
- template_arg_list_t list;
+CP_STATIC_IF_GLIBCPP_V3
+int
+cplus_demangle_fill_extended_operator (p, args, name)
+ struct demangle_component *p;
+ int args;
+ struct demangle_component *name;
{
- /* If there are any arguments on LIST, delete them. */
- if (list->first_argument != NULL)
- string_list_delete (list->first_argument);
- /* Delete LIST. */
- free (list);
+ if (p == NULL || args < 0 || name == NULL)
+ return 0;
+ p->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR;
+ p->u.s_extended_operator.args = args;
+ p->u.s_extended_operator.name = name;
+ return 1;
}
-/* Adds ARG to the template argument list ARG_LIST. */
+/* Fill in a DEMANGLE_COMPONENT_CTOR. */
-static void
-template_arg_list_add_arg (arg_list, arg)
- template_arg_list_t arg_list;
- string_list_t arg;
+CP_STATIC_IF_GLIBCPP_V3
+int
+cplus_demangle_fill_ctor (p, kind, name)
+ struct demangle_component *p;
+ enum gnu_v3_ctor_kinds kind;
+ struct demangle_component *name;
{
- if (arg_list->first_argument == NULL)
- /* If there were no arguments before, ARG is the first one. */
- arg_list->first_argument = arg;
- else
- /* Make ARG the last argument on the list. */
- arg_list->last_argument->next = arg;
- /* Make ARG the last on the list. */
- arg_list->last_argument = arg;
- arg->next = NULL;
+ if (p == NULL
+ || name == NULL
+ || (kind < gnu_v3_complete_object_ctor
+ && kind > gnu_v3_complete_object_allocating_ctor))
+ return 0;
+ p->type = DEMANGLE_COMPONENT_CTOR;
+ p->u.s_ctor.kind = kind;
+ p->u.s_ctor.name = name;
+ return 1;
+}
+
+/* Fill in a DEMANGLE_COMPONENT_DTOR. */
+
+CP_STATIC_IF_GLIBCPP_V3
+int
+cplus_demangle_fill_dtor (p, kind, name)
+ struct demangle_component *p;
+ enum gnu_v3_dtor_kinds kind;
+ struct demangle_component *name;
+{
+ if (p == NULL
+ || name == NULL
+ || (kind < gnu_v3_deleting_dtor
+ && kind > gnu_v3_base_object_dtor))
+ return 0;
+ p->type = DEMANGLE_COMPONENT_DTOR;
+ p->u.s_dtor.kind = kind;
+ p->u.s_dtor.name = name;
+ return 1;
}
-/* Returns the template arugment at position INDEX in template
- argument list ARG_LIST. */
+/* Add a new component. */
-static string_list_t
-template_arg_list_get_arg (arg_list, index)
- template_arg_list_t arg_list;
- int index;
+static struct demangle_component *
+d_make_empty (di)
+ struct d_info *di;
{
- string_list_t arg = arg_list->first_argument;
- /* Scan down the list of arguments to find the one at position
- INDEX. */
- while (index--)
+ struct demangle_component *p;
+
+ if (di->next_comp >= di->num_comps)
+ return NULL;
+ p = &di->comps[di->next_comp];
+ ++di->next_comp;
+ return p;
+}
+
+/* Add a new generic component. */
+
+static struct demangle_component *
+d_make_comp (di, type, left, right)
+ struct d_info *di;
+ enum demangle_component_type type;
+ struct demangle_component *left;
+ struct demangle_component *right;
+{
+ struct demangle_component *p;
+
+ /* We check for errors here. A typical error would be a NULL return
+ from a subroutine. We catch those here, and return NULL
+ upward. */
+ switch (type)
{
- arg = arg->next;
- if (arg == NULL)
- /* Ran out of arguments before INDEX hit zero. That's an
- error. */
+ /* These types require two parameters. */
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ case DEMANGLE_COMPONENT_UNARY:
+ case DEMANGLE_COMPONENT_BINARY:
+ case DEMANGLE_COMPONENT_BINARY_ARGS:
+ case DEMANGLE_COMPONENT_TRINARY:
+ case DEMANGLE_COMPONENT_TRINARY_ARG1:
+ case DEMANGLE_COMPONENT_TRINARY_ARG2:
+ case DEMANGLE_COMPONENT_LITERAL:
+ case DEMANGLE_COMPONENT_LITERAL_NEG:
+ if (left == NULL || right == NULL)
+ return NULL;
+ break;
+
+ /* These types only require one parameter. */
+ case DEMANGLE_COMPONENT_VTABLE:
+ case DEMANGLE_COMPONENT_VTT:
+ case DEMANGLE_COMPONENT_TYPEINFO:
+ case DEMANGLE_COMPONENT_TYPEINFO_NAME:
+ case DEMANGLE_COMPONENT_TYPEINFO_FN:
+ case DEMANGLE_COMPONENT_THUNK:
+ case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
+ case DEMANGLE_COMPONENT_COVARIANT_THUNK:
+ case DEMANGLE_COMPONENT_JAVA_CLASS:
+ case DEMANGLE_COMPONENT_GUARD:
+ case DEMANGLE_COMPONENT_REFTEMP:
+ case DEMANGLE_COMPONENT_POINTER:
+ case DEMANGLE_COMPONENT_REFERENCE:
+ case DEMANGLE_COMPONENT_COMPLEX:
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE:
+ case DEMANGLE_COMPONENT_ARGLIST:
+ case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
+ case DEMANGLE_COMPONENT_CAST:
+ if (left == NULL)
return NULL;
+ break;
+
+ /* This needs a right parameter, but the left parameter can be
+ empty. */
+ case DEMANGLE_COMPONENT_ARRAY_TYPE:
+ if (right == NULL)
+ return NULL;
+ break;
+
+ /* These are allowed to have no parameters--in some cases they
+ will be filled in later. */
+ case DEMANGLE_COMPONENT_FUNCTION_TYPE:
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ break;
+
+ /* Other types should not be seen here. */
+ default:
+ return NULL;
}
- /* Return the argument at position INDEX. */
- return arg;
+
+ p = d_make_empty (di);
+ if (p != NULL)
+ {
+ p->type = type;
+ p->u.s_binary.left = left;
+ p->u.s_binary.right = right;
+ }
+ return p;
}
-/* Pushes ARG_LIST onto the top of the template argument list stack. */
+/* Add a new name component. */
-static void
-push_template_arg_list (dm, arg_list)
- demangling_t dm;
- template_arg_list_t arg_list;
+static struct demangle_component *
+d_make_name (di, s, len)
+ struct d_info *di;
+ const char *s;
+ int len;
{
- arg_list->next = dm->template_arg_lists;
- dm->template_arg_lists = arg_list;
-#ifdef CP_DEMANGLE_DEBUG
- fprintf (stderr, " ** pushing template arg list\n");
- template_arg_list_print (arg_list, stderr);
-#endif
+ struct demangle_component *p;
+
+ p = d_make_empty (di);
+ if (! cplus_demangle_fill_name (p, s, len))
+ return NULL;
+ return p;
}
-/* Pops and deletes elements on the template argument list stack until
- arg_list is the topmost element. If arg_list is NULL, all elements
- are popped and deleted. */
+/* Add a new builtin type component. */
-static void
-pop_to_template_arg_list (dm, arg_list)
- demangling_t dm;
- template_arg_list_t arg_list;
+static struct demangle_component *
+d_make_builtin_type (di, type)
+ struct d_info *di;
+ const struct demangle_builtin_type_info *type;
{
- while (dm->template_arg_lists != arg_list)
+ struct demangle_component *p;
+
+ if (type == NULL)
+ return NULL;
+ p = d_make_empty (di);
+ if (p != NULL)
{
- template_arg_list_t top = dm->template_arg_lists;
- /* Disconnect the topmost element from the list. */
- dm->template_arg_lists = top->next;
- /* Delete the popped element. */
- template_arg_list_delete (top);
-#ifdef CP_DEMANGLE_DEBUG
- fprintf (stderr, " ** removing template arg list\n");
-#endif
+ p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
+ p->u.s_builtin.type = type;
}
+ return p;
}
-#ifdef CP_DEMANGLE_DEBUG
+/* Add a new operator component. */
-/* Prints the contents of ARG_LIST to FP. */
-
-static void
-template_arg_list_print (arg_list, fp)
- template_arg_list_t arg_list;
- FILE *fp;
+static struct demangle_component *
+d_make_operator (di, op)
+ struct d_info *di;
+ const struct demangle_operator_info *op;
{
- string_list_t arg;
- int index = -1;
+ struct demangle_component *p;
- fprintf (fp, "TEMPLATE ARGUMENT LIST:\n");
- for (arg = arg_list->first_argument; arg != NULL; arg = arg->next)
+ p = d_make_empty (di);
+ if (p != NULL)
{
- if (index == -1)
- fprintf (fp, " T_ : ");
- else
- fprintf (fp, " T%d_ : ", index);
- ++index;
- fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg));
+ p->type = DEMANGLE_COMPONENT_OPERATOR;
+ p->u.s_operator.op = op;
}
+ return p;
}
-#endif /* CP_DEMANGLE_DEBUG */
-
-/* Returns the topmost element on the stack of template argument
- lists. If there is no list of template arguments, returns NULL. */
+/* Add a new extended operator component. */
-static template_arg_list_t
-current_template_arg_list (dm)
- demangling_t dm;
+static struct demangle_component *
+d_make_extended_operator (di, args, name)
+ struct d_info *di;
+ int args;
+ struct demangle_component *name;
{
- return dm->template_arg_lists;
+ struct demangle_component *p;
+
+ p = d_make_empty (di);
+ if (! cplus_demangle_fill_extended_operator (p, args, name))
+ return NULL;
+ return p;
}
-/* Allocates a demangling_t object for demangling mangled NAME. A new
- result must be pushed before the returned object can be used.
- Returns NULL if allocation fails. */
+/* Add a new constructor component. */
-static demangling_t
-demangling_new (name, style)
- const char *name;
- int style;
+static struct demangle_component *
+d_make_ctor (di, kind, name)
+ struct d_info *di;
+ enum gnu_v3_ctor_kinds kind;
+ struct demangle_component *name;
{
- demangling_t dm;
- dm = (demangling_t) malloc (sizeof (struct demangling_def));
- if (dm == NULL)
- return NULL;
+ struct demangle_component *p;
- dm->name = name;
- dm->next = name;
- dm->result = NULL;
- dm->num_substitutions = 0;
- dm->substitutions_allocated = 10;
- dm->template_arg_lists = NULL;
- dm->last_source_name = dyn_string_new (0);
- if (dm->last_source_name == NULL)
+ p = d_make_empty (di);
+ if (! cplus_demangle_fill_ctor (p, kind, name))
return NULL;
- dm->substitutions = (struct substitution_def *)
- malloc (dm->substitutions_allocated * sizeof (struct substitution_def));
- if (dm->substitutions == NULL)
- {
- dyn_string_delete (dm->last_source_name);
- return NULL;
- }
- dm->style = style;
- dm->is_constructor = 0;
- dm->is_destructor = 0;
+ return p;
+}
+
+/* Add a new destructor component. */
+
+static struct demangle_component *
+d_make_dtor (di, kind, name)
+ struct d_info *di;
+ enum gnu_v3_dtor_kinds kind;
+ struct demangle_component *name;
+{
+ struct demangle_component *p;
- return dm;
+ p = d_make_empty (di);
+ if (! cplus_demangle_fill_dtor (p, kind, name))
+ return NULL;
+ return p;
}
-/* Deallocates a demangling_t object and all memory associated with
- it. */
+/* Add a new template parameter. */
-static void
-demangling_delete (dm)
- demangling_t dm;
+static struct demangle_component *
+d_make_template_param (di, i)
+ struct d_info *di;
+ long i;
{
- int i;
- template_arg_list_t arg_list = dm->template_arg_lists;
+ struct demangle_component *p;
- /* Delete the stack of template argument lists. */
- while (arg_list != NULL)
+ p = d_make_empty (di);
+ if (p != NULL)
{
- template_arg_list_t next = arg_list->next;
- template_arg_list_delete (arg_list);
- arg_list = next;
+ p->type = DEMANGLE_COMPONENT_TEMPLATE_PARAM;
+ p->u.s_number.number = i;
}
- /* Delete the list of substitutions. */
- for (i = dm->num_substitutions; --i >= 0; )
- dyn_string_delete (dm->substitutions[i].text);
- free (dm->substitutions);
- /* Delete the demangled result. */
- string_list_delete (dm->result);
- /* Delete the stored identifier name. */
- dyn_string_delete (dm->last_source_name);
- /* Delete the context object itself. */
- free (dm);
+ return p;
}
-/* These functions demangle an alternative of the corresponding
- production in the mangling spec. The first argument of each is a
- demangling context structure for the current demangling
- operation. Most emit demangled text directly to the topmost result
- string on the result string stack in the demangling context
- structure. */
-
-static status_t demangle_char
- PARAMS ((demangling_t, int));
-static status_t demangle_mangled_name
- PARAMS ((demangling_t));
-static status_t demangle_encoding
- PARAMS ((demangling_t));
-static status_t demangle_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_nested_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_prefix
- PARAMS ((demangling_t, int *));
-static status_t demangle_unqualified_name
- PARAMS ((demangling_t, int *));
-static status_t demangle_source_name
- PARAMS ((demangling_t));
-static status_t demangle_number
- PARAMS ((demangling_t, int *, int, int));
-static status_t demangle_number_literally
- PARAMS ((demangling_t, dyn_string_t, int, int));
-static status_t demangle_identifier
- PARAMS ((demangling_t, int, dyn_string_t));
-static status_t demangle_operator_name
- PARAMS ((demangling_t, int, int *, int *));
-static status_t demangle_nv_offset
- PARAMS ((demangling_t));
-static status_t demangle_v_offset
- PARAMS ((demangling_t));
-static status_t demangle_call_offset
- PARAMS ((demangling_t));
-static status_t demangle_special_name
- PARAMS ((demangling_t));
-static status_t demangle_ctor_dtor_name
- PARAMS ((demangling_t));
-static status_t demangle_type_ptr
- PARAMS ((demangling_t, int *, int));
-static status_t demangle_type
- PARAMS ((demangling_t));
-static status_t demangle_CV_qualifiers
- PARAMS ((demangling_t, dyn_string_t));
-static status_t demangle_builtin_type
- PARAMS ((demangling_t));
-static status_t demangle_function_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_bare_function_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_class_enum_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_array_type
- PARAMS ((demangling_t, int *));
-static status_t demangle_template_param
- PARAMS ((demangling_t));
-static status_t demangle_template_args
- PARAMS ((demangling_t));
-static status_t demangle_literal
- PARAMS ((demangling_t));
-static status_t demangle_template_arg
- PARAMS ((demangling_t));
-static status_t demangle_expression
- PARAMS ((demangling_t));
-static status_t demangle_scope_expression
- PARAMS ((demangling_t));
-static status_t demangle_expr_primary
- PARAMS ((demangling_t));
-static status_t demangle_substitution
- PARAMS ((demangling_t, int *));
-static status_t demangle_local_name
- PARAMS ((demangling_t));
-static status_t demangle_discriminator
- PARAMS ((demangling_t, int));
-static status_t cp_demangle
- PARAMS ((const char *, dyn_string_t, int));
-static status_t cp_demangle_type
- PARAMS ((const char*, dyn_string_t));
-
-/* When passed to demangle_bare_function_type, indicates that the
- function's return type is not encoded before its parameter types. */
-#define BFT_NO_RETURN_TYPE NULL
-
-/* Check that the next character is C. If so, consume it. If not,
- return an error. */
-
-static status_t
-demangle_char (dm, c)
- demangling_t dm;
- int c;
+/* Add a new standard substitution component. */
+
+static struct demangle_component *
+d_make_sub (di, name, len)
+ struct d_info *di;
+ const char *name;
+ int len;
{
- static char *error_message = NULL;
+ struct demangle_component *p;
- if (peek_char (dm) == c)
+ p = d_make_empty (di);
+ if (p != NULL)
{
- advance_char (dm);
- return STATUS_OK;
- }
- else
- {
- if (error_message == NULL)
- error_message = strdup ("Expected ?");
- error_message[9] = c;
- return error_message;
+ p->type = DEMANGLE_COMPONENT_SUB_STD;
+ p->u.s_string.string = name;
+ p->u.s_string.len = len;
}
+ return p;
}
-/* Demangles and emits a <mangled-name>.
+/* <mangled-name> ::= _Z <encoding>
- <mangled-name> ::= _Z <encoding> */
+ TOP_LEVEL is non-zero when called at the top level. */
-static status_t
-demangle_mangled_name (dm)
- demangling_t dm;
+CP_STATIC_IF_GLIBCPP_V3
+struct demangle_component *
+cplus_demangle_mangled_name (di, top_level)
+ struct d_info *di;
+ int top_level;
{
- DEMANGLE_TRACE ("mangled-name", dm);
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- RETURN_IF_ERROR (demangle_char (dm, 'Z'));
- RETURN_IF_ERROR (demangle_encoding (dm));
- return STATUS_OK;
+ if (d_next_char (di) != '_')
+ return NULL;
+ if (d_next_char (di) != 'Z')
+ return NULL;
+ return d_encoding (di, top_level);
}
-/* Demangles and emits an <encoding>.
+/* Return whether a function should have a return type. The argument
+ is the function name, which may be qualified in various ways. The
+ rules are that template functions have return types with some
+ exceptions, function types which are not part of a function name
+ mangling have return types with some exceptions, and non-template
+ function names do not have return types. The exceptions are that
+ constructors, destructors, and conversion operators do not have
+ return types. */
+
+static int
+has_return_type (dc)
+ struct demangle_component *dc;
+{
+ if (dc == NULL)
+ return 0;
+ switch (dc->type)
+ {
+ default:
+ return 0;
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ return ! is_ctor_dtor_or_conversion (d_left (dc));
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ return has_return_type (d_left (dc));
+ }
+}
- <encoding> ::= <function name> <bare-function-type>
- ::= <data name>
- ::= <special-name> */
+/* Return whether a name is a constructor, a destructor, or a
+ conversion operator. */
-static status_t
-demangle_encoding (dm)
- demangling_t dm;
+static int
+is_ctor_dtor_or_conversion (dc)
+ struct demangle_component *dc;
{
- int encode_return_type;
- int start_position;
- template_arg_list_t old_arg_list = current_template_arg_list (dm);
- char peek = peek_char (dm);
+ if (dc == NULL)
+ return 0;
+ switch (dc->type)
+ {
+ default:
+ return 0;
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ return is_ctor_dtor_or_conversion (d_right (dc));
+ case DEMANGLE_COMPONENT_CTOR:
+ case DEMANGLE_COMPONENT_DTOR:
+ case DEMANGLE_COMPONENT_CAST:
+ return 1;
+ }
+}
- DEMANGLE_TRACE ("encoding", dm);
-
- /* Remember where the name starts. If it turns out to be a template
- function, we'll have to insert the return type here. */
- start_position = result_caret_pos (dm);
+/* <encoding> ::= <(function) name> <bare-function-type>
+ ::= <(data) name>
+ ::= <special-name>
+
+ TOP_LEVEL is non-zero when called at the top level, in which case
+ if DMGL_PARAMS is not set we do not demangle the function
+ parameters. We only set this at the top level, because otherwise
+ we would not correctly demangle names in local scopes. */
+
+static struct demangle_component *
+d_encoding (di, top_level)
+ struct d_info *di;
+ int top_level;
+{
+ char peek = d_peek_char (di);
if (peek == 'G' || peek == 'T')
- RETURN_IF_ERROR (demangle_special_name (dm));
+ return d_special_name (di);
else
{
- /* Now demangle the name. */
- RETURN_IF_ERROR (demangle_name (dm, &encode_return_type));
+ struct demangle_component *dc;
- /* If there's anything left, the name was a function name, with
- maybe its return type, and its parameter types, following. */
- if (!end_of_name_p (dm)
- && peek_char (dm) != 'E')
+ dc = d_name (di);
+
+ if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0)
{
- if (encode_return_type)
- /* Template functions have their return type encoded. The
- return type should be inserted at start_position. */
- RETURN_IF_ERROR
- (demangle_bare_function_type (dm, &start_position));
- else
- /* Non-template functions don't have their return type
- encoded. */
- RETURN_IF_ERROR
- (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE));
- }
- }
+ /* Strip off any initial CV-qualifiers, as they really apply
+ to the `this' parameter, and they were not output by the
+ v2 demangler without DMGL_PARAMS. */
+ while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS
+ || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
+ || dc->type == DEMANGLE_COMPONENT_CONST_THIS)
+ dc = d_left (dc);
+
+ /* If the top level is a DEMANGLE_COMPONENT_LOCAL_NAME, then
+ there may be CV-qualifiers on its right argument which
+ really apply here; this happens when parsing a class
+ which is local to a function. */
+ if (dc->type == DEMANGLE_COMPONENT_LOCAL_NAME)
+ {
+ struct demangle_component *dcr;
+
+ dcr = d_right (dc);
+ while (dcr->type == DEMANGLE_COMPONENT_RESTRICT_THIS
+ || dcr->type == DEMANGLE_COMPONENT_VOLATILE_THIS
+ || dcr->type == DEMANGLE_COMPONENT_CONST_THIS)
+ dcr = d_left (dcr);
+ dc->u.s_binary.right = dcr;
+ }
- /* Pop off template argument lists that were built during the
- mangling of this name, to restore the old template context. */
- pop_to_template_arg_list (dm, old_arg_list);
+ return dc;
+ }
- return STATUS_OK;
+ peek = d_peek_char (di);
+ if (peek == '\0' || peek == 'E')
+ return dc;
+ return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc,
+ d_bare_function_type (di, has_return_type (dc)));
+ }
}
-/* Demangles and emits a <name>.
-
- <name> ::= <unscoped-name>
- ::= <unscoped-template-name> <template-args>
- ::= <nested-name>
- ::= <local-name>
+/* <name> ::= <nested-name>
+ ::= <unscoped-name>
+ ::= <unscoped-template-name> <template-args>
+ ::= <local-name>
- <unscoped-name> ::= <unqualified-name>
- ::= St <unqualified-name> # ::std::
+ <unscoped-name> ::= <unqualified-name>
+ ::= St <unqualified-name>
- <unscoped-template-name>
- ::= <unscoped-name>
- ::= <substitution> */
+ <unscoped-template-name> ::= <unscoped-name>
+ ::= <substitution>
+*/
-static status_t
-demangle_name (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
+static struct demangle_component *
+d_name (di)
+ struct d_info *di;
{
- int start = substitution_start (dm);
- char peek = peek_char (dm);
- int is_std_substitution = 0;
-
- /* Generally, the return type is encoded if the function is a
- template-id, and suppressed otherwise. There are a few cases,
- though, in which the return type is not encoded even for a
- templated function. In these cases, this flag is set. */
- int suppress_return_type = 0;
-
- DEMANGLE_TRACE ("name", dm);
+ char peek = d_peek_char (di);
+ struct demangle_component *dc;
switch (peek)
{
case 'N':
- /* This is a <nested-name>. */
- RETURN_IF_ERROR (demangle_nested_name (dm, encode_return_type));
- break;
+ return d_nested_name (di);
case 'Z':
- RETURN_IF_ERROR (demangle_local_name (dm));
- *encode_return_type = 0;
- break;
+ return d_local_name (di);
case 'S':
- /* The `St' substitution allows a name nested in std:: to appear
- without being enclosed in a nested name. */
- if (peek_char_next (dm) == 't')
- {
- (void) next_char (dm);
- (void) next_char (dm);
- RETURN_IF_ERROR (result_add (dm, "std::"));
- RETURN_IF_ERROR
- (demangle_unqualified_name (dm, &suppress_return_type));
- is_std_substitution = 1;
- }
- else
- RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
- /* Check if a template argument list immediately follows.
- If so, then we just demangled an <unqualified-template-name>. */
- if (peek_char (dm) == 'I')
- {
- /* A template name of the form std::<unqualified-name> is a
- substitution candidate. */
- if (is_std_substitution)
- RETURN_IF_ERROR (substitution_add (dm, start, 0));
- /* Demangle the <template-args> here. */
- RETURN_IF_ERROR (demangle_template_args (dm));
- *encode_return_type = !suppress_return_type;
- }
- else
- *encode_return_type = 0;
+ {
+ int subst;
- break;
+ if (d_peek_next_char (di) != 't')
+ {
+ dc = d_substitution (di, 0);
+ subst = 1;
+ }
+ else
+ {
+ d_advance (di, 2);
+ dc = d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME,
+ d_make_name (di, "std", 3),
+ d_unqualified_name (di));
+ di->expansion += 3;
+ subst = 0;
+ }
- default:
- /* This is an <unscoped-name> or <unscoped-template-name>. */
- RETURN_IF_ERROR (demangle_unqualified_name (dm, &suppress_return_type));
+ if (d_peek_char (di) != 'I')
+ {
+ /* The grammar does not permit this case to occur if we
+ called d_substitution() above (i.e., subst == 1). We
+ don't bother to check. */
+ }
+ else
+ {
+ /* This is <template-args>, which means that we just saw
+ <unscoped-template-name>, which is a substitution
+ candidate if we didn't just get it from a
+ substitution. */
+ if (! subst)
+ {
+ if (! d_add_substitution (di, dc))
+ return NULL;
+ }
+ dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
+ d_template_args (di));
+ }
- /* If the <unqualified-name> is followed by template args, this
- is an <unscoped-template-name>. */
- if (peek_char (dm) == 'I')
- {
- /* Add a substitution for the unqualified template name. */
- RETURN_IF_ERROR (substitution_add (dm, start, 0));
+ return dc;
+ }
- RETURN_IF_ERROR (demangle_template_args (dm));
- *encode_return_type = !suppress_return_type;
+ default:
+ dc = d_unqualified_name (di);
+ if (d_peek_char (di) == 'I')
+ {
+ /* This is <template-args>, which means that we just saw
+ <unscoped-template-name>, which is a substitution
+ candidate. */
+ if (! d_add_substitution (di, dc))
+ return NULL;
+ dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
+ d_template_args (di));
}
- else
- *encode_return_type = 0;
-
- break;
+ return dc;
}
-
- return STATUS_OK;
}
-/* Demangles and emits a <nested-name>.
-
- <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqulified-name> E */
+/* <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
+ ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
+*/
-static status_t
-demangle_nested_name (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
+static struct demangle_component *
+d_nested_name (di)
+ struct d_info *di;
{
- char peek;
+ struct demangle_component *ret;
+ struct demangle_component **pret;
- DEMANGLE_TRACE ("nested-name", dm);
+ if (d_next_char (di) != 'N')
+ return NULL;
- RETURN_IF_ERROR (demangle_char (dm, 'N'));
+ pret = d_cv_qualifiers (di, &ret, 1);
+ if (pret == NULL)
+ return NULL;
- peek = peek_char (dm);
- if (peek == 'r' || peek == 'V' || peek == 'K')
- {
- dyn_string_t cv_qualifiers;
- status_t status;
-
- /* Snarf up CV qualifiers. */
- cv_qualifiers = dyn_string_new (24);
- if (cv_qualifiers == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_CV_qualifiers (dm, cv_qualifiers);
-
- /* Emit them, preceded by a space. */
- status = result_add_char (dm, ' ');
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, cv_qualifiers);
- /* The CV qualifiers that occur in a <nested-name> will be
- qualifiers for member functions. These are placed at the end
- of the function. Therefore, shift the caret to the left by
- the length of the qualifiers, so other text is inserted
- before them and they stay at the end. */
- result_shift_caret (dm, -dyn_string_length (cv_qualifiers) - 1);
- /* Clean up. */
- dyn_string_delete (cv_qualifiers);
- RETURN_IF_ERROR (status);
- }
+ *pret = d_prefix (di);
+ if (*pret == NULL)
+ return NULL;
- RETURN_IF_ERROR (demangle_prefix (dm, encode_return_type));
- /* No need to demangle the final <unqualified-name>; demangle_prefix
- will handle it. */
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
+ if (d_next_char (di) != 'E')
+ return NULL;
- return STATUS_OK;
+ return ret;
}
-/* Demangles and emits a <prefix>.
-
- <prefix> ::= <prefix> <unqualified-name>
- ::= <template-prefix> <template-args>
- ::= # empty
- ::= <substitution>
+/* <prefix> ::= <prefix> <unqualified-name>
+ ::= <template-prefix> <template-args>
+ ::= <template-param>
+ ::=
+ ::= <substitution>
- <template-prefix> ::= <prefix>
- ::= <substitution> */
+ <template-prefix> ::= <prefix> <(template) unqualified-name>
+ ::= <template-param>
+ ::= <substitution>
+*/
-static status_t
-demangle_prefix (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
+static struct demangle_component *
+d_prefix (di)
+ struct d_info *di;
{
- int start = substitution_start (dm);
- int nested = 0;
-
- /* ENCODE_RETURN_TYPE is updated as we decend the nesting chain.
- After <template-args>, it is set to non-zero; after everything
- else it is set to zero. */
-
- /* Generally, the return type is encoded if the function is a
- template-id, and suppressed otherwise. There are a few cases,
- though, in which the return type is not encoded even for a
- templated function. In these cases, this flag is set. */
- int suppress_return_type = 0;
-
- DEMANGLE_TRACE ("prefix", dm);
+ struct demangle_component *ret = NULL;
while (1)
{
char peek;
+ enum demangle_component_type comb_type;
+ struct demangle_component *dc;
- if (end_of_name_p (dm))
- return "Unexpected end of name in <compound-name>.";
-
- peek = peek_char (dm);
-
- /* We'll initialize suppress_return_type to false, and set it to true
- if we end up demangling a constructor name. However, make
- sure we're not actually about to demangle template arguments
- -- if so, this is the <template-args> following a
- <template-prefix>, so we'll want the previous flag value
- around. */
- if (peek != 'I')
- suppress_return_type = 0;
-
- if (IS_DIGIT ((unsigned char) peek)
- || (peek >= 'a' && peek <= 'z')
- || peek == 'C' || peek == 'D'
- || peek == 'S')
- {
- /* We have another level of scope qualification. */
- if (nested)
- RETURN_IF_ERROR (result_add (dm, NAMESPACE_SEPARATOR));
- else
- nested = 1;
+ peek = d_peek_char (di);
+ if (peek == '\0')
+ return NULL;
- if (peek == 'S')
- /* The substitution determines whether this is a
- template-id. */
- RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
- else
- {
- /* It's just a name. */
- RETURN_IF_ERROR
- (demangle_unqualified_name (dm, &suppress_return_type));
- *encode_return_type = 0;
- }
- }
- else if (peek == 'Z')
- RETURN_IF_ERROR (demangle_local_name (dm));
+ /* The older code accepts a <local-name> here, but I don't see
+ that in the grammar. The older code does not accept a
+ <template-param> here. */
+
+ comb_type = DEMANGLE_COMPONENT_QUAL_NAME;
+ if (IS_DIGIT (peek)
+ || IS_LOWER (peek)
+ || peek == 'C'
+ || peek == 'D')
+ dc = d_unqualified_name (di);
+ else if (peek == 'S')
+ dc = d_substitution (di, 1);
else if (peek == 'I')
{
- RETURN_IF_ERROR (demangle_template_args (dm));
-
- /* Now we want to indicate to the caller that we've
- demangled template arguments, thus the prefix was a
- <template-prefix>. That's so that the caller knows to
- demangle the function's return type, if this turns out to
- be a function name. But, if it's a member template
- constructor or a templated conversion operator, report it
- as untemplated. Those never get encoded return types. */
- *encode_return_type = !suppress_return_type;
+ if (ret == NULL)
+ return NULL;
+ comb_type = DEMANGLE_COMPONENT_TEMPLATE;
+ dc = d_template_args (di);
}
+ else if (peek == 'T')
+ dc = d_template_param (di);
else if (peek == 'E')
- /* All done. */
- return STATUS_OK;
+ return ret;
+ else
+ return NULL;
+
+ if (ret == NULL)
+ ret = dc;
else
- return "Unexpected character in <compound-name>.";
+ ret = d_make_comp (di, comb_type, ret, dc);
- if (peek != 'S'
- && peek_char (dm) != 'E')
- /* Add a new substitution for the prefix thus far. */
- RETURN_IF_ERROR (substitution_add (dm, start, *encode_return_type));
+ if (peek != 'S' && d_peek_char (di) != 'E')
+ {
+ if (! d_add_substitution (di, ret))
+ return NULL;
+ }
}
}
-/* Demangles and emits an <unqualified-name>. If this
- <unqualified-name> is for a special function type that should never
- have its return type encoded (particularly, a constructor or
- conversion operator), *SUPPRESS_RETURN_TYPE is set to 1; otherwise,
- it is set to zero.
-
- <unqualified-name> ::= <operator-name>
- ::= <special-name>
- ::= <source-name> */
+/* <unqualified-name> ::= <operator-name>
+ ::= <ctor-dtor-name>
+ ::= <source-name>
+*/
-static status_t
-demangle_unqualified_name (dm, suppress_return_type)
- demangling_t dm;
- int *suppress_return_type;
+static struct demangle_component *
+d_unqualified_name (di)
+ struct d_info *di;
{
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("unqualified-name", dm);
-
- /* By default, don't force suppression of the return type (though
- non-template functions still don't get a return type encoded). */
- *suppress_return_type = 0;
+ char peek;
- if (IS_DIGIT ((unsigned char) peek))
- RETURN_IF_ERROR (demangle_source_name (dm));
- else if (peek >= 'a' && peek <= 'z')
+ peek = d_peek_char (di);
+ if (IS_DIGIT (peek))
+ return d_source_name (di);
+ else if (IS_LOWER (peek))
{
- int num_args;
-
- /* Conversion operators never have a return type encoded. */
- if (peek == 'c' && peek_char_next (dm) == 'v')
- *suppress_return_type = 1;
+ struct demangle_component *ret;
- RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args, NULL));
+ ret = d_operator_name (di);
+ if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR)
+ di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
+ return ret;
}
else if (peek == 'C' || peek == 'D')
- {
- /* Constructors never have a return type encoded. */
- if (peek == 'C')
- *suppress_return_type = 1;
-
- RETURN_IF_ERROR (demangle_ctor_dtor_name (dm));
- }
+ return d_ctor_dtor_name (di);
else
- return "Unexpected character in <unqualified-name>.";
-
- return STATUS_OK;
+ return NULL;
}
-/* Demangles and emits <source-name>.
+/* <source-name> ::= <(positive length) number> <identifier> */
- <source-name> ::= <length number> <identifier> */
-
-static status_t
-demangle_source_name (dm)
- demangling_t dm;
+static struct demangle_component *
+d_source_name (di)
+ struct d_info *di;
{
- int length;
-
- DEMANGLE_TRACE ("source-name", dm);
-
- /* Decode the length of the identifier. */
- RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0));
- if (length == 0)
- return "Zero length in <source-name>.";
-
- /* Now the identifier itself. It's placed into last_source_name,
- where it can be used to build a constructor or destructor name. */
- RETURN_IF_ERROR (demangle_identifier (dm, length,
- dm->last_source_name));
-
- /* Emit it. */
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
+ long len;
+ struct demangle_component *ret;
- return STATUS_OK;
+ len = d_number (di);
+ if (len <= 0)
+ return NULL;
+ ret = d_identifier (di, len);
+ di->last_name = ret;
+ return ret;
}
-/* Demangles a number, either a <number> or a <positive-number> at the
- current position, consuming all consecutive digit characters. Sets
- *VALUE to the resulting numberand returns STATUS_OK. The number is
- interpreted as BASE, which must be either 10 or 36. If IS_SIGNED
- is non-zero, negative numbers -- prefixed with `n' -- are accepted.
-
- <number> ::= [n] <positive-number>
-
- <positive-number> ::= <decimal integer> */
-
-static status_t
-demangle_number (dm, value, base, is_signed)
- demangling_t dm;
- int *value;
- int base;
- int is_signed;
-{
- dyn_string_t number = dyn_string_new (10);
-
- DEMANGLE_TRACE ("number", dm);
-
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- demangle_number_literally (dm, number, base, is_signed);
- *value = strtol (dyn_string_buf (number), NULL, base);
- dyn_string_delete (number);
-
- return STATUS_OK;
-}
+/* number ::= [n] <(non-negative decimal integer)> */
-/* Demangles a number at the current position. The digits (and minus
- sign, if present) that make up the number are appended to STR.
- Only base-BASE digits are accepted; BASE must be either 10 or 36.
- If IS_SIGNED, negative numbers -- prefixed with `n' -- are
- accepted. Does not consume a trailing underscore or other
- terminating character. */
-
-static status_t
-demangle_number_literally (dm, str, base, is_signed)
- demangling_t dm;
- dyn_string_t str;
- int base;
- int is_signed;
+static long
+d_number (di)
+ struct d_info *di;
{
- DEMANGLE_TRACE ("number*", dm);
-
- if (base != 10 && base != 36)
- return STATUS_INTERNAL_ERROR;
+ int negative;
+ char peek;
+ long ret;
- /* An `n' denotes a negative number. */
- if (is_signed && peek_char (dm) == 'n')
+ negative = 0;
+ peek = d_peek_char (di);
+ if (peek == 'n')
{
- /* Skip past the n. */
- advance_char (dm);
- /* The normal way to write a negative number is with a minus
- sign. */
- if (!dyn_string_append_char (str, '-'))
- return STATUS_ALLOCATION_FAILED;
+ negative = 1;
+ d_advance (di, 1);
+ peek = d_peek_char (di);
}
- /* Loop until we hit a non-digit. */
+ ret = 0;
while (1)
{
- char peek = peek_char (dm);
- if (IS_DIGIT ((unsigned char) peek)
- || (base == 36 && peek >= 'A' && peek <= 'Z'))
+ if (! IS_DIGIT (peek))
{
- /* Accumulate digits. */
- if (!dyn_string_append_char (str, next_char (dm)))
- return STATUS_ALLOCATION_FAILED;
+ if (negative)
+ ret = - ret;
+ return ret;
}
- else
- /* Not a digit? All done. */
- break;
+ ret = ret * 10 + peek - '0';
+ d_advance (di, 1);
+ peek = d_peek_char (di);
}
-
- return STATUS_OK;
}
-/* Demangles an identifier at the current position of LENGTH
- characters and places it in IDENTIFIER. */
+/* identifier ::= <(unqualified source code identifier)> */
-static status_t
-demangle_identifier (dm, length, identifier)
- demangling_t dm;
- int length;
- dyn_string_t identifier;
+static struct demangle_component *
+d_identifier (di, len)
+ struct d_info *di;
+ int len;
{
- DEMANGLE_TRACE ("identifier", dm);
+ const char *name;
- dyn_string_clear (identifier);
- if (!dyn_string_resize (identifier, length))
- return STATUS_ALLOCATION_FAILED;
+ name = d_str (di);
- while (length-- > 0)
- {
- int ch;
- if (end_of_name_p (dm))
- return "Unexpected end of name in <identifier>.";
- ch = next_char (dm);
-
- /* Handle extended Unicode characters. We encode them as __U{hex}_,
- where {hex} omits leading 0's. For instance, '$' is encoded as
- "__U24_". */
- if (ch == '_'
- && peek_char (dm) == '_'
- && peek_char_next (dm) == 'U')
- {
- char buf[10];
- int pos = 0;
- advance_char (dm); advance_char (dm); length -= 2;
- while (length-- > 0)
- {
- ch = next_char (dm);
- if (!isxdigit (ch))
- break;
- buf[pos++] = ch;
- }
- if (ch != '_' || length < 0)
- return STATUS_ERROR;
- if (pos == 0)
- {
- /* __U_ just means __U. */
- if (!dyn_string_append_cstr (identifier, "__U"))
- return STATUS_ALLOCATION_FAILED;
- continue;
- }
- else
- {
- buf[pos] = '\0';
- ch = strtol (buf, 0, 16);
- }
- }
-
- if (!dyn_string_append_char (identifier, ch))
- return STATUS_ALLOCATION_FAILED;
- }
+ if (di->send - name < len)
+ return NULL;
- /* GCC encodes anonymous namespaces using a `_GLOBAL_[_.$]N.'
- followed by the source file name and some random characters.
- Unless we're in strict mode, decipher these names appropriately. */
- if (!flag_strict)
+ d_advance (di, len);
+
+ /* A Java mangled name may have a trailing '$' if it is a C++
+ keyword. This '$' is not included in the length count. We just
+ ignore the '$'. */
+ if ((di->options & DMGL_JAVA) != 0
+ && d_peek_char (di) == '$')
+ d_advance (di, 1);
+
+ /* Look for something which looks like a gcc encoding of an
+ anonymous namespace, and replace it with a more user friendly
+ name. */
+ if (len >= (int) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2
+ && memcmp (name, ANONYMOUS_NAMESPACE_PREFIX,
+ ANONYMOUS_NAMESPACE_PREFIX_LEN) == 0)
{
- char *name = dyn_string_buf (identifier);
- int prefix_length = strlen (ANONYMOUS_NAMESPACE_PREFIX);
-
- /* Compare the first, fixed part. */
- if (strncmp (name, ANONYMOUS_NAMESPACE_PREFIX, prefix_length) == 0)
- {
- name += prefix_length;
- /* The next character might be a period, an underscore, or
- dollar sign, depending on the target architecture's
- assembler's capabilities. After that comes an `N'. */
- if ((*name == '.' || *name == '_' || *name == '$')
- && *(name + 1) == 'N')
- /* This looks like the anonymous namespace identifier.
- Replace it with something comprehensible. */
- dyn_string_copy_cstr (identifier, "(anonymous namespace)");
+ const char *s;
+
+ s = name + ANONYMOUS_NAMESPACE_PREFIX_LEN;
+ if ((*s == '.' || *s == '_' || *s == '$')
+ && s[1] == 'N')
+ {
+ di->expansion -= len - sizeof "(anonymous namespace)";
+ return d_make_name (di, "(anonymous namespace)",
+ sizeof "(anonymous namespace)" - 1);
}
}
- return STATUS_OK;
+ return d_make_name (di, name, len);
}
-/* Demangles and emits an <operator-name>. If SHORT_NAME is non-zero,
- the short form is emitted; otherwise the full source form
- (`operator +' etc.) is emitted. *NUM_ARGS is set to the number of
- operands that the operator takes. If TYPE_ARG is non-NULL,
- *TYPE_ARG is set to 1 if the first argument is a type and 0
- otherwise.
-
- <operator-name>
- ::= nw # new
- ::= na # new[]
- ::= dl # delete
- ::= da # delete[]
- ::= ps # + (unary)
- ::= ng # - (unary)
- ::= ad # & (unary)
- ::= de # * (unary)
- ::= co # ~
- ::= pl # +
- ::= mi # -
- ::= ml # *
- ::= dv # /
- ::= rm # %
- ::= an # &
- ::= or # |
- ::= eo # ^
- ::= aS # =
- ::= pL # +=
- ::= mI # -=
- ::= mL # *=
- ::= dV # /=
- ::= rM # %=
- ::= aN # &=
- ::= oR # |=
- ::= eO # ^=
- ::= ls # <<
- ::= rs # >>
- ::= lS # <<=
- ::= rS # >>=
- ::= eq # ==
- ::= ne # !=
- ::= lt # <
- ::= gt # >
- ::= le # <=
- ::= ge # >=
- ::= nt # !
- ::= aa # &&
- ::= oo # ||
- ::= pp # ++
- ::= mm # --
- ::= cm # ,
- ::= pm # ->*
- ::= pt # ->
- ::= cl # ()
- ::= ix # []
- ::= qu # ?
- ::= st # sizeof (a type)
- ::= sz # sizeof (an expression)
- ::= cv <type> # cast
- ::= v [0-9] <source-name> # vendor extended operator */
-
-static status_t
-demangle_operator_name (dm, short_name, num_args, type_arg)
- demangling_t dm;
- int short_name;
- int *num_args;
- int *type_arg;
-{
- struct operator_code
- {
- /* The mangled code for this operator. */
- const char *const code;
- /* The source name of this operator. */
- const char *const name;
- /* The number of arguments this operator takes. */
- const int num_args;
- };
-
- static const struct operator_code operators[] =
- {
- { "aN", "&=" , 2 },
- { "aS", "=" , 2 },
- { "aa", "&&" , 2 },
- { "ad", "&" , 1 },
- { "an", "&" , 2 },
- { "cl", "()" , 0 },
- { "cm", "," , 2 },
- { "co", "~" , 1 },
- { "dV", "/=" , 2 },
- { "da", " delete[]", 1 },
- { "de", "*" , 1 },
- { "dl", " delete" , 1 },
- { "dv", "/" , 2 },
- { "eO", "^=" , 2 },
- { "eo", "^" , 2 },
- { "eq", "==" , 2 },
- { "ge", ">=" , 2 },
- { "gt", ">" , 2 },
- { "ix", "[]" , 2 },
- { "lS", "<<=" , 2 },
- { "le", "<=" , 2 },
- { "ls", "<<" , 2 },
- { "lt", "<" , 2 },
- { "mI", "-=" , 2 },
- { "mL", "*=" , 2 },
- { "mi", "-" , 2 },
- { "ml", "*" , 2 },
- { "mm", "--" , 1 },
- { "na", " new[]" , 1 },
- { "ne", "!=" , 2 },
- { "ng", "-" , 1 },
- { "nt", "!" , 1 },
- { "nw", " new" , 1 },
- { "oR", "|=" , 2 },
- { "oo", "||" , 2 },
- { "or", "|" , 2 },
- { "pL", "+=" , 2 },
- { "pl", "+" , 2 },
- { "pm", "->*" , 2 },
- { "pp", "++" , 1 },
- { "ps", "+" , 1 },
- { "pt", "->" , 2 },
- { "qu", "?" , 3 },
- { "rM", "%=" , 2 },
- { "rS", ">>=" , 2 },
- { "rm", "%" , 2 },
- { "rs", ">>" , 2 },
- { "sz", " sizeof" , 1 }
- };
-
- const int num_operators =
- sizeof (operators) / sizeof (struct operator_code);
-
- int c0 = next_char (dm);
- int c1 = next_char (dm);
- const struct operator_code* p1 = operators;
- const struct operator_code* p2 = operators + num_operators;
-
- DEMANGLE_TRACE ("operator-name", dm);
-
- /* Assume the first argument is not a type. */
- if (type_arg)
- *type_arg = 0;
-
- /* Is this a vendor-extended operator? */
- if (c0 == 'v' && IS_DIGIT (c1))
- {
- RETURN_IF_ERROR (result_add (dm, "operator "));
- RETURN_IF_ERROR (demangle_source_name (dm));
- *num_args = 0;
- return STATUS_OK;
- }
+/* operator_name ::= many different two character encodings.
+ ::= cv <type>
+ ::= v <digit> <source-name>
+*/
- /* Is this a conversion operator? */
- if (c0 == 'c' && c1 == 'v')
- {
- RETURN_IF_ERROR (result_add (dm, "operator "));
- /* Demangle the converted-to type. */
- RETURN_IF_ERROR (demangle_type (dm));
- *num_args = 0;
- return STATUS_OK;
- }
+#define NL(s) s, (sizeof s) - 1
- /* Is it the sizeof variant that takes a type? */
- if (c0 == 's' && c1 == 't')
- {
- RETURN_IF_ERROR (result_add (dm, " sizeof"));
- *num_args = 1;
- if (type_arg)
- *type_arg = 1;
- return STATUS_OK;
- }
+CP_STATIC_IF_GLIBCPP_V3
+const struct demangle_operator_info cplus_demangle_operators[] =
+{
+ { "aN", NL ("&="), 2 },
+ { "aS", NL ("="), 2 },
+ { "aa", NL ("&&"), 2 },
+ { "ad", NL ("&"), 1 },
+ { "an", NL ("&"), 2 },
+ { "cl", NL ("()"), 0 },
+ { "cm", NL (","), 2 },
+ { "co", NL ("~"), 1 },
+ { "dV", NL ("/="), 2 },
+ { "da", NL ("delete[]"), 1 },
+ { "de", NL ("*"), 1 },
+ { "dl", NL ("delete"), 1 },
+ { "dv", NL ("/"), 2 },
+ { "eO", NL ("^="), 2 },
+ { "eo", NL ("^"), 2 },
+ { "eq", NL ("=="), 2 },
+ { "ge", NL (">="), 2 },
+ { "gt", NL (">"), 2 },
+ { "ix", NL ("[]"), 2 },
+ { "lS", NL ("<<="), 2 },
+ { "le", NL ("<="), 2 },
+ { "ls", NL ("<<"), 2 },
+ { "lt", NL ("<"), 2 },
+ { "mI", NL ("-="), 2 },
+ { "mL", NL ("*="), 2 },
+ { "mi", NL ("-"), 2 },
+ { "ml", NL ("*"), 2 },
+ { "mm", NL ("--"), 1 },
+ { "na", NL ("new[]"), 1 },
+ { "ne", NL ("!="), 2 },
+ { "ng", NL ("-"), 1 },
+ { "nt", NL ("!"), 1 },
+ { "nw", NL ("new"), 1 },
+ { "oR", NL ("|="), 2 },
+ { "oo", NL ("||"), 2 },
+ { "or", NL ("|"), 2 },
+ { "pL", NL ("+="), 2 },
+ { "pl", NL ("+"), 2 },
+ { "pm", NL ("->*"), 2 },
+ { "pp", NL ("++"), 1 },
+ { "ps", NL ("+"), 1 },
+ { "pt", NL ("->"), 2 },
+ { "qu", NL ("?"), 3 },
+ { "rM", NL ("%="), 2 },
+ { "rS", NL (">>="), 2 },
+ { "rm", NL ("%"), 2 },
+ { "rs", NL (">>"), 2 },
+ { "st", NL ("sizeof "), 1 },
+ { "sz", NL ("sizeof "), 1 },
+ { NULL, NULL, 0, 0 }
+};
- /* Perform a binary search for the operator code. */
- while (1)
+static struct demangle_component *
+d_operator_name (di)
+ struct d_info *di;
+{
+ char c1;
+ char c2;
+
+ c1 = d_next_char (di);
+ c2 = d_next_char (di);
+ if (c1 == 'v' && IS_DIGIT (c2))
+ return d_make_extended_operator (di, c2 - '0', d_source_name (di));
+ else if (c1 == 'c' && c2 == 'v')
+ return d_make_comp (di, DEMANGLE_COMPONENT_CAST,
+ cplus_demangle_type (di), NULL);
+ else
{
- const struct operator_code* p = p1 + (p2 - p1) / 2;
- char match0 = p->code[0];
- char match1 = p->code[1];
-
- if (c0 == match0 && c1 == match1)
- /* Found it. */
+ /* LOW is the inclusive lower bound. */
+ int low = 0;
+ /* HIGH is the exclusive upper bound. We subtract one to ignore
+ the sentinel at the end of the array. */
+ int high = ((sizeof (cplus_demangle_operators)
+ / sizeof (cplus_demangle_operators[0]))
+ - 1);
+
+ while (1)
{
- if (!short_name)
- RETURN_IF_ERROR (result_add (dm, "operator"));
- RETURN_IF_ERROR (result_add (dm, p->name));
- *num_args = p->num_args;
+ int i;
+ const struct demangle_operator_info *p;
- return STATUS_OK;
- }
+ i = low + (high - low) / 2;
+ p = cplus_demangle_operators + i;
- if (p == p1)
- /* Couldn't find it. */
- return "Unknown code in <operator-name>.";
+ if (c1 == p->code[0] && c2 == p->code[1])
+ return d_make_operator (di, p);
- /* Try again. */
- if (c0 < match0 || (c0 == match0 && c1 < match1))
- p2 = p;
- else
- p1 = p;
+ if (c1 < p->code[0] || (c1 == p->code[0] && c2 < p->code[1]))
+ high = i;
+ else
+ low = i + 1;
+ if (low == high)
+ return NULL;
+ }
}
}
-/* Demangles and omits an <nv-offset>.
-
- <nv-offset> ::= <offset number> # non-virtual base override */
+/* <special-name> ::= TV <type>
+ ::= TT <type>
+ ::= TI <type>
+ ::= TS <type>
+ ::= GV <(object) name>
+ ::= T <call-offset> <(base) encoding>
+ ::= Tc <call-offset> <call-offset> <(base) encoding>
+ Also g++ extensions:
+ ::= TC <type> <(offset) number> _ <(base) type>
+ ::= TF <type>
+ ::= TJ <type>
+ ::= GR <name>
+*/
-static status_t
-demangle_nv_offset (dm)
- demangling_t dm;
+static struct demangle_component *
+d_special_name (di)
+ struct d_info *di;
{
- dyn_string_t number;
- status_t status = STATUS_OK;
-
- DEMANGLE_TRACE ("h-offset", dm);
+ char c;
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
-
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
+ di->expansion += 20;
+ c = d_next_char (di);
+ if (c == 'T')
{
- status = result_add (dm, " [nv:");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
- }
-
- /* Clean up. */
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
- return STATUS_OK;
-}
+ switch (d_next_char (di))
+ {
+ case 'V':
+ di->expansion -= 5;
+ return d_make_comp (di, DEMANGLE_COMPONENT_VTABLE,
+ cplus_demangle_type (di), NULL);
+ case 'T':
+ di->expansion -= 10;
+ return d_make_comp (di, DEMANGLE_COMPONENT_VTT,
+ cplus_demangle_type (di), NULL);
+ case 'I':
+ return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO,
+ cplus_demangle_type (di), NULL);
+ case 'S':
+ return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_NAME,
+ cplus_demangle_type (di), NULL);
-/* Demangles and emits a <v-offset>.
+ case 'h':
+ if (! d_call_offset (di, 'h'))
+ return NULL;
+ return d_make_comp (di, DEMANGLE_COMPONENT_THUNK,
+ d_encoding (di, 0), NULL);
- <v-offset> ::= <offset number> _ <virtual offset number>
- # virtual base override, with vcall offset */
+ case 'v':
+ if (! d_call_offset (di, 'v'))
+ return NULL;
+ return d_make_comp (di, DEMANGLE_COMPONENT_VIRTUAL_THUNK,
+ d_encoding (di, 0), NULL);
-static status_t
-demangle_v_offset (dm)
- demangling_t dm;
-{
- dyn_string_t number;
- status_t status = STATUS_OK;
+ case 'c':
+ if (! d_call_offset (di, '\0'))
+ return NULL;
+ if (! d_call_offset (di, '\0'))
+ return NULL;
+ return d_make_comp (di, DEMANGLE_COMPONENT_COVARIANT_THUNK,
+ d_encoding (di, 0), NULL);
- DEMANGLE_TRACE ("v-offset", dm);
+ case 'C':
+ {
+ struct demangle_component *derived_type;
+ long offset;
+ struct demangle_component *base_type;
+
+ derived_type = cplus_demangle_type (di);
+ offset = d_number (di);
+ if (offset < 0)
+ return NULL;
+ if (d_next_char (di) != '_')
+ return NULL;
+ base_type = cplus_demangle_type (di);
+ /* We don't display the offset. FIXME: We should display
+ it in verbose mode. */
+ di->expansion += 5;
+ return d_make_comp (di, DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
+ base_type, derived_type);
+ }
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
+ case 'F':
+ return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_FN,
+ cplus_demangle_type (di), NULL);
+ case 'J':
+ return d_make_comp (di, DEMANGLE_COMPONENT_JAVA_CLASS,
+ cplus_demangle_type (di), NULL);
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add (dm, " [v:");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- result_add_char (dm, ',');
+ default:
+ return NULL;
+ }
}
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
-
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
+ else if (c == 'G')
+ {
+ switch (d_next_char (di))
+ {
+ case 'V':
+ return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL);
- /* Demangle the vcall offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- return STATUS_ALLOCATION_FAILED;
- demangle_number_literally (dm, number, 10, 1);
+ case 'R':
+ return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, d_name (di),
+ NULL);
- /* Don't display the vcall offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add_string (dm, number);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
+ default:
+ return NULL;
+ }
}
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
-
- return STATUS_OK;
+ else
+ return NULL;
}
-/* Demangles and emits a <call-offset>.
+/* <call-offset> ::= h <nv-offset> _
+ ::= v <v-offset> _
- <call-offset> ::= h <nv-offset> _
- ::= v <v-offset> _ */
+ <nv-offset> ::= <(offset) number>
-static status_t
-demangle_call_offset (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("call-offset", dm);
+ <v-offset> ::= <(offset) number> _ <(virtual offset) number>
- switch (peek_char (dm))
- {
- case 'h':
- advance_char (dm);
- /* Demangle the offset. */
- RETURN_IF_ERROR (demangle_nv_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- break;
+ The C parameter, if not '\0', is a character we just read which is
+ the start of the <call-offset>.
- case 'v':
- advance_char (dm);
- /* Demangle the offset. */
- RETURN_IF_ERROR (demangle_v_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- break;
+ We don't display the offset information anywhere. FIXME: We should
+ display it in verbose mode. */
- default:
- return "Unrecognized <call-offset>.";
- }
+static int
+d_call_offset (di, c)
+ struct d_info *di;
+ int c;
+{
+ long offset;
+ long virtual_offset;
- return STATUS_OK;
-}
+ if (c == '\0')
+ c = d_next_char (di);
+
+ if (c == 'h')
+ offset = d_number (di);
+ else if (c == 'v')
+ {
+ offset = d_number (di);
+ if (d_next_char (di) != '_')
+ return 0;
+ virtual_offset = d_number (di);
+ }
+ else
+ return 0;
-/* Demangles and emits a <special-name>.
+ if (d_next_char (di) != '_')
+ return 0;
- <special-name> ::= GV <object name> # Guard variable
- ::= TV <type> # virtual table
- ::= TT <type> # VTT
- ::= TI <type> # typeinfo structure
- ::= TS <type> # typeinfo name
+ return 1;
+}
- Other relevant productions include thunks:
+/* <ctor-dtor-name> ::= C1
+ ::= C2
+ ::= C3
+ ::= D0
+ ::= D1
+ ::= D2
+*/
- <special-name> ::= T <call-offset> <base encoding>
- # base is the nominal target function of thunk
+static struct demangle_component *
+d_ctor_dtor_name (di)
+ struct d_info *di;
+{
+ if (di->last_name != NULL)
+ {
+ if (di->last_name->type == DEMANGLE_COMPONENT_NAME)
+ di->expansion += di->last_name->u.s_name.len;
+ else if (di->last_name->type == DEMANGLE_COMPONENT_SUB_STD)
+ di->expansion += di->last_name->u.s_string.len;
+ }
+ switch (d_next_char (di))
+ {
+ case 'C':
+ {
+ enum gnu_v3_ctor_kinds kind;
- <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
- # base is the nominal target function of thunk
- # first call-offset is 'this' adjustment
- # second call-offset is result adjustment
+ switch (d_next_char (di))
+ {
+ case '1':
+ kind = gnu_v3_complete_object_ctor;
+ break;
+ case '2':
+ kind = gnu_v3_base_object_ctor;
+ break;
+ case '3':
+ kind = gnu_v3_complete_object_allocating_ctor;
+ break;
+ default:
+ return NULL;
+ }
+ return d_make_ctor (di, kind, di->last_name);
+ }
- where
+ case 'D':
+ {
+ enum gnu_v3_dtor_kinds kind;
- <call-offset> ::= h <nv-offset> _
- ::= v <v-offset> _
+ switch (d_next_char (di))
+ {
+ case '0':
+ kind = gnu_v3_deleting_dtor;
+ break;
+ case '1':
+ kind = gnu_v3_complete_object_dtor;
+ break;
+ case '2':
+ kind = gnu_v3_base_object_dtor;
+ break;
+ default:
+ return NULL;
+ }
+ return d_make_dtor (di, kind, di->last_name);
+ }
- Also demangles the special g++ manglings,
+ default:
+ return NULL;
+ }
+}
- <special-name> ::= TC <type> <offset number> _ <base type>
- # construction vtable
- ::= TF <type> # typeinfo function (old ABI only)
- ::= TJ <type> # java Class structure */
+/* <type> ::= <builtin-type>
+ ::= <function-type>
+ ::= <class-enum-type>
+ ::= <array-type>
+ ::= <pointer-to-member-type>
+ ::= <template-param>
+ ::= <template-template-param> <template-args>
+ ::= <substitution>
+ ::= <CV-qualifiers> <type>
+ ::= P <type>
+ ::= R <type>
+ ::= C <type>
+ ::= G <type>
+ ::= U <source-name> <type>
+
+ <builtin-type> ::= various one letter codes
+ ::= u <source-name>
+*/
-static status_t
-demangle_special_name (dm)
- demangling_t dm;
+CP_STATIC_IF_GLIBCPP_V3
+const struct demangle_builtin_type_info
+cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT] =
{
- dyn_string_t number;
- int unused;
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("special-name", dm);
+ /* a */ { NL ("signed char"), NL ("signed char"), D_PRINT_INT },
+ /* b */ { NL ("bool"), NL ("boolean"), D_PRINT_BOOL },
+ /* c */ { NL ("char"), NL ("byte"), D_PRINT_INT },
+ /* d */ { NL ("double"), NL ("double"), D_PRINT_DEFAULT },
+ /* e */ { NL ("long double"), NL ("long double"), D_PRINT_DEFAULT },
+ /* f */ { NL ("float"), NL ("float"), D_PRINT_DEFAULT },
+ /* g */ { NL ("__float128"), NL ("__float128"), D_PRINT_DEFAULT },
+ /* h */ { NL ("unsigned char"), NL ("unsigned char"), D_PRINT_INT },
+ /* i */ { NL ("int"), NL ("int"), D_PRINT_INT },
+ /* j */ { NL ("unsigned int"), NL ("unsigned"), D_PRINT_INT },
+ /* k */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT },
+ /* l */ { NL ("long"), NL ("long"), D_PRINT_LONG },
+ /* m */ { NL ("unsigned long"), NL ("unsigned long"), D_PRINT_LONG },
+ /* n */ { NL ("__int128"), NL ("__int128"), D_PRINT_DEFAULT },
+ /* o */ { NL ("unsigned __int128"), NL ("unsigned __int128"), D_PRINT_DEFAULT },
+ /* p */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT },
+ /* q */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT },
+ /* r */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT },
+ /* s */ { NL ("short"), NL ("short"), D_PRINT_INT },
+ /* t */ { NL ("unsigned short"), NL ("unsigned short"), D_PRINT_INT },
+ /* u */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT },
+ /* v */ { NL ("void"), NL ("void"), D_PRINT_VOID },
+ /* w */ { NL ("wchar_t"), NL ("char"), D_PRINT_INT },
+ /* x */ { NL ("long long"), NL ("long"), D_PRINT_DEFAULT },
+ /* y */ { NL ("unsigned long long"), NL ("unsigned long long"), D_PRINT_DEFAULT },
+ /* z */ { NL ("..."), NL ("..."), D_PRINT_DEFAULT },
+};
- if (peek == 'G')
+CP_STATIC_IF_GLIBCPP_V3
+struct demangle_component *
+cplus_demangle_type (di)
+ struct d_info *di;
+{
+ char peek;
+ struct demangle_component *ret;
+ int can_subst;
+
+ /* The ABI specifies that when CV-qualifiers are used, the base type
+ is substitutable, and the fully qualified type is substitutable,
+ but the base type with a strict subset of the CV-qualifiers is
+ not substitutable. The natural recursive implementation of the
+ CV-qualifiers would cause subsets to be substitutable, so instead
+ we pull them all off now.
+
+ FIXME: The ABI says that order-insensitive vendor qualifiers
+ should be handled in the same way, but we have no way to tell
+ which vendor qualifiers are order-insensitive and which are
+ order-sensitive. So we just assume that they are all
+ order-sensitive. g++ 3.4 supports only one vendor qualifier,
+ __vector, and it treats it as order-sensitive when mangling
+ names. */
+
+ peek = d_peek_char (di);
+ if (peek == 'r' || peek == 'V' || peek == 'K')
{
- /* Consume the G. */
- advance_char (dm);
- switch (peek_char (dm))
- {
- case 'V':
- /* A guard variable name. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "guard variable for "));
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- break;
+ struct demangle_component **pret;
- case 'R':
- /* A reference temporary. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "reference temporary for "));
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- break;
-
- default:
- return "Unrecognized <special-name>.";
- }
+ pret = d_cv_qualifiers (di, &ret, 0);
+ if (pret == NULL)
+ return NULL;
+ *pret = cplus_demangle_type (di);
+ if (! d_add_substitution (di, ret))
+ return NULL;
+ return ret;
}
- else if (peek == 'T')
+
+ can_subst = 1;
+
+ switch (peek)
{
- status_t status = STATUS_OK;
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
+ case 'h': case 'i': case 'j': case 'l': case 'm': case 'n':
+ case 'o': case 's': case 't':
+ case 'v': case 'w': case 'x': case 'y': case 'z':
+ ret = d_make_builtin_type (di,
+ &cplus_demangle_builtin_types[peek - 'a']);
+ di->expansion += ret->u.s_builtin.type->len;
+ can_subst = 0;
+ d_advance (di, 1);
+ break;
- /* Other C++ implementation miscellania. Consume the T. */
- advance_char (dm);
+ case 'u':
+ d_advance (di, 1);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE,
+ d_source_name (di), NULL);
+ break;
- switch (peek_char (dm))
- {
- case 'V':
- /* Virtual table. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "vtable for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case 'F':
+ ret = d_function_type (di);
+ break;
- case 'T':
- /* VTT structure. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "VTT for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'N':
+ case 'Z':
+ ret = d_class_enum_type (di);
+ break;
- case 'I':
- /* Typeinfo structure. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case 'A':
+ ret = d_array_type (di);
+ break;
- case 'F':
- /* Typeinfo function. Used only in old ABI with new mangling. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo fn for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case 'M':
+ ret = d_pointer_to_member_type (di);
+ break;
- case 'S':
- /* Character string containing type name, used in typeinfo. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "typeinfo name for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case 'T':
+ ret = d_template_param (di);
+ if (d_peek_char (di) == 'I')
+ {
+ /* This is <template-template-param> <template-args>. The
+ <template-template-param> part is a substitution
+ candidate. */
+ if (! d_add_substitution (di, ret))
+ return NULL;
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
+ d_template_args (di));
+ }
+ break;
- case 'J':
- /* The java Class variable corresponding to a C++ class. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "java Class for "));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ case 'S':
+ /* If this is a special substitution, then it is the start of
+ <class-enum-type>. */
+ {
+ char peek_next;
- case 'h':
- /* Non-virtual thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "non-virtual thunk"));
- RETURN_IF_ERROR (demangle_nv_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- /* Demangle and emit the target name and function type. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
+ peek_next = d_peek_next_char (di);
+ if (IS_DIGIT (peek_next)
+ || peek_next == '_'
+ || IS_UPPER (peek_next))
+ {
+ ret = d_substitution (di, 0);
+ /* The substituted name may have been a template name and
+ may be followed by tepmlate args. */
+ if (d_peek_char (di) == 'I')
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
+ d_template_args (di));
+ else
+ can_subst = 0;
+ }
+ else
+ {
+ ret = d_class_enum_type (di);
+ /* If the substitution was a complete type, then it is not
+ a new substitution candidate. However, if the
+ substitution was followed by template arguments, then
+ the whole thing is a substitution candidate. */
+ if (ret != NULL && ret->type == DEMANGLE_COMPONENT_SUB_STD)
+ can_subst = 0;
+ }
+ }
+ break;
- case 'v':
- /* Virtual thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "virtual thunk"));
- RETURN_IF_ERROR (demangle_v_offset (dm));
- /* Demangle the separator. */
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- /* Demangle and emit the target function. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
+ case 'P':
+ d_advance (di, 1);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_POINTER,
+ cplus_demangle_type (di), NULL);
+ break;
- case 'c':
- /* Covariant return thunk. */
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "covariant return thunk"));
- RETURN_IF_ERROR (demangle_call_offset (dm));
- RETURN_IF_ERROR (demangle_call_offset (dm));
- /* Demangle and emit the target function. */
- RETURN_IF_ERROR (result_add (dm, " to "));
- RETURN_IF_ERROR (demangle_encoding (dm));
- break;
+ case 'R':
+ d_advance (di, 1);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_REFERENCE,
+ cplus_demangle_type (di), NULL);
+ break;
- case 'C':
- /* TC is a special g++ mangling for a construction vtable. */
- if (!flag_strict)
- {
- dyn_string_t derived_type;
+ case 'C':
+ d_advance (di, 1);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_COMPLEX,
+ cplus_demangle_type (di), NULL);
+ break;
- advance_char (dm);
- RETURN_IF_ERROR (result_add (dm, "construction vtable for "));
+ case 'G':
+ d_advance (di, 1);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_IMAGINARY,
+ cplus_demangle_type (di), NULL);
+ break;
- /* Demangle the derived type off to the side. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- derived_type = (dyn_string_t) result_pop (dm);
+ case 'U':
+ d_advance (di, 1);
+ ret = d_source_name (di);
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
+ cplus_demangle_type (di), ret);
+ break;
- /* Demangle the offset. */
- number = dyn_string_new (4);
- if (number == NULL)
- {
- dyn_string_delete (derived_type);
- return STATUS_ALLOCATION_FAILED;
- }
- demangle_number_literally (dm, number, 10, 1);
- /* Demangle the underscore separator. */
- status = demangle_char (dm, '_');
-
- /* Demangle the base type. */
- if (STATUS_NO_ERROR (status))
- status = demangle_type (dm);
-
- /* Emit the derived type. */
- if (STATUS_NO_ERROR (status))
- status = result_add (dm, "-in-");
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, derived_type);
- dyn_string_delete (derived_type);
-
- /* Don't display the offset unless in verbose mode. */
- if (flag_verbose)
- {
- status = result_add_char (dm, ' ');
- if (STATUS_NO_ERROR (status))
- result_add_string (dm, number);
- }
- dyn_string_delete (number);
- RETURN_IF_ERROR (status);
- break;
- }
- /* If flag_strict, fall through. */
+ default:
+ return NULL;
+ }
- default:
- return "Unrecognized <special-name>.";
- }
+ if (can_subst)
+ {
+ if (! d_add_substitution (di, ret))
+ return NULL;
}
- else
- return STATUS_ERROR;
- return STATUS_OK;
+ return ret;
}
-/* Demangles and emits a <ctor-dtor-name>.
-
- <ctor-dtor-name>
- ::= C1 # complete object (in-charge) ctor
- ::= C2 # base object (not-in-charge) ctor
- ::= C3 # complete object (in-charge) allocating ctor
- ::= D0 # deleting (in-charge) dtor
- ::= D1 # complete object (in-charge) dtor
- ::= D2 # base object (not-in-charge) dtor */
-
-static status_t
-demangle_ctor_dtor_name (dm)
- demangling_t dm;
-{
- static const char *const ctor_flavors[] =
- {
- "in-charge",
- "not-in-charge",
- "allocating"
- };
- static const char *const dtor_flavors[] =
- {
- "in-charge deleting",
- "in-charge",
- "not-in-charge"
- };
+/* <CV-qualifiers> ::= [r] [V] [K] */
- int flavor;
- char peek = peek_char (dm);
+static struct demangle_component **
+d_cv_qualifiers (di, pret, member_fn)
+ struct d_info *di;
+ struct demangle_component **pret;
+ int member_fn;
+{
+ char peek;
- DEMANGLE_TRACE ("ctor-dtor-name", dm);
-
- if (peek == 'C')
+ peek = d_peek_char (di);
+ while (peek == 'r' || peek == 'V' || peek == 'K')
{
- /* A constructor name. Consume the C. */
- advance_char (dm);
- flavor = next_char (dm);
- if (flavor < '1' || flavor > '3')
- return "Unrecognized constructor.";
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
- switch (flavor)
+ enum demangle_component_type t;
+
+ d_advance (di, 1);
+ if (peek == 'r')
{
- case '1': dm->is_constructor = gnu_v3_complete_object_ctor;
- break;
- case '2': dm->is_constructor = gnu_v3_base_object_ctor;
- break;
- case '3': dm->is_constructor = gnu_v3_complete_object_allocating_ctor;
- break;
+ t = (member_fn
+ ? DEMANGLE_COMPONENT_RESTRICT_THIS
+ : DEMANGLE_COMPONENT_RESTRICT);
+ di->expansion += sizeof "restrict";
}
- /* Print the flavor of the constructor if in verbose mode. */
- if (flag_verbose)
+ else if (peek == 'V')
{
- RETURN_IF_ERROR (result_add (dm, "["));
- RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor - '1']));
- RETURN_IF_ERROR (result_add_char (dm, ']'));
+ t = (member_fn
+ ? DEMANGLE_COMPONENT_VOLATILE_THIS
+ : DEMANGLE_COMPONENT_VOLATILE);
+ di->expansion += sizeof "volatile";
}
- }
- else if (peek == 'D')
- {
- /* A destructor name. Consume the D. */
- advance_char (dm);
- flavor = next_char (dm);
- if (flavor < '0' || flavor > '2')
- return "Unrecognized destructor.";
- RETURN_IF_ERROR (result_add_char (dm, '~'));
- RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
- switch (flavor)
- {
- case '0': dm->is_destructor = gnu_v3_deleting_dtor;
- break;
- case '1': dm->is_destructor = gnu_v3_complete_object_dtor;
- break;
- case '2': dm->is_destructor = gnu_v3_base_object_dtor;
- break;
- }
- /* Print the flavor of the destructor if in verbose mode. */
- if (flag_verbose)
+ else
{
- RETURN_IF_ERROR (result_add (dm, " ["));
- RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor - '0']));
- RETURN_IF_ERROR (result_add_char (dm, ']'));
+ t = (member_fn
+ ? DEMANGLE_COMPONENT_CONST_THIS
+ : DEMANGLE_COMPONENT_CONST);
+ di->expansion += sizeof "const";
}
+
+ *pret = d_make_comp (di, t, NULL, NULL);
+ if (*pret == NULL)
+ return NULL;
+ pret = &d_left (*pret);
+
+ peek = d_peek_char (di);
}
- else
- return STATUS_ERROR;
- return STATUS_OK;
+ return pret;
}
-/* Handle pointer, reference, and pointer-to-member cases for
- demangle_type. All consecutive `P's, `R's, and 'M's are joined to
- build a pointer/reference type. We snarf all these, plus the
- following <type>, all at once since we need to know whether we have
- a pointer to data or pointer to function to construct the right
- output syntax. C++'s pointer syntax is hairy.
-
- This function adds substitution candidates for every nested
- pointer/reference type it processes, including the outermost, final
- type, assuming the substitution starts at SUBSTITUTION_START in the
- demangling result. For example, if this function demangles
- `PP3Foo', it will add a substitution for `Foo', `Foo*', and
- `Foo**', in that order.
-
- *INSERT_POS is a quantity used internally, when this function calls
- itself recursively, to figure out where to insert pointer
- punctuation on the way up. On entry to this function, INSERT_POS
- should point to a temporary value, but that value need not be
- initialized.
-
- <type> ::= P <type>
- ::= R <type>
- ::= <pointer-to-member-type>
-
- <pointer-to-member-type> ::= M </class/ type> </member/ type> */
-
-static status_t
-demangle_type_ptr (dm, insert_pos, substitution_start)
- demangling_t dm;
- int *insert_pos;
- int substitution_start;
-{
- status_t status;
- int is_substitution_candidate = 1;
+/* <function-type> ::= F [Y] <bare-function-type> E */
- DEMANGLE_TRACE ("type*", dm);
+static struct demangle_component *
+d_function_type (di)
+ struct d_info *di;
+{
+ struct demangle_component *ret;
- /* Scan forward, collecting pointers and references into symbols,
- until we hit something else. Then emit the type. */
- switch (peek_char (dm))
+ if (d_next_char (di) != 'F')
+ return NULL;
+ if (d_peek_char (di) == 'Y')
{
- case 'P':
- /* A pointer. Snarf the `P'. */
- advance_char (dm);
- /* Demangle the underlying type. */
- RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos,
- substitution_start));
- /* Insert an asterisk where we're told to; it doesn't
- necessarily go at the end. If we're doing Java style output,
- there is no pointer symbol. */
- if (dm->style != DMGL_JAVA)
- RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*'));
- /* The next (outermost) pointer or reference character should go
- after this one. */
- ++(*insert_pos);
- break;
+ /* Function has C linkage. We don't print this information.
+ FIXME: We should print it in verbose mode. */
+ d_advance (di, 1);
+ }
+ ret = d_bare_function_type (di, 1);
+ if (d_next_char (di) != 'E')
+ return NULL;
+ return ret;
+}
- case 'R':
- /* A reference. Snarf the `R'. */
- advance_char (dm);
- /* Demangle the underlying type. */
- RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos,
- substitution_start));
- /* Insert an ampersand where we're told to; it doesn't
- necessarily go at the end. */
- RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '&'));
- /* The next (outermost) pointer or reference character should go
- after this one. */
- ++(*insert_pos);
- break;
+/* <bare-function-type> ::= <type>+ */
- case 'M':
+static struct demangle_component *
+d_bare_function_type (di, has_return_type)
+ struct d_info *di;
+ int has_return_type;
+{
+ struct demangle_component *return_type;
+ struct demangle_component *tl;
+ struct demangle_component **ptl;
+
+ return_type = NULL;
+ tl = NULL;
+ ptl = &tl;
+ while (1)
{
- /* A pointer-to-member. */
- dyn_string_t class_type;
-
- /* Eat the 'M'. */
- advance_char (dm);
-
- /* Capture the type of which this is a pointer-to-member. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- class_type = (dyn_string_t) result_pop (dm);
-
- if (peek_char (dm) == 'F')
- /* A pointer-to-member function. We want output along the
- lines of `void (C::*) (int, int)'. Demangle the function
- type, which would in this case give `void () (int, int)'
- and set *insert_pos to the spot between the first
- parentheses. */
- status = demangle_type_ptr (dm, insert_pos, substitution_start);
- else if (peek_char (dm) == 'A')
- /* A pointer-to-member array variable. We want output that
- looks like `int (Klass::*) [10]'. Demangle the array type
- as `int () [10]', and set *insert_pos to the spot between
- the parentheses. */
- status = demangle_array_type (dm, insert_pos);
+ char peek;
+ struct demangle_component *type;
+
+ peek = d_peek_char (di);
+ if (peek == '\0' || peek == 'E')
+ break;
+ type = cplus_demangle_type (di);
+ if (type == NULL)
+ return NULL;
+ if (has_return_type)
+ {
+ return_type = type;
+ has_return_type = 0;
+ }
else
- {
- /* A pointer-to-member variable. Demangle the type of the
- pointed-to member. */
- status = demangle_type (dm);
- /* Make it pretty. */
- if (STATUS_NO_ERROR (status)
- && !result_previous_char_is_space (dm))
- status = result_add_char (dm, ' ');
- /* The pointer-to-member notation (e.g. `C::*') follows the
- member's type. */
- *insert_pos = result_caret_pos (dm);
+ {
+ *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL);
+ if (*ptl == NULL)
+ return NULL;
+ ptl = &d_right (*ptl);
}
+ }
- /* Build the pointer-to-member notation. */
- if (STATUS_NO_ERROR (status))
- status = result_insert (dm, *insert_pos, "::*");
- if (STATUS_NO_ERROR (status))
- status = result_insert_string (dm, *insert_pos, class_type);
- /* There may be additional levels of (pointer or reference)
- indirection in this type. If so, the `*' and `&' should be
- added after the pointer-to-member notation (e.g. `C::*&' for
- a reference to a pointer-to-member of class C). */
- *insert_pos += dyn_string_length (class_type) + 3;
-
- /* Clean up. */
- dyn_string_delete (class_type);
-
- RETURN_IF_ERROR (status);
+ /* There should be at least one parameter type besides the optional
+ return type. A function which takes no arguments will have a
+ single parameter type void. */
+ if (tl == NULL)
+ return NULL;
+
+ /* If we have a single parameter type void, omit it. */
+ if (d_right (tl) == NULL
+ && d_left (tl)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE
+ && d_left (tl)->u.s_builtin.type->print == D_PRINT_VOID)
+ {
+ di->expansion -= d_left (tl)->u.s_builtin.type->len;
+ tl = NULL;
}
- break;
- case 'F':
- /* Ooh, tricky, a pointer-to-function. When we demangle the
- function type, the return type should go at the very
- beginning. */
- *insert_pos = result_caret_pos (dm);
- /* The parentheses indicate this is a function pointer or
- reference type. */
- RETURN_IF_ERROR (result_add (dm, "()"));
- /* Now demangle the function type. The return type will be
- inserted before the `()', and the argument list will go after
- it. */
- RETURN_IF_ERROR (demangle_function_type (dm, insert_pos));
- /* We should now have something along the lines of
- `void () (int, int)'. The pointer or reference characters
- have to inside the first set of parentheses. *insert_pos has
- already been updated to point past the end of the return
- type. Move it one character over so it points inside the
- `()'. */
- ++(*insert_pos);
- break;
+ return d_make_comp (di, DEMANGLE_COMPONENT_FUNCTION_TYPE, return_type, tl);
+}
- case 'A':
- /* An array pointer or reference. demangle_array_type will figure
- out where the asterisks and ampersands go. */
- RETURN_IF_ERROR (demangle_array_type (dm, insert_pos));
- break;
+/* <class-enum-type> ::= <name> */
- default:
- /* No more pointer or reference tokens; this is therefore a
- pointer to data. Finish up by demangling the underlying
- type. */
- RETURN_IF_ERROR (demangle_type (dm));
- /* The pointer or reference characters follow the underlying
- type, as in `int*&'. */
- *insert_pos = result_caret_pos (dm);
- /* Because of the production <type> ::= <substitution>,
- demangle_type will already have added the underlying type as
- a substitution candidate. Don't do it again. */
- is_substitution_candidate = 0;
- break;
- }
-
- if (is_substitution_candidate)
- RETURN_IF_ERROR (substitution_add (dm, substitution_start, 0));
-
- return STATUS_OK;
+static struct demangle_component *
+d_class_enum_type (di)
+ struct d_info *di;
+{
+ return d_name (di);
}
-/* Demangles and emits a <type>.
-
- <type> ::= <builtin-type>
- ::= <function-type>
- ::= <class-enum-type>
- ::= <array-type>
- ::= <pointer-to-member-type>
- ::= <template-param>
- ::= <template-template-param> <template-args>
- ::= <CV-qualifiers> <type>
- ::= P <type> # pointer-to
- ::= R <type> # reference-to
- ::= C <type> # complex pair (C 2000)
- ::= G <type> # imaginary (C 2000)
- ::= U <source-name> <type> # vendor extended type qualifier
- ::= <substitution> */
-
-static status_t
-demangle_type (dm)
- demangling_t dm;
+/* <array-type> ::= A <(positive dimension) number> _ <(element) type>
+ ::= A [<(dimension) expression>] _ <(element) type>
+*/
+
+static struct demangle_component *
+d_array_type (di)
+ struct d_info *di;
{
- int start = substitution_start (dm);
- char peek = peek_char (dm);
- char peek_next;
- int encode_return_type = 0;
- template_arg_list_t old_arg_list = current_template_arg_list (dm);
- int insert_pos;
-
- /* A <type> can be a <substitution>; therefore, this <type> is a
- substitution candidate unless a special condition holds (see
- below). */
- int is_substitution_candidate = 1;
-
- DEMANGLE_TRACE ("type", dm);
-
- /* A <class-enum-type> can start with a digit (a <source-name>), an
- N (a <nested-name>), or a Z (a <local-name>). */
- if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z')
- RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type));
- /* Lower-case letters begin <builtin-type>s, except for `r', which
- denotes restrict. */
- else if (peek >= 'a' && peek <= 'z' && peek != 'r')
+ char peek;
+ struct demangle_component *dim;
+
+ if (d_next_char (di) != 'A')
+ return NULL;
+
+ peek = d_peek_char (di);
+ if (peek == '_')
+ dim = NULL;
+ else if (IS_DIGIT (peek))
{
- RETURN_IF_ERROR (demangle_builtin_type (dm));
- /* Built-in types are not substitution candidates. */
- is_substitution_candidate = 0;
- }
- else
- switch (peek)
- {
- case 'r':
- case 'V':
- case 'K':
- /* CV-qualifiers (including restrict). We have to demangle
- them off to the side, since C++ syntax puts them in a funny
- place for qualified pointer and reference types. */
+ const char *s;
+
+ s = d_str (di);
+ do
{
- status_t status;
- dyn_string_t cv_qualifiers = dyn_string_new (24);
- int old_caret_position = result_get_caret (dm);
-
- if (cv_qualifiers == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Decode all adjacent CV qualifiers. */
- demangle_CV_qualifiers (dm, cv_qualifiers);
- /* Emit them, and shift the caret left so that the
- underlying type will be emitted before the qualifiers. */
- status = result_add_string (dm, cv_qualifiers);
- result_shift_caret (dm, -dyn_string_length (cv_qualifiers));
- /* Clean up. */
- dyn_string_delete (cv_qualifiers);
- RETURN_IF_ERROR (status);
- /* Also prepend a blank, if needed. */
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- result_shift_caret (dm, -1);
-
- /* Demangle the underlying type. It will be emitted before
- the CV qualifiers, since we moved the caret. */
- RETURN_IF_ERROR (demangle_type (dm));
-
- /* Put the caret back where it was previously. */
- result_set_caret (dm, old_caret_position);
+ d_advance (di, 1);
+ peek = d_peek_char (di);
}
- break;
-
- case 'F':
- return "Non-pointer or -reference function type.";
+ while (IS_DIGIT (peek));
+ dim = d_make_name (di, s, d_str (di) - s);
+ if (dim == NULL)
+ return NULL;
+ }
+ else
+ {
+ dim = d_expression (di);
+ if (dim == NULL)
+ return NULL;
+ }
- case 'A':
- RETURN_IF_ERROR (demangle_array_type (dm, NULL));
- break;
+ if (d_next_char (di) != '_')
+ return NULL;
- case 'T':
- /* It's either a <template-param> or a
- <template-template-param>. In either case, demangle the
- `T' token first. */
- RETURN_IF_ERROR (demangle_template_param (dm));
+ return d_make_comp (di, DEMANGLE_COMPONENT_ARRAY_TYPE, dim,
+ cplus_demangle_type (di));
+}
- /* Check for a template argument list; if one is found, it's a
- <template-template-param> ::= <template-param>
- ::= <substitution> */
- if (peek_char (dm) == 'I')
- {
- /* Add a substitution candidate. The template parameter
- `T' token is a substitution candidate by itself,
- without the template argument list. */
- RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
-
- /* Now demangle the template argument list. */
- RETURN_IF_ERROR (demangle_template_args (dm));
- /* The entire type, including the template template
- parameter and its argument list, will be added as a
- substitution candidate below. */
- }
+/* <pointer-to-member-type> ::= M <(class) type> <(member) type> */
- break;
+static struct demangle_component *
+d_pointer_to_member_type (di)
+ struct d_info *di;
+{
+ struct demangle_component *cl;
+ struct demangle_component *mem;
+ struct demangle_component **pmem;
- case 'S':
- /* First check if this is a special substitution. If it is,
- this is a <class-enum-type>. Special substitutions have a
- letter following the `S'; other substitutions have a digit
- or underscore. */
- peek_next = peek_char_next (dm);
- if (IS_DIGIT (peek_next) || peek_next == '_')
- {
- RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type));
-
- /* The substituted name may have been a template name.
- Check if template arguments follow, and if so, demangle
- them. */
- if (peek_char (dm) == 'I')
- RETURN_IF_ERROR (demangle_template_args (dm));
- else
- /* A substitution token is not itself a substitution
- candidate. (However, if the substituted template is
- instantiated, the resulting type is.) */
- is_substitution_candidate = 0;
- }
- else
- {
- /* Now some trickiness. We have a special substitution
- here. Often, the special substitution provides the
- name of a template that's subsequently instantiated,
- for instance `SaIcE' => std::allocator<char>. In these
- cases we need to add a substitution candidate for the
- entire <class-enum-type> and thus don't want to clear
- the is_substitution_candidate flag.
-
- However, it's possible that what we have here is a
- substitution token representing an entire type, such as
- `Ss' => std::string. In this case, we mustn't add a
- new substitution candidate for this substitution token.
- To detect this case, remember where the start of the
- substitution token is. */
- const char *next = dm->next;
- /* Now demangle the <class-enum-type>. */
- RETURN_IF_ERROR
- (demangle_class_enum_type (dm, &encode_return_type));
- /* If all that was just demangled is the two-character
- special substitution token, supress the addition of a
- new candidate for it. */
- if (dm->next == next + 2)
- is_substitution_candidate = 0;
- }
+ if (d_next_char (di) != 'M')
+ return NULL;
- break;
+ cl = cplus_demangle_type (di);
+
+ /* The ABI specifies that any type can be a substitution source, and
+ that M is followed by two types, and that when a CV-qualified
+ type is seen both the base type and the CV-qualified types are
+ substitution sources. The ABI also specifies that for a pointer
+ to a CV-qualified member function, the qualifiers are attached to
+ the second type. Given the grammar, a plain reading of the ABI
+ suggests that both the CV-qualified member function and the
+ non-qualified member function are substitution sources. However,
+ g++ does not work that way. g++ treats only the CV-qualified
+ member function as a substitution source. FIXME. So to work
+ with g++, we need to pull off the CV-qualifiers here, in order to
+ avoid calling add_substitution() in cplus_demangle_type(). */
+
+ pmem = d_cv_qualifiers (di, &mem, 1);
+ if (pmem == NULL)
+ return NULL;
+ *pmem = cplus_demangle_type (di);
- case 'P':
- case 'R':
- case 'M':
- RETURN_IF_ERROR (demangle_type_ptr (dm, &insert_pos, start));
- /* demangle_type_ptr adds all applicable substitution
- candidates. */
- is_substitution_candidate = 0;
- break;
+ return d_make_comp (di, DEMANGLE_COMPONENT_PTRMEM_TYPE, cl, mem);
+}
- case 'C':
- /* A C99 complex type. */
- RETURN_IF_ERROR (result_add (dm, "complex "));
- advance_char (dm);
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+/* <template-param> ::= T_
+ ::= T <(parameter-2 non-negative) number> _
+*/
- case 'G':
- /* A C99 imaginary type. */
- RETURN_IF_ERROR (result_add (dm, "imaginary "));
- advance_char (dm);
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+static struct demangle_component *
+d_template_param (di)
+ struct d_info *di;
+{
+ long param;
- case 'U':
- /* Vendor-extended type qualifier. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_source_name (dm));
- RETURN_IF_ERROR (result_add_char (dm, ' '));
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ if (d_next_char (di) != 'T')
+ return NULL;
- default:
- return "Unexpected character in <type>.";
- }
+ if (d_peek_char (di) == '_')
+ param = 0;
+ else
+ {
+ param = d_number (di);
+ if (param < 0)
+ return NULL;
+ param += 1;
+ }
- if (is_substitution_candidate)
- /* Add a new substitution for the type. If this type was a
- <template-param>, pass its index since from the point of
- substitutions; a <template-param> token is a substitution
- candidate distinct from the type that is substituted for it. */
- RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
+ if (d_next_char (di) != '_')
+ return NULL;
- /* Pop off template argument lists added during mangling of this
- type. */
- pop_to_template_arg_list (dm, old_arg_list);
+ ++di->did_subs;
- return STATUS_OK;
+ return d_make_template_param (di, param);
}
-/* C++ source names of builtin types, indexed by the mangled code
- letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc). */
-static const char *const builtin_type_names[26] =
-{
- "signed char", /* a */
- "bool", /* b */
- "char", /* c */
- "double", /* d */
- "long double", /* e */
- "float", /* f */
- "__float128", /* g */
- "unsigned char", /* h */
- "int", /* i */
- "unsigned", /* j */
- NULL, /* k */
- "long", /* l */
- "unsigned long", /* m */
- "__int128", /* n */
- "unsigned __int128", /* o */
- NULL, /* p */
- NULL, /* q */
- NULL, /* r */
- "short", /* s */
- "unsigned short", /* t */
- NULL, /* u */
- "void", /* v */
- "wchar_t", /* w */
- "long long", /* x */
- "unsigned long long", /* y */
- "..." /* z */
-};
-
-/* Java source names of builtin types. Types that arn't valid in Java
- are also included here - we don't fail if someone attempts to demangle a
- C++ symbol in Java style. */
-static const char *const java_builtin_type_names[26] =
-{
- "signed char", /* a */
- "boolean", /* C++ "bool" */ /* b */
- "byte", /* C++ "char" */ /* c */
- "double", /* d */
- "long double", /* e */
- "float", /* f */
- "__float128", /* g */
- "unsigned char", /* h */
- "int", /* i */
- "unsigned", /* j */
- NULL, /* k */
- "long", /* l */
- "unsigned long", /* m */
- "__int128", /* n */
- "unsigned __int128", /* o */
- NULL, /* p */
- NULL, /* q */
- NULL, /* r */
- "short", /* s */
- "unsigned short", /* t */
- NULL, /* u */
- "void", /* v */
- "char", /* C++ "wchar_t" */ /* w */
- "long", /* C++ "long long" */ /* x */
- "unsigned long long", /* y */
- "..." /* z */
-};
+/* <template-args> ::= I <template-arg>+ E */
-/* Demangles and emits a <builtin-type>.
-
- <builtin-type> ::= v # void
- ::= w # wchar_t
- ::= b # bool
- ::= c # char
- ::= a # signed char
- ::= h # unsigned char
- ::= s # short
- ::= t # unsigned short
- ::= i # int
- ::= j # unsigned int
- ::= l # long
- ::= m # unsigned long
- ::= x # long long, __int64
- ::= y # unsigned long long, __int64
- ::= n # __int128
- ::= o # unsigned __int128
- ::= f # float
- ::= d # double
- ::= e # long double, __float80
- ::= g # __float128
- ::= z # ellipsis
- ::= u <source-name> # vendor extended type */
-
-static status_t
-demangle_builtin_type (dm)
- demangling_t dm;
+static struct demangle_component *
+d_template_args (di)
+ struct d_info *di;
{
+ struct demangle_component *hold_last_name;
+ struct demangle_component *al;
+ struct demangle_component **pal;
- char code = peek_char (dm);
+ /* Preserve the last name we saw--don't let the template arguments
+ clobber it, as that would give us the wrong name for a subsequent
+ constructor or destructor. */
+ hold_last_name = di->last_name;
- DEMANGLE_TRACE ("builtin-type", dm);
+ if (d_next_char (di) != 'I')
+ return NULL;
- if (code == 'u')
+ al = NULL;
+ pal = &al;
+ while (1)
{
- advance_char (dm);
- RETURN_IF_ERROR (demangle_source_name (dm));
- return STATUS_OK;
+ struct demangle_component *a;
+
+ a = d_template_arg (di);
+ if (a == NULL)
+ return NULL;
+
+ *pal = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, a, NULL);
+ if (*pal == NULL)
+ return NULL;
+ pal = &d_right (*pal);
+
+ if (d_peek_char (di) == 'E')
+ {
+ d_advance (di, 1);
+ break;
+ }
}
- else if (code >= 'a' && code <= 'z')
+
+ di->last_name = hold_last_name;
+
+ return al;
+}
+
+/* <template-arg> ::= <type>
+ ::= X <expression> E
+ ::= <expr-primary>
+*/
+
+static struct demangle_component *
+d_template_arg (di)
+ struct d_info *di;
+{
+ struct demangle_component *ret;
+
+ switch (d_peek_char (di))
{
- const char *type_name;
- /* Java uses different names for some built-in types. */
- if (dm->style == DMGL_JAVA)
- type_name = java_builtin_type_names[code - 'a'];
- else
- type_name = builtin_type_names[code - 'a'];
- if (type_name == NULL)
- return "Unrecognized <builtin-type> code.";
+ case 'X':
+ d_advance (di, 1);
+ ret = d_expression (di);
+ if (d_next_char (di) != 'E')
+ return NULL;
+ return ret;
- RETURN_IF_ERROR (result_add (dm, type_name));
- advance_char (dm);
- return STATUS_OK;
+ case 'L':
+ return d_expr_primary (di);
+
+ default:
+ return cplus_demangle_type (di);
}
- else
- return "Non-alphabetic <builtin-type> code.";
}
-/* Demangles all consecutive CV-qualifiers (const, volatile, and
- restrict) at the current position. The qualifiers are appended to
- QUALIFIERS. Returns STATUS_OK. */
+/* <expression> ::= <(unary) operator-name> <expression>
+ ::= <(binary) operator-name> <expression> <expression>
+ ::= <(trinary) operator-name> <expression> <expression> <expression>
+ ::= st <type>
+ ::= <template-param>
+ ::= sr <type> <unqualified-name>
+ ::= sr <type> <unqualified-name> <template-args>
+ ::= <expr-primary>
+*/
-static status_t
-demangle_CV_qualifiers (dm, qualifiers)
- demangling_t dm;
- dyn_string_t qualifiers;
+static struct demangle_component *
+d_expression (di)
+ struct d_info *di;
{
- DEMANGLE_TRACE ("CV-qualifiers", dm);
+ char peek;
- while (1)
+ peek = d_peek_char (di);
+ if (peek == 'L')
+ return d_expr_primary (di);
+ else if (peek == 'T')
+ return d_template_param (di);
+ else if (peek == 's' && d_peek_next_char (di) == 'r')
{
- switch (peek_char (dm))
+ struct demangle_component *type;
+ struct demangle_component *name;
+
+ d_advance (di, 2);
+ type = cplus_demangle_type (di);
+ name = d_unqualified_name (di);
+ if (d_peek_char (di) != 'I')
+ return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type, name);
+ else
+ return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type,
+ d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
+ d_template_args (di)));
+ }
+ else
+ {
+ struct demangle_component *op;
+ int args;
+
+ op = d_operator_name (di);
+ if (op == NULL)
+ return NULL;
+
+ if (op->type == DEMANGLE_COMPONENT_OPERATOR)
+ di->expansion += op->u.s_operator.op->len - 2;
+
+ if (op->type == DEMANGLE_COMPONENT_OPERATOR
+ && strcmp (op->u.s_operator.op->code, "st") == 0)
+ return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
+ cplus_demangle_type (di));
+
+ switch (op->type)
{
- case 'r':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "restrict"))
- return STATUS_ALLOCATION_FAILED;
+ default:
+ return NULL;
+ case DEMANGLE_COMPONENT_OPERATOR:
+ args = op->u.s_operator.op->args;
break;
-
- case 'V':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "volatile"))
- return STATUS_ALLOCATION_FAILED;
+ case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
+ args = op->u.s_extended_operator.args;
break;
-
- case 'K':
- if (!dyn_string_append_space (qualifiers))
- return STATUS_ALLOCATION_FAILED;
- if (!dyn_string_append_cstr (qualifiers, "const"))
- return STATUS_ALLOCATION_FAILED;
+ case DEMANGLE_COMPONENT_CAST:
+ args = 1;
break;
+ }
+ switch (args)
+ {
+ case 1:
+ return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
+ d_expression (di));
+ case 2:
+ {
+ struct demangle_component *left;
+
+ left = d_expression (di);
+ return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op,
+ d_make_comp (di,
+ DEMANGLE_COMPONENT_BINARY_ARGS,
+ left,
+ d_expression (di)));
+ }
+ case 3:
+ {
+ struct demangle_component *first;
+ struct demangle_component *second;
+
+ first = d_expression (di);
+ second = d_expression (di);
+ return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op,
+ d_make_comp (di,
+ DEMANGLE_COMPONENT_TRINARY_ARG1,
+ first,
+ d_make_comp (di,
+ DEMANGLE_COMPONENT_TRINARY_ARG2,
+ second,
+ d_expression (di))));
+ }
default:
- return STATUS_OK;
+ return NULL;
}
-
- advance_char (dm);
}
}
-/* Demangles and emits a <function-type>. *FUNCTION_NAME_POS is the
- position in the result string of the start of the function
- identifier, at which the function's return type will be inserted;
- *FUNCTION_NAME_POS is updated to position past the end of the
- function's return type.
+/* <expr-primary> ::= L <type> <(value) number> E
+ ::= L <type> <(value) float> E
+ ::= L <mangled-name> E
+*/
- <function-type> ::= F [Y] <bare-function-type> E */
+static struct demangle_component *
+d_expr_primary (di)
+ struct d_info *di;
+{
+ struct demangle_component *ret;
-static status_t
-demangle_function_type (dm, function_name_pos)
- demangling_t dm;
- int *function_name_pos;
+ if (d_next_char (di) != 'L')
+ return NULL;
+ if (d_peek_char (di) == '_')
+ ret = cplus_demangle_mangled_name (di, 0);
+ else
+ {
+ struct demangle_component *type;
+ enum demangle_component_type t;
+ const char *s;
+
+ type = cplus_demangle_type (di);
+
+ /* If we have a type we know how to print, we aren't going to
+ print the type name itself. */
+ if (type->type == DEMANGLE_COMPONENT_BUILTIN_TYPE
+ && type->u.s_builtin.type->print != D_PRINT_DEFAULT)
+ di->expansion -= type->u.s_builtin.type->len;
+
+ /* Rather than try to interpret the literal value, we just
+ collect it as a string. Note that it's possible to have a
+ floating point literal here. The ABI specifies that the
+ format of such literals is machine independent. That's fine,
+ but what's not fine is that versions of g++ up to 3.2 with
+ -fabi-version=1 used upper case letters in the hex constant,
+ and dumped out gcc's internal representation. That makes it
+ hard to tell where the constant ends, and hard to dump the
+ constant in any readable form anyhow. We don't attempt to
+ handle these cases. */
+
+ t = DEMANGLE_COMPONENT_LITERAL;
+ if (d_peek_char (di) == 'n')
+ {
+ t = DEMANGLE_COMPONENT_LITERAL_NEG;
+ d_advance (di, 1);
+ }
+ s = d_str (di);
+ while (d_peek_char (di) != 'E')
+ d_advance (di, 1);
+ ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s));
+ }
+ if (d_next_char (di) != 'E')
+ return NULL;
+ return ret;
+}
+
+/* <local-name> ::= Z <(function) encoding> E <(entity) name> [<discriminator>]
+ ::= Z <(function) encoding> E s [<discriminator>]
+*/
+
+static struct demangle_component *
+d_local_name (di)
+ struct d_info *di;
{
- DEMANGLE_TRACE ("function-type", dm);
- RETURN_IF_ERROR (demangle_char (dm, 'F'));
- if (peek_char (dm) == 'Y')
+ struct demangle_component *function;
+
+ if (d_next_char (di) != 'Z')
+ return NULL;
+
+ function = d_encoding (di, 0);
+
+ if (d_next_char (di) != 'E')
+ return NULL;
+
+ if (d_peek_char (di) == 's')
{
- /* Indicate this function has C linkage if in verbose mode. */
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [extern \"C\"] "));
- advance_char (dm);
+ d_advance (di, 1);
+ if (! d_discriminator (di))
+ return NULL;
+ return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function,
+ d_make_name (di, "string literal",
+ sizeof "string literal" - 1));
}
- RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- return STATUS_OK;
+ else
+ {
+ struct demangle_component *name;
+
+ name = d_name (di);
+ if (! d_discriminator (di))
+ return NULL;
+ return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name);
+ }
+}
+
+/* <discriminator> ::= _ <(non-negative) number>
+
+ We demangle the discriminator, but we don't print it out. FIXME:
+ We should print it out in verbose mode. */
+
+static int
+d_discriminator (di)
+ struct d_info *di;
+{
+ long discrim;
+
+ if (d_peek_char (di) != '_')
+ return 1;
+ d_advance (di, 1);
+ discrim = d_number (di);
+ if (discrim < 0)
+ return 0;
+ return 1;
+}
+
+/* Add a new substitution. */
+
+static int
+d_add_substitution (di, dc)
+ struct d_info *di;
+ struct demangle_component *dc;
+{
+ if (dc == NULL)
+ return 0;
+ if (di->next_sub >= di->num_subs)
+ return 0;
+ di->subs[di->next_sub] = dc;
+ ++di->next_sub;
+ return 1;
}
-/* Demangles and emits a <bare-function-type>. RETURN_TYPE_POS is the
- position in the result string at which the function return type
- should be inserted. If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the
- function's return type is assumed not to be encoded.
+/* <substitution> ::= S <seq-id> _
+ ::= S_
+ ::= St
+ ::= Sa
+ ::= Sb
+ ::= Ss
+ ::= Si
+ ::= So
+ ::= Sd
+
+ If PREFIX is non-zero, then this type is being used as a prefix in
+ a qualified name. In this case, for the standard substitutions, we
+ need to check whether we are being used as a prefix for a
+ constructor or destructor, and return a full template name.
+ Otherwise we will get something like std::iostream::~iostream()
+ which does not correspond particularly well to any function which
+ actually appears in the source.
+*/
- <bare-function-type> ::= <signature type>+ */
+static const struct d_standard_sub_info standard_subs[] =
+{
+ { 't', NL ("std"),
+ NL ("std"),
+ NULL, 0 },
+ { 'a', NL ("std::allocator"),
+ NL ("std::allocator"),
+ NL ("allocator") },
+ { 'b', NL ("std::basic_string"),
+ NL ("std::basic_string"),
+ NL ("basic_string") },
+ { 's', NL ("std::string"),
+ NL ("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
+ NL ("basic_string") },
+ { 'i', NL ("std::istream"),
+ NL ("std::basic_istream<char, std::char_traits<char> >"),
+ NL ("basic_istream") },
+ { 'o', NL ("std::ostream"),
+ NL ("std::basic_ostream<char, std::char_traits<char> >"),
+ NL ("basic_ostream") },
+ { 'd', NL ("std::iostream"),
+ NL ("std::basic_iostream<char, std::char_traits<char> >"),
+ NL ("basic_iostream") }
+};
-static status_t
-demangle_bare_function_type (dm, return_type_pos)
- demangling_t dm;
- int *return_type_pos;
+static struct demangle_component *
+d_substitution (di, prefix)
+ struct d_info *di;
+ int prefix;
{
- /* Sequence is the index of the current function parameter, counting
- from zero. The value -1 denotes the return type. */
- int sequence =
- (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1);
+ char c;
- DEMANGLE_TRACE ("bare-function-type", dm);
+ if (d_next_char (di) != 'S')
+ return NULL;
- RETURN_IF_ERROR (result_add_char (dm, '('));
- while (!end_of_name_p (dm) && peek_char (dm) != 'E')
+ c = d_next_char (di);
+ if (c == '_' || IS_DIGIT (c) || IS_UPPER (c))
{
- if (sequence == -1)
- /* We're decoding the function's return type. */
+ int id;
+
+ id = 0;
+ if (c != '_')
{
- dyn_string_t return_type;
- status_t status = STATUS_OK;
-
- /* Decode the return type off to the side. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_type (dm));
- return_type = (dyn_string_t) result_pop (dm);
-
- /* Add a space to the end of the type. Insert the return
- type where we've been asked to. */
- if (!dyn_string_append_space (return_type))
- status = STATUS_ALLOCATION_FAILED;
- if (STATUS_NO_ERROR (status))
+ do
{
- if (!dyn_string_insert (result_string (dm), *return_type_pos,
- return_type))
- status = STATUS_ALLOCATION_FAILED;
+ if (IS_DIGIT (c))
+ id = id * 36 + c - '0';
+ else if (IS_UPPER (c))
+ id = id * 36 + c - 'A' + 10;
else
- *return_type_pos += dyn_string_length (return_type);
+ return NULL;
+ c = d_next_char (di);
}
+ while (c != '_');
- dyn_string_delete (return_type);
- RETURN_IF_ERROR (status);
+ ++id;
}
- else
+
+ if (id >= di->next_sub)
+ return NULL;
+
+ ++di->did_subs;
+
+ return di->subs[id];
+ }
+ else
+ {
+ int verbose;
+ const struct d_standard_sub_info *p;
+ const struct d_standard_sub_info *pend;
+
+ verbose = (di->options & DMGL_VERBOSE) != 0;
+ if (! verbose && prefix)
{
- /* Skip `void' parameter types. One should only occur as
- the only type in a parameter list; in that case, we want
- to print `foo ()' instead of `foo (void)'. */
- if (peek_char (dm) == 'v')
- /* Consume the v. */
- advance_char (dm);
- else
+ char peek;
+
+ peek = d_peek_char (di);
+ if (peek == 'C' || peek == 'D')
+ verbose = 1;
+ }
+
+ pend = (&standard_subs[0]
+ + sizeof standard_subs / sizeof standard_subs[0]);
+ for (p = &standard_subs[0]; p < pend; ++p)
+ {
+ if (c == p->code)
{
- /* Separate parameter types by commas. */
- if (sequence > 0)
- RETURN_IF_ERROR (result_add (dm, ", "));
- /* Demangle the type. */
- RETURN_IF_ERROR (demangle_type (dm));
+ const char *s;
+ int len;
+
+ if (p->set_last_name != NULL)
+ di->last_name = d_make_sub (di, p->set_last_name,
+ p->set_last_name_len);
+ if (verbose)
+ {
+ s = p->full_expansion;
+ len = p->full_len;
+ }
+ else
+ {
+ s = p->simple_expansion;
+ len = p->simple_len;
+ }
+ di->expansion += len;
+ return d_make_sub (di, s, len);
}
}
- ++sequence;
+ return NULL;
}
- RETURN_IF_ERROR (result_add_char (dm, ')'));
+}
- /* We should have demangled at least one parameter type (which would
- be void, for a function that takes no parameters), plus the
- return type, if we were supposed to demangle that. */
- if (sequence == -1)
- return "Missing function return type.";
- else if (sequence == 0)
- return "Missing function parameter.";
+/* Resize the print buffer. */
- return STATUS_OK;
-}
+static void
+d_print_resize (dpi, add)
+ struct d_print_info *dpi;
+ size_t add;
+{
+ size_t need;
-/* Demangles and emits a <class-enum-type>. *ENCODE_RETURN_TYPE is set to
- non-zero if the type is a template-id, zero otherwise.
+ if (dpi->buf == NULL)
+ return;
+ need = dpi->len + add;
+ while (need > dpi->alc)
+ {
+ size_t newalc;
+ char *newbuf;
+
+ newalc = dpi->alc * 2;
+ newbuf = realloc (dpi->buf, newalc);
+ if (newbuf == NULL)
+ {
+ free (dpi->buf);
+ dpi->buf = NULL;
+ dpi->allocation_failure = 1;
+ return;
+ }
+ dpi->buf = newbuf;
+ dpi->alc = newalc;
+ }
+}
- <class-enum-type> ::= <name> */
+/* Append a character to the print buffer. */
-static status_t
-demangle_class_enum_type (dm, encode_return_type)
- demangling_t dm;
- int *encode_return_type;
+static void
+d_print_append_char (dpi, c)
+ struct d_print_info *dpi;
+ int c;
{
- DEMANGLE_TRACE ("class-enum-type", dm);
+ if (dpi->buf != NULL)
+ {
+ if (dpi->len >= dpi->alc)
+ {
+ d_print_resize (dpi, 1);
+ if (dpi->buf == NULL)
+ return;
+ }
- RETURN_IF_ERROR (demangle_name (dm, encode_return_type));
- return STATUS_OK;
+ dpi->buf[dpi->len] = c;
+ ++dpi->len;
+ }
}
-/* Demangles and emits an <array-type>.
+/* Append a buffer to the print buffer. */
- If PTR_INSERT_POS is not NULL, the array type is formatted as a
- pointer or reference to an array, except that asterisk and
- ampersand punctuation is omitted (since it's not know at this
- point). *PTR_INSERT_POS is set to the position in the demangled
- name at which this punctuation should be inserted. For example,
- `A10_i' is demangled to `int () [10]' and *PTR_INSERT_POS points
- between the parentheses.
+static void
+d_print_append_buffer (dpi, s, l)
+ struct d_print_info *dpi;
+ const char *s;
+ size_t l;
+{
+ if (dpi->buf != NULL)
+ {
+ if (dpi->len + l > dpi->alc)
+ {
+ d_print_resize (dpi, l);
+ if (dpi->buf == NULL)
+ return;
+ }
- If PTR_INSERT_POS is NULL, the array type is assumed not to be
- pointer- or reference-qualified. Then, for example, `A10_i' is
- demangled simply as `int[10]'.
+ memcpy (dpi->buf + dpi->len, s, l);
+ dpi->len += l;
+ }
+}
- <array-type> ::= A [<dimension number>] _ <element type>
- ::= A <dimension expression> _ <element type> */
+/* Indicate that an error occurred during printing. */
-static status_t
-demangle_array_type (dm, ptr_insert_pos)
- demangling_t dm;
- int *ptr_insert_pos;
+static void
+d_print_error (dpi)
+ struct d_print_info *dpi;
{
- status_t status = STATUS_OK;
- dyn_string_t array_size = NULL;
- char peek;
+ free (dpi->buf);
+ dpi->buf = NULL;
+}
- DEMANGLE_TRACE ("array-type", dm);
+/* Turn components into a human readable string. OPTIONS is the
+ options bits passed to the demangler. DC is the tree to print.
+ ESTIMATE is a guess at the length of the result. This returns a
+ string allocated by malloc, or NULL on error. On success, this
+ sets *PALC to the size of the allocated buffer. On failure, this
+ sets *PALC to 0 for a bad parse, or to 1 for a memory allocation
+ failure. */
- RETURN_IF_ERROR (demangle_char (dm, 'A'));
+CP_STATIC_IF_GLIBCPP_V3
+char *
+cplus_demangle_print (options, dc, estimate, palc)
+ int options;
+ const struct demangle_component *dc;
+ int estimate;
+ size_t *palc;
+{
+ struct d_print_info dpi;
- /* Demangle the array size into array_size. */
- peek = peek_char (dm);
- if (peek == '_')
- /* Array bound is omitted. This is a C99-style VLA. */
- ;
- else if (IS_DIGIT (peek_char (dm)))
+ dpi.options = options;
+
+ dpi.alc = estimate + 1;
+ dpi.buf = malloc (dpi.alc);
+ if (dpi.buf == NULL)
{
- /* It looks like a constant array bound. */
- array_size = dyn_string_new (10);
- if (array_size == NULL)
- return STATUS_ALLOCATION_FAILED;
- status = demangle_number_literally (dm, array_size, 10, 0);
+ *palc = 1;
+ return NULL;
}
+
+ dpi.len = 0;
+ dpi.templates = NULL;
+ dpi.modifiers = NULL;
+
+ dpi.allocation_failure = 0;
+
+ d_print_comp (&dpi, dc);
+
+ d_append_char (&dpi, '\0');
+
+ if (dpi.buf != NULL)
+ *palc = dpi.alc;
else
- {
- /* Anything is must be an expression for a nont-constant array
- bound. This happens if the array type occurs in a template
- and the array bound references a template parameter. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_expression (dm));
- array_size = (dyn_string_t) result_pop (dm);
- }
- /* array_size may have been allocated by now, so we can't use
- RETURN_IF_ERROR until it's been deallocated. */
+ *palc = dpi.allocation_failure;
+
+ return dpi.buf;
+}
- /* Demangle the base type of the array. */
- if (STATUS_NO_ERROR (status))
- status = demangle_char (dm, '_');
- if (STATUS_NO_ERROR (status))
- status = demangle_type (dm);
+/* Subroutine to handle components. */
- if (ptr_insert_pos != NULL)
+static void
+d_print_comp (dpi, dc)
+ struct d_print_info *dpi;
+ const struct demangle_component *dc;
+{
+ if (dc == NULL)
{
- /* This array is actually part of an pointer- or
- reference-to-array type. Format appropriately, except we
- don't know which and how much punctuation to use. */
- if (STATUS_NO_ERROR (status))
- status = result_add (dm, " () ");
- /* Let the caller know where to insert the punctuation. */
- *ptr_insert_pos = result_caret_pos (dm) - 2;
+ d_print_error (dpi);
+ return;
}
+ if (d_print_saw_error (dpi))
+ return;
- /* Emit the array dimension syntax. */
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, '[');
- if (STATUS_NO_ERROR (status) && array_size != NULL)
- status = result_add_string (dm, array_size);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ']');
- if (array_size != NULL)
- dyn_string_delete (array_size);
-
- RETURN_IF_ERROR (status);
-
- return STATUS_OK;
-}
+ switch (dc->type)
+ {
+ case DEMANGLE_COMPONENT_NAME:
+ if ((dpi->options & DMGL_JAVA) == 0)
+ d_append_buffer (dpi, dc->u.s_name.s, dc->u.s_name.len);
+ else
+ d_print_java_identifier (dpi, dc->u.s_name.s, dc->u.s_name.len);
+ return;
+
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ d_print_comp (dpi, d_left (dc));
+ if ((dpi->options & DMGL_JAVA) == 0)
+ d_append_string_constant (dpi, "::");
+ else
+ d_append_char (dpi, '.');
+ d_print_comp (dpi, d_right (dc));
+ return;
-/* Demangles and emits a <template-param>.
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ {
+ struct d_print_mod *hold_modifiers;
+ struct demangle_component *typed_name;
+ struct d_print_mod adpm[4];
+ unsigned int i;
+ struct d_print_template dpt;
+
+ /* Pass the name down to the type so that it can be printed in
+ the right place for the type. We also have to pass down
+ any CV-qualifiers, which apply to the this parameter. */
+ hold_modifiers = dpi->modifiers;
+ i = 0;
+ typed_name = d_left (dc);
+ while (typed_name != NULL)
+ {
+ if (i >= sizeof adpm / sizeof adpm[0])
+ {
+ d_print_error (dpi);
+ return;
+ }
+
+ adpm[i].next = dpi->modifiers;
+ dpi->modifiers = &adpm[i];
+ adpm[i].mod = typed_name;
+ adpm[i].printed = 0;
+ adpm[i].templates = dpi->templates;
+ ++i;
+
+ if (typed_name->type != DEMANGLE_COMPONENT_RESTRICT_THIS
+ && typed_name->type != DEMANGLE_COMPONENT_VOLATILE_THIS
+ && typed_name->type != DEMANGLE_COMPONENT_CONST_THIS)
+ break;
- <template-param> ::= T_ # first template parameter
- ::= T <parameter-2 number> _ */
+ typed_name = d_left (typed_name);
+ }
-static status_t
-demangle_template_param (dm)
- demangling_t dm;
-{
- int parm_number;
- template_arg_list_t current_arg_list = current_template_arg_list (dm);
- string_list_t arg;
+ /* If typed_name is a template, then it applies to the
+ function type as well. */
+ if (typed_name->type == DEMANGLE_COMPONENT_TEMPLATE)
+ {
+ dpt.next = dpi->templates;
+ dpi->templates = &dpt;
+ dpt.template = typed_name;
+ }
- DEMANGLE_TRACE ("template-param", dm);
+ /* If typed_name is a DEMANGLE_COMPONENT_LOCAL_NAME, then
+ there may be CV-qualifiers on its right argument which
+ really apply here; this happens when parsing a class which
+ is local to a function. */
+ if (typed_name->type == DEMANGLE_COMPONENT_LOCAL_NAME)
+ {
+ struct demangle_component *local_name;
+
+ local_name = d_right (typed_name);
+ while (local_name->type == DEMANGLE_COMPONENT_RESTRICT_THIS
+ || local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS
+ || local_name->type == DEMANGLE_COMPONENT_CONST_THIS)
+ {
+ if (i >= sizeof adpm / sizeof adpm[0])
+ {
+ d_print_error (dpi);
+ return;
+ }
+
+ adpm[i] = adpm[i - 1];
+ adpm[i].next = &adpm[i - 1];
+ dpi->modifiers = &adpm[i];
+
+ adpm[i - 1].mod = local_name;
+ adpm[i - 1].printed = 0;
+ adpm[i - 1].templates = dpi->templates;
+ ++i;
+
+ local_name = d_left (local_name);
+ }
+ }
- /* Make sure there is a template argmust list in which to look up
- this parameter reference. */
- if (current_arg_list == NULL)
- return "Template parameter outside of template.";
+ d_print_comp (dpi, d_right (dc));
- RETURN_IF_ERROR (demangle_char (dm, 'T'));
- if (peek_char (dm) == '_')
- parm_number = 0;
- else
- {
- RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0));
- ++parm_number;
- }
- RETURN_IF_ERROR (demangle_char (dm, '_'));
+ if (typed_name->type == DEMANGLE_COMPONENT_TEMPLATE)
+ dpi->templates = dpt.next;
- arg = template_arg_list_get_arg (current_arg_list, parm_number);
- if (arg == NULL)
- /* parm_number exceeded the number of arguments in the current
- template argument list. */
- return "Template parameter number out of bounds.";
- RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
+ /* If the modifiers didn't get printed by the type, print them
+ now. */
+ while (i > 0)
+ {
+ --i;
+ if (! adpm[i].printed)
+ {
+ d_append_char (dpi, ' ');
+ d_print_mod (dpi, adpm[i].mod);
+ }
+ }
- return STATUS_OK;
-}
+ dpi->modifiers = hold_modifiers;
-/* Demangles and emits a <template-args>.
+ return;
+ }
- <template-args> ::= I <template-arg>+ E */
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ {
+ struct d_print_mod *hold_dpm;
-static status_t
-demangle_template_args (dm)
- demangling_t dm;
-{
- int first = 1;
- dyn_string_t old_last_source_name;
- template_arg_list_t arg_list = template_arg_list_new ();
+ /* Don't push modifiers into a template definition. Doing so
+ could give the wrong definition for a template argument.
+ Instead, treat the template essentially as a name. */
- if (arg_list == NULL)
- return STATUS_ALLOCATION_FAILED;
+ hold_dpm = dpi->modifiers;
+ dpi->modifiers = NULL;
- /* Preserve the most recently demangled source name. */
- old_last_source_name = dm->last_source_name;
- dm->last_source_name = dyn_string_new (0);
+ d_print_comp (dpi, d_left (dc));
+ if (d_last_char (dpi) == '<')
+ d_append_char (dpi, ' ');
+ d_append_char (dpi, '<');
+ d_print_comp (dpi, d_right (dc));
+ /* Avoid generating two consecutive '>' characters, to avoid
+ the C++ syntactic ambiguity. */
+ if (d_last_char (dpi) == '>')
+ d_append_char (dpi, ' ');
+ d_append_char (dpi, '>');
- DEMANGLE_TRACE ("template-args", dm);
+ dpi->modifiers = hold_dpm;
- if (dm->last_source_name == NULL)
- return STATUS_ALLOCATION_FAILED;
+ return;
+ }
- RETURN_IF_ERROR (demangle_char (dm, 'I'));
- RETURN_IF_ERROR (result_open_template_list (dm));
- do
- {
- string_list_t arg;
+ case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
+ {
+ long i;
+ struct demangle_component *a;
+ struct d_print_template *hold_dpt;
- if (first)
- first = 0;
+ if (dpi->templates == NULL)
+ {
+ d_print_error (dpi);
+ return;
+ }
+ i = dc->u.s_number.number;
+ for (a = d_right (dpi->templates->template);
+ a != NULL;
+ a = d_right (a))
+ {
+ if (a->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
+ {
+ d_print_error (dpi);
+ return;
+ }
+ if (i <= 0)
+ break;
+ --i;
+ }
+ if (i != 0 || a == NULL)
+ {
+ d_print_error (dpi);
+ return;
+ }
+
+ /* While processing this parameter, we need to pop the list of
+ templates. This is because the template parameter may
+ itself be a reference to a parameter of an outer
+ template. */
+
+ hold_dpt = dpi->templates;
+ dpi->templates = hold_dpt->next;
+
+ d_print_comp (dpi, d_left (a));
+
+ dpi->templates = hold_dpt;
+
+ return;
+ }
+
+ case DEMANGLE_COMPONENT_CTOR:
+ d_print_comp (dpi, dc->u.s_ctor.name);
+ return;
+
+ case DEMANGLE_COMPONENT_DTOR:
+ d_append_char (dpi, '~');
+ d_print_comp (dpi, dc->u.s_dtor.name);
+ return;
+
+ case DEMANGLE_COMPONENT_VTABLE:
+ d_append_string_constant (dpi, "vtable for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_VTT:
+ d_append_string_constant (dpi, "VTT for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
+ d_append_string_constant (dpi, "construction vtable for ");
+ d_print_comp (dpi, d_left (dc));
+ d_append_string_constant (dpi, "-in-");
+ d_print_comp (dpi, d_right (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_TYPEINFO:
+ d_append_string_constant (dpi, "typeinfo for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_TYPEINFO_NAME:
+ d_append_string_constant (dpi, "typeinfo name for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_TYPEINFO_FN:
+ d_append_string_constant (dpi, "typeinfo fn for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_THUNK:
+ d_append_string_constant (dpi, "non-virtual thunk to ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
+ d_append_string_constant (dpi, "virtual thunk to ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_COVARIANT_THUNK:
+ d_append_string_constant (dpi, "covariant return thunk to ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_JAVA_CLASS:
+ d_append_string_constant (dpi, "java Class for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_GUARD:
+ d_append_string_constant (dpi, "guard variable for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_REFTEMP:
+ d_append_string_constant (dpi, "reference temporary for ");
+ d_print_comp (dpi, d_left (dc));
+ return;
+
+ case DEMANGLE_COMPONENT_SUB_STD:
+ d_append_buffer (dpi, dc->u.s_string.string, dc->u.s_string.len);
+ return;
+
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_POINTER:
+ case DEMANGLE_COMPONENT_REFERENCE:
+ case DEMANGLE_COMPONENT_COMPLEX:
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ {
+ /* We keep a list of modifiers on the stack. */
+ struct d_print_mod dpm;
+
+ dpm.next = dpi->modifiers;
+ dpi->modifiers = &dpm;
+ dpm.mod = dc;
+ dpm.printed = 0;
+ dpm.templates = dpi->templates;
+
+ d_print_comp (dpi, d_left (dc));
+
+ /* If the modifier didn't get printed by the type, print it
+ now. */
+ if (! dpm.printed)
+ d_print_mod (dpi, dc);
+
+ dpi->modifiers = dpm.next;
+
+ return;
+ }
+
+ case DEMANGLE_COMPONENT_BUILTIN_TYPE:
+ if ((dpi->options & DMGL_JAVA) == 0)
+ d_append_buffer (dpi, dc->u.s_builtin.type->name,
+ dc->u.s_builtin.type->len);
else
- RETURN_IF_ERROR (result_add (dm, ", "));
+ d_append_buffer (dpi, dc->u.s_builtin.type->java_name,
+ dc->u.s_builtin.type->java_len);
+ return;
- /* Capture the template arg. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_template_arg (dm));
- arg = result_pop (dm);
+ case DEMANGLE_COMPONENT_VENDOR_TYPE:
+ d_print_comp (dpi, d_left (dc));
+ return;
- /* Emit it in the demangled name. */
- RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
+ case DEMANGLE_COMPONENT_FUNCTION_TYPE:
+ {
+ if (d_left (dc) != NULL)
+ {
+ struct d_print_mod dpm;
- /* Save it for use in expanding <template-param>s. */
- template_arg_list_add_arg (arg_list, arg);
- }
- while (peek_char (dm) != 'E');
- /* Append the '>'. */
- RETURN_IF_ERROR (result_close_template_list (dm));
+ /* We must pass this type down as a modifier in order to
+ print it in the right location. */
- /* Consume the 'E'. */
- advance_char (dm);
+ dpm.next = dpi->modifiers;
+ dpi->modifiers = &dpm;
+ dpm.mod = dc;
+ dpm.printed = 0;
+ dpm.templates = dpi->templates;
- /* Restore the most recent demangled source name. */
- dyn_string_delete (dm->last_source_name);
- dm->last_source_name = old_last_source_name;
+ d_print_comp (dpi, d_left (dc));
- /* Push the list onto the top of the stack of template argument
- lists, so that arguments from it are used from now on when
- expanding <template-param>s. */
- push_template_arg_list (dm, arg_list);
+ dpi->modifiers = dpm.next;
- return STATUS_OK;
-}
+ if (dpm.printed)
+ return;
-/* This function, which does not correspond to a production in the
- mangling spec, handles the `literal' production for both
- <template-arg> and <expr-primary>. It does not expect or consume
- the initial `L' or final `E'. The demangling is given by:
+ d_append_char (dpi, ' ');
+ }
- <literal> ::= <type> </value/ number>
+ d_print_function_type (dpi, dc, dpi->modifiers);
- and the emitted output is `(type)number'. */
+ return;
+ }
-static status_t
-demangle_literal (dm)
- demangling_t dm;
-{
- char peek = peek_char (dm);
- dyn_string_t value_string;
- status_t status;
+ case DEMANGLE_COMPONENT_ARRAY_TYPE:
+ {
+ struct d_print_mod dpm;
- DEMANGLE_TRACE ("literal", dm);
+ /* We must pass this type down as a modifier in order to print
+ multi-dimensional arrays correctly. */
- if (!flag_verbose && peek >= 'a' && peek <= 'z')
- {
- /* If not in verbose mode and this is a builtin type, see if we
- can produce simpler numerical output. In particular, for
- integer types shorter than `long', just write the number
- without type information; for bools, write `true' or `false'.
- Other refinements could be made here too. */
-
- /* This constant string is used to map from <builtin-type> codes
- (26 letters of the alphabet) to codes that determine how the
- value will be displayed. The codes are:
- b: display as bool
- i: display as int
- l: display as long
- A space means the value will be represented using cast
- notation. */
- static const char *const code_map = "ibi iii ll ii i ";
-
- char code = code_map[peek - 'a'];
- /* FIXME: Implement demangling of floats and doubles. */
- if (code == 'u')
- return STATUS_UNIMPLEMENTED;
- if (code == 'b')
- {
- /* It's a boolean. */
- char value;
-
- /* Consume the b. */
- advance_char (dm);
- /* Look at the next character. It should be 0 or 1,
- corresponding to false or true, respectively. */
- value = peek_char (dm);
- if (value == '0')
- RETURN_IF_ERROR (result_add (dm, "false"));
- else if (value == '1')
- RETURN_IF_ERROR (result_add (dm, "true"));
- else
- return "Unrecognized bool constant.";
- /* Consume the 0 or 1. */
- advance_char (dm);
- return STATUS_OK;
- }
- else if (code == 'i' || code == 'l')
- {
- /* It's an integer or long. */
-
- /* Consume the type character. */
- advance_char (dm);
-
- /* Demangle the number and write it out. */
- value_string = dyn_string_new (0);
- status = demangle_number_literally (dm, value_string, 10, 1);
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, value_string);
- /* For long integers, append an l. */
- if (code == 'l' && STATUS_NO_ERROR (status))
- status = result_add_char (dm, code);
- dyn_string_delete (value_string);
-
- RETURN_IF_ERROR (status);
- return STATUS_OK;
- }
- /* ...else code == ' ', so fall through to represent this
- literal's type explicitly using cast syntax. */
- }
+ dpm.next = dpi->modifiers;
+ dpi->modifiers = &dpm;
+ dpm.mod = dc;
+ dpm.printed = 0;
+ dpm.templates = dpi->templates;
- RETURN_IF_ERROR (result_add_char (dm, '('));
- RETURN_IF_ERROR (demangle_type (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
+ d_print_comp (dpi, d_right (dc));
- value_string = dyn_string_new (0);
- if (value_string == NULL)
- return STATUS_ALLOCATION_FAILED;
+ dpi->modifiers = dpm.next;
- status = demangle_number_literally (dm, value_string, 10, 1);
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, value_string);
- dyn_string_delete (value_string);
- RETURN_IF_ERROR (status);
+ if (dpm.printed)
+ return;
- return STATUS_OK;
-}
+ d_print_array_type (dpi, dc, dpi->modifiers);
-/* Demangles and emits a <template-arg>.
+ return;
+ }
- <template-arg> ::= <type> # type
- ::= L <type> <value number> E # literal
- ::= LZ <encoding> E # external name
- ::= X <expression> E # expression */
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ {
+ struct d_print_mod dpm;
-static status_t
-demangle_template_arg (dm)
- demangling_t dm;
-{
- DEMANGLE_TRACE ("template-arg", dm);
+ dpm.next = dpi->modifiers;
+ dpi->modifiers = &dpm;
+ dpm.mod = dc;
+ dpm.printed = 0;
+ dpm.templates = dpi->templates;
- switch (peek_char (dm))
- {
- case 'L':
- advance_char (dm);
+ d_print_comp (dpi, d_right (dc));
- if (peek_char (dm) == 'Z')
+ /* If the modifier didn't get printed by the type, print it
+ now. */
+ if (! dpm.printed)
+ {
+ d_append_char (dpi, ' ');
+ d_print_comp (dpi, d_left (dc));
+ d_append_string_constant (dpi, "::*");
+ }
+
+ dpi->modifiers = dpm.next;
+
+ return;
+ }
+
+ case DEMANGLE_COMPONENT_ARGLIST:
+ case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
+ d_print_comp (dpi, d_left (dc));
+ if (d_right (dc) != NULL)
{
- /* External name. */
- advance_char (dm);
- /* FIXME: Standard is contradictory here. */
- RETURN_IF_ERROR (demangle_encoding (dm));
+ d_append_string_constant (dpi, ", ");
+ d_print_comp (dpi, d_right (dc));
}
+ return;
+
+ case DEMANGLE_COMPONENT_OPERATOR:
+ {
+ char c;
+
+ d_append_string_constant (dpi, "operator");
+ c = dc->u.s_operator.op->name[0];
+ if (IS_LOWER (c))
+ d_append_char (dpi, ' ');
+ d_append_buffer (dpi, dc->u.s_operator.op->name,
+ dc->u.s_operator.op->len);
+ return;
+ }
+
+ case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
+ d_append_string_constant (dpi, "operator ");
+ d_print_comp (dpi, dc->u.s_extended_operator.name);
+ return;
+
+ case DEMANGLE_COMPONENT_CAST:
+ d_append_string_constant (dpi, "operator ");
+ d_print_cast (dpi, dc);
+ return;
+
+ case DEMANGLE_COMPONENT_UNARY:
+ if (d_left (dc)->type != DEMANGLE_COMPONENT_CAST)
+ d_print_expr_op (dpi, d_left (dc));
else
- RETURN_IF_ERROR (demangle_literal (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- break;
+ {
+ d_append_string_constant (dpi, "((");
+ d_print_cast (dpi, d_left (dc));
+ d_append_char (dpi, ')');
+ }
+ d_append_char (dpi, '(');
+ d_print_comp (dpi, d_right (dc));
+ d_append_char (dpi, ')');
+ if (d_left (dc)->type == DEMANGLE_COMPONENT_CAST)
+ d_append_char (dpi, ')');
+ return;
+
+ case DEMANGLE_COMPONENT_BINARY:
+ if (d_right (dc)->type != DEMANGLE_COMPONENT_BINARY_ARGS)
+ {
+ d_print_error (dpi);
+ return;
+ }
- case 'X':
- /* Expression. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- break;
+ /* We wrap an expression which uses the greater-than operator in
+ an extra layer of parens so that it does not get confused
+ with the '>' which ends the template parameters. */
+ if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR
+ && d_left (dc)->u.s_operator.op->len == 1
+ && d_left (dc)->u.s_operator.op->name[0] == '>')
+ d_append_char (dpi, '(');
+
+ d_append_char (dpi, '(');
+ d_print_comp (dpi, d_left (d_right (dc)));
+ d_append_string_constant (dpi, ") ");
+ d_print_expr_op (dpi, d_left (dc));
+ d_append_string_constant (dpi, " (");
+ d_print_comp (dpi, d_right (d_right (dc)));
+ d_append_char (dpi, ')');
+
+ if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR
+ && d_left (dc)->u.s_operator.op->len == 1
+ && d_left (dc)->u.s_operator.op->name[0] == '>')
+ d_append_char (dpi, ')');
+
+ return;
+
+ case DEMANGLE_COMPONENT_BINARY_ARGS:
+ /* We should only see this as part of DEMANGLE_COMPONENT_BINARY. */
+ d_print_error (dpi);
+ return;
+
+ case DEMANGLE_COMPONENT_TRINARY:
+ if (d_right (dc)->type != DEMANGLE_COMPONENT_TRINARY_ARG1
+ || d_right (d_right (dc))->type != DEMANGLE_COMPONENT_TRINARY_ARG2)
+ {
+ d_print_error (dpi);
+ return;
+ }
+ d_append_char (dpi, '(');
+ d_print_comp (dpi, d_left (d_right (dc)));
+ d_append_string_constant (dpi, ") ");
+ d_print_expr_op (dpi, d_left (dc));
+ d_append_string_constant (dpi, " (");
+ d_print_comp (dpi, d_left (d_right (d_right (dc))));
+ d_append_string_constant (dpi, ") : (");
+ d_print_comp (dpi, d_right (d_right (d_right (dc))));
+ d_append_char (dpi, ')');
+ return;
+
+ case DEMANGLE_COMPONENT_TRINARY_ARG1:
+ case DEMANGLE_COMPONENT_TRINARY_ARG2:
+ /* We should only see these are part of DEMANGLE_COMPONENT_TRINARY. */
+ d_print_error (dpi);
+ return;
+
+ case DEMANGLE_COMPONENT_LITERAL:
+ case DEMANGLE_COMPONENT_LITERAL_NEG:
+ /* For some builtin types, produce simpler output. */
+ if (d_left (dc)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE)
+ {
+ switch (d_left (dc)->u.s_builtin.type->print)
+ {
+ case D_PRINT_INT:
+ if (d_right (dc)->type == DEMANGLE_COMPONENT_NAME)
+ {
+ if (dc->type == DEMANGLE_COMPONENT_LITERAL_NEG)
+ d_append_char (dpi, '-');
+ d_print_comp (dpi, d_right (dc));
+ return;
+ }
+ break;
+
+ case D_PRINT_LONG:
+ if (d_right (dc)->type == DEMANGLE_COMPONENT_NAME)
+ {
+ if (dc->type == DEMANGLE_COMPONENT_LITERAL_NEG)
+ d_append_char (dpi, '-');
+ d_print_comp (dpi, d_right (dc));
+ d_append_char (dpi, 'l');
+ return;
+ }
+ break;
+
+ case D_PRINT_BOOL:
+ if (d_right (dc)->type == DEMANGLE_COMPONENT_NAME
+ && d_right (dc)->u.s_name.len == 1
+ && dc->type == DEMANGLE_COMPONENT_LITERAL)
+ {
+ switch (d_right (dc)->u.s_name.s[0])
+ {
+ case '0':
+ d_append_string_constant (dpi, "false");
+ return;
+ case '1':
+ d_append_string_constant (dpi, "true");
+ return;
+ default:
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ d_append_char (dpi, '(');
+ d_print_comp (dpi, d_left (dc));
+ d_append_char (dpi, ')');
+ if (dc->type == DEMANGLE_COMPONENT_LITERAL_NEG)
+ d_append_char (dpi, '-');
+ d_print_comp (dpi, d_right (dc));
+ return;
default:
- RETURN_IF_ERROR (demangle_type (dm));
- break;
+ d_print_error (dpi);
+ return;
}
-
- return STATUS_OK;
}
-/* Demangles and emits an <expression>.
+/* Print a Java dentifier. For Java we try to handle encoded extended
+ Unicode characters. The C++ ABI doesn't mention Unicode encoding,
+ so we don't it for C++. Characters are encoded as
+ __U<hex-char>+_. */
- <expression> ::= <unary operator-name> <expression>
- ::= <binary operator-name> <expression> <expression>
- ::= <expr-primary>
- ::= <scope-expression> */
-
-static status_t
-demangle_expression (dm)
- demangling_t dm;
+static void
+d_print_java_identifier (dpi, name, len)
+ struct d_print_info *dpi;
+ const char *name;
+ int len;
{
- char peek = peek_char (dm);
-
- DEMANGLE_TRACE ("expression", dm);
+ const char *p;
+ const char *end;
- if (peek == 'L' || peek == 'T')
- RETURN_IF_ERROR (demangle_expr_primary (dm));
- else if (peek == 's' && peek_char_next (dm) == 'r')
- RETURN_IF_ERROR (demangle_scope_expression (dm));
- else
- /* An operator expression. */
+ end = name + len;
+ for (p = name; p < end; ++p)
{
- int num_args;
- int type_arg;
- status_t status = STATUS_OK;
- dyn_string_t operator_name;
-
- /* We have an operator name. Since we want to output binary
- operations in infix notation, capture the operator name
- first. */
- RETURN_IF_ERROR (result_push (dm));
- RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args,
- &type_arg));
- operator_name = (dyn_string_t) result_pop (dm);
-
- /* If it's binary, do an operand first. */
- if (num_args > 1)
+ if (end - p > 3
+ && p[0] == '_'
+ && p[1] == '_'
+ && p[2] == 'U')
{
- status = result_add_char (dm, '(');
- if (STATUS_NO_ERROR (status))
- status = demangle_expression (dm);
- if (STATUS_NO_ERROR (status))
- status = result_add_char (dm, ')');
- }
+ unsigned long c;
+ const char *q;
- /* Emit the operator. */
- if (STATUS_NO_ERROR (status))
- status = result_add_string (dm, operator_name);
- dyn_string_delete (operator_name);
- RETURN_IF_ERROR (status);
-
- /* Emit its second (if binary) or only (if unary) operand. */
- RETURN_IF_ERROR (result_add_char (dm, '('));
- if (type_arg)
- RETURN_IF_ERROR (demangle_type (dm));
- else
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
+ c = 0;
+ for (q = p + 3; q < end; ++q)
+ {
+ int dig;
+
+ if (IS_DIGIT (*q))
+ dig = *q - '0';
+ else if (*q >= 'A' && *q <= 'F')
+ dig = *q - 'A' + 10;
+ else if (*q >= 'a' && *q <= 'f')
+ dig = *q - 'a' + 10;
+ else
+ break;
- /* The ternary operator takes a third operand. */
- if (num_args == 3)
- {
- RETURN_IF_ERROR (result_add (dm, ":("));
- RETURN_IF_ERROR (demangle_expression (dm));
- RETURN_IF_ERROR (result_add_char (dm, ')'));
+ c = c * 16 + dig;
+ }
+ /* If the Unicode character is larger than 256, we don't try
+ to deal with it here. FIXME. */
+ if (q < end && *q == '_' && c < 256)
+ {
+ d_append_char (dpi, c);
+ p = q;
+ continue;
+ }
}
- }
- return STATUS_OK;
+ d_append_char (dpi, *p);
+ }
}
-/* Demangles and emits a <scope-expression>.
+/* Print a list of modifiers. SUFFIX is 1 if we are printing
+ qualifiers on this after printing a function. */
- <scope-expression> ::= sr <qualifying type> <source-name>
- ::= sr <qualifying type> <encoding> */
-
-static status_t
-demangle_scope_expression (dm)
- demangling_t dm;
+static void
+d_print_mod_list (dpi, mods, suffix)
+ struct d_print_info *dpi;
+ struct d_print_mod *mods;
+ int suffix;
{
- RETURN_IF_ERROR (demangle_char (dm, 's'));
- RETURN_IF_ERROR (demangle_char (dm, 'r'));
- RETURN_IF_ERROR (demangle_type (dm));
- RETURN_IF_ERROR (result_add (dm, "::"));
- RETURN_IF_ERROR (demangle_encoding (dm));
- return STATUS_OK;
-}
+ struct d_print_template *hold_dpt;
-/* Demangles and emits an <expr-primary>.
+ if (mods == NULL || d_print_saw_error (dpi))
+ return;
- <expr-primary> ::= <template-param>
- ::= L <type> <value number> E # literal
- ::= L <mangled-name> E # external name */
+ if (mods->printed
+ || (! suffix
+ && (mods->mod->type == DEMANGLE_COMPONENT_RESTRICT_THIS
+ || mods->mod->type == DEMANGLE_COMPONENT_VOLATILE_THIS
+ || mods->mod->type == DEMANGLE_COMPONENT_CONST_THIS)))
+ {
+ d_print_mod_list (dpi, mods->next, suffix);
+ return;
+ }
-static status_t
-demangle_expr_primary (dm)
- demangling_t dm;
-{
- char peek = peek_char (dm);
+ mods->printed = 1;
- DEMANGLE_TRACE ("expr-primary", dm);
+ hold_dpt = dpi->templates;
+ dpi->templates = mods->templates;
- if (peek == 'T')
- RETURN_IF_ERROR (demangle_template_param (dm));
- else if (peek == 'L')
+ if (mods->mod->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
+ {
+ d_print_function_type (dpi, mods->mod, mods->next);
+ dpi->templates = hold_dpt;
+ return;
+ }
+ else if (mods->mod->type == DEMANGLE_COMPONENT_ARRAY_TYPE)
+ {
+ d_print_array_type (dpi, mods->mod, mods->next);
+ dpi->templates = hold_dpt;
+ return;
+ }
+ else if (mods->mod->type == DEMANGLE_COMPONENT_LOCAL_NAME)
{
- /* Consume the `L'. */
- advance_char (dm);
- peek = peek_char (dm);
+ struct d_print_mod *hold_modifiers;
+ struct demangle_component *dc;
- if (peek == '_')
- RETURN_IF_ERROR (demangle_mangled_name (dm));
+ /* When this is on the modifier stack, we have pulled any
+ qualifiers off the right argument already. Otherwise, we
+ print it as usual, but don't let the left argument see any
+ modifiers. */
+
+ hold_modifiers = dpi->modifiers;
+ dpi->modifiers = NULL;
+ d_print_comp (dpi, d_left (mods->mod));
+ dpi->modifiers = hold_modifiers;
+
+ if ((dpi->options & DMGL_JAVA) == 0)
+ d_append_string_constant (dpi, "::");
else
- RETURN_IF_ERROR (demangle_literal (dm));
+ d_append_char (dpi, '.');
+
+ dc = d_right (mods->mod);
+ while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS
+ || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
+ || dc->type == DEMANGLE_COMPONENT_CONST_THIS)
+ dc = d_left (dc);
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
+ d_print_comp (dpi, dc);
+
+ dpi->templates = hold_dpt;
+ return;
}
- else
- return STATUS_ERROR;
- return STATUS_OK;
+ d_print_mod (dpi, mods->mod);
+
+ dpi->templates = hold_dpt;
+
+ d_print_mod_list (dpi, mods->next, suffix);
}
-/* Demangles and emits a <substitution>. Sets *TEMPLATE_P to non-zero
- if the substitution is the name of a template, zero otherwise.
-
- <substitution> ::= S <seq-id> _
- ::= S_
-
- ::= St # ::std::
- ::= Sa # ::std::allocator
- ::= Sb # ::std::basic_string
- ::= Ss # ::std::basic_string<char,
- ::std::char_traits<char>,
- ::std::allocator<char> >
- ::= Si # ::std::basic_istream<char,
- std::char_traits<char> >
- ::= So # ::std::basic_ostream<char,
- std::char_traits<char> >
- ::= Sd # ::std::basic_iostream<char,
- std::char_traits<char> >
-*/
+/* Print a modifier. */
-static status_t
-demangle_substitution (dm, template_p)
- demangling_t dm;
- int *template_p;
+static void
+d_print_mod (dpi, mod)
+ struct d_print_info *dpi;
+ const struct demangle_component *mod;
{
- int seq_id;
- int peek;
- dyn_string_t text;
-
- DEMANGLE_TRACE ("substitution", dm);
+ switch (mod->type)
+ {
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ d_append_string_constant (dpi, " restrict");
+ return;
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ d_append_string_constant (dpi, " volatile");
+ return;
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ d_append_string_constant (dpi, " const");
+ return;
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ d_append_char (dpi, ' ');
+ d_print_comp (dpi, d_right (mod));
+ return;
+ case DEMANGLE_COMPONENT_POINTER:
+ /* There is no pointer symbol in Java. */
+ if ((dpi->options & DMGL_JAVA) == 0)
+ d_append_char (dpi, '*');
+ return;
+ case DEMANGLE_COMPONENT_REFERENCE:
+ d_append_char (dpi, '&');
+ return;
+ case DEMANGLE_COMPONENT_COMPLEX:
+ d_append_string_constant (dpi, "complex ");
+ return;
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ d_append_string_constant (dpi, "imaginary ");
+ return;
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ if (d_last_char (dpi) != '(')
+ d_append_char (dpi, ' ');
+ d_print_comp (dpi, d_left (mod));
+ d_append_string_constant (dpi, "::*");
+ return;
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ d_print_comp (dpi, d_left (mod));
+ return;
+ default:
+ /* Otherwise, we have something that won't go back on the
+ modifier stack, so we can just print it. */
+ d_print_comp (dpi, mod);
+ return;
+ }
+}
- RETURN_IF_ERROR (demangle_char (dm, 'S'));
+/* Print a function type, except for the return type. */
- /* Scan the substitution sequence index. A missing number denotes
- the first index. */
- peek = peek_char (dm);
- if (peek == '_')
- seq_id = -1;
- /* If the following character is 0-9 or a capital letter, interpret
- the sequence up to the next underscore as a base-36 substitution
- index. */
- else if (IS_DIGIT ((unsigned char) peek)
- || (peek >= 'A' && peek <= 'Z'))
- RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0));
- else
+static void
+d_print_function_type (dpi, dc, mods)
+ struct d_print_info *dpi;
+ const struct demangle_component *dc;
+ struct d_print_mod *mods;
+{
+ int need_paren;
+ int saw_mod;
+ struct d_print_mod *p;
+ struct d_print_mod *hold_modifiers;
+
+ need_paren = 0;
+ saw_mod = 0;
+ for (p = mods; p != NULL; p = p->next)
{
- const char *new_last_source_name = NULL;
+ if (p->printed)
+ break;
- switch (peek)
+ saw_mod = 1;
+ switch (p->mod->type)
{
- case 't':
- RETURN_IF_ERROR (result_add (dm, "std"));
- break;
-
- case 'a':
- RETURN_IF_ERROR (result_add (dm, "std::allocator"));
- new_last_source_name = "allocator";
- *template_p = 1;
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_POINTER:
+ case DEMANGLE_COMPONENT_REFERENCE:
+ case DEMANGLE_COMPONENT_COMPLEX:
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ need_paren = 1;
break;
-
- case 'b':
- RETURN_IF_ERROR (result_add (dm, "std::basic_string"));
- new_last_source_name = "basic_string";
- *template_p = 1;
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
break;
-
- case 's':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::string"));
- new_last_source_name = "string";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"));
- new_last_source_name = "basic_string";
- }
- *template_p = 0;
+ default:
break;
+ }
+ if (need_paren)
+ break;
+ }
- case 'i':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::istream"));
- new_last_source_name = "istream";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_istream<char, std::char_traints<char> >"));
- new_last_source_name = "basic_istream";
- }
- *template_p = 0;
+ if (d_left (dc) != NULL && ! saw_mod)
+ need_paren = 1;
+
+ if (need_paren)
+ {
+ switch (d_last_char (dpi))
+ {
+ case ' ':
+ case '(':
+ case '*':
break;
- case 'o':
- if (!flag_verbose)
- {
- RETURN_IF_ERROR (result_add (dm, "std::ostream"));
- new_last_source_name = "ostream";
- }
- else
- {
- RETURN_IF_ERROR (result_add (dm, "std::basic_ostream<char, std::char_traits<char> >"));
- new_last_source_name = "basic_ostream";
- }
- *template_p = 0;
+ default:
+ d_append_char (dpi, ' ');
break;
+ }
+
+ d_append_char (dpi, '(');
+ }
+
+ hold_modifiers = dpi->modifiers;
+ dpi->modifiers = NULL;
- case 'd':
- if (!flag_verbose)
+ d_print_mod_list (dpi, mods, 0);
+
+ if (need_paren)
+ d_append_char (dpi, ')');
+
+ d_append_char (dpi, '(');
+
+ if (d_right (dc) != NULL)
+ d_print_comp (dpi, d_right (dc));
+
+ d_append_char (dpi, ')');
+
+ d_print_mod_list (dpi, mods, 1);
+
+ dpi->modifiers = hold_modifiers;
+}
+
+/* Print an array type, except for the element type. */
+
+static void
+d_print_array_type (dpi, dc, mods)
+ struct d_print_info *dpi;
+ const struct demangle_component *dc;
+ struct d_print_mod *mods;
+{
+ int need_space;
+
+ need_space = 1;
+ if (mods != NULL)
+ {
+ int need_paren;
+ struct d_print_mod *p;
+
+ need_paren = 0;
+ for (p = mods; p != NULL; p = p->next)
+ {
+ if (p->printed)
+ break;
+
+ if (p->mod->type == DEMANGLE_COMPONENT_ARRAY_TYPE)
{
- RETURN_IF_ERROR (result_add (dm, "std::iostream"));
- new_last_source_name = "iostream";
+ need_space = 0;
+ break;
}
else
{
- RETURN_IF_ERROR (result_add (dm, "std::basic_iostream<char, std::char_traits<char> >"));
- new_last_source_name = "basic_iostream";
+ need_paren = 1;
+ need_space = 1;
+ break;
}
- *template_p = 0;
- break;
-
- default:
- return "Unrecognized <substitution>.";
}
-
- /* Consume the character we just processed. */
- advance_char (dm);
- if (new_last_source_name != NULL)
- {
- if (!dyn_string_copy_cstr (dm->last_source_name,
- new_last_source_name))
- return STATUS_ALLOCATION_FAILED;
- }
+ if (need_paren)
+ d_append_string_constant (dpi, " (");
+
+ d_print_mod_list (dpi, mods, 0);
- return STATUS_OK;
+ if (need_paren)
+ d_append_char (dpi, ')');
}
- /* Look up the substitution text. Since `S_' is the most recent
- substitution, `S0_' is the second-most-recent, etc., shift the
- numbering by one. */
- text = substitution_get (dm, seq_id + 1, template_p);
- if (text == NULL)
- return "Substitution number out of range.";
+ if (need_space)
+ d_append_char (dpi, ' ');
- /* Emit the substitution text. */
- RETURN_IF_ERROR (result_add_string (dm, text));
+ d_append_char (dpi, '[');
- RETURN_IF_ERROR (demangle_char (dm, '_'));
- return STATUS_OK;
-}
+ if (d_left (dc) != NULL)
+ d_print_comp (dpi, d_left (dc));
-/* Demangles and emits a <local-name>.
+ d_append_char (dpi, ']');
+}
- <local-name> := Z <function encoding> E <entity name> [<discriminator>]
- := Z <function encoding> E s [<discriminator>] */
+/* Print an operator in an expression. */
-static status_t
-demangle_local_name (dm)
- demangling_t dm;
+static void
+d_print_expr_op (dpi, dc)
+ struct d_print_info *dpi;
+ const struct demangle_component *dc;
{
- DEMANGLE_TRACE ("local-name", dm);
+ if (dc->type == DEMANGLE_COMPONENT_OPERATOR)
+ d_append_buffer (dpi, dc->u.s_operator.op->name,
+ dc->u.s_operator.op->len);
+ else
+ d_print_comp (dpi, dc);
+}
- RETURN_IF_ERROR (demangle_char (dm, 'Z'));
- RETURN_IF_ERROR (demangle_encoding (dm));
- RETURN_IF_ERROR (demangle_char (dm, 'E'));
- RETURN_IF_ERROR (result_add (dm, "::"));
+/* Print a cast. */
- if (peek_char (dm) == 's')
- {
- /* Local character string literal. */
- RETURN_IF_ERROR (result_add (dm, "string literal"));
- /* Consume the s. */
- advance_char (dm);
- RETURN_IF_ERROR (demangle_discriminator (dm, 0));
- }
+static void
+d_print_cast (dpi, dc)
+ struct d_print_info *dpi;
+ const struct demangle_component *dc;
+{
+ if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE)
+ d_print_comp (dpi, d_left (dc));
else
{
- int unused;
- /* Local name for some other entity. Demangle its name. */
- RETURN_IF_ERROR (demangle_name (dm, &unused));
- RETURN_IF_ERROR (demangle_discriminator (dm, 1));
- }
-
- return STATUS_OK;
- }
-
- /* Optimonally demangles and emits a <discriminator>. If there is no
- <discriminator> at the current position in the mangled string, the
- descriminator is assumed to be zero. Emit the discriminator number
- in parentheses, unless SUPPRESS_FIRST is non-zero and the
- discriminator is zero.
-
- <discriminator> ::= _ <number> */
-
-static status_t
-demangle_discriminator (dm, suppress_first)
- demangling_t dm;
- int suppress_first;
-{
- /* Output for <discriminator>s to the demangled name is completely
- suppressed if not in verbose mode. */
+ struct d_print_mod *hold_dpm;
+ struct d_print_template dpt;
- if (peek_char (dm) == '_')
- {
- /* Consume the underscore. */
- advance_char (dm);
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [#"));
- /* Check if there's a number following the underscore. */
- if (IS_DIGIT ((unsigned char) peek_char (dm)))
- {
- int discriminator;
- /* Demangle the number. */
- RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0));
- if (flag_verbose)
- /* Write the discriminator. The mangled number is two
- less than the discriminator ordinal, counting from
- zero. */
- RETURN_IF_ERROR (int_to_dyn_string (discriminator + 1,
- (dyn_string_t) dm->result));
- }
- else
- return STATUS_ERROR;
- if (flag_verbose)
- RETURN_IF_ERROR (result_add_char (dm, ']'));
- }
- else if (!suppress_first)
- {
- if (flag_verbose)
- RETURN_IF_ERROR (result_add (dm, " [#0]"));
+ /* It appears that for a templated cast operator, we need to put
+ the template parameters in scope for the operator name, but
+ not for the parameters. The effect is that we need to handle
+ the template printing here. */
+
+ hold_dpm = dpi->modifiers;
+ dpi->modifiers = NULL;
+
+ dpt.next = dpi->templates;
+ dpi->templates = &dpt;
+ dpt.template = d_left (dc);
+
+ d_print_comp (dpi, d_left (d_left (dc)));
+
+ dpi->templates = dpt.next;
+
+ if (d_last_char (dpi) == '<')
+ d_append_char (dpi, ' ');
+ d_append_char (dpi, '<');
+ d_print_comp (dpi, d_right (d_left (dc)));
+ /* Avoid generating two consecutive '>' characters, to avoid
+ the C++ syntactic ambiguity. */
+ if (d_last_char (dpi) == '>')
+ d_append_char (dpi, ' ');
+ d_append_char (dpi, '>');
+
+ dpi->modifiers = hold_dpm;
}
+}
+
+/* Initialize the information structure we use to pass around
+ information. */
- return STATUS_OK;
+CP_STATIC_IF_GLIBCPP_V3
+void
+cplus_demangle_init_info (mangled, options, len, di)
+ const char *mangled;
+ int options;
+ size_t len;
+ struct d_info *di;
+{
+ di->s = mangled;
+ di->send = mangled + len;
+ di->options = options;
+
+ di->n = mangled;
+
+ /* We can not need more components than twice the number of chars in
+ the mangled string. Most components correspond directly to
+ chars, but the ARGLIST types are exceptions. */
+ di->num_comps = 2 * len;
+ di->next_comp = 0;
+
+ /* Similarly, we can not need more substitutions than there are
+ chars in the mangled string. */
+ di->num_subs = len;
+ di->next_sub = 0;
+ di->did_subs = 0;
+
+ di->last_name = NULL;
+
+ di->expansion = 0;
}
-/* Demangle NAME into RESULT, which must be an initialized
- dyn_string_t. On success, returns STATUS_OK. On failure, returns
- an error message, and the contents of RESULT are unchanged. */
+/* Entry point for the demangler. If MANGLED is a g++ v3 ABI mangled
+ name, return a buffer allocated with malloc holding the demangled
+ name. OPTIONS is the usual libiberty demangler options. On
+ success, this sets *PALC to the allocated size of the returned
+ buffer. On failure, this sets *PALC to 0 for a bad name, or 1 for
+ a memory allocation failure. On failure, this returns NULL. */
-static status_t
-cp_demangle (name, result, style)
- const char *name;
- dyn_string_t result;
- int style;
+static char *
+d_demangle (mangled, options, palc)
+ const char* mangled;
+ int options;
+ size_t *palc;
{
- status_t status;
- int length = strlen (name);
+ size_t len;
+ int type;
+ struct d_info di;
+ struct demangle_component *dc;
+ int estimate;
+ char *ret;
- if (length > 2 && name[0] == '_' && name[1] == 'Z')
- {
- demangling_t dm = demangling_new (name, style);
- if (dm == NULL)
- return STATUS_ALLOCATION_FAILED;
+ *palc = 0;
- status = result_push (dm);
- if (status != STATUS_OK)
- {
- demangling_delete (dm);
- return status;
- }
+ len = strlen (mangled);
+
+ if (mangled[0] == '_' && mangled[1] == 'Z')
+ type = 0;
+ else if (strncmp (mangled, "_GLOBAL_", 8) == 0
+ && (mangled[8] == '.' || mangled[8] == '_' || mangled[8] == '$')
+ && (mangled[9] == 'D' || mangled[9] == 'I')
+ && mangled[10] == '_')
+ {
+ char *r;
- status = demangle_mangled_name (dm);
- if (STATUS_NO_ERROR (status))
+ r = malloc (40 + len - 11);
+ if (r == NULL)
+ *palc = 1;
+ else
{
- dyn_string_t demangled = (dyn_string_t) result_pop (dm);
- if (!dyn_string_copy (result, demangled))
- return STATUS_ALLOCATION_FAILED;
- dyn_string_delete (demangled);
+ if (mangled[9] == 'I')
+ strcpy (r, "global constructors keyed to ");
+ else
+ strcpy (r, "global destructors keyed to ");
+ strcat (r, mangled + 11);
}
-
- demangling_delete (dm);
+ return r;
}
else
{
- /* It's evidently not a mangled C++ name. It could be the name
- of something with C linkage, though, so just copy NAME into
- RESULT. */
- if (!dyn_string_copy_cstr (result, name))
- return STATUS_ALLOCATION_FAILED;
- status = STATUS_OK;
+ if ((options & DMGL_TYPES) == 0)
+ return NULL;
+ type = 1;
}
- return status;
-}
+ cplus_demangle_init_info (mangled, options, len, &di);
-/* Demangle TYPE_NAME into RESULT, which must be an initialized
- dyn_string_t. On success, returns STATUS_OK. On failiure, returns
- an error message, and the contents of RESULT are unchanged. */
+ {
+#ifdef CP_DYNAMIC_ARRAYS
+ __extension__ struct demangle_component comps[di.num_comps];
+ __extension__ struct demangle_component *subs[di.num_subs];
-static status_t
-cp_demangle_type (type_name, result)
- const char* type_name;
- dyn_string_t result;
-{
- status_t status;
- demangling_t dm = demangling_new (type_name, DMGL_GNU_V3);
-
- if (dm == NULL)
- return STATUS_ALLOCATION_FAILED;
-
- /* Demangle the type name. The demangled name is stored in dm. */
- status = result_push (dm);
- if (status != STATUS_OK)
- {
- demangling_delete (dm);
- return status;
- }
+ di.comps = &comps[0];
+ di.subs = &subs[0];
+#else
+ di.comps = ((struct demangle_component *)
+ malloc (di.num_comps * sizeof (struct demangle_component)));
+ di.subs = ((struct demangle_component **)
+ malloc (di.num_subs * sizeof (struct demangle_component *)));
+ if (di.comps == NULL || di.subs == NULL)
+ {
+ if (di.comps != NULL)
+ free (di.comps);
+ if (di.subs != NULL)
+ free (di.subs);
+ *palc = 1;
+ return NULL;
+ }
+#endif
- status = demangle_type (dm);
+ if (! type)
+ dc = cplus_demangle_mangled_name (&di, 1);
+ else
+ dc = cplus_demangle_type (&di);
- if (STATUS_NO_ERROR (status))
- {
- /* The demangling succeeded. Pop the result out of dm and copy
- it into RESULT. */
- dyn_string_t demangled = (dyn_string_t) result_pop (dm);
- if (!dyn_string_copy (result, demangled))
- return STATUS_ALLOCATION_FAILED;
- dyn_string_delete (demangled);
- }
+ /* If DMGL_PARAMS is set, then if we didn't consume the entire
+ mangled string, then we didn't successfully demangle it. If
+ DMGL_PARAMS is not set, we didn't look at the trailing
+ parameters. */
+ if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0')
+ dc = NULL;
+
+#ifdef CP_DEMANGLE_DEBUG
+ if (dc == NULL)
+ printf ("failed demangling\n");
+ else
+ d_dump (dc, 0);
+#endif
+
+ /* We try to guess the length of the demangled string, to minimize
+ calls to realloc during demangling. */
+ estimate = len + di.expansion + 10 * di.did_subs;
+ estimate += estimate / 8;
+
+ ret = NULL;
+ if (dc != NULL)
+ ret = cplus_demangle_print (options, dc, estimate, palc);
+
+#ifndef CP_DYNAMIC_ARRAYS
+ free (di.comps);
+ free (di.subs);
+#endif
- /* Clean up. */
- demangling_delete (dm);
+#ifdef CP_DEMANGLE_DEBUG
+ if (ret != NULL)
+ {
+ int rlen;
+
+ rlen = strlen (ret);
+ if (rlen > 2 * estimate)
+ printf ("*** Length %d much greater than estimate %d\n",
+ rlen, estimate);
+ else if (rlen > estimate)
+ printf ("*** Length %d greater than estimate %d\n",
+ rlen, estimate);
+ else if (rlen < estimate / 2)
+ printf ("*** Length %d much less than estimate %d\n",
+ rlen, estimate);
+ }
+#endif
+ }
- return status;
+ return ret;
}
#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
+
extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
-/* ia64 ABI-mandated entry point in the C++ runtime library for performing
- demangling. MANGLED_NAME is a NUL-terminated character string
- containing the name to be demangled.
+/* ia64 ABI-mandated entry point in the C++ runtime library for
+ performing demangling. MANGLED_NAME is a NUL-terminated character
+ string containing the name to be demangled.
OUTPUT_BUFFER is a region of memory, allocated with malloc, of
*LENGTH bytes, into which the demangled name is stored. If
OUTPUT_BUFFER is not long enough, it is expanded using realloc.
OUTPUT_BUFFER may instead be NULL; in that case, the demangled name
- is placed in a region of memory allocated with malloc.
+ is placed in a region of memory allocated with malloc.
If LENGTH is non-NULL, the length of the buffer conaining the
- demangled name, is placed in *LENGTH.
+ demangled name, is placed in *LENGTH.
The return value is a pointer to the start of the NUL-terminated
demangled name, or NULL if the demangling fails. The caller is
- responsible for deallocating this memory using free.
+ responsible for deallocating this memory using free.
*STATUS is set to one of the following values:
0: The demangling operation succeeded.
- -1: A memory allocation failiure occurred.
+ -1: A memory allocation failure occurred.
-2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules.
-3: One of the arguments is invalid.
- The demagling is performed using the C++ ABI mangling rules, with
+ The demangling is performed using the C++ ABI mangling rules, with
GNU extensions. */
char *
@@ -3674,137 +3941,74 @@ __cxa_demangle (mangled_name, output_buffer, length, status)
size_t *length;
int *status;
{
- struct dyn_string demangled_name;
- status_t result;
+ char *demangled;
+ size_t alc;
if (status == NULL)
return NULL;
- if (mangled_name == NULL) {
- *status = -3;
- return NULL;
- }
+ if (mangled_name == NULL)
+ {
+ *status = -3;
+ return NULL;
+ }
- /* Did the caller provide a buffer for the demangled name? */
- if (output_buffer == NULL) {
- /* No; dyn_string will malloc a buffer for us. */
- if (!dyn_string_init (&demangled_name, 0))
- {
- *status = -1;
- return NULL;
- }
- }
- else {
- /* Yes. Check that the length was provided. */
- if (length == NULL) {
+ if (output_buffer != NULL && length == NULL)
+ {
*status = -3;
return NULL;
}
- /* Install the buffer into a dyn_string. */
- demangled_name.allocated = *length;
- demangled_name.length = 0;
- demangled_name.s = output_buffer;
- }
- if (mangled_name[0] == '_' && mangled_name[1] == 'Z')
- /* MANGLED_NAME apprears to be a function or variable name.
- Demangle it accordingly. */
- result = cp_demangle (mangled_name, &demangled_name, 0);
- else
- /* Try to demangled MANGLED_NAME as the name of a type. */
- result = cp_demangle_type (mangled_name, &demangled_name);
+ demangled = d_demangle (mangled_name, DMGL_TYPES, &alc);
- if (result == STATUS_OK)
- /* The demangling succeeded. */
+ if (demangled == NULL)
{
- /* If LENGTH isn't NULL, store the allocated buffer length
- there; the buffer may have been realloced by dyn_string
- functions. */
- if (length != NULL)
- *length = demangled_name.allocated;
- /* The operation was a success. */
- *status = 0;
- return dyn_string_buf (&demangled_name);
+ if (alc == 1)
+ *status = -1;
+ else
+ *status = -2;
+ return NULL;
}
- else if (result == STATUS_ALLOCATION_FAILED)
- /* A call to malloc or realloc failed during the demangling
- operation. */
+
+ if (output_buffer == NULL)
{
- *status = -1;
- return NULL;
+ if (length != NULL)
+ *length = alc;
}
else
- /* The demangling failed for another reason, most probably because
- MANGLED_NAME isn't a valid mangled name. */
{
- /* If the buffer containing the demangled name wasn't provided
- by the caller, free it. */
- if (output_buffer == NULL)
- free (dyn_string_buf (&demangled_name));
- *status = -2;
- return NULL;
+ if (strlen (demangled) < *length)
+ {
+ strcpy (output_buffer, demangled);
+ free (demangled);
+ demangled = output_buffer;
+ }
+ else
+ {
+ free (output_buffer);
+ *length = alc;
+ }
}
+
+ *status = 0;
+
+ return demangled;
}
#else /* ! (IN_LIBGCC2 || IN_GLIBCPP_V3) */
-/* Variant entry point for integration with the existing cplus-dem
- demangler. Attempts to demangle MANGLED. If the demangling
- succeeds, returns a buffer, allocated with malloc, containing the
- demangled name. The caller must deallocate the buffer using free.
- If the demangling failes, returns NULL. */
+/* Entry point for libiberty demangler. If MANGLED is a g++ v3 ABI
+ mangled name, return a buffer allocated with malloc holding the
+ demangled name. Otherwise, return NULL. */
char *
cplus_demangle_v3 (mangled, options)
const char* mangled;
int options;
{
- dyn_string_t demangled;
- status_t status;
- int type = !!(options & DMGL_TYPES);
-
- if (mangled[0] == '_' && mangled[1] == 'Z')
- /* It is not a type. */
- type = 0;
- else
- {
- /* It is a type. Stop if we don't want to demangle types. */
- if (!type)
- return NULL;
- }
-
- flag_verbose = !!(options & DMGL_VERBOSE);
+ size_t alc;
- /* Create a dyn_string to hold the demangled name. */
- demangled = dyn_string_new (0);
- /* Attempt the demangling. */
- if (!type)
- /* Appears to be a function or variable name. */
- status = cp_demangle (mangled, demangled, 0);
- else
- /* Try to demangle it as the name of a type. */
- status = cp_demangle_type (mangled, demangled);
-
- if (STATUS_NO_ERROR (status))
- /* Demangling succeeded. */
- {
- /* Grab the demangled result from the dyn_string. It was
- allocated with malloc, so we can return it directly. */
- char *return_value = dyn_string_release (demangled);
- /* Hand back the demangled name. */
- return return_value;
- }
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- else
- /* Demangling failed. */
- {
- dyn_string_delete (demangled);
- return NULL;
- }
+ return d_demangle (mangled, options, &alc);
}
/* Demangle a Java symbol. Java uses a subset of the V3 ABI C++ mangling
@@ -3818,195 +4022,179 @@ char *
java_demangle_v3 (mangled)
const char* mangled;
{
- dyn_string_t demangled;
- char *next;
- char *end;
- int len;
- status_t status;
- int nesting = 0;
- char *cplus_demangled;
- char *return_value;
-
- /* Create a dyn_string to hold the demangled name. */
- demangled = dyn_string_new (0);
-
- /* Attempt the demangling. */
- status = cp_demangle ((char *) mangled, demangled, DMGL_JAVA);
-
- if (STATUS_NO_ERROR (status))
- /* Demangling succeeded. */
- {
- /* Grab the demangled result from the dyn_string. */
- cplus_demangled = dyn_string_release (demangled);
- }
- else if (status == STATUS_ALLOCATION_FAILED)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
- else
- /* Demangling failed. */
- {
- dyn_string_delete (demangled);
- return NULL;
- }
-
- len = strlen (cplus_demangled);
- next = cplus_demangled;
- end = next + len;
- demangled = NULL;
-
- /* Replace occurances of JArray<TYPE> with TYPE[]. */
- while (next < end)
+ size_t alc;
+ char *demangled;
+ int nesting;
+ char *from;
+ char *to;
+
+ demangled = d_demangle (mangled, DMGL_JAVA | DMGL_PARAMS, &alc);
+
+ if (demangled == NULL)
+ return NULL;
+
+ nesting = 0;
+ from = demangled;
+ to = from;
+ while (*from != '\0')
{
- char *open_str = strstr (next, "JArray<");
- char *close_str = NULL;
- if (nesting > 0)
- close_str = strchr (next, '>');
-
- if (open_str != NULL && (close_str == NULL || close_str > open_str))
- {
+ if (strncmp (from, "JArray<", 7) == 0)
+ {
+ from += 7;
++nesting;
-
- if (!demangled)
- demangled = dyn_string_new(len);
-
- /* Copy prepending symbols, if any. */
- if (open_str > next)
- {
- open_str[0] = 0;
- dyn_string_append_cstr (demangled, next);
- }
- next = open_str + 7;
}
- else if (close_str != NULL)
- {
+ else if (nesting > 0 && *from == '>')
+ {
+ while (to > demangled && to[-1] == ' ')
+ --to;
+ *to++ = '[';
+ *to++ = ']';
--nesting;
-
- /* Copy prepending type symbol, if any. Squash any spurious
- whitespace. */
- if (close_str > next && next[0] != ' ')
- {
- close_str[0] = 0;
- dyn_string_append_cstr (demangled, next);
- }
- dyn_string_append_cstr (demangled, "[]");
- next = close_str + 1;
+ ++from;
}
else
- {
- /* There are no more arrays. Copy the rest of the symbol, or
- simply return the original symbol if no changes were made. */
- if (next == cplus_demangled)
- return cplus_demangled;
-
- dyn_string_append_cstr (demangled, next);
- next = end;
- }
+ *to++ = *from++;
}
- free (cplus_demangled);
-
- if (demangled)
- return_value = dyn_string_release (demangled);
- else
- return_value = NULL;
+ *to = '\0';
- return return_value;
+ return demangled;
}
#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */
-
#ifndef IN_GLIBCPP_V3
-/* Demangle NAME in the G++ V3 ABI demangling style, and return either
- zero, indicating that some error occurred, or a demangling_t
- holding the results. */
-static demangling_t
-demangle_v3_with_details (name)
- const char *name;
+
+/* Demangle a string in order to find out whether it is a constructor
+ or destructor. Return non-zero on success. Set *CTOR_KIND and
+ *DTOR_KIND appropriately. */
+
+static int
+is_ctor_or_dtor (mangled, ctor_kind, dtor_kind)
+ const char *mangled;
+ enum gnu_v3_ctor_kinds *ctor_kind;
+ enum gnu_v3_dtor_kinds *dtor_kind;
{
- demangling_t dm;
- status_t status;
+ struct d_info di;
+ struct demangle_component *dc;
+ int ret;
- if (strncmp (name, "_Z", 2))
- return 0;
+ *ctor_kind = (enum gnu_v3_ctor_kinds) 0;
+ *dtor_kind = (enum gnu_v3_dtor_kinds) 0;
- dm = demangling_new (name, DMGL_GNU_V3);
- if (dm == NULL)
- {
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
- }
+ cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di);
- status = result_push (dm);
- if (! STATUS_NO_ERROR (status))
- {
- demangling_delete (dm);
- fprintf (stderr, "%s\n", status);
- abort ();
- }
+ {
+#ifdef CP_DYNAMIC_ARRAYS
+ __extension__ struct demangle_component comps[di.num_comps];
+ __extension__ struct demangle_component *subs[di.num_subs];
- status = demangle_mangled_name (dm);
- if (STATUS_NO_ERROR (status))
- return dm;
+ di.comps = &comps[0];
+ di.subs = &subs[0];
+#else
+ di.comps = ((struct demangle_component *)
+ malloc (di.num_comps * sizeof (struct demangle_component)));
+ di.subs = ((struct demangle_component **)
+ malloc (di.num_subs * sizeof (struct demangle_component *)));
+ if (di.comps == NULL || di.subs == NULL)
+ {
+ if (di.comps != NULL)
+ free (di.comps);
+ if (di.subs != NULL)
+ free (di.subs);
+ return 0;
+ }
+#endif
- demangling_delete (dm);
- return 0;
+ dc = cplus_demangle_mangled_name (&di, 1);
+
+ /* Note that because we did not pass DMGL_PARAMS, we don't expect
+ to demangle the entire string. */
+
+ ret = 0;
+ while (dc != NULL)
+ {
+ switch (dc->type)
+ {
+ default:
+ dc = NULL;
+ break;
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ dc = d_left (dc);
+ break;
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ dc = d_right (dc);
+ break;
+ case DEMANGLE_COMPONENT_CTOR:
+ *ctor_kind = dc->u.s_ctor.kind;
+ ret = 1;
+ dc = NULL;
+ break;
+ case DEMANGLE_COMPONENT_DTOR:
+ *dtor_kind = dc->u.s_dtor.kind;
+ ret = 1;
+ dc = NULL;
+ break;
+ }
+ }
+
+#ifndef CP_DYNAMIC_ARRAYS
+ free (di.subs);
+ free (di.comps);
+#endif
+ }
+
+ return ret;
}
+/* Return whether NAME is the mangled form of a g++ V3 ABI constructor
+ name. A non-zero return indicates the type of constructor. */
-/* Return non-zero iff NAME is the mangled form of a constructor name
- in the G++ V3 ABI demangling style. Specifically, return:
- - '1' if NAME is a complete object constructor,
- - '2' if NAME is a base object constructor, or
- - '3' if NAME is a complete object allocating constructor. */
enum gnu_v3_ctor_kinds
is_gnu_v3_mangled_ctor (name)
const char *name;
{
- demangling_t dm = demangle_v3_with_details (name);
+ enum gnu_v3_ctor_kinds ctor_kind;
+ enum gnu_v3_dtor_kinds dtor_kind;
- if (dm)
- {
- enum gnu_v3_ctor_kinds result = dm->is_constructor;
- demangling_delete (dm);
- return result;
- }
- else
- return 0;
+ if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind))
+ return (enum gnu_v3_ctor_kinds) 0;
+ return ctor_kind;
}
-/* Return non-zero iff NAME is the mangled form of a destructor name
- in the G++ V3 ABI demangling style. Specifically, return:
- - '0' if NAME is a deleting destructor,
- - '1' if NAME is a complete object destructor, or
- - '2' if NAME is a base object destructor. */
+/* Return whether NAME is the mangled form of a g++ V3 ABI destructor
+ name. A non-zero return indicates the type of destructor. */
+
enum gnu_v3_dtor_kinds
is_gnu_v3_mangled_dtor (name)
const char *name;
{
- demangling_t dm = demangle_v3_with_details (name);
+ enum gnu_v3_ctor_kinds ctor_kind;
+ enum gnu_v3_dtor_kinds dtor_kind;
- if (dm)
- {
- enum gnu_v3_dtor_kinds result = dm->is_destructor;
- demangling_delete (dm);
- return result;
- }
- else
- return 0;
+ if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind))
+ return (enum gnu_v3_dtor_kinds) 0;
+ return dtor_kind;
}
-#endif /* IN_GLIBCPP_V3 */
+#endif /* IN_GLIBCPP_V3 */
#ifdef STANDALONE_DEMANGLER
#include "getopt.h"
+#include "dyn-string.h"
-static void print_usage
- PARAMS ((FILE* fp, int exit_value));
+static void print_usage PARAMS ((FILE* fp, int exit_value));
+
+#define IS_ALPHA(CHAR) \
+ (((CHAR) >= 'a' && (CHAR) <= 'z') \
+ || ((CHAR) >= 'A' && (CHAR) <= 'Z'))
/* Non-zero if CHAR is a character than can occur in a mangled name. */
#define is_mangled_char(CHAR) \
@@ -4026,7 +4214,7 @@ print_usage (fp, exit_value)
fprintf (fp, "Usage: %s [options] [names ...]\n", program_name);
fprintf (fp, "Options:\n");
fprintf (fp, " -h,--help Display this message.\n");
- fprintf (fp, " -s,--strict Demangle standard names only.\n");
+ fprintf (fp, " -p,--no-params Don't display function parameters\n");
fprintf (fp, " -v,--verbose Produce verbose demanglings.\n");
fprintf (fp, "If names are provided, they are demangled. Otherwise filters standard input.\n");
@@ -4036,10 +4224,10 @@ print_usage (fp, exit_value)
/* Option specification for getopt_long. */
static const struct option long_options[] =
{
- { "help", no_argument, NULL, 'h' },
- { "strict", no_argument, NULL, 's' },
- { "verbose", no_argument, NULL, 'v' },
- { NULL, no_argument, NULL, 0 },
+ { "help", no_argument, NULL, 'h' },
+ { "no-params", no_argument, NULL, 'p' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, no_argument, NULL, 0 },
};
/* Main entry for a demangling filter executable. It will demangle
@@ -4052,9 +4240,9 @@ main (argc, argv)
int argc;
char *argv[];
{
- status_t status;
int i;
int opt_char;
+ int options = DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES;
/* Use the program name of this program, as invoked. */
program_name = argv[0];
@@ -4062,7 +4250,7 @@ main (argc, argv)
/* Parse options. */
do
{
- opt_char = getopt_long (argc, argv, "hsv", long_options, NULL);
+ opt_char = getopt_long (argc, argv, "hpv", long_options, NULL);
switch (opt_char)
{
case '?': /* Unrecognized option. */
@@ -4073,12 +4261,12 @@ main (argc, argv)
print_usage (stdout, 0);
break;
- case 's':
- flag_strict = 1;
+ case 'p':
+ options &= ~ DMGL_PARAMS;
break;
case 'v':
- flag_verbose = 1;
+ options |= DMGL_VERBOSE;
break;
}
}
@@ -4088,41 +4276,12 @@ main (argc, argv)
/* No command line arguments were provided. Filter stdin. */
{
dyn_string_t mangled = dyn_string_new (3);
- dyn_string_t demangled = dyn_string_new (0);
- status_t status;
+ char *s;
/* Read all of input. */
while (!feof (stdin))
{
- char c = getchar ();
-
- /* The first character of a mangled name is an underscore. */
- if (feof (stdin))
- break;
- if (c != '_')
- {
- /* It's not a mangled name. Print the character and go
- on. */
- putchar (c);
- continue;
- }
- c = getchar ();
-
- /* The second character of a mangled name is a capital `Z'. */
- if (feof (stdin))
- break;
- if (c != 'Z')
- {
- /* It's not a mangled name. Print the previous
- underscore, the `Z', and go on. */
- putchar ('_');
- putchar (c);
- continue;
- }
-
- /* Start keeping track of the candidate mangled name. */
- dyn_string_append_char (mangled, '_');
- dyn_string_append_char (mangled, 'Z');
+ char c;
/* Pile characters into mangled until we hit one that can't
occur in a mangled name. */
@@ -4135,62 +4294,53 @@ main (argc, argv)
c = getchar ();
}
- /* Attempt to demangle the name. */
- status = cp_demangle (dyn_string_buf (mangled), demangled, 0);
-
- /* If the demangling succeeded, great! Print out the
- demangled version. */
- if (STATUS_NO_ERROR (status))
- fputs (dyn_string_buf (demangled), stdout);
- /* Abort on allocation failures. */
- else if (status == STATUS_ALLOCATION_FAILED)
+ if (dyn_string_length (mangled) > 0)
{
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
+ s = cplus_demangle_v3 (dyn_string_buf (mangled), options);
+
+ if (s != NULL)
+ {
+ fputs (s, stdout);
+ free (s);
+ }
+ else
+ {
+ /* It might not have been a mangled name. Print the
+ original text. */
+ fputs (dyn_string_buf (mangled), stdout);
+ }
+
+ dyn_string_clear (mangled);
}
- /* Otherwise, it might not have been a mangled name. Just
- print out the original text. */
- else
- fputs (dyn_string_buf (mangled), stdout);
/* If we haven't hit EOF yet, we've read one character that
can't occur in a mangled name, so print it out. */
if (!feof (stdin))
putchar (c);
-
- /* Clear the candidate mangled name, to start afresh next
- time we hit a `_Z'. */
- dyn_string_clear (mangled);
}
dyn_string_delete (mangled);
- dyn_string_delete (demangled);
}
else
/* Demangle command line arguments. */
{
- dyn_string_t result = dyn_string_new (0);
-
/* Loop over command line arguments. */
for (i = optind; i < argc; ++i)
{
+ char *s;
+
/* Attempt to demangle. */
- status = cp_demangle (argv[i], result, 0);
+ s = cplus_demangle_v3 (argv[i], options);
/* If it worked, print the demangled name. */
- if (STATUS_NO_ERROR (status))
- printf ("%s\n", dyn_string_buf (result));
- /* Abort on allocaiton failures. */
- else if (status == STATUS_ALLOCATION_FAILED)
+ if (s != NULL)
{
- fprintf (stderr, "Memory allocation failed.\n");
- abort ();
+ printf ("%s\n", s);
+ free (s);
}
- /* If not, print the error message to stderr instead. */
- else
- fprintf (stderr, "%s\n", status);
+ else
+ fprintf (stderr, "Failed: %s\n", argv[i]);
}
- dyn_string_delete (result);
}
return 0;
diff --git a/contrib/binutils/libiberty/cp-demangle.h b/contrib/binutils/libiberty/cp-demangle.h
new file mode 100644
index 0000000..d3c57ce
--- /dev/null
+++ b/contrib/binutils/libiberty/cp-demangle.h
@@ -0,0 +1,139 @@
+/* Internal demangler interface for g++ V3 ABI.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <ian@wasabisystems.com>.
+
+ This file is part of the libiberty library, which is part of GCC.
+
+ This file 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.
+
+ In addition to the permissions in the GNU General Public License, the
+ Free Software Foundation gives you unlimited permission to link the
+ compiled version of this file into combinations with other programs,
+ and to distribute those combinations without any restriction coming
+ from the use of this file. (The General Public License restrictions
+ do apply in other respects; for example, they cover modification of
+ the file, and distribution when not linked into a combined
+ executable.)
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/* This file provides some definitions shared by cp-demangle.c and
+ cp-demint.c. It should not be included by any other files. */
+
+/* Information we keep for operators. */
+
+struct demangle_operator_info
+{
+ /* Mangled name. */
+ const char *code;
+ /* Real name. */
+ const char *name;
+ /* Length of real name. */
+ int len;
+ /* Number of arguments. */
+ int args;
+};
+
+/* How to print the value of a builtin type. */
+
+enum d_builtin_type_print
+{
+ /* Print as (type)val. */
+ D_PRINT_DEFAULT,
+ /* Print as integer. */
+ D_PRINT_INT,
+ /* Print as long, with trailing `l'. */
+ D_PRINT_LONG,
+ /* Print as bool. */
+ D_PRINT_BOOL,
+ /* Print in usual way, but here to detect void. */
+ D_PRINT_VOID
+};
+
+/* Information we keep for a builtin type. */
+
+struct demangle_builtin_type_info
+{
+ /* Type name. */
+ const char *name;
+ /* Length of type name. */
+ int len;
+ /* Type name when using Java. */
+ const char *java_name;
+ /* Length of java name. */
+ int java_len;
+ /* How to print a value of this type. */
+ enum d_builtin_type_print print;
+};
+
+/* The information structure we pass around. */
+
+struct d_info
+{
+ /* The string we are demangling. */
+ const char *s;
+ /* The end of the string we are demangling. */
+ const char *send;
+ /* The options passed to the demangler. */
+ int options;
+ /* The next character in the string to consider. */
+ const char *n;
+ /* The array of components. */
+ struct demangle_component *comps;
+ /* The index of the next available component. */
+ int next_comp;
+ /* The number of available component structures. */
+ int num_comps;
+ /* The array of substitutions. */
+ struct demangle_component **subs;
+ /* The index of the next substitution. */
+ int next_sub;
+ /* The number of available entries in the subs array. */
+ int num_subs;
+ /* The number of substitutions which we actually made from the subs
+ array, plus the number of template parameter references we
+ saw. */
+ int did_subs;
+ /* The last name we saw, for constructors and destructors. */
+ struct demangle_component *last_name;
+ /* A running total of the length of large expansions from the
+ mangled name to the demangled name, such as standard
+ substitutions and builtin types. */
+ int expansion;
+};
+
+#define d_peek_char(di) (*((di)->n))
+#define d_peek_next_char(di) ((di)->n[1])
+#define d_advance(di, i) ((di)->n += (i))
+#define d_next_char(di) (*((di)->n++))
+#define d_str(di) ((di)->n)
+
+/* Functions and arrays in cp-demangle.c which are referenced by
+ functions in cp-demint.c. */
+
+extern const struct demangle_operator_info cplus_demangle_operators[];
+
+#define D_BUILTIN_TYPE_COUNT (26)
+
+extern const struct demangle_builtin_type_info
+cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT];
+
+extern struct demangle_component *
+cplus_demangle_mangled_name PARAMS ((struct d_info *, int));
+
+extern struct demangle_component *
+cplus_demangle_type PARAMS ((struct d_info *));
+
+extern void
+cplus_demangle_init_info PARAMS ((const char *, int, size_t, struct d_info *));
diff --git a/contrib/binutils/libiberty/cp-demint.c b/contrib/binutils/libiberty/cp-demint.c
new file mode 100644
index 0000000..533202d
--- /dev/null
+++ b/contrib/binutils/libiberty/cp-demint.c
@@ -0,0 +1,241 @@
+/* Demangler component interface functions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <ian@wasabisystems.com>.
+
+ This file is part of the libiberty library, which is part of GCC.
+
+ This file 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.
+
+ In addition to the permissions in the GNU General Public License, the
+ Free Software Foundation gives you unlimited permission to link the
+ compiled version of this file into combinations with other programs,
+ and to distribute those combinations without any restriction coming
+ from the use of this file. (The General Public License restrictions
+ do apply in other respects; for example, they cover modification of
+ the file, and distribution when not linked into a combined
+ executable.)
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/* This file implements a few interface functions which are provided
+ for use with struct demangle_component trees. These functions are
+ declared in demangle.h. These functions are closely tied to the
+ demangler code in cp-demangle.c, and other interface functions can
+ be found in that file. We put these functions in a separate file
+ because they are not needed by the demangler, and so we avoid
+ having them pulled in by programs which only need the
+ demangler. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "ansidecl.h"
+#include "libiberty.h"
+#include "demangle.h"
+#include "cp-demangle.h"
+
+/* Fill in most component types. */
+
+int
+cplus_demangle_fill_component (p, type, left, right)
+ struct demangle_component *p;
+ enum demangle_component_type type;
+ struct demangle_component *left;
+ struct demangle_component *right;
+{
+ if (p == NULL)
+ return 0;
+ switch (type)
+ {
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ case DEMANGLE_COMPONENT_TYPED_NAME:
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_FUNCTION_TYPE:
+ case DEMANGLE_COMPONENT_ARRAY_TYPE:
+ case DEMANGLE_COMPONENT_PTRMEM_TYPE:
+ case DEMANGLE_COMPONENT_ARGLIST:
+ case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
+ case DEMANGLE_COMPONENT_UNARY:
+ case DEMANGLE_COMPONENT_BINARY:
+ case DEMANGLE_COMPONENT_BINARY_ARGS:
+ case DEMANGLE_COMPONENT_TRINARY:
+ case DEMANGLE_COMPONENT_TRINARY_ARG1:
+ case DEMANGLE_COMPONENT_TRINARY_ARG2:
+ case DEMANGLE_COMPONENT_LITERAL:
+ case DEMANGLE_COMPONENT_LITERAL_NEG:
+ break;
+
+ /* These component types only have one subtree. */
+ case DEMANGLE_COMPONENT_VTABLE:
+ case DEMANGLE_COMPONENT_VTT:
+ case DEMANGLE_COMPONENT_TYPEINFO:
+ case DEMANGLE_COMPONENT_TYPEINFO_NAME:
+ case DEMANGLE_COMPONENT_TYPEINFO_FN:
+ case DEMANGLE_COMPONENT_THUNK:
+ case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
+ case DEMANGLE_COMPONENT_COVARIANT_THUNK:
+ case DEMANGLE_COMPONENT_JAVA_CLASS:
+ case DEMANGLE_COMPONENT_GUARD:
+ case DEMANGLE_COMPONENT_REFTEMP:
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ case DEMANGLE_COMPONENT_POINTER:
+ case DEMANGLE_COMPONENT_REFERENCE:
+ case DEMANGLE_COMPONENT_COMPLEX:
+ case DEMANGLE_COMPONENT_IMAGINARY:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE:
+ case DEMANGLE_COMPONENT_CAST:
+ if (right != NULL)
+ return 0;
+ break;
+
+ default:
+ /* Other types do not use subtrees. */
+ return 0;
+ }
+
+ p->type = type;
+ p->u.s_binary.left = left;
+ p->u.s_binary.right = right;
+
+ return 1;
+}
+
+/* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE. */
+
+int
+cplus_demangle_fill_builtin_type (p, typename)
+ struct demangle_component *p;
+ const char *typename;
+{
+ int len;
+ unsigned int i;
+
+ if (p == NULL || typename == NULL)
+ return 0;
+ len = strlen (typename);
+ for (i = 0; i < D_BUILTIN_TYPE_COUNT; ++i)
+ {
+ if (len == cplus_demangle_builtin_types[i].len
+ && strcmp (typename, cplus_demangle_builtin_types[i].name) == 0)
+ {
+ p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
+ p->u.s_builtin.type = &cplus_demangle_builtin_types[i];
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Fill in a DEMANGLE_COMPONENT_OPERATOR. */
+
+int
+cplus_demangle_fill_operator (p, opname, args)
+ struct demangle_component *p;
+ const char *opname;
+ int args;
+{
+ int len;
+ unsigned int i;
+
+ if (p == NULL || opname == NULL)
+ return 0;
+ len = strlen (opname);
+ for (i = 0; cplus_demangle_operators[i].name != NULL; ++i)
+ {
+ if (len == cplus_demangle_operators[i].len
+ && args == cplus_demangle_operators[i].args
+ && strcmp (opname, cplus_demangle_operators[i].name) == 0)
+ {
+ p->type = DEMANGLE_COMPONENT_OPERATOR;
+ p->u.s_operator.op = &cplus_demangle_operators[i];
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Translate a mangled name into components. */
+
+struct demangle_component *
+cplus_demangle_v3_components (mangled, options, mem)
+ const char *mangled;
+ int options;
+ void **mem;
+{
+ size_t len;
+ int type;
+ struct d_info di;
+ struct demangle_component *dc;
+
+ len = strlen (mangled);
+
+ if (mangled[0] == '_' && mangled[1] == 'Z')
+ type = 0;
+ else
+ {
+ if ((options & DMGL_TYPES) == 0)
+ return NULL;
+ type = 1;
+ }
+
+ cplus_demangle_init_info (mangled, options, len, &di);
+
+ di.comps = ((struct demangle_component *)
+ malloc (di.num_comps * sizeof (struct demangle_component)));
+ di.subs = ((struct demangle_component **)
+ malloc (di.num_subs * sizeof (struct demangle_component *)));
+ if (di.comps == NULL || di.subs == NULL)
+ {
+ if (di.comps != NULL)
+ free (di.comps);
+ if (di.subs != NULL)
+ free (di.subs);
+ return NULL;
+ }
+
+ if (! type)
+ dc = cplus_demangle_mangled_name (&di, 1);
+ else
+ dc = cplus_demangle_type (&di);
+
+ /* If DMGL_PARAMS is set, then if we didn't consume the entire
+ mangled string, then we didn't successfully demangle it. */
+ if ((options & DMGL_PARAMS) != 0 && d_peek_char (&di) != '\0')
+ dc = NULL;
+
+ free (di.subs);
+
+ if (dc != NULL)
+ *mem = di.comps;
+ else
+ free (di.comps);
+
+ return dc;
+}
diff --git a/contrib/binutils/libiberty/cplus-dem.c b/contrib/binutils/libiberty/cplus-dem.c
index 203e30d..f3c4464 100644
--- a/contrib/binutils/libiberty/cplus-dem.c
+++ b/contrib/binutils/libiberty/cplus-dem.c
@@ -1,6 +1,6 @@
/* Demangler for GNU C++
Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
@@ -11,6 +11,15 @@ modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
+In addition to the permissions in the GNU Library General Public
+License, the Free Software Foundation gives you unlimited permission
+to link the compiled version of this file into combinations with other
+programs, and to distribute those combinations without any restriction
+coming from the use of this file. (The Library Public License
+restrictions do apply in other respects; for example, they cover
+modification of the file, and distribution when not linked into a
+combined executable.)
+
Libiberty 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
@@ -305,8 +314,6 @@ const struct demangler_engine libiberty_demanglers[] =
};
#define STRING_EMPTY(str) ((str) -> b == (str) -> p)
-#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
- string_prepend(str, " ");}
#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
string_append(str, " ");}
#define LEN_STRING(str) ( (STRING_EMPTY(str))?0:((str)->p - (str)->b))
@@ -516,7 +523,7 @@ recursively_demangle PARAMS ((struct work_stuff *, const char **, string *,
int));
static void
-grow_vect PARAMS ((void **, size_t *, size_t, int));
+grow_vect PARAMS ((char **, size_t *, size_t, int));
/* Translate count to integer, consuming tokens in the process.
Conversion terminates on the first non-digit character.
@@ -938,7 +945,7 @@ cplus_demangle (mangled, options)
static void
grow_vect (old_vect, size, min_size, element_size)
- void **old_vect;
+ char **old_vect;
size_t *size;
size_t min_size;
int element_size;
@@ -948,7 +955,7 @@ grow_vect (old_vect, size, min_size, element_size)
*size *= 2;
if (*size < min_size)
*size = min_size;
- *old_vect = xrealloc (*old_vect, *size * element_size);
+ *old_vect = (void *) xrealloc (*old_vect, *size * element_size);
}
}
@@ -971,8 +978,7 @@ ada_demangle (mangled, option)
char *demangled = NULL;
int at_start_name;
int changed;
- char *demangling_buffer = NULL;
- size_t demangling_buffer_size = 0;
+ size_t demangled_size = 0;
changed = 0;
@@ -1000,10 +1006,9 @@ ada_demangle (mangled, option)
}
/* Make demangled big enough for possible expansion by operator name. */
- grow_vect ((void **) &(demangling_buffer),
- &demangling_buffer_size, 2 * len0 + 1,
+ grow_vect (&demangled,
+ &demangled_size, 2 * len0 + 1,
sizeof (char));
- demangled = demangling_buffer;
if (ISDIGIT ((unsigned char) mangled[len0 - 1])) {
for (i = len0 - 2; i >= 0 && ISDIGIT ((unsigned char) mangled[i]); i -= 1)
@@ -1053,10 +1058,10 @@ ada_demangle (mangled, option)
return demangled;
Suppress:
- grow_vect ((void **) &(demangling_buffer),
- &demangling_buffer_size, strlen (mangled) + 3,
+ grow_vect (&demangled,
+ &demangled_size, strlen (mangled) + 3,
sizeof (char));
- demangled = demangling_buffer;
+
if (mangled[0] == '<')
strcpy (demangled, mangled);
else
@@ -1068,7 +1073,7 @@ ada_demangle (mangled, option)
/* This function performs most of what cplus_demangle use to do, but
to be able to demangle a name with a B, K or n code, we need to
have a longer term memory of what types have been seen. The original
- now intializes and cleans up the squangle code info, while internal
+ now initializes and cleans up the squangle code info, while internal
calls go directly to this routine to avoid resetting that info. */
static char *
@@ -1208,7 +1213,7 @@ work_stuff_copy_to_from (to, from)
if (from->ntmpl_args)
to->tmpl_argvec
- = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
+ = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
for (i = 0; i < from->ntmpl_args; i++)
{
@@ -1433,6 +1438,7 @@ demangle_signature (work, mangled, declp)
{
string_append (&s, SCOPE_STRING (work));
string_prepends (declp, &s);
+ string_delete (&s);
}
oldmangled = NULL;
expect_func = 1;
@@ -1512,7 +1518,6 @@ demangle_signature (work, mangled, declp)
{
/* Read the return type. */
string return_type;
- string_init (&return_type);
(*mangled)++;
success = do_type (work, mangled, &return_type);
@@ -1792,31 +1797,34 @@ demangle_integral_value (work, mangled, s)
success = 0;
- /* Negative numbers are indicated with a leading `m'. */
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- else if (mangled[0][0] == '_' && mangled[0][1] == 'm')
- {
- /* Since consume_count_with_underscores does not handle the
- `m'-prefix we must do it here, using consume_count and
- adjusting underscores: we have to consume the underscore
- matching the prepended one. */
- multidigit_without_leading_underscore = 1;
- string_appendn (s, "-", 1);
- (*mangled) += 2;
- }
- else if (**mangled == '_')
- {
- /* Do not consume a following underscore;
- multidigit_without_leading_underscore will consume what should be
- consumed. */
- leave_following_underscore = 1;
+ if (**mangled == '_')
+ {
+ if (mangled[0][1] == 'm')
+ {
+ /* Since consume_count_with_underscores does not handle the
+ `m'-prefix we must do it here, using consume_count and
+ adjusting underscores: we have to consume the underscore
+ matching the prepended one. */
+ multidigit_without_leading_underscore = 1;
+ string_appendn (s, "-", 1);
+ (*mangled) += 2;
+ }
+ else
+ {
+ /* Do not consume a following underscore;
+ consume_count_with_underscores will consume what
+ should be consumed. */
+ leave_following_underscore = 1;
+ }
}
else
{
+ /* Negative numbers are indicated with a leading `m'. */
+ if (**mangled == 'm')
+ {
+ string_appendn (s, "-", 1);
+ (*mangled)++;
+ }
/* Since consume_count_with_underscores does not handle
multi-digit numbers that do not start with an underscore,
and this number can be an integer template parameter,
@@ -1857,7 +1865,7 @@ demangle_integral_value (work, mangled, s)
/* All is well. */
success = 1;
}
- }
+ }
return success;
}
@@ -2035,13 +2043,10 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
const char *start;
int is_java_array = 0;
string temp;
- int bindex = 0;
(*mangled)++;
if (is_type)
{
- if (remember)
- bindex = register_Btype (work);
start = *mangled;
/* get template name */
if (**mangled == 'z')
@@ -2218,7 +2223,10 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
}
if (is_type && remember)
- remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
+ {
+ const int bindex = register_Btype (work);
+ remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
+ }
/*
if (work -> static_type)
@@ -2310,6 +2318,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
if (HP_DEMANGLING && ((*mangled)[n] == 'X'))
{
char *start_spec_args = NULL;
+ int hold_options;
/* First check for and omit template specialization pseudo-arguments,
such as in "Spec<#1,#1.*>" */
@@ -2322,10 +2331,16 @@ demangle_arm_hp_template (work, mangled, n, declp)
string_init (&arg);
if (work->temp_start == -1) /* non-recursive call */
work->temp_start = declp->p - declp->b;
+
+ /* We want to unconditionally demangle parameter types in
+ template parameters. */
+ hold_options = work->options;
+ work->options |= DMGL_PARAMS;
+
string_append (declp, "<");
while (1)
{
- string_clear (&arg);
+ string_delete (&arg);
switch (**mangled)
{
case 'T':
@@ -2368,21 +2383,29 @@ demangle_arm_hp_template (work, mangled, n, declp)
string_delete (&arg);
if (**mangled == '_')
(*mangled)++;
+ work->options = hold_options;
return;
}
/* ARM template? (Also handles HP cfront extensions) */
else if (arm_pt (work, *mangled, n, &p, &args))
{
+ int hold_options;
string type_str;
string_init (&arg);
string_appendn (declp, *mangled, p - *mangled);
if (work->temp_start == -1) /* non-recursive call */
work->temp_start = declp->p - declp->b;
+
+ /* We want to unconditionally demangle parameter types in
+ template parameters. */
+ hold_options = work->options;
+ work->options |= DMGL_PARAMS;
+
string_append (declp, "<");
/* should do error checking here */
while (args < e) {
- string_clear (&arg);
+ string_delete (&arg);
/* Check for type or literal here */
switch (*args)
@@ -2397,6 +2420,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
goto cfront_template_args_done;
string_append (&arg, "(");
string_appends (&arg, &type_str);
+ string_delete (&type_str);
string_append (&arg, ")");
if (*args != 'L')
goto cfront_template_args_done;
@@ -2421,7 +2445,10 @@ demangle_arm_hp_template (work, mangled, n, declp)
/* Fail if we didn't make any progress: prevent infinite loop. */
if (args == old_args)
- return;
+ {
+ work->options = hold_options;
+ return;
+ }
}
}
string_appends (declp, &arg);
@@ -2432,6 +2459,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
if (args >= e)
--declp->p; /* remove extra comma */
string_append (declp, ">");
+ work->options = hold_options;
}
else if (n>10 && strncmp (*mangled, "_GLOBAL_", 8) == 0
&& (*mangled)[9] == 'N'
@@ -3354,6 +3382,7 @@ demangle_qualified (work, mangled, result, isfuncname, append)
}
else
{
+ string_delete (&last_name);
success = do_type (work, mangled, &last_name);
if (!success)
break;
@@ -3496,10 +3525,8 @@ do_type (work, mangled, result)
string decl;
const char *remembered_type;
int type_quals;
- string btype;
type_kind_t tk = tk_none;
- string_init (&btype);
string_init (&decl);
string_init (result);
@@ -3617,6 +3644,7 @@ do_type (work, mangled, result)
string temp;
do_type (work, mangled, &temp);
string_prepends (&decl, &temp);
+ string_delete (&temp);
}
else if (**mangled == 't')
{
@@ -3627,7 +3655,7 @@ do_type (work, mangled, result)
if (success)
{
string_prependn (&decl, temp.b, temp.p - temp.b);
- string_clear (&temp);
+ string_delete (&temp);
}
else
break;
@@ -3807,11 +3835,8 @@ demangle_fund_type (work, mangled, result)
int success = 1;
char buf[10];
unsigned int dec = 0;
- string btype;
type_kind_t tk = tk_integral;
- string_init (&btype);
-
/* First pick off any type qualifiers. There can be more than one. */
while (!done)
@@ -3983,8 +4008,11 @@ demangle_fund_type (work, mangled, result)
}
case 't':
{
+ string btype;
+ string_init (&btype);
success = demangle_template (work, mangled, &btype, 0, 1, 1);
string_appends (result, &btype);
+ string_delete (&btype);
break;
}
default:
@@ -4186,12 +4214,9 @@ do_arg (work, mangled, result)
do not want to add additional types to the back-referenceable
type vector when processing a repeated type. */
if (work->previous_argument)
- string_clear (work->previous_argument);
+ string_delete (work->previous_argument);
else
- {
- work->previous_argument = (string*) xmalloc (sizeof (string));
- string_init (work->previous_argument);
- }
+ work->previous_argument = (string*) xmalloc (sizeof (string));
if (!do_type (work, mangled, work->previous_argument))
return 0;
@@ -4555,7 +4580,10 @@ demangle_nested_args (work, mangled, declp)
/* Restore the previous_argument field. */
if (work->previous_argument)
- string_delete (work->previous_argument);
+ {
+ string_delete (work->previous_argument);
+ free ((char *) work->previous_argument);
+ }
work->previous_argument = saved_previous_argument;
--work->forgetting_types;
work->nrepeats = saved_nrepeats;
@@ -4880,337 +4908,3 @@ string_append_template_idx (s, idx)
sprintf(buf, "T%d", idx);
string_append (s, buf);
}
-
-/* To generate a standalone demangler program for testing purposes,
- just compile and link this file with -DMAIN and libiberty.a. When
- run, it demangles each command line arg, or each stdin string, and
- prints the result on stdout. */
-
-#ifdef MAIN
-
-#include "getopt.h"
-
-static const char *program_name;
-static const char *program_version = VERSION;
-static int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE;
-
-static void demangle_it PARAMS ((char *));
-static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
-static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;
-static void print_demangler_list PARAMS ((FILE *));
-
-static void
-demangle_it (mangled_name)
- char *mangled_name;
-{
- char *result;
-
- /* For command line args, also try to demangle type encodings. */
- result = cplus_demangle (mangled_name, flags | DMGL_TYPES);
- if (result == NULL)
- {
- printf ("%s\n", mangled_name);
- }
- else
- {
- printf ("%s\n", result);
- free (result);
- }
-}
-
-static void
-print_demangler_list (stream)
- FILE *stream;
-{
- const struct demangler_engine *demangler;
-
- fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name);
-
- for (demangler = libiberty_demanglers + 1;
- demangler->demangling_style != unknown_demangling;
- ++demangler)
- fprintf (stream, ",%s", demangler->demangling_style_name);
-
- fprintf (stream, "}");
-}
-
-static void
-usage (stream, status)
- FILE *stream;
- int status;
-{
- fprintf (stream, "\
-Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores] \n",
- program_name);
-
- fprintf (stream, "\
- [-s ");
- print_demangler_list (stream);
- fprintf (stream, "]\n");
-
- fprintf (stream, "\
- [--format ");
- print_demangler_list (stream);
- fprintf (stream, "]\n");
-
- fprintf (stream, "\
- [--help] [--version] [arg...]\n");
- exit (status);
-}
-
-#define MBUF_SIZE 32767
-char mbuffer[MBUF_SIZE];
-
-/* Defined in the automatically-generated underscore.c. */
-extern int prepends_underscore;
-
-int strip_underscore = 0;
-
-static const struct option long_options[] = {
- {"strip-underscores", no_argument, 0, '_'},
- {"format", required_argument, 0, 's'},
- {"help", no_argument, 0, 'h'},
- {"no-strip-underscores", no_argument, 0, 'n'},
- {"version", no_argument, 0, 'v'},
- {0, no_argument, 0, 0}
-};
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-
-static const char *
-standard_symbol_characters PARAMS ((void));
-
-static const char *
-hp_symbol_characters PARAMS ((void));
-
-static const char *
-gnu_v3_symbol_characters PARAMS ((void));
-
-/* Return the string of non-alnum characters that may occur
- as a valid symbol component, in the standard assembler symbol
- syntax. */
-
-static const char *
-standard_symbol_characters ()
-{
- return "_$.";
-}
-
-
-/* Return the string of non-alnum characters that may occur
- as a valid symbol name component in an HP object file.
-
- Note that, since HP's compiler generates object code straight from
- C++ source, without going through an assembler, its mangled
- identifiers can use all sorts of characters that no assembler would
- tolerate, so the alphabet this function creates is a little odd.
- Here are some sample mangled identifiers offered by HP:
-
- typeid*__XT24AddressIndExpClassMember_
- [Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv
- __ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv
-
- This still seems really weird to me, since nowhere else in this
- file is there anything to recognize curly brackets, parens, etc.
- I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me
- this is right, but I still strongly suspect that there's a
- misunderstanding here.
-
- If we decide it's better for c++filt to use HP's assembler syntax
- to scrape identifiers out of its input, here's the definition of
- the symbol name syntax from the HP assembler manual:
-
- Symbols are composed of uppercase and lowercase letters, decimal
- digits, dollar symbol, period (.), ampersand (&), pound sign(#) and
- underscore (_). A symbol can begin with a letter, digit underscore or
- dollar sign. If a symbol begins with a digit, it must contain a
- non-digit character.
-
- So have fun. */
-static const char *
-hp_symbol_characters ()
-{
- return "_$.<>#,*&[]:(){}";
-}
-
-
-/* Return the string of non-alnum characters that may occur
- as a valid symbol component in the GNU C++ V3 ABI mangling
- scheme. */
-
-static const char *
-gnu_v3_symbol_characters ()
-{
- return "_$.";
-}
-
-
-extern int main PARAMS ((int, char **));
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- char *result;
- int c;
- const char *valid_symbols;
- enum demangling_styles style = auto_demangling;
-
- program_name = argv[0];
-
- strip_underscore = prepends_underscore;
-
- while ((c = getopt_long (argc, argv, "_ns:", long_options, (int *) 0)) != EOF)
- {
- switch (c)
- {
- case '?':
- usage (stderr, 1);
- break;
- case 'h':
- usage (stdout, 0);
- case 'n':
- strip_underscore = 0;
- break;
- case 'v':
- printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version);
- return (0);
- case '_':
- strip_underscore = 1;
- break;
- case 's':
- {
- style = cplus_demangle_name_to_style (optarg);
- if (style == unknown_demangling)
- {
- fprintf (stderr, "%s: unknown demangling style `%s'\n",
- program_name, optarg);
- return (1);
- }
- else
- cplus_demangle_set_style (style);
- }
- break;
- }
- }
-
- if (optind < argc)
- {
- for ( ; optind < argc; optind++)
- {
- demangle_it (argv[optind]);
- }
- }
- else
- {
- switch (current_demangling_style)
- {
- case gnu_demangling:
- case lucid_demangling:
- case arm_demangling:
- case java_demangling:
- case edg_demangling:
- case gnat_demangling:
- case auto_demangling:
- valid_symbols = standard_symbol_characters ();
- break;
- case hp_demangling:
- valid_symbols = hp_symbol_characters ();
- break;
- case gnu_v3_demangling:
- valid_symbols = gnu_v3_symbol_characters ();
- break;
- default:
- /* Folks should explicitly indicate the appropriate alphabet for
- each demangling. Providing a default would allow the
- question to go unconsidered. */
- abort ();
- }
-
- for (;;)
- {
- int i = 0;
- c = getchar ();
- /* Try to read a label. */
- while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
- {
- if (i >= MBUF_SIZE-1)
- break;
- mbuffer[i++] = c;
- c = getchar ();
- }
- if (i > 0)
- {
- int skip_first = 0;
-
- if (mbuffer[0] == '.' || mbuffer[0] == '$')
- ++skip_first;
- if (strip_underscore && mbuffer[skip_first] == '_')
- ++skip_first;
-
- if (skip_first > i)
- skip_first = i;
-
- mbuffer[i] = 0;
- flags |= (int) style;
- result = cplus_demangle (mbuffer + skip_first, flags);
- if (result)
- {
- if (mbuffer[0] == '.')
- putc ('.', stdout);
- fputs (result, stdout);
- free (result);
- }
- else
- fputs (mbuffer, stdout);
-
- fflush (stdout);
- }
- if (c == EOF)
- break;
- putchar (c);
- fflush (stdout);
- }
- }
-
- return (0);
-}
-
-static void
-fatal (str)
- const char *str;
-{
- fprintf (stderr, "%s: %s\n", program_name, str);
- exit (1);
-}
-
-PTR
-xmalloc (size)
- size_t size;
-{
- register PTR value = (PTR) malloc (size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-PTR
-xrealloc (ptr, size)
- PTR ptr;
- size_t size;
-{
- register PTR value = (PTR) realloc (ptr, size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-#endif /* main */
diff --git a/contrib/binutils/libiberty/fibheap.c b/contrib/binutils/libiberty/fibheap.c
index 0ba9b8d..bcecf80 100644
--- a/contrib/binutils/libiberty/fibheap.c
+++ b/contrib/binutils/libiberty/fibheap.c
@@ -66,7 +66,7 @@ fibnode_new ()
{
fibnode_t node;
- node = xcalloc (1, sizeof *node);
+ node = (fibnode_t) xcalloc (1, sizeof *node);
node->left = node;
node->right = node;
@@ -218,7 +218,7 @@ fibheap_replace_key_data (heap, node, key, data)
void *data;
{
void *odata;
- int okey;
+ fibheapkey_t okey;
fibnode_t y;
/* If we wanted to, we could actually do a real increase by redeleting and
diff --git a/contrib/binutils/libiberty/floatformat.c b/contrib/binutils/libiberty/floatformat.c
index d9e9fad..a0f6535 100644
--- a/contrib/binutils/libiberty/floatformat.c
+++ b/contrib/binutils/libiberty/floatformat.c
@@ -1,5 +1,5 @@
/* IEEE floating point support routines, for GDB, the GNU Debugger.
- Copyright (C) 1991, 1994, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1999, 2000, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,17 +17,51 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* This is needed to pick up the NAN macro on some systems. */
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <math.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "ansidecl.h"
+#include "libiberty.h"
#include "floatformat.h"
-#include <math.h> /* ldexp */
-#ifdef __STDC__
-#include <stddef.h>
-extern void *memcpy (void *s1, const void *s2, size_t n);
-extern void *memset (void *s, int c, size_t n);
+
+#ifndef INFINITY
+#ifdef HUGE_VAL
+#define INFINITY HUGE_VAL
#else
-extern char *memcpy ();
-extern char *memset ();
+#define INFINITY (1.0 / 0.0)
+#endif
#endif
+#ifndef NAN
+#define NAN (0.0 / 0.0)
+#endif
+
+static unsigned long get_field PARAMS ((const unsigned char *,
+ enum floatformat_byteorders,
+ unsigned int,
+ unsigned int,
+ unsigned int));
+static int floatformat_always_valid PARAMS ((const struct floatformat *fmt,
+ const char *from));
+
+static int
+floatformat_always_valid (fmt, from)
+ const struct floatformat *fmt ATTRIBUTE_UNUSED;
+ const char *from ATTRIBUTE_UNUSED;
+{
+ return 1;
+}
+
/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not
going to bother with trying to muck around with whether it is defined in
a system header, what we do if not, etc. */
@@ -38,25 +72,29 @@ const struct floatformat floatformat_ieee_single_big =
{
floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
floatformat_intbit_no,
- "floatformat_ieee_single_big"
+ "floatformat_ieee_single_big",
+ floatformat_always_valid
};
const struct floatformat floatformat_ieee_single_little =
{
floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
floatformat_intbit_no,
- "floatformat_ieee_single_little"
+ "floatformat_ieee_single_little",
+ floatformat_always_valid
};
const struct floatformat floatformat_ieee_double_big =
{
floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
floatformat_intbit_no,
- "floatformat_ieee_double_big"
+ "floatformat_ieee_double_big",
+ floatformat_always_valid
};
const struct floatformat floatformat_ieee_double_little =
{
floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
floatformat_intbit_no,
- "floatformat_ieee_double_little"
+ "floatformat_ieee_double_little",
+ floatformat_always_valid
};
/* floatformat for IEEE double, little endian byte order, with big endian word
@@ -66,34 +104,64 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword =
{
floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
floatformat_intbit_no,
- "floatformat_ieee_double_littlebyte_bigword"
+ "floatformat_ieee_double_littlebyte_bigword",
+ floatformat_always_valid
};
+static int floatformat_i387_ext_is_valid PARAMS ((const struct floatformat *fmt, const char *from));
+
+static int
+floatformat_i387_ext_is_valid (fmt, from)
+ const struct floatformat *fmt;
+ const char *from;
+{
+ /* In the i387 double-extended format, if the exponent is all ones,
+ then the integer bit must be set. If the exponent is neither 0
+ nor ~0, the intbit must also be set. Only if the exponent is
+ zero can it be zero, and then it must be zero. */
+ unsigned long exponent, int_bit;
+ const unsigned char *ufrom = (const unsigned char *) from;
+
+ exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
+ fmt->exp_start, fmt->exp_len);
+ int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
+ fmt->man_start, 1);
+
+ if ((exponent == 0) != (int_bit == 0))
+ return 0;
+ else
+ return 1;
+}
+
const struct floatformat floatformat_i387_ext =
{
floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
floatformat_intbit_yes,
- "floatformat_i387_ext"
+ "floatformat_i387_ext",
+ floatformat_i387_ext_is_valid
};
const struct floatformat floatformat_m68881_ext =
{
/* Note that the bits from 16 to 31 are unused. */
floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
floatformat_intbit_yes,
- "floatformat_m68881_ext"
+ "floatformat_m68881_ext",
+ floatformat_always_valid
};
const struct floatformat floatformat_i960_ext =
{
/* Note that the bits from 0 to 15 are unused. */
floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
floatformat_intbit_yes,
- "floatformat_i960_ext"
+ "floatformat_i960_ext",
+ floatformat_always_valid
};
const struct floatformat floatformat_m88110_ext =
{
floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
floatformat_intbit_yes,
- "floatformat_m88110_ext"
+ "floatformat_m88110_ext",
+ floatformat_always_valid
};
const struct floatformat floatformat_m88110_harris_ext =
{
@@ -101,58 +169,59 @@ const struct floatformat floatformat_m88110_harris_ext =
double, and the last 64 bits are wasted. */
floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52,
floatformat_intbit_no,
- "floatformat_m88110_ext_harris"
+ "floatformat_m88110_ext_harris",
+ floatformat_always_valid
};
const struct floatformat floatformat_arm_ext_big =
{
/* Bits 1 to 16 are unused. */
floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
floatformat_intbit_yes,
- "floatformat_arm_ext_big"
+ "floatformat_arm_ext_big",
+ floatformat_always_valid
};
const struct floatformat floatformat_arm_ext_littlebyte_bigword =
{
/* Bits 1 to 16 are unused. */
floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
floatformat_intbit_yes,
- "floatformat_arm_ext_littlebyte_bigword"
+ "floatformat_arm_ext_littlebyte_bigword",
+ floatformat_always_valid
};
const struct floatformat floatformat_ia64_spill_big =
{
floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
floatformat_intbit_yes,
- "floatformat_ia64_spill_big"
+ "floatformat_ia64_spill_big",
+ floatformat_always_valid
};
const struct floatformat floatformat_ia64_spill_little =
{
floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
floatformat_intbit_yes,
- "floatformat_ia64_spill_little"
+ "floatformat_ia64_spill_little",
+ floatformat_always_valid
};
const struct floatformat floatformat_ia64_quad_big =
{
floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
floatformat_intbit_no,
- "floatformat_ia64_quad_big"
+ "floatformat_ia64_quad_big",
+ floatformat_always_valid
};
const struct floatformat floatformat_ia64_quad_little =
{
floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
floatformat_intbit_no,
- "floatformat_ia64_quad_little"
+ "floatformat_ia64_quad_little",
+ floatformat_always_valid
};
-static unsigned long get_field PARAMS ((unsigned char *,
- enum floatformat_byteorders,
- unsigned int,
- unsigned int,
- unsigned int));
-
-/* Extract a field which starts at START and is LEN bytes long. DATA and
+/* Extract a field which starts at START and is LEN bits long. DATA and
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
static unsigned long
get_field (data, order, total_len, start, len)
- unsigned char *data;
+ const unsigned char *data;
enum floatformat_byteorders order;
unsigned int total_len;
unsigned int start;
@@ -206,10 +275,10 @@ get_field (data, order, total_len, start, len)
void
floatformat_to_double (fmt, from, to)
const struct floatformat *fmt;
- char *from;
+ const char *from;
double *to;
{
- unsigned char *ufrom = (unsigned char *)from;
+ const unsigned char *ufrom = (const unsigned char *)from;
double dto;
long exponent;
unsigned long mant;
@@ -219,9 +288,45 @@ floatformat_to_double (fmt, from, to)
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->exp_start, fmt->exp_len);
- /* Note that if exponent indicates a NaN, we can't really do anything useful
- (not knowing if the host has NaN's, or how to build one). So it will
- end up as an infinity or something close; that is OK. */
+
+ /* If the exponent indicates a NaN, we don't have information to
+ decide what to do. So we handle it like IEEE, except that we
+ don't try to preserve the type of NaN. FIXME. */
+ if ((unsigned long) exponent == fmt->exp_nan)
+ {
+ int nan;
+
+ mant_off = fmt->man_start;
+ mant_bits_left = fmt->man_len;
+ nan = 0;
+ while (mant_bits_left > 0)
+ {
+ mant_bits = min (mant_bits_left, 32);
+
+ if (get_field (ufrom, fmt->byteorder, fmt->totalsize,
+ mant_off, mant_bits) != 0)
+ {
+ /* This is a NaN. */
+ nan = 1;
+ break;
+ }
+
+ mant_off += mant_bits;
+ mant_bits_left -= mant_bits;
+ }
+
+ if (nan)
+ dto = NAN;
+ else
+ dto = INFINITY;
+
+ if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
+ dto = -dto;
+
+ *to = dto;
+
+ return;
+ }
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
@@ -254,8 +359,18 @@ floatformat_to_double (fmt, from, to)
mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
mant_off, mant_bits);
- dto += ldexp ((double)mant, exponent - mant_bits);
- exponent -= mant_bits;
+ /* Handle denormalized numbers. FIXME: What should we do for
+ non-IEEE formats? */
+ if (exponent == 0 && mant != 0)
+ dto += ldexp ((double)mant,
+ (- fmt->exp_bias
+ - mant_bits
+ - (mant_off - fmt->man_start)
+ + 1));
+ else
+ dto += ldexp ((double)mant, exponent - mant_bits);
+ if (exponent != 0)
+ exponent -= mant_bits;
mant_off += mant_bits;
mant_bits_left -= mant_bits;
}
@@ -272,7 +387,7 @@ static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders,
unsigned int,
unsigned long));
-/* Set a field which starts at START and is LEN bytes long. DATA and
+/* Set a field which starts at START and is LEN bits long. DATA and
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
static void
put_field (data, order, total_len, start, len, stuff_to_put)
@@ -330,7 +445,7 @@ put_field (data, order, total_len, start, len, stuff_to_put)
void
floatformat_from_double (fmt, from, to)
const struct floatformat *fmt;
- double *from;
+ const double *from;
char *to;
{
double dfrom;
@@ -340,33 +455,54 @@ floatformat_from_double (fmt, from, to)
int mant_bits_left;
unsigned char *uto = (unsigned char *)to;
- memcpy (&dfrom, from, sizeof (dfrom));
+ dfrom = *from;
memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
+
+ /* If negative, set the sign bit. */
+ if (dfrom < 0)
+ {
+ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
+ dfrom = -dfrom;
+ }
+
if (dfrom == 0)
- return; /* Result is zero */
+ {
+ /* 0.0. */
+ return;
+ }
+
if (dfrom != dfrom)
{
- /* From is NaN */
+ /* NaN. */
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
fmt->exp_len, fmt->exp_nan);
- /* Be sure it's not infinity, but NaN value is irrel */
+ /* Be sure it's not infinity, but NaN value is irrelevant. */
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
32, 1);
return;
}
- /* If negative, set the sign bit. */
- if (dfrom < 0)
+ if (dfrom + dfrom == dfrom)
{
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
- dfrom = -dfrom;
+ /* This can only happen for an infinite value (or zero, which we
+ already handled above). */
+ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
+ fmt->exp_len, fmt->exp_nan);
+ return;
}
- /* How to tell an infinity from an ordinary number? FIXME-someday */
-
mant = frexp (dfrom, &exponent);
- put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len,
- exponent + fmt->exp_bias - 1);
+ if (exponent + fmt->exp_bias - 1 > 0)
+ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
+ fmt->exp_len, exponent + fmt->exp_bias - 1);
+ else
+ {
+ /* Handle a denormalized number. FIXME: What should we do for
+ non-IEEE formats? */
+ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
+ fmt->exp_len, 0);
+ mant = ldexp (mant, exponent + fmt->exp_bias - 1);
+ }
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
@@ -379,12 +515,11 @@ floatformat_from_double (fmt, from, to)
mant_long = (unsigned long)mant;
mant -= mant_long;
- /* If the integer bit is implicit, then we need to discard it.
- If we are discarding a zero, we should be (but are not) creating
- a denormalized number which means adjusting the exponent
- (I think). */
+ /* If the integer bit is implicit, and we are not creating a
+ denormalized number, then we need to discard it. */
if ((unsigned int) mant_bits_left == fmt->man_len
- && fmt->intbit == floatformat_intbit_no)
+ && fmt->intbit == floatformat_intbit_no
+ && exponent + fmt->exp_bias - 1 > 0)
{
mant_long &= 0x7fffffff;
mant_bits -= 1;
@@ -403,9 +538,21 @@ floatformat_from_double (fmt, from, to)
}
}
+/* Return non-zero iff the data at FROM is a valid number in format FMT. */
+
+int
+floatformat_is_valid (fmt, from)
+ const struct floatformat *fmt;
+ const char *from;
+{
+ return fmt->is_valid (fmt, from);
+}
+
#ifdef IEEE_DEBUG
+#include <stdio.h>
+
/* This is to be run on a host which uses IEEE floating point. */
void
@@ -413,19 +560,31 @@ ieee_test (n)
double n;
{
double result;
- char exten[16];
- floatformat_to_double (&floatformat_ieee_double_big, &n, &result);
- if (n != result)
+ floatformat_to_double (&floatformat_ieee_double_little, (char *) &n,
+ &result);
+ if ((n != result && (! isnan (n) || ! isnan (result)))
+ || (n < 0 && result >= 0)
+ || (n >= 0 && result < 0))
printf ("Differ(to): %.20g -> %.20g\n", n, result);
- floatformat_from_double (&floatformat_ieee_double_big, &n, &result);
- if (n != result)
+
+ floatformat_from_double (&floatformat_ieee_double_little, &n,
+ (char *) &result);
+ if ((n != result && (! isnan (n) || ! isnan (result)))
+ || (n < 0 && result >= 0)
+ || (n >= 0 && result < 0))
printf ("Differ(from): %.20g -> %.20g\n", n, result);
- floatformat_from_double (&floatformat_m68881_ext, &n, exten);
- floatformat_to_double (&floatformat_m68881_ext, exten, &result);
- if (n != result)
- printf ("Differ(to+from): %.20g -> %.20g\n", n, result);
+#if 0
+ {
+ char exten[16];
+
+ floatformat_from_double (&floatformat_m68881_ext, &n, exten);
+ floatformat_to_double (&floatformat_m68881_ext, exten, &result);
+ if (n != result)
+ printf ("Differ(to+from): %.20g -> %.20g\n", n, result);
+ }
+#endif
#if IEEE_DEBUG > 1
/* This is to be run on a host which uses 68881 format. */
@@ -440,12 +599,22 @@ ieee_test (n)
int
main ()
{
+ ieee_test (0.0);
ieee_test (0.5);
ieee_test (256.0);
ieee_test (0.12345);
ieee_test (234235.78907234);
ieee_test (-512.0);
ieee_test (-0.004321);
+ ieee_test (1.2E-70);
+ ieee_test (1.2E-316);
+ ieee_test (4.9406564584124654E-324);
+ ieee_test (- 4.9406564584124654E-324);
+ ieee_test (- 0.0);
+ ieee_test (- INFINITY);
+ ieee_test (- NAN);
+ ieee_test (INFINITY);
+ ieee_test (NAN);
return 0;
}
#endif
diff --git a/contrib/binutils/libiberty/functions.texi b/contrib/binutils/libiberty/functions.texi
index b518243..aac4424 100644
--- a/contrib/binutils/libiberty/functions.texi
+++ b/contrib/binutils/libiberty/functions.texi
@@ -3,6 +3,28 @@
@c Edit the *.c files, configure with --enable-maintainer-mode,
@c and let gather-docs build you a new copy.
+@c safe-ctype.c:24
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC. (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
@c alloca.c:26
@deftypefn Replacement void* alloca (size_t @var{size})
@@ -29,7 +51,7 @@ pass a pointer to a pointer. This function will compute the size of
the buffer needed, allocate memory with @code{malloc}, and store a
pointer to the allocated memory in @code{*@var{resptr}}. The value
returned is the same as @code{sprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
+not be allocated, minus one is returned and @code{NULL} is stored in
@code{*@var{resptr}}.
@end deftypefn
@@ -276,7 +298,7 @@ itself.
@end deftypefn
-@c getruntime.c:78
+@c getruntime.c:82
@deftypefn Replacement long get_run_time (void)
Returns the time used so far, in microseconds. If possible, this is
@@ -317,16 +339,17 @@ between calls to @code{getpwd}.
@end deftypefn
-@c hex.c:25
+@c hex.c:30
@deftypefn Extension void hex_init (void)
Initializes the array mapping the current character set to
corresponding hex values. This function must be called before any
-call to @code{hex_p} or @code{hex_value}.
+call to @code{hex_p} or @code{hex_value}. If you fail to call it, a
+default ASCII-based table will normally be used on ASCII systems.
@end deftypefn
-@c hex.c:33
+@c hex.c:39
@deftypefn Extension int hex_p (int @var{c})
Evaluates to non-zero if the given character is a valid hex character,
@@ -335,14 +358,20 @@ or zero if it is not. Note that the value you pass will be cast to
@end deftypefn
-@c hex.c:41
-@deftypefn Extension int hex_value (int @var{c})
+@c hex.c:47
+@deftypefn Extension unsigned int hex_value (int @var{c})
Returns the numeric equivalent of the given character when interpreted
as a hexidecimal digit. The result is undefined if you pass an
invalid hex digit. Note that the value you pass will be cast to
@code{unsigned char} within the macro.
+The @code{hex_value} macro returns @code{unsigned int}, rather than
+signed @code{int}, to make it easier to use in parsing addresses from
+hex dump files: a signed @code{int} would be sign-extended when
+converted to a wider unsigned type --- like @code{bfd_vma}, on some
+systems.
+
@end deftypefn
@c index.c:5
@@ -375,6 +404,78 @@ struct qelem @{
@end deftypefn
+@c safe-ctype.c:45
+@deffn Extension ISALPHA (@var{c})
+@deffnx Extension ISALNUM (@var{c})
+@deffnx Extension ISBLANK (@var{c})
+@deffnx Extension ISCNTRL (@var{c})
+@deffnx Extension ISDIGIT (@var{c})
+@deffnx Extension ISGRAPH (@var{c})
+@deffnx Extension ISLOWER (@var{c})
+@deffnx Extension ISPRINT (@var{c})
+@deffnx Extension ISPUNCT (@var{c})
+@deffnx Extension ISSPACE (@var{c})
+@deffnx Extension ISUPPER (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}. Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}. For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others. However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA} @tab @kbd{A-Za-z}
+@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
+@item @code{BLANK} @tab @kbd{space tab}
+@item @code{CNTRL} @tab @code{!PRINT}
+@item @code{DIGIT} @tab @kbd{0-9}
+@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
+@item @code{LOWER} @tab @kbd{a-z}
+@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER} @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@c safe-ctype.c:94
+@deffn Extension ISIDNUM (@var{c})
+@deffnx Extension ISIDST (@var{c})
+@deffnx Extension IS_VSPACE (@var{c})
+@deffnx Extension IS_NVSPACE (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages. They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
+@item @code{IDST} @tab @kbd{A-Za-z_}
+@item @code{VSPACE} @tab @kbd{\r \n}
+@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
@c lbasename.c:23
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
@@ -391,6 +492,41 @@ and a path ending in @code{/} returns the empty string after it.
@end deftypefn
+@c lrealpath.c:25
+@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
+
+Given a pointer to a string containing a pathname, returns a canonical
+version of the filename. Symlinks will be resolved, and ``.'' and ``..''
+components will be simplified. The returned value will be allocated using
+@code{malloc}, or @code{NULL} will be returned on a memory allocation error.
+
+@end deftypefn
+
+@c make-relative-prefix.c:24
+@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
+
+Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
+return the path that is in the same position relative to
+@var{progname}'s directory as @var{prefix} is relative to
+@var{bin_prefix}. That is, a string starting with the directory
+portion of @var{progname}, followed by a relative pathname of the
+difference between @var{bin_prefix} and @var{prefix}.
+
+If @var{progname} does not contain any directory separators,
+@code{make_relative_prefix} will search @env{PATH} to find a program
+named @var{progname}. Also, if @var{progname} is a symbolic link,
+the symbolic link will be resolved.
+
+For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
+@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
+@code{/red/green/blue/gcc}, then this function will return
+@code{/red/green/blue/../../omega/}.
+
+The return value is normally allocated via @code{malloc}. If no
+relative prefix can be found, return @code{NULL}.
+
+@end deftypefn
+
@c make-temp-file.c:138
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
@@ -440,6 +576,14 @@ Copies @var{count} bytes from memory area @var{from} to memory area
@end deftypefn
+@c mempcpy.c:23
+@deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
+
+Copies @var{length} bytes from memory region @var{in} to region
+@var{out}. Returns a pointer to @var{out} + @var{length}.
+
+@end deftypefn
+
@c memset.c:6
@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
@@ -466,7 +610,7 @@ reading and writing.
@end deftypefn
-@c pexecute.c:67
+@c pexecute.txh:1
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
Executes a program.
@@ -481,14 +625,15 @@ use if needed. This is currently only needed for MS-DOS ports that
don't use @code{go32} (do any still exist?). Ports that don't need it
can pass @code{NULL}.
-(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
-(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
-PEXECUTE_FIRST}) is nonzero for the first process in chain.
-(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
-in chain. The first/last flags could be simplified to only mark the
-last of a chain of processes but that requires the caller to always
-mark the last one (and not give up early if some error occurs).
-It's more robust to require the caller to mark both ends of the chain.
+(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH}
+should be searched (??? It's not clear that GCC passes this flag
+correctly). (@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the
+first process in chain. (@code{@var{flags} & PEXECUTE_FIRST}) is
+nonzero for the last process in chain. The first/last flags could be
+simplified to only mark the last of a chain of processes but that
+requires the caller to always mark the last one (and not give up
+early if some error occurs). It's more robust to require the caller
+to mark both ends of the chain.
The result is the pid on systems like Unix where we
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
@@ -523,21 +668,23 @@ name is unset/removed.
@end deftypefn
-@c pexecute.c:104
+@c pexecute.txh:39
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
Waits for a program started by @code{pexecute} to finish.
@var{pid} is the process id of the task to wait for. @var{status} is
-the `status' argument to wait. @var{flags} is currently unused (allows
-future enhancement without breaking upward compatibility). Pass 0 for now.
+the `status' argument to wait. @var{flags} is currently unused
+(allows future enhancement without breaking upward compatibility).
+Pass 0 for now.
The result is the pid of the child reaped, or -1 for failure
(@code{errno} says why).
-On systems that don't support waiting for a particular child, @var{pid} is
-ignored. On systems like MS-DOS that don't really multitask @code{pwait}
-is just a mechanism to provide a consistent interface for the caller.
+On systems that don't support waiting for a particular child,
+@var{pid} is ignored. On systems like MS-DOS that don't really
+multitask @code{pwait} is just a mechanism to provide a consistent
+interface for the caller.
@end deftypefn
@@ -626,6 +773,19 @@ be the value @code{1}).
@end deftypefn
+@c snprintf.c:28
+@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...)
+
+This function is similar to sprintf, but it will print at most @var{n}
+characters. On error the return value is -1, otherwise it returns the
+number of characters that would have been printed had @var{n} been
+sufficiently large, regardless of the actual value of @var{n}. Note
+some pre-C99 system libraries do not implement this correctly so users
+cannot generally rely on the return value if the system version of
+this function is used.
+
+@end deftypefn
+
@c spaces.c:22
@deftypefn Extension char* spaces (int @var{count})
@@ -635,6 +795,24 @@ valid until at least the next call.
@end deftypefn
+@c stpcpy.c:23
+@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src})
+
+Copies the string @var{src} into @var{dst}. Returns a pointer to
+@var{dst} + strlen(@var{src}).
+
+@end deftypefn
+
+@c stpncpy.c:23
+@deftypefn Supplemental char* stpncpy (char *@var{dst}, const char *@var{src}, size_t @var{len})
+
+Copies the string @var{src} into @var{dst}, copying exactly @var{len}
+and padding with zeros if necessary. If @var{len} < strlen(@var{src})
+then return @var{dst} + @var{len}, otherwise returns @var{dst} +
+strlen(@var{src}).
+
+@end deftypefn
+
@c strcasecmp.c:15
@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
@@ -838,7 +1016,7 @@ you pass a pointer to a pointer. This function will compute the size
of the buffer needed, allocate memory with @code{malloc}, and store a
pointer to the allocated memory in @code{*@var{resptr}}. The value
returned is the same as @code{vsprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
+not be allocated, minus one is returned and @code{NULL} is stored in
@code{*@var{resptr}}.
@end deftypefn
@@ -864,6 +1042,19 @@ nonstandard but common function @code{_doprnt}.
@end deftypefn
+@c vsnprintf.c:28
+@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap})
+
+This function is similar to vsprintf, but it will print at most
+@var{n} characters. On error the return value is -1, otherwise it
+returns the number of characters that would have been printed had
+@var{n} been sufficiently large, regardless of the actual value of
+@var{n}. Note some pre-C99 system libraries do not implement this
+correctly so users cannot generally rely on the return value if the
+system version of this function is used.
+
+@end deftypefn
+
@c waitpid.c:3
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
diff --git a/contrib/binutils/libiberty/getcwd.c b/contrib/binutils/libiberty/getcwd.c
index 465b4e0..a19d267 100644
--- a/contrib/binutils/libiberty/getcwd.c
+++ b/contrib/binutils/libiberty/getcwd.c
@@ -40,7 +40,7 @@ extern int errno;
char *
getcwd (buf, len)
char *buf;
- int len;
+ size_t len;
{
char ourbuf[MAXPATHLEN];
char *result;
diff --git a/contrib/binutils/libiberty/getopt.c b/contrib/binutils/libiberty/getopt.c
new file mode 100644
index 0000000..a1e4827
--- /dev/null
+++ b/contrib/binutils/libiberty/getopt.c
@@ -0,0 +1,1056 @@
+/* Getopt for GNU.
+ NOTE: getopt is now part of the C library, so if you don't know what
+ "Keep this file name-space clean" means, talk to drepper@gnu.org
+ before changing it!
+
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
+ Free Software Foundation, Inc.
+
+ NOTE: This source is derived from an old version taken from the GNU C
+ Library (glibc).
+
+ This program 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, or (at your option) any
+ later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+ Ditto for AIX 3.2 and <stdlib.h>. */
+#ifndef _NO_PROTO
+# define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+ reject `defined (const)'. */
+# ifndef const
+# define const
+# endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+# define ELIDE_CODE
+# endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+ contain conflicting prototypes for getopt. */
+# include <stdlib.h>
+# include <unistd.h>
+#endif /* GNU C library. */
+
+#ifdef VMS
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+# include <string.h>
+# endif
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+ When compiling libc, the _ macro is predefined. */
+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+# else
+# define _(msgid) (msgid)
+# endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+ but it behaves differently for the user, since it allows the user
+ to intersperse the options with the other arguments.
+
+ As `getopt' works, it permutes the elements of ARGV so that,
+ when it is done, all the options precede everything else. Thus
+ all application programs are extended to handle flexible argument order.
+
+ Setting the environment variable POSIXLY_CORRECT disables permutation.
+ Then the behavior is completely standard.
+
+ GNU application programs can use a third alternative mode in which
+ they can distinguish the relative order of options and other arguments. */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+char *optarg = NULL;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns -1, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+/* 1003.2 says this must be 1 before any call. */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+ causes problems with re-calling getopt as programs generally don't
+ know that. */
+
+int __getopt_initialized = 0;
+
+/* The next char to be scanned in the option-element
+ in which the last option character we returned was found.
+ This allows us to pick up the scan where we left off.
+
+ If this is zero, or a null string, it means resume the scan
+ by advancing to the next ARGV-element. */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+ for unrecognized options. */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+ This must be initialized on some systems to avoid linking in the
+ system's own getopt implementation. */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+ If the caller did not specify anything,
+ the default is REQUIRE_ORDER if the environment variable
+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+ REQUIRE_ORDER means don't recognize them as options;
+ stop option processing when the first non-option is seen.
+ This is what Unix does.
+ This mode of operation is selected by either setting the environment
+ variable POSIXLY_CORRECT, or using `+' as the first character
+ of the list of option characters.
+
+ PERMUTE is the default. We permute the contents of ARGV as we scan,
+ so that eventually all the non-options are at the end. This allows options
+ to be given in any order, even with programs that were not written to
+ expect this.
+
+ RETURN_IN_ORDER is an option available to programs that were written
+ to expect options and other ARGV-elements in any order and that care about
+ the ordering of the two. We describe each non-option ARGV-element
+ as if it were the argument of an option with character code 1.
+ Using `-' as the first character of the list of option characters
+ selects this mode of operation.
+
+ The special argument `--' forces an end of option-scanning regardless
+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
+
+static enum
+{
+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable. */
+static char *posixly_correct;
+
+#ifdef __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+ because there are many ways it can cause trouble.
+ On some systems, it contains special magic macros that don't work
+ in GCC. */
+# include <string.h>
+# define my_index strchr
+#else
+
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# if HAVE_STRINGS_H
+# include <strings.h>
+# endif
+# endif
+
+/* Avoid depending on library functions or files
+ whose names are inconsistent. */
+
+#ifndef getenv
+extern char *getenv ();
+#endif
+
+static char *
+my_index (str, chr)
+ const char *str;
+ int chr;
+{
+ while (*str)
+ {
+ if (*str == chr)
+ return (char *) str;
+ str++;
+ }
+ return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+ If not using GCC, it is ok not to declare it. */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+ That was relevant to code that was here before. */
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
+/* gcc with -traditional declares the built-in strlen to return int,
+ and has done so at least since version 2.4.5. -- rms. */
+extern int strlen (const char *);
+# endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+
+/* Handle permutation of arguments. */
+
+/* Describe the part of ARGV that contains non-options that have
+ been skipped. `first_nonopt' is the index in ARGV of the first of them;
+ `last_nonopt' is the index after the last of them. */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Bash 2.0 gives us an environment variable containing flags
+ indicating ARGV elements that should not be considered arguments. */
+
+/* Defined in getopt_init.c */
+extern char *__getopt_nonoption_flags;
+
+static int nonoption_flags_max_len;
+static int nonoption_flags_len;
+
+static int original_argc;
+static char *const *original_argv;
+
+/* Make sure the environment variable bash 2.0 puts in the environment
+ is valid for the getopt call we must make sure that the ARGV passed
+ to getopt is that one passed to the process. */
+static void
+__attribute__ ((unused))
+store_args_and_env (int argc, char *const *argv)
+{
+ /* XXX This is no good solution. We should rather copy the args so
+ that we can compare them later. But we must not use malloc(3). */
+ original_argc = argc;
+ original_argv = argv;
+}
+# ifdef text_set_element
+text_set_element (__libc_subinit, store_args_and_env);
+# endif /* text_set_element */
+
+# define SWAP_FLAGS(ch1, ch2) \
+ if (nonoption_flags_len > 0) \
+ { \
+ char __tmp = __getopt_nonoption_flags[ch1]; \
+ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
+ __getopt_nonoption_flags[ch2] = __tmp; \
+ }
+#else /* !_LIBC */
+# define SWAP_FLAGS(ch1, ch2)
+#endif /* _LIBC */
+
+/* Exchange two adjacent subsequences of ARGV.
+ One subsequence is elements [first_nonopt,last_nonopt)
+ which contains all the non-options that have been skipped so far.
+ The other is elements [last_nonopt,optind), which contains all
+ the options processed since those non-options were skipped.
+
+ `first_nonopt' and `last_nonopt' are relocated so that they describe
+ the new indices of the non-options in ARGV after they are moved. */
+
+#if defined __STDC__ && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+ char **argv;
+{
+ int bottom = first_nonopt;
+ int middle = last_nonopt;
+ int top = optind;
+ char *tem;
+
+ /* Exchange the shorter segment with the far end of the longer segment.
+ That puts the shorter segment into the right place.
+ It leaves the longer segment in the right place overall,
+ but it consists of two parts that need to be swapped next. */
+
+#ifdef _LIBC
+ /* First make sure the handling of the `__getopt_nonoption_flags'
+ string can work normally. Our top argument must be in the range
+ of the string. */
+ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
+ {
+ /* We must extend the array. The user plays games with us and
+ presents new arguments. */
+ char *new_str = malloc (top + 1);
+ if (new_str == NULL)
+ nonoption_flags_len = nonoption_flags_max_len = 0;
+ else
+ {
+ memset (mempcpy (new_str, __getopt_nonoption_flags,
+ nonoption_flags_max_len),
+ '\0', top + 1 - nonoption_flags_max_len);
+ nonoption_flags_max_len = top + 1;
+ __getopt_nonoption_flags = new_str;
+ }
+ }
+#endif
+
+ while (top > middle && middle > bottom)
+ {
+ if (top - middle > middle - bottom)
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
+
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
+ else
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
+
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ SWAP_FLAGS (bottom + i, middle + i);
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
+ }
+
+ /* Update records for the slots the non-options now occupy. */
+
+ first_nonopt += (optind - last_nonopt);
+ last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made. */
+
+#if defined __STDC__ && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+{
+ /* Start processing options with ARGV-element 1 (since ARGV-element 0
+ is the program name); the sequence of previously skipped
+ non-option ARGV-elements is empty. */
+
+ first_nonopt = last_nonopt = optind;
+
+ nextchar = NULL;
+
+ posixly_correct = getenv ("POSIXLY_CORRECT");
+
+ /* Determine how to handle the ordering of options and nonoptions. */
+
+ if (optstring[0] == '-')
+ {
+ ordering = RETURN_IN_ORDER;
+ ++optstring;
+ }
+ else if (optstring[0] == '+')
+ {
+ ordering = REQUIRE_ORDER;
+ ++optstring;
+ }
+ else if (posixly_correct != NULL)
+ ordering = REQUIRE_ORDER;
+ else
+ ordering = PERMUTE;
+
+#ifdef _LIBC
+ if (posixly_correct == NULL
+ && argc == original_argc && argv == original_argv)
+ {
+ if (nonoption_flags_max_len == 0)
+ {
+ if (__getopt_nonoption_flags == NULL
+ || __getopt_nonoption_flags[0] == '\0')
+ nonoption_flags_max_len = -1;
+ else
+ {
+ const char *orig_str = __getopt_nonoption_flags;
+ int len = nonoption_flags_max_len = strlen (orig_str);
+ if (nonoption_flags_max_len < argc)
+ nonoption_flags_max_len = argc;
+ __getopt_nonoption_flags =
+ (char *) malloc (nonoption_flags_max_len);
+ if (__getopt_nonoption_flags == NULL)
+ nonoption_flags_max_len = -1;
+ else
+ memset (mempcpy (__getopt_nonoption_flags, orig_str, len),
+ '\0', nonoption_flags_max_len - len);
+ }
+ }
+ nonoption_flags_len = nonoption_flags_max_len;
+ }
+ else
+ nonoption_flags_len = 0;
+#endif
+
+ return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+ given in OPTSTRING.
+
+ If an element of ARGV starts with '-', and is not exactly "-" or "--",
+ then it is an option element. The characters of this element
+ (aside from the initial '-') are option characters. If `getopt'
+ is called repeatedly, it returns successively each of the option characters
+ from each of the option elements.
+
+ If `getopt' finds another option character, it returns that character,
+ updating `optind' and `nextchar' so that the next call to `getopt' can
+ resume the scan with the following option character or ARGV-element.
+
+ If there are no more option characters, `getopt' returns -1.
+ Then `optind' is the index in ARGV of the first ARGV-element
+ that is not an option. (The ARGV-elements have been permuted
+ so that those that are not options now come last.)
+
+ OPTSTRING is a string containing the legitimate option characters.
+ If an option character is seen that is not listed in OPTSTRING,
+ return '?' after printing an error message. If you set `opterr' to
+ zero, the error message is suppressed but we still return '?'.
+
+ If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+ so the following text in the same ARGV-element, or the text of the following
+ ARGV-element, is returned in `optarg'. Two colons mean an option that
+ wants an optional arg; if there is text in the current ARGV-element,
+ it is returned in `optarg', otherwise `optarg' is set to zero.
+
+ If OPTSTRING starts with `-' or `+', it requests different methods of
+ handling the non-option ARGV-elements.
+ See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+ Long-named options begin with `--' instead of `-'.
+ Their names may be abbreviated as long as the abbreviation is unique
+ or is an exact match for some defined option. If they have an
+ argument, it follows the option name in the same ARGV-element, separated
+ from the option name by a `=', or else the in next ARGV-element.
+ When `getopt' finds a long-named option, it returns 0 if that option's
+ `flag' field is nonzero, the value of the option's `val' field
+ if the `flag' field is zero.
+
+ The elements of ARGV aren't really const, because we permute them.
+ But we pretend they're const in the prototype to be compatible
+ with other systems.
+
+ LONGOPTS is a vector of `struct option' terminated by an
+ element containing a name which is zero.
+
+ LONGIND returns the index in LONGOPT of the long-named option found.
+ It is only valid when a long-named option has been found by the most
+ recent call.
+
+ If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+ long-named options. */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+ const struct option *longopts;
+ int *longind;
+ int long_only;
+{
+ optarg = NULL;
+
+ if (optind == 0 || !__getopt_initialized)
+ {
+ if (optind == 0)
+ optind = 1; /* Don't scan ARGV[0], the program name. */
+ optstring = _getopt_initialize (argc, argv, optstring);
+ __getopt_initialized = 1;
+ }
+
+ /* Test whether ARGV[optind] points to a non-option argument.
+ Either it does not have option syntax, or there is an environment flag
+ from the shell indicating it is not an option. The later information
+ is only used when the used in the GNU libc. */
+#ifdef _LIBC
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
+ || (optind < nonoption_flags_len \
+ && __getopt_nonoption_flags[optind] == '1'))
+#else
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+ if (nextchar == NULL || *nextchar == '\0')
+ {
+ /* Advance to the next ARGV-element. */
+
+ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+ moved back by the user (who may also have changed the arguments). */
+ if (last_nonopt > optind)
+ last_nonopt = optind;
+ if (first_nonopt > optind)
+ first_nonopt = optind;
+
+ if (ordering == PERMUTE)
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
+
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
+
+ while (optind < argc && NONOPTION_P)
+ optind++;
+ last_nonopt = optind;
+ }
+
+ /* The special ARGV-element `--' means premature end of options.
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
+
+ if (optind != argc && !strcmp (argv[optind], "--"))
+ {
+ optind++;
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
+
+ optind = argc;
+ }
+
+ /* If we have done all the ARGV-elements, stop the scan
+ and back over any non-options that we skipped and permuted. */
+
+ if (optind == argc)
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return -1;
+ }
+
+ /* If we have come to a non-option and did not permute it,
+ either stop the scan or describe it to the caller and pass it by. */
+
+ if (NONOPTION_P)
+ {
+ if (ordering == REQUIRE_ORDER)
+ return -1;
+ optarg = argv[optind++];
+ return 1;
+ }
+
+ /* We have found another option-ARGV-element.
+ Skip the initial punctuation. */
+
+ nextchar = (argv[optind] + 1
+ + (longopts != NULL && argv[optind][1] == '-'));
+ }
+
+ /* Decode the current option-ARGV-element. */
+
+ /* Check whether the ARGV-element is a long option.
+
+ If long_only and the ARGV-element has the form "-f", where f is
+ a valid short option, don't consider it an abbreviated form of
+ a long option that starts with f. Otherwise there would be no
+ way to give the -f short option.
+
+ On the other hand, if there's a long option "fubar" and
+ the ARGV-element is "-fu", do consider that an abbreviation of
+ the long option, just like "--fu", and not "-f" with arg "u".
+
+ This distinction seems to be the most useful approach. */
+
+ if (longopts != NULL
+ && (argv[optind][1] == '-'
+ || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = -1;
+ int option_index;
+
+ for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar)
+ == (unsigned int) strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ optopt = 0;
+ return '?';
+ }
+
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+
+ nextchar += strlen (nextchar);
+
+ optopt = pfound->val;
+ return '?';
+ }
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ optopt = pfound->val;
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+
+ /* Can't find it as a long option. If this is not getopt_long_only,
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
+ if (!long_only || argv[optind][1] == '-'
+ || my_index (optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ optopt = 0;
+ return '?';
+ }
+ }
+
+ /* Look at and handle the next short option-character. */
+
+ {
+ char c = *nextchar++;
+ char *temp = my_index (optstring, c);
+
+ /* Increment `optind' when we start to process its last character. */
+ if (*nextchar == '\0')
+ ++optind;
+
+ if (temp == NULL || c == ':')
+ {
+ if (opterr)
+ {
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+ else
+ fprintf (stderr, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ return '?';
+ }
+ /* Convenience. Treat POSIX -W foo same as long option --foo */
+ if (temp[0] == 'W' && temp[1] == ';')
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = 0;
+ int option_index;
+
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ return c;
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+
+ /* optarg is now the argument, see if it's in the
+ table of longopts. */
+
+ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ return '?';
+ }
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+
+ nextchar += strlen (nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+ nextchar = NULL;
+ return 'W'; /* Let the application handle it. */
+ }
+ if (temp[1] == ':')
+ {
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = NULL;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
+ }
+ return c;
+ }
+}
+
+int
+getopt (argc, argv, optstring)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+{
+ return _getopt_internal (argc, argv, optstring,
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
+}
+
+#endif /* Not ELIDE_CODE. */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+ the above definition of `getopt'. */
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int c;
+ int digit_optind = 0;
+
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
+
+ c = getopt (argc, argv, "abc:d:0123456789");
+ if (c == -1)
+ break;
+
+ switch (c)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
+
+ if (optind < argc)
+ {
+ printf ("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf ("%s ", argv[optind++]);
+ printf ("\n");
+ }
+
+ exit (0);
+}
+
+#endif /* TEST */
diff --git a/contrib/binutils/libiberty/getopt1.c b/contrib/binutils/libiberty/getopt1.c
new file mode 100644
index 0000000..a3637c2
--- /dev/null
+++ b/contrib/binutils/libiberty/getopt1.c
@@ -0,0 +1,190 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+ Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+ Free Software Foundation, Inc.
+
+ NOTE: This source is derived from an old version taken from the GNU C
+ Library (glibc).
+
+ This program 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, or (at your option) any
+ later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "getopt.h"
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+ reject `defined (const)'. */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+ int argc;
+ char *const *argv;
+ const char *options;
+ const struct option *long_options;
+ int *opt_index;
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+ If an option that starts with '-' (not '--') doesn't match a long option,
+ but does match a short option, it is parsed as a short option
+ instead. */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+ int argc;
+ char *const *argv;
+ const char *options;
+ const struct option *long_options;
+ int *opt_index;
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif /* Not ELIDE_CODE. */
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int c;
+ int digit_optind = 0;
+
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+ static struct option long_options[] =
+ {
+ {"add", 1, 0, 0},
+ {"append", 0, 0, 0},
+ {"delete", 1, 0, 0},
+ {"verbose", 0, 0, 0},
+ {"create", 0, 0, 0},
+ {"file", 1, 0, 0},
+ {0, 0, 0, 0}
+ };
+
+ c = getopt_long (argc, argv, "abc:d:0123456789",
+ long_options, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c)
+ {
+ case 0:
+ printf ("option %s", long_options[option_index].name);
+ if (optarg)
+ printf (" with arg %s", optarg);
+ printf ("\n");
+ break;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case 'd':
+ printf ("option d with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
+
+ if (optind < argc)
+ {
+ printf ("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf ("%s ", argv[optind++]);
+ printf ("\n");
+ }
+
+ exit (0);
+}
+
+#endif /* TEST */
diff --git a/contrib/binutils/libiberty/getpwd.c b/contrib/binutils/libiberty/getpwd.c
index f508b1e..31c7d20 100644
--- a/contrib/binutils/libiberty/getpwd.c
+++ b/contrib/binutils/libiberty/getpwd.c
@@ -35,6 +35,9 @@ extern int errno;
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
/* Prototype these in case the system headers don't provide them. */
extern char *getpwd ();
diff --git a/contrib/binutils/libiberty/hashtab.c b/contrib/binutils/libiberty/hashtab.c
index 6bf59ff..231fbc0 100644
--- a/contrib/binutils/libiberty/hashtab.c
+++ b/contrib/binutils/libiberty/hashtab.c
@@ -1,5 +1,5 @@
/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This file is part of the libiberty library.
@@ -45,6 +45,10 @@ Boston, MA 02111-1307, USA. */
#include <string.h>
#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
#include <stdio.h>
#include "libiberty.h"
@@ -191,6 +195,63 @@ htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
return result;
}
+/* As above, but use the variants of alloc_f and free_f which accept
+ an extra argument. */
+
+htab_t
+htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f,
+ free_f)
+ size_t size;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ PTR alloc_arg;
+ htab_alloc_with_arg alloc_f;
+ htab_free_with_arg free_f;
+{
+ htab_t result;
+
+ size = higher_prime_number (size);
+ result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab));
+ if (result == NULL)
+ return NULL;
+ result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR));
+ if (result->entries == NULL)
+ {
+ if (free_f != NULL)
+ (*free_f) (alloc_arg, result);
+ return NULL;
+ }
+ result->size = size;
+ result->hash_f = hash_f;
+ result->eq_f = eq_f;
+ result->del_f = del_f;
+ result->alloc_arg = alloc_arg;
+ result->alloc_with_arg_f = alloc_f;
+ result->free_with_arg_f = free_f;
+ return result;
+}
+
+/* Update the function pointers and allocation parameter in the htab_t. */
+
+void
+htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
+ htab_t htab;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+ PTR alloc_arg;
+ htab_alloc_with_arg alloc_f;
+ htab_free_with_arg free_f;
+{
+ htab->hash_f = hash_f;
+ htab->eq_f = eq_f;
+ htab->del_f = del_f;
+ htab->alloc_arg = alloc_arg;
+ htab->alloc_with_arg_f = alloc_f;
+ htab->free_with_arg_f = free_f;
+}
+
/* These functions exist solely for backward compatibility. */
#undef htab_create
@@ -234,6 +295,11 @@ htab_delete (htab)
(*htab->free_f) (htab->entries);
(*htab->free_f) (htab);
}
+ else if (htab->free_with_arg_f != NULL)
+ {
+ (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries);
+ (*htab->free_with_arg_f) (htab->alloc_arg, htab);
+ }
}
/* This function clears all entries in the given hash table. */
@@ -306,16 +372,29 @@ htab_expand (htab)
PTR *olimit;
PTR *p;
PTR *nentries;
+ size_t nsize;
oentries = htab->entries;
olimit = oentries + htab->size;
- htab->size = higher_prime_number (htab->size * 2);
-
- nentries = (PTR *) (*htab->alloc_f) (htab->size, sizeof (PTR *));
+ /* Resize only when table after removal of unused elements is either
+ too full or too empty. */
+ if ((htab->n_elements - htab->n_deleted) * 2 > htab->size
+ || ((htab->n_elements - htab->n_deleted) * 8 < htab->size
+ && htab->size > 32))
+ nsize = higher_prime_number ((htab->n_elements - htab->n_deleted) * 2);
+ else
+ nsize = htab->size;
+
+ if (htab->alloc_with_arg_f != NULL)
+ nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
+ sizeof (PTR *));
+ else
+ nentries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *));
if (nentries == NULL)
return 0;
htab->entries = nentries;
+ htab->size = nsize;
htab->n_elements -= htab->n_deleted;
htab->n_deleted = 0;
@@ -338,6 +417,8 @@ htab_expand (htab)
if (htab->free_f != NULL)
(*htab->free_f) (oentries);
+ else if (htab->free_with_arg_f != NULL)
+ (*htab->free_with_arg_f) (htab->alloc_arg, oentries);
return 1;
}
@@ -454,14 +535,14 @@ htab_find_slot_with_hash (htab, element, hash, insert)
if (insert == NO_INSERT)
return NULL;
- htab->n_elements++;
-
if (first_deleted_slot)
{
+ htab->n_deleted--;
*first_deleted_slot = EMPTY_ENTRY;
return first_deleted_slot;
}
+ htab->n_elements++;
return &htab->entries[index];
}
@@ -526,13 +607,16 @@ htab_clear_slot (htab, slot)
argument. */
void
-htab_traverse (htab, callback, info)
+htab_traverse_noresize (htab, callback, info)
htab_t htab;
htab_trav callback;
PTR info;
{
- PTR *slot = htab->entries;
- PTR *limit = slot + htab->size;
+ PTR *slot;
+ PTR *limit;
+
+ slot = htab->entries;
+ limit = slot + htab->size;
do
{
@@ -545,6 +629,21 @@ htab_traverse (htab, callback, info)
while (++slot < limit);
}
+/* Like htab_traverse_noresize, but does resize the table when it is
+ too empty to improve effectivity of subsequent calls. */
+
+void
+htab_traverse (htab, callback, info)
+ htab_t htab;
+ htab_trav callback;
+ PTR info;
+{
+ if ((htab->n_elements - htab->n_deleted) * 8 < htab->size)
+ htab_expand (htab);
+
+ htab_traverse_noresize (htab, callback, info);
+}
+
/* Return the current size of given hash table. */
size_t
@@ -614,3 +713,141 @@ htab_hash_string (p)
return r;
}
+
+/* DERIVED FROM:
+--------------------------------------------------------------------
+lookup2.c, by Bob Jenkins, December 1996, Public Domain.
+hash(), hash2(), hash3, and mix() are externally useful functions.
+Routines to test the hash are included if SELF_TEST is defined.
+You can use this free for any purpose. It has no warranty.
+--------------------------------------------------------------------
+*/
+
+/*
+--------------------------------------------------------------------
+mix -- mix 3 32-bit values reversibly.
+For every delta with one or two bit set, and the deltas of all three
+ high bits or all three low bits, whether the original value of a,b,c
+ is almost all zero or is uniformly distributed,
+* If mix() is run forward or backward, at least 32 bits in a,b,c
+ have at least 1/4 probability of changing.
+* If mix() is run forward, every bit of c will change between 1/3 and
+ 2/3 of the time. (Well, 22/100 and 78/100 for some 2-bit deltas.)
+mix() was built out of 36 single-cycle latency instructions in a
+ structure that could supported 2x parallelism, like so:
+ a -= b;
+ a -= c; x = (c>>13);
+ b -= c; a ^= x;
+ b -= a; x = (a<<8);
+ c -= a; b ^= x;
+ c -= b; x = (b>>13);
+ ...
+ Unfortunately, superscalar Pentiums and Sparcs can't take advantage
+ of that parallelism. They've also turned some of those single-cycle
+ latency instructions into multi-cycle latency instructions. Still,
+ this is the fastest good hash I could find. There were about 2^^68
+ to choose from. I only looked at a billion or so.
+--------------------------------------------------------------------
+*/
+/* same, but slower, works on systems that might have 8 byte hashval_t's */
+#define mix(a,b,c) \
+{ \
+ a -= b; a -= c; a ^= (c>>13); \
+ b -= c; b -= a; b ^= (a<< 8); \
+ c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \
+ a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \
+ b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \
+ c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \
+ a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \
+ b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \
+ c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \
+}
+
+/*
+--------------------------------------------------------------------
+hash() -- hash a variable-length key into a 32-bit value
+ k : the key (the unaligned variable-length array of bytes)
+ len : the length of the key, counting by bytes
+ level : can be any 4-byte value
+Returns a 32-bit value. Every bit of the key affects every bit of
+the return value. Every 1-bit and 2-bit delta achieves avalanche.
+About 36+6len instructions.
+
+The best hash table sizes are powers of 2. There is no need to do
+mod a prime (mod is sooo slow!). If you need less than 32 bits,
+use a bitmask. For example, if you need only 10 bits, do
+ h = (h & hashmask(10));
+In which case, the hash table should have hashsize(10) elements.
+
+If you are hashing n strings (ub1 **)k, do it like this:
+ for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h);
+
+By Bob Jenkins, 1996. bob_jenkins@burtleburtle.net. You may use this
+code any way you wish, private, educational, or commercial. It's free.
+
+See http://burtleburtle.net/bob/hash/evahash.html
+Use for hash table lookup, or anything where one collision in 2^32 is
+acceptable. Do NOT use for cryptographic purposes.
+--------------------------------------------------------------------
+*/
+
+hashval_t iterative_hash (k_in, length, initval)
+ const PTR k_in; /* the key */
+ register size_t length; /* the length of the key */
+ register hashval_t initval; /* the previous hash, or an arbitrary value */
+{
+ register const unsigned char *k = (const unsigned char *)k_in;
+ register hashval_t a,b,c,len;
+
+ /* Set up the internal state */
+ len = length;
+ a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
+ c = initval; /* the previous hash value */
+
+ /*---------------------------------------- handle most of the key */
+#ifndef WORDS_BIGENDIAN
+ /* On a little-endian machine, if the data is 4-byte aligned we can hash
+ by word for better speed. This gives nondeterministic results on
+ big-endian machines. */
+ if (sizeof (hashval_t) == 4 && (((size_t)k)&3) == 0)
+ while (len >= 12) /* aligned */
+ {
+ a += *(hashval_t *)(k+0);
+ b += *(hashval_t *)(k+4);
+ c += *(hashval_t *)(k+8);
+ mix(a,b,c);
+ k += 12; len -= 12;
+ }
+ else /* unaligned */
+#endif
+ while (len >= 12)
+ {
+ a += (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) +((hashval_t)k[3]<<24));
+ b += (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) +((hashval_t)k[7]<<24));
+ c += (k[8] +((hashval_t)k[9]<<8) +((hashval_t)k[10]<<16)+((hashval_t)k[11]<<24));
+ mix(a,b,c);
+ k += 12; len -= 12;
+ }
+
+ /*------------------------------------- handle the last 11 bytes */
+ c += length;
+ switch(len) /* all the case statements fall through */
+ {
+ case 11: c+=((hashval_t)k[10]<<24);
+ case 10: c+=((hashval_t)k[9]<<16);
+ case 9 : c+=((hashval_t)k[8]<<8);
+ /* the first byte of c is reserved for the length */
+ case 8 : b+=((hashval_t)k[7]<<24);
+ case 7 : b+=((hashval_t)k[6]<<16);
+ case 6 : b+=((hashval_t)k[5]<<8);
+ case 5 : b+=k[4];
+ case 4 : a+=((hashval_t)k[3]<<24);
+ case 3 : a+=((hashval_t)k[2]<<16);
+ case 2 : a+=((hashval_t)k[1]<<8);
+ case 1 : a+=k[0];
+ /* case 0: nothing left to add */
+ }
+ mix(a,b,c);
+ /*-------------------------------------------- report the result */
+ return c;
+}
diff --git a/contrib/binutils/libiberty/hex.c b/contrib/binutils/libiberty/hex.c
index 5f82292..e4c5dfa 100644
--- a/contrib/binutils/libiberty/hex.c
+++ b/contrib/binutils/libiberty/hex.c
@@ -19,6 +19,11 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h> /* for EOF */
#include "libiberty.h"
+#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
+
+#if EOF != -1
+ #error "hex.c requires EOF == -1"
+#endif
/*
@@ -39,13 +44,19 @@ or zero if it is not. Note that the value you pass will be cast to
@end deftypefn
-@deftypefn Extension int hex_value (int @var{c})
+@deftypefn Extension unsigned int hex_value (int @var{c})
Returns the numeric equivalent of the given character when interpreted
as a hexidecimal digit. The result is undefined if you pass an
invalid hex digit. Note that the value you pass will be cast to
@code{unsigned char} within the macro.
+The @code{hex_value} macro returns @code{unsigned int}, rather than
+signed @code{int}, to make it easier to use in parsing addresses from
+hex dump files: a signed @code{int} would be sign-extended when
+converted to a wider unsigned type --- like @code{bfd_vma}, on some
+systems.
+
@end deftypefn
@undocumented _hex_array_size
@@ -56,11 +67,9 @@ invalid hex digit. Note that the value you pass will be cast to
/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
-const char _hex_value[_hex_array_size] =
+const unsigned char _hex_value[_hex_array_size] =
{
_hex_bad, _hex_bad, _hex_bad, _hex_bad, /* NUL SOH STX ETX */
_hex_bad, _hex_bad, _hex_bad, _hex_bad, /* EOT ENQ ACK BEL */
@@ -139,7 +148,7 @@ const char _hex_value[_hex_array_size] =
#else
-char _hex_value[_hex_array_size];
+unsigned char _hex_value[_hex_array_size];
#endif /* not ASCII */
diff --git a/contrib/binutils/libiberty/lbasename.c b/contrib/binutils/libiberty/lbasename.c
index 43cb73f..200a87f 100644
--- a/contrib/binutils/libiberty/lbasename.c
+++ b/contrib/binutils/libiberty/lbasename.c
@@ -40,25 +40,7 @@ and a path ending in @code{/} returns the empty string after it.
#include "ansidecl.h"
#include "libiberty.h"
#include "safe-ctype.h"
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) \
- || defined (__DJGPP__) || defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif
+#include "filenames.h"
const char *
lbasename (name)
diff --git a/contrib/binutils/libiberty/libiberty.texi b/contrib/binutils/libiberty/libiberty.texi
index 4b60d6a..b57e3c5 100644
--- a/contrib/binutils/libiberty/libiberty.texi
+++ b/contrib/binutils/libiberty/libiberty.texi
@@ -29,7 +29,7 @@ This edition accompanies GCC 3, September 2001.
Copyright @copyright{} 2001 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
+ under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
@@ -58,7 +58,7 @@ notice identical to this one except for the removal of this paragraph
Copyright @copyright{} 2001 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
+ under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
diff --git a/contrib/binutils/libiberty/lrealpath.c b/contrib/binutils/libiberty/lrealpath.c
new file mode 100644
index 0000000..b001b38
--- /dev/null
+++ b/contrib/binutils/libiberty/lrealpath.c
@@ -0,0 +1,128 @@
+/* Libiberty realpath. Like realpath, but more consistent behavior.
+ Based on gdb_realpath from GDB.
+
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of the libiberty library.
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+
+@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
+
+Given a pointer to a string containing a pathname, returns a canonical
+version of the filename. Symlinks will be resolved, and ``.'' and ``..''
+components will be simplified. The returned value will be allocated using
+@code{malloc}, or @code{NULL} will be returned on a memory allocation error.
+
+@end deftypefn
+
+*/
+
+#include "config.h"
+#include "ansidecl.h"
+#include "libiberty.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */
+#if defined(HAVE_CANONICALIZE_FILE_NAME) \
+ && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME)
+extern char *canonicalize_file_name (const char *);
+#endif
+
+#if defined(HAVE_REALPATH)
+# if defined (PATH_MAX)
+# define REALPATH_LIMIT PATH_MAX
+# else
+# if defined (MAXPATHLEN)
+# define REALPATH_LIMIT MAXPATHLEN
+# endif
+# endif
+#endif
+
+char *
+lrealpath (filename)
+ const char *filename;
+{
+ /* Method 1: The system has a compile time upper bound on a filename
+ path. Use that and realpath() to canonicalize the name. This is
+ the most common case. Note that, if there isn't a compile time
+ upper bound, you want to avoid realpath() at all costs. */
+#if defined(REALPATH_LIMIT)
+ {
+ char buf[REALPATH_LIMIT];
+ const char *rp = realpath (filename, buf);
+ if (rp == NULL)
+ rp = filename;
+ return strdup (rp);
+ }
+#endif /* REALPATH_LIMIT */
+
+ /* Method 2: The host system (i.e., GNU) has the function
+ canonicalize_file_name() which malloc's a chunk of memory and
+ returns that, use that. */
+#if defined(HAVE_CANONICALIZE_FILE_NAME)
+ {
+ char *rp = canonicalize_file_name (filename);
+ if (rp == NULL)
+ return strdup (filename);
+ else
+ return rp;
+ }
+#endif
+
+ /* Method 3: Now we're getting desperate! The system doesn't have a
+ compile time buffer size and no alternative function. Query the
+ OS, using pathconf(), for the buffer limit. Care is needed
+ though, some systems do not limit PATH_MAX (return -1 for
+ pathconf()) making it impossible to pass a correctly sized buffer
+ to realpath() (it could always overflow). On those systems, we
+ skip this. */
+#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H)
+ {
+ /* Find out the max path size. */
+ long path_max = pathconf ("/", _PC_PATH_MAX);
+ if (path_max > 0)
+ {
+ /* PATH_MAX is bounded. */
+ char *buf, *rp, *ret;
+ buf = malloc (path_max);
+ if (buf == NULL)
+ return NULL;
+ rp = realpath (filename, buf);
+ ret = strdup (rp ? rp : filename);
+ free (buf);
+ return ret;
+ }
+ }
+#endif
+
+ /* This system is a lost cause, just duplicate the filename. */
+ return strdup (filename);
+}
diff --git a/contrib/binutils/libiberty/maint-tool b/contrib/binutils/libiberty/maint-tool
index ceeb48d..bfc5304 100644
--- a/contrib/binutils/libiberty/maint-tool
+++ b/contrib/binutils/libiberty/maint-tool
@@ -213,6 +213,12 @@ sub locals_first {
sub deps {
+ $crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n";
+ $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n";
+ $crule .= "\telse true; fi\n";
+ $crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n";
+ $crule .= "\n";
+
$incdir = shift @ARGV;
opendir(INC, $incdir);
@@ -223,6 +229,14 @@ sub deps {
}
$mine{'config.h'} = "config.h";
+ opendir(INC, $srcdir);
+ while ($f = readdir INC) {
+ next unless $f =~ /\.h$/;
+ $mine{$f} = "\$(srcdir)/$f";
+ $deps{$f} = join(' ', &deps_for("$srcdir/$f"));
+ }
+ $mine{'config.h'} = "config.h";
+
open(IN, "$srcdir/Makefile.in");
open(OUT, ">$srcdir/Makefile.tmp");
while (<IN>) {
@@ -252,10 +266,10 @@ sub deps {
@deps = sort { &locals_first($a,$b) } keys %scanned;
$obj = $f;
$obj =~ s/\.c$/.o/;
- $obj = "$obj:";
+ $obj = "./$obj:";
if ($#deps >= 0) {
- print OUT $obj;
- $len = length($obj);
+ print OUT "$obj \$(srcdir)/$f";
+ $len = length("$obj $f");
for $dt (@deps) {
$d = $mine{$dt};
if ($len + length($d) > 70) {
@@ -267,7 +281,12 @@ sub deps {
}
}
print OUT "\n";
+ } else {
+ print OUT "$obj \$(srcdir)/$f\n";
}
+ $c = $crule;
+ $c =~ s@\$\<@\$\(srcdir\)\/$f@g;
+ print OUT $c;
}
}
closedir(S);
diff --git a/contrib/binutils/libiberty/make-relative-prefix.c b/contrib/binutils/libiberty/make-relative-prefix.c
new file mode 100644
index 0000000..dc4f8d5
--- /dev/null
+++ b/contrib/binutils/libiberty/make-relative-prefix.c
@@ -0,0 +1,396 @@
+/* Relative (relocatable) prefix support.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of libiberty.
+
+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 2, 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 COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/*
+
+@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
+
+Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
+return the path that is in the same position relative to
+@var{progname}'s directory as @var{prefix} is relative to
+@var{bin_prefix}. That is, a string starting with the directory
+portion of @var{progname}, followed by a relative pathname of the
+difference between @var{bin_prefix} and @var{prefix}.
+
+If @var{progname} does not contain any directory separators,
+@code{make_relative_prefix} will search @env{PATH} to find a program
+named @var{progname}. Also, if @var{progname} is a symbolic link,
+the symbolic link will be resolved.
+
+For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
+@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
+@code{/red/green/blue/gcc}, then this function will return
+@code{/red/green/blue/../../omega/}.
+
+The return value is normally allocated via @code{malloc}. If no
+relative prefix can be found, return @code{NULL}.
+
+@end deftypefn
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+
+#include "ansidecl.h"
+#include "libiberty.h"
+
+#ifndef R_OK
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) \
+ || defined (__DJGPP__) || defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define HAVE_HOST_EXECUTABLE_SUFFIX
+# define HOST_EXECUTABLE_SUFFIX ".exe"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# define PATH_SEPARATOR ';'
+#else
+# define PATH_SEPARATOR ':'
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif
+
+#define DIR_UP ".."
+
+static char *save_string PARAMS ((const char *, int));
+static char **split_directories PARAMS ((const char *, int *));
+static void free_split_directories PARAMS ((char **));
+
+static char *
+save_string (s, len)
+ const char *s;
+ int len;
+{
+ char *result = malloc (len + 1);
+
+ memcpy (result, s, len);
+ result[len] = 0;
+ return result;
+}
+
+/* Split a filename into component directories. */
+
+static char **
+split_directories (name, ptr_num_dirs)
+ const char *name;
+ int *ptr_num_dirs;
+{
+ int num_dirs = 0;
+ char **dirs;
+ const char *p, *q;
+ int ch;
+
+ /* Count the number of directories. Special case MSDOS disk names as part
+ of the initial directory. */
+ p = name;
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ if (name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
+ {
+ p += 3;
+ num_dirs++;
+ }
+#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
+
+ while ((ch = *p++) != '\0')
+ {
+ if (IS_DIR_SEPARATOR (ch))
+ {
+ num_dirs++;
+ while (IS_DIR_SEPARATOR (*p))
+ p++;
+ }
+ }
+
+ dirs = (char **) malloc (sizeof (char *) * (num_dirs + 2));
+ if (dirs == NULL)
+ return NULL;
+
+ /* Now copy the directory parts. */
+ num_dirs = 0;
+ p = name;
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ if (name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
+ {
+ dirs[num_dirs++] = save_string (p, 3);
+ if (dirs[num_dirs - 1] == NULL)
+ {
+ free (dirs);
+ return NULL;
+ }
+ p += 3;
+ }
+#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
+
+ q = p;
+ while ((ch = *p++) != '\0')
+ {
+ if (IS_DIR_SEPARATOR (ch))
+ {
+ while (IS_DIR_SEPARATOR (*p))
+ p++;
+
+ dirs[num_dirs++] = save_string (q, p - q);
+ if (dirs[num_dirs - 1] == NULL)
+ {
+ dirs[num_dirs] = NULL;
+ free_split_directories (dirs);
+ return NULL;
+ }
+ q = p;
+ }
+ }
+
+ if (p - 1 - q > 0)
+ dirs[num_dirs++] = save_string (q, p - 1 - q);
+ dirs[num_dirs] = NULL;
+
+ if (dirs[num_dirs - 1] == NULL)
+ {
+ free_split_directories (dirs);
+ return NULL;
+ }
+
+ if (ptr_num_dirs)
+ *ptr_num_dirs = num_dirs;
+ return dirs;
+}
+
+/* Release storage held by split directories. */
+
+static void
+free_split_directories (dirs)
+ char **dirs;
+{
+ int i = 0;
+
+ while (dirs[i] != NULL)
+ free (dirs[i++]);
+
+ free ((char *) dirs);
+}
+
+/* Given three strings PROGNAME, BIN_PREFIX, PREFIX, return a string that gets
+ to PREFIX starting with the directory portion of PROGNAME and a relative
+ pathname of the difference between BIN_PREFIX and PREFIX.
+
+ For example, if BIN_PREFIX is /alpha/beta/gamma/gcc/delta, PREFIX is
+ /alpha/beta/gamma/omega/, and PROGNAME is /red/green/blue/gcc, then this
+ function will return /red/green/blue/../../omega/.
+
+ If no relative prefix can be found, return NULL. */
+
+char *
+make_relative_prefix (progname, bin_prefix, prefix)
+ const char *progname;
+ const char *bin_prefix;
+ const char *prefix;
+{
+ char **prog_dirs, **bin_dirs, **prefix_dirs;
+ int prog_num, bin_num, prefix_num;
+ int i, n, common;
+ int needed_len;
+ char *ret, *ptr, *full_progname = NULL;
+
+ if (progname == NULL || bin_prefix == NULL || prefix == NULL)
+ return NULL;
+
+ /* If there is no full pathname, try to find the program by checking in each
+ of the directories specified in the PATH environment variable. */
+ if (lbasename (progname) == progname)
+ {
+ char *temp;
+
+ temp = getenv ("PATH");
+ if (temp)
+ {
+ char *startp, *endp, *nstore;
+ size_t prefixlen = strlen (temp) + 1;
+ if (prefixlen < 2)
+ prefixlen = 2;
+
+ nstore = (char *) alloca (prefixlen + strlen (progname) + 1);
+
+ startp = endp = temp;
+ while (1)
+ {
+ if (*endp == PATH_SEPARATOR || *endp == 0)
+ {
+ if (endp == startp)
+ {
+ nstore[0] = '.';
+ nstore[1] = DIR_SEPARATOR;
+ nstore[2] = '\0';
+ }
+ else
+ {
+ strncpy (nstore, startp, endp - startp);
+ if (! IS_DIR_SEPARATOR (endp[-1]))
+ {
+ nstore[endp - startp] = DIR_SEPARATOR;
+ nstore[endp - startp + 1] = 0;
+ }
+ else
+ nstore[endp - startp] = 0;
+ }
+ strcat (nstore, progname);
+ if (! access (nstore, X_OK)
+#ifdef HAVE_HOST_EXECUTABLE_SUFFIX
+ || ! access (strcat (nstore, HOST_EXECUTABLE_SUFFIX), X_OK)
+#endif
+ )
+ {
+ progname = nstore;
+ break;
+ }
+
+ if (*endp == 0)
+ break;
+ endp = startp = endp + 1;
+ }
+ else
+ endp++;
+ }
+ }
+ }
+
+ full_progname = lrealpath (progname);
+ if (full_progname == NULL)
+ return NULL;
+
+ prog_dirs = split_directories (full_progname, &prog_num);
+ bin_dirs = split_directories (bin_prefix, &bin_num);
+ free (full_progname);
+ if (bin_dirs == NULL || prog_dirs == NULL)
+ return NULL;
+
+ /* Remove the program name from comparison of directory names. */
+ prog_num--;
+
+ /* If we are still installed in the standard location, we don't need to
+ specify relative directories. Also, if argv[0] still doesn't contain
+ any directory specifiers after the search above, then there is not much
+ we can do. */
+ if (prog_num == bin_num)
+ {
+ for (i = 0; i < bin_num; i++)
+ {
+ if (strcmp (prog_dirs[i], bin_dirs[i]) != 0)
+ break;
+ }
+
+ if (prog_num <= 0 || i == bin_num)
+ {
+ free_split_directories (prog_dirs);
+ free_split_directories (bin_dirs);
+ prog_dirs = bin_dirs = (char **) 0;
+ return NULL;
+ }
+ }
+
+ prefix_dirs = split_directories (prefix, &prefix_num);
+ if (prefix_dirs == NULL)
+ {
+ free_split_directories (prog_dirs);
+ free_split_directories (bin_dirs);
+ return NULL;
+ }
+
+ /* Find how many directories are in common between bin_prefix & prefix. */
+ n = (prefix_num < bin_num) ? prefix_num : bin_num;
+ for (common = 0; common < n; common++)
+ {
+ if (strcmp (bin_dirs[common], prefix_dirs[common]) != 0)
+ break;
+ }
+
+ /* If there are no common directories, there can be no relative prefix. */
+ if (common == 0)
+ {
+ free_split_directories (prog_dirs);
+ free_split_directories (bin_dirs);
+ free_split_directories (prefix_dirs);
+ return NULL;
+ }
+
+ /* Two passes: first figure out the size of the result string, and
+ then construct it. */
+ needed_len = 0;
+ for (i = 0; i < prog_num; i++)
+ needed_len += strlen (prog_dirs[i]);
+ needed_len += sizeof (DIR_UP) * (bin_num - common);
+ for (i = common; i < prefix_num; i++)
+ needed_len += strlen (prefix_dirs[i]);
+ needed_len += 1; /* Trailing NUL. */
+
+ ret = (char *) malloc (needed_len);
+ if (ret == NULL)
+ return NULL;
+
+ /* Build up the pathnames in argv[0]. */
+ *ret = '\0';
+ for (i = 0; i < prog_num; i++)
+ strcat (ret, prog_dirs[i]);
+
+ /* Now build up the ..'s. */
+ ptr = ret + strlen(ret);
+ for (i = common; i < bin_num; i++)
+ {
+ strcpy (ptr, DIR_UP);
+ ptr += sizeof (DIR_UP) - 1;
+ *(ptr++) = DIR_SEPARATOR;
+ }
+ *ptr = '\0';
+
+ /* Put in directories to move over to prefix. */
+ for (i = common; i < prefix_num; i++)
+ strcat (ret, prefix_dirs[i]);
+
+ free_split_directories (prog_dirs);
+ free_split_directories (bin_dirs);
+ free_split_directories (prefix_dirs);
+
+ return ret;
+}
diff --git a/contrib/binutils/libiberty/md5.c b/contrib/binutils/libiberty/md5.c
index 9450586..e458f2a 100644
--- a/contrib/binutils/libiberty/md5.c
+++ b/contrib/binutils/libiberty/md5.c
@@ -229,7 +229,7 @@ md5_process_bytes (buffer, len, ctx)
ctx->buflen = (left_over + add) & 63;
}
- buffer = (const char *) buffer + add;
+ buffer = (const void *) ((const char *) buffer + add);
len -= add;
}
@@ -237,7 +237,7 @@ md5_process_bytes (buffer, len, ctx)
if (len > 64)
{
md5_process_block (buffer, len & ~63, ctx);
- buffer = (const char *) buffer + (len & ~63);
+ buffer = (const void *) ((const char *) buffer + (len & ~63));
len &= 63;
}
@@ -269,7 +269,7 @@ md5_process_block (buffer, len, ctx)
struct md5_ctx *ctx;
{
md5_uint32 correct_words[16];
- const md5_uint32 *words = buffer;
+ const md5_uint32 *words = (const md5_uint32 *) buffer;
size_t nwords = len / sizeof (md5_uint32);
const md5_uint32 *endp = words + nwords;
md5_uint32 A = ctx->A;
@@ -343,68 +343,76 @@ md5_process_block (buffer, len, ctx)
in CORRECT_WORDS. Redefine the macro to take an additional first
argument specifying the function to use. */
#undef OP
-#define OP(f, a, b, c, d, k, s, T) \
+#define OP(a, b, c, d, k, s, T) \
do \
{ \
- a += f (b, c, d) + correct_words[k] + T; \
+ a += FX (b, c, d) + correct_words[k] + T; \
CYCLIC (a, s); \
a += b; \
} \
while (0)
+#define FX(b, c, d) FG (b, c, d)
+
/* Round 2. */
- OP (FG, A, B, C, D, 1, 5, (md5_uint32) 0xf61e2562);
- OP (FG, D, A, B, C, 6, 9, (md5_uint32) 0xc040b340);
- OP (FG, C, D, A, B, 11, 14, (md5_uint32) 0x265e5a51);
- OP (FG, B, C, D, A, 0, 20, (md5_uint32) 0xe9b6c7aa);
- OP (FG, A, B, C, D, 5, 5, (md5_uint32) 0xd62f105d);
- OP (FG, D, A, B, C, 10, 9, (md5_uint32) 0x02441453);
- OP (FG, C, D, A, B, 15, 14, (md5_uint32) 0xd8a1e681);
- OP (FG, B, C, D, A, 4, 20, (md5_uint32) 0xe7d3fbc8);
- OP (FG, A, B, C, D, 9, 5, (md5_uint32) 0x21e1cde6);
- OP (FG, D, A, B, C, 14, 9, (md5_uint32) 0xc33707d6);
- OP (FG, C, D, A, B, 3, 14, (md5_uint32) 0xf4d50d87);
- OP (FG, B, C, D, A, 8, 20, (md5_uint32) 0x455a14ed);
- OP (FG, A, B, C, D, 13, 5, (md5_uint32) 0xa9e3e905);
- OP (FG, D, A, B, C, 2, 9, (md5_uint32) 0xfcefa3f8);
- OP (FG, C, D, A, B, 7, 14, (md5_uint32) 0x676f02d9);
- OP (FG, B, C, D, A, 12, 20, (md5_uint32) 0x8d2a4c8a);
+ OP (A, B, C, D, 1, 5, (md5_uint32) 0xf61e2562);
+ OP (D, A, B, C, 6, 9, (md5_uint32) 0xc040b340);
+ OP (C, D, A, B, 11, 14, (md5_uint32) 0x265e5a51);
+ OP (B, C, D, A, 0, 20, (md5_uint32) 0xe9b6c7aa);
+ OP (A, B, C, D, 5, 5, (md5_uint32) 0xd62f105d);
+ OP (D, A, B, C, 10, 9, (md5_uint32) 0x02441453);
+ OP (C, D, A, B, 15, 14, (md5_uint32) 0xd8a1e681);
+ OP (B, C, D, A, 4, 20, (md5_uint32) 0xe7d3fbc8);
+ OP (A, B, C, D, 9, 5, (md5_uint32) 0x21e1cde6);
+ OP (D, A, B, C, 14, 9, (md5_uint32) 0xc33707d6);
+ OP (C, D, A, B, 3, 14, (md5_uint32) 0xf4d50d87);
+ OP (B, C, D, A, 8, 20, (md5_uint32) 0x455a14ed);
+ OP (A, B, C, D, 13, 5, (md5_uint32) 0xa9e3e905);
+ OP (D, A, B, C, 2, 9, (md5_uint32) 0xfcefa3f8);
+ OP (C, D, A, B, 7, 14, (md5_uint32) 0x676f02d9);
+ OP (B, C, D, A, 12, 20, (md5_uint32) 0x8d2a4c8a);
+
+#undef FX
+#define FX(b, c, d) FH (b, c, d)
/* Round 3. */
- OP (FH, A, B, C, D, 5, 4, (md5_uint32) 0xfffa3942);
- OP (FH, D, A, B, C, 8, 11, (md5_uint32) 0x8771f681);
- OP (FH, C, D, A, B, 11, 16, (md5_uint32) 0x6d9d6122);
- OP (FH, B, C, D, A, 14, 23, (md5_uint32) 0xfde5380c);
- OP (FH, A, B, C, D, 1, 4, (md5_uint32) 0xa4beea44);
- OP (FH, D, A, B, C, 4, 11, (md5_uint32) 0x4bdecfa9);
- OP (FH, C, D, A, B, 7, 16, (md5_uint32) 0xf6bb4b60);
- OP (FH, B, C, D, A, 10, 23, (md5_uint32) 0xbebfbc70);
- OP (FH, A, B, C, D, 13, 4, (md5_uint32) 0x289b7ec6);
- OP (FH, D, A, B, C, 0, 11, (md5_uint32) 0xeaa127fa);
- OP (FH, C, D, A, B, 3, 16, (md5_uint32) 0xd4ef3085);
- OP (FH, B, C, D, A, 6, 23, (md5_uint32) 0x04881d05);
- OP (FH, A, B, C, D, 9, 4, (md5_uint32) 0xd9d4d039);
- OP (FH, D, A, B, C, 12, 11, (md5_uint32) 0xe6db99e5);
- OP (FH, C, D, A, B, 15, 16, (md5_uint32) 0x1fa27cf8);
- OP (FH, B, C, D, A, 2, 23, (md5_uint32) 0xc4ac5665);
+ OP (A, B, C, D, 5, 4, (md5_uint32) 0xfffa3942);
+ OP (D, A, B, C, 8, 11, (md5_uint32) 0x8771f681);
+ OP (C, D, A, B, 11, 16, (md5_uint32) 0x6d9d6122);
+ OP (B, C, D, A, 14, 23, (md5_uint32) 0xfde5380c);
+ OP (A, B, C, D, 1, 4, (md5_uint32) 0xa4beea44);
+ OP (D, A, B, C, 4, 11, (md5_uint32) 0x4bdecfa9);
+ OP (C, D, A, B, 7, 16, (md5_uint32) 0xf6bb4b60);
+ OP (B, C, D, A, 10, 23, (md5_uint32) 0xbebfbc70);
+ OP (A, B, C, D, 13, 4, (md5_uint32) 0x289b7ec6);
+ OP (D, A, B, C, 0, 11, (md5_uint32) 0xeaa127fa);
+ OP (C, D, A, B, 3, 16, (md5_uint32) 0xd4ef3085);
+ OP (B, C, D, A, 6, 23, (md5_uint32) 0x04881d05);
+ OP (A, B, C, D, 9, 4, (md5_uint32) 0xd9d4d039);
+ OP (D, A, B, C, 12, 11, (md5_uint32) 0xe6db99e5);
+ OP (C, D, A, B, 15, 16, (md5_uint32) 0x1fa27cf8);
+ OP (B, C, D, A, 2, 23, (md5_uint32) 0xc4ac5665);
+
+#undef FX
+#define FX(b, c, d) FI (b, c, d)
/* Round 4. */
- OP (FI, A, B, C, D, 0, 6, (md5_uint32) 0xf4292244);
- OP (FI, D, A, B, C, 7, 10, (md5_uint32) 0x432aff97);
- OP (FI, C, D, A, B, 14, 15, (md5_uint32) 0xab9423a7);
- OP (FI, B, C, D, A, 5, 21, (md5_uint32) 0xfc93a039);
- OP (FI, A, B, C, D, 12, 6, (md5_uint32) 0x655b59c3);
- OP (FI, D, A, B, C, 3, 10, (md5_uint32) 0x8f0ccc92);
- OP (FI, C, D, A, B, 10, 15, (md5_uint32) 0xffeff47d);
- OP (FI, B, C, D, A, 1, 21, (md5_uint32) 0x85845dd1);
- OP (FI, A, B, C, D, 8, 6, (md5_uint32) 0x6fa87e4f);
- OP (FI, D, A, B, C, 15, 10, (md5_uint32) 0xfe2ce6e0);
- OP (FI, C, D, A, B, 6, 15, (md5_uint32) 0xa3014314);
- OP (FI, B, C, D, A, 13, 21, (md5_uint32) 0x4e0811a1);
- OP (FI, A, B, C, D, 4, 6, (md5_uint32) 0xf7537e82);
- OP (FI, D, A, B, C, 11, 10, (md5_uint32) 0xbd3af235);
- OP (FI, C, D, A, B, 2, 15, (md5_uint32) 0x2ad7d2bb);
- OP (FI, B, C, D, A, 9, 21, (md5_uint32) 0xeb86d391);
+ OP (A, B, C, D, 0, 6, (md5_uint32) 0xf4292244);
+ OP (D, A, B, C, 7, 10, (md5_uint32) 0x432aff97);
+ OP (C, D, A, B, 14, 15, (md5_uint32) 0xab9423a7);
+ OP (B, C, D, A, 5, 21, (md5_uint32) 0xfc93a039);
+ OP (A, B, C, D, 12, 6, (md5_uint32) 0x655b59c3);
+ OP (D, A, B, C, 3, 10, (md5_uint32) 0x8f0ccc92);
+ OP (C, D, A, B, 10, 15, (md5_uint32) 0xffeff47d);
+ OP (B, C, D, A, 1, 21, (md5_uint32) 0x85845dd1);
+ OP (A, B, C, D, 8, 6, (md5_uint32) 0x6fa87e4f);
+ OP (D, A, B, C, 15, 10, (md5_uint32) 0xfe2ce6e0);
+ OP (C, D, A, B, 6, 15, (md5_uint32) 0xa3014314);
+ OP (B, C, D, A, 13, 21, (md5_uint32) 0x4e0811a1);
+ OP (A, B, C, D, 4, 6, (md5_uint32) 0xf7537e82);
+ OP (D, A, B, C, 11, 10, (md5_uint32) 0xbd3af235);
+ OP (C, D, A, B, 2, 15, (md5_uint32) 0x2ad7d2bb);
+ OP (B, C, D, A, 9, 21, (md5_uint32) 0xeb86d391);
/* Add the starting values of the context. */
A += A_save;
diff --git a/contrib/binutils/libiberty/memchr.c b/contrib/binutils/libiberty/memchr.c
index f94bea0..3948125 100644
--- a/contrib/binutils/libiberty/memchr.c
+++ b/contrib/binutils/libiberty/memchr.c
@@ -15,7 +15,7 @@ returned.
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
diff --git a/contrib/binutils/libiberty/memcmp.c b/contrib/binutils/libiberty/memcmp.c
index d8d3997..92f2b6e 100644
--- a/contrib/binutils/libiberty/memcmp.c
+++ b/contrib/binutils/libiberty/memcmp.c
@@ -16,15 +16,17 @@ as if comparing unsigned char arrays.
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
int
-DEFUN(memcmp, (str1, str2, count),
- const PTR str1 AND const PTR str2 AND size_t count)
+memcmp (str1, str2, count)
+ const PTR str1;
+ const PTR str2;
+ size_t count;
{
register const unsigned char *s1 = (const unsigned char*)str1;
register const unsigned char *s2 = (const unsigned char*)str2;
diff --git a/contrib/binutils/libiberty/memcpy.c b/contrib/binutils/libiberty/memcpy.c
index 0f2bac7..5eece7a 100644
--- a/contrib/binutils/libiberty/memcpy.c
+++ b/contrib/binutils/libiberty/memcpy.c
@@ -13,14 +13,19 @@ Copies @var{length} bytes from memory region @var{in} to region
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
+void bcopy PARAMS((const void*, void*, size_t));
+
PTR
-DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length)
+memcpy (out, in, length)
+ PTR out;
+ const PTR in;
+ size_t length;
{
bcopy(in, out, length);
return out;
diff --git a/contrib/binutils/libiberty/memmove.c b/contrib/binutils/libiberty/memmove.c
index 3ec7320..00ac053 100644
--- a/contrib/binutils/libiberty/memmove.c
+++ b/contrib/binutils/libiberty/memmove.c
@@ -13,12 +13,14 @@ Copies @var{count} bytes from memory area @var{from} to memory area
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
+void bcopy PARAMS ((const void*, void*, size_t));
+
PTR
memmove (s1, s2, n)
PTR s1;
diff --git a/contrib/binutils/libiberty/memset.c b/contrib/binutils/libiberty/memset.c
index 489ca17..5119f85 100644
--- a/contrib/binutils/libiberty/memset.c
+++ b/contrib/binutils/libiberty/memset.c
@@ -13,15 +13,17 @@ Sets the first @var{count} bytes of @var{s} to the constant byte
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
PTR
-DEFUN(memset, (dest, val, len),
- PTR dest AND register int val AND register size_t len)
+memset (dest, val, len)
+ PTR dest;
+ register int val;
+ register size_t len;
{
register unsigned char *ptr = (unsigned char*)dest;
while (len-- > 0)
diff --git a/contrib/binutils/libiberty/physmem.c b/contrib/binutils/libiberty/physmem.c
new file mode 100644
index 0000000..f64e07c
--- /dev/null
+++ b/contrib/binutils/libiberty/physmem.c
@@ -0,0 +1,305 @@
+/* Calculate the size of physical memory.
+ Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+
+ This program 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, or (at your option)
+ any later version.
+
+ This program 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 this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Written by Paul Eggert. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_PSTAT_H
+# include <sys/pstat.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+# include <sys/sysmp.h>
+#endif
+
+#if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H
+# include <sys/sysinfo.h>
+# include <machine/hal_sysinfo.h>
+#endif
+
+#if HAVE_SYS_TABLE_H
+# include <sys/table.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+#if HAVE_SYS_SYSTEMCFG_H
+# include <sys/systemcfg.h>
+#endif
+
+#ifdef _WIN32
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* MEMORYSTATUSEX is missing from older windows headers, so define
+ a local replacement. */
+typedef struct
+{
+ DWORD dwLength;
+ DWORD dwMemoryLoad;
+ DWORDLONG ullTotalPhys;
+ DWORDLONG ullAvailPhys;
+ DWORDLONG ullTotalPageFile;
+ DWORDLONG ullAvailPageFile;
+ DWORDLONG ullTotalVirtual;
+ DWORDLONG ullAvailVirtual;
+ DWORDLONG ullAvailExtendedVirtual;
+} lMEMORYSTATUSEX;
+typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
+#endif
+
+#include "libiberty.h"
+
+/* Return the total amount of physical memory. */
+double
+physmem_total ()
+{
+#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
+ { /* This works on linux-gnu, solaris2 and cygwin. */
+ double pages = sysconf (_SC_PHYS_PAGES);
+ double pagesize = sysconf (_SC_PAGESIZE);
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC
+ { /* This works on hpux11. */
+ struct pst_static pss;
+ if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
+ {
+ double pages = pss.physical_memory;
+ double pagesize = pss.page_size;
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+ }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+ { /* This works on irix6. */
+ struct rminfo realmem;
+ if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+ {
+ double pagesize = sysconf (_SC_PAGESIZE);
+ double pages = realmem.physmem;
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+ }
+#endif
+
+#if HAVE_GETSYSINFO && defined GSI_PHYSMEM
+ { /* This works on Tru64 UNIX V4/5. */
+ int physmem;
+
+ if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem),
+ NULL, NULL, NULL) == 1)
+ {
+ double kbytes = physmem;
+
+ if (0 <= kbytes)
+ return kbytes * 1024.0;
+ }
+ }
+#endif
+
+#if HAVE_SYSCTL && defined HW_PHYSMEM
+ { /* This works on *bsd and darwin. */
+ unsigned int physmem;
+ size_t len = sizeof physmem;
+ static int mib[2] = { CTL_HW, HW_PHYSMEM };
+
+ if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
+ && len == sizeof (physmem))
+ return (double) physmem;
+ }
+#endif
+
+#if HAVE__SYSTEM_CONFIGURATION
+ /* This works on AIX 4.3.3+. */
+ return _system_configuration.physmem;
+#endif
+
+#if defined _WIN32
+ { /* this works on windows */
+ PFN_MS_EX pfnex;
+ HMODULE h = GetModuleHandle ("kernel32.dll");
+
+ if (!h)
+ return 0.0;
+
+ /* Use GlobalMemoryStatusEx if available. */
+ if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+ {
+ lMEMORYSTATUSEX lms_ex;
+ lms_ex.dwLength = sizeof lms_ex;
+ if (!pfnex (&lms_ex))
+ return 0.0;
+ return (double) lms_ex.ullTotalPhys;
+ }
+
+ /* Fall back to GlobalMemoryStatus which is always available.
+ but returns wrong results for physical memory > 4GB. */
+ else
+ {
+ MEMORYSTATUS ms;
+ GlobalMemoryStatus (&ms);
+ return (double) ms.dwTotalPhys;
+ }
+ }
+#endif
+
+ /* Return 0 if we can't determine the value. */
+ return 0;
+}
+
+/* Return the amount of physical memory available. */
+double
+physmem_available ()
+{
+#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
+ { /* This works on linux-gnu, solaris2 and cygwin. */
+ double pages = sysconf (_SC_AVPHYS_PAGES);
+ double pagesize = sysconf (_SC_PAGESIZE);
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
+ { /* This works on hpux11. */
+ struct pst_static pss;
+ struct pst_dynamic psd;
+ if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
+ && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0))
+ {
+ double pages = psd.psd_free;
+ double pagesize = pss.page_size;
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+ }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+ { /* This works on irix6. */
+ struct rminfo realmem;
+ if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+ {
+ double pagesize = sysconf (_SC_PAGESIZE);
+ double pages = realmem.availrmem;
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+ }
+#endif
+
+#if HAVE_TABLE && defined TBL_VMSTATS
+ { /* This works on Tru64 UNIX V4/5. */
+ struct tbl_vmstats vmstats;
+
+ if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1)
+ {
+ double pages = vmstats.free_count;
+ double pagesize = vmstats.pagesize;
+
+ if (0 <= pages && 0 <= pagesize)
+ return pages * pagesize;
+ }
+ }
+#endif
+
+#if HAVE_SYSCTL && defined HW_USERMEM
+ { /* This works on *bsd and darwin. */
+ unsigned int usermem;
+ size_t len = sizeof usermem;
+ static int mib[2] = { CTL_HW, HW_USERMEM };
+
+ if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0
+ && len == sizeof (usermem))
+ return (double) usermem;
+ }
+#endif
+
+#if defined _WIN32
+ { /* this works on windows */
+ PFN_MS_EX pfnex;
+ HMODULE h = GetModuleHandle ("kernel32.dll");
+
+ if (!h)
+ return 0.0;
+
+ /* Use GlobalMemoryStatusEx if available. */
+ if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+ {
+ lMEMORYSTATUSEX lms_ex;
+ lms_ex.dwLength = sizeof lms_ex;
+ if (!pfnex (&lms_ex))
+ return 0.0;
+ return (double) lms_ex.ullAvailPhys;
+ }
+
+ /* Fall back to GlobalMemoryStatus which is always available.
+ but returns wrong results for physical memory > 4GB */
+ else
+ {
+ MEMORYSTATUS ms;
+ GlobalMemoryStatus (&ms);
+ return (double) ms.dwAvailPhys;
+ }
+ }
+#endif
+
+ /* Guess 25% of physical memory. */
+ return physmem_total () / 4;
+}
+
+
+#if DEBUG
+
+# include <stdio.h>
+# include <stdlib.h>
+
+int
+main ()
+{
+ printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
+ exit (0);
+}
+
+#endif /* DEBUG */
+
+/*
+Local Variables:
+compile-command: "gcc -DDEBUG -DHAVE_CONFIG_H -I.. -g -O -Wall -W physmem.c"
+End:
+*/
diff --git a/contrib/binutils/libiberty/regex.c b/contrib/binutils/libiberty/regex.c
index a64cd562..522b0ee 100644
--- a/contrib/binutils/libiberty/regex.c
+++ b/contrib/binutils/libiberty/regex.c
@@ -2,7 +2,7 @@
version 0.12.
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
- Copyright (C) 1993-1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1993-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
routines with an "x" prefix so they do not collide with the native regex
routines or with other components regex routines. */
/* AIX requires this to be the first thing in the file. */
-#if defined _AIX && !defined REGEX_MALLOC
+#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
#pragma alloca
#endif
@@ -36,6 +36,8 @@
# include <config.h>
#endif
+#include <ansidecl.h>
+
#ifndef PARAMS
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
# define PARAMS(args) args
@@ -1373,80 +1375,26 @@ weak_alias (__re_set_syntax, re_set_syntax)
POSIX doesn't require that we do anything for REG_NOERROR,
but why not be nice? */
-static const char re_error_msgid[] =
+static const char *re_error_msgid[] =
{
-# define REG_NOERROR_IDX 0
- gettext_noop ("Success") /* REG_NOERROR */
- "\0"
-# define REG_NOMATCH_IDX (REG_NOERROR_IDX + sizeof "Success")
- gettext_noop ("No match") /* REG_NOMATCH */
- "\0"
-# define REG_BADPAT_IDX (REG_NOMATCH_IDX + sizeof "No match")
- gettext_noop ("Invalid regular expression") /* REG_BADPAT */
- "\0"
-# define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression")
- gettext_noop ("Invalid collation character") /* REG_ECOLLATE */
- "\0"
-# define REG_ECTYPE_IDX (REG_ECOLLATE_IDX + sizeof "Invalid collation character")
- gettext_noop ("Invalid character class name") /* REG_ECTYPE */
- "\0"
-# define REG_EESCAPE_IDX (REG_ECTYPE_IDX + sizeof "Invalid character class name")
- gettext_noop ("Trailing backslash") /* REG_EESCAPE */
- "\0"
-# define REG_ESUBREG_IDX (REG_EESCAPE_IDX + sizeof "Trailing backslash")
- gettext_noop ("Invalid back reference") /* REG_ESUBREG */
- "\0"
-# define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference")
- gettext_noop ("Unmatched [ or [^") /* REG_EBRACK */
- "\0"
-# define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [ or [^")
- gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */
- "\0"
-# define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(")
- gettext_noop ("Unmatched \\{") /* REG_EBRACE */
- "\0"
-# define REG_BADBR_IDX (REG_EBRACE_IDX + sizeof "Unmatched \\{")
- gettext_noop ("Invalid content of \\{\\}") /* REG_BADBR */
- "\0"
-# define REG_ERANGE_IDX (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}")
- gettext_noop ("Invalid range end") /* REG_ERANGE */
- "\0"
-# define REG_ESPACE_IDX (REG_ERANGE_IDX + sizeof "Invalid range end")
- gettext_noop ("Memory exhausted") /* REG_ESPACE */
- "\0"
-# define REG_BADRPT_IDX (REG_ESPACE_IDX + sizeof "Memory exhausted")
- gettext_noop ("Invalid preceding regular expression") /* REG_BADRPT */
- "\0"
-# define REG_EEND_IDX (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression")
- gettext_noop ("Premature end of regular expression") /* REG_EEND */
- "\0"
-# define REG_ESIZE_IDX (REG_EEND_IDX + sizeof "Premature end of regular expression")
- gettext_noop ("Regular expression too big") /* REG_ESIZE */
- "\0"
-# define REG_ERPAREN_IDX (REG_ESIZE_IDX + sizeof "Regular expression too big")
+ gettext_noop ("Success"), /* REG_NOERROR */
+ gettext_noop ("No match"), /* REG_NOMATCH */
+ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
+ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
+ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
+ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
+ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
+ gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
+ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
+ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
+ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
+ gettext_noop ("Invalid range end"), /* REG_ERANGE */
+ gettext_noop ("Memory exhausted"), /* REG_ESPACE */
+ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
+ gettext_noop ("Premature end of regular expression"), /* REG_EEND */
+ gettext_noop ("Regular expression too big"), /* REG_ESIZE */
gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
};
-
-static const size_t re_error_msgid_idx[] =
- {
- REG_NOERROR_IDX,
- REG_NOMATCH_IDX,
- REG_BADPAT_IDX,
- REG_ECOLLATE_IDX,
- REG_ECTYPE_IDX,
- REG_EESCAPE_IDX,
- REG_ESUBREG_IDX,
- REG_EBRACK_IDX,
- REG_EPAREN_IDX,
- REG_EBRACE_IDX,
- REG_BADBR_IDX,
- REG_ERANGE_IDX,
- REG_ESPACE_IDX,
- REG_BADRPT_IDX,
- REG_EEND_IDX,
- REG_ESIZE_IDX,
- REG_ERPAREN_IDX
- };
#endif /* INSIDE_RECURSION */
@@ -4702,7 +4650,7 @@ PREFIX(re_compile_fastmap) (bufp)
while (1)
{
- if (p == pend || *p == succeed)
+ if (p == pend || *p == (UCHAR_T) succeed)
{
/* We have reached the (effective) end of pattern. */
if (!FAIL_STACK_EMPTY ())
@@ -7944,7 +7892,7 @@ re_compile_pattern (pattern, length, bufp)
if (!ret)
return NULL;
- return gettext (re_error_msgid + re_error_msgid_idx[(int) ret]);
+ return gettext (re_error_msgid[(int) ret]);
}
#ifdef _LIBC
weak_alias (__re_compile_pattern, re_compile_pattern)
@@ -7981,14 +7929,12 @@ re_comp (s)
{
re_comp_buf.buffer = (unsigned char *) malloc (200);
if (re_comp_buf.buffer == NULL)
- return (char *) gettext (re_error_msgid
- + re_error_msgid_idx[(int) REG_ESPACE]);
+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
re_comp_buf.allocated = 200;
re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
if (re_comp_buf.fastmap == NULL)
- return (char *) gettext (re_error_msgid
- + re_error_msgid_idx[(int) REG_ESPACE]);
+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
}
/* Since `re_exec' always passes NULL for the `regs' argument, we
@@ -8008,7 +7954,7 @@ re_comp (s)
return NULL;
/* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
- return (char *) gettext (re_error_msgid + re_error_msgid_idx[(int) ret]);
+ return (char *) gettext (re_error_msgid[(int) ret]);
}
@@ -8096,7 +8042,7 @@ regcomp (preg, pattern, cflags)
/* Map uppercase characters to corresponding lowercase ones. */
for (i = 0; i < CHAR_SET_SIZE; i++)
- preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
+ preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : (int) i;
}
else
preg->translate = NULL;
@@ -8231,7 +8177,7 @@ weak_alias (__regexec, regexec)
size_t
regerror (errcode, preg, errbuf, errbuf_size)
int errcode;
- const regex_t *preg;
+ const regex_t *preg ATTRIBUTE_UNUSED;
char *errbuf;
size_t errbuf_size;
{
@@ -8239,15 +8185,15 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t msg_size;
if (errcode < 0
- || errcode >= (int) (sizeof (re_error_msgid_idx)
- / sizeof (re_error_msgid_idx[0])))
+ || errcode >= (int) (sizeof (re_error_msgid)
+ / sizeof (re_error_msgid[0])))
/* Only error codes returned by the rest of the code should be passed
to this routine. If we are given anything else, or if other regex
code generates an invalid error code, then the program has a bug.
Dump core so we can fix it. */
abort ();
- msg = gettext (re_error_msgid + re_error_msgid_idx[errcode]);
+ msg = gettext (re_error_msgid[errcode]);
msg_size = strlen (msg) + 1; /* Includes the null. */
@@ -8256,7 +8202,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
if (msg_size > errbuf_size)
{
#if defined HAVE_MEMPCPY || defined _LIBC
- *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
#else
memcpy (errbuf, msg, errbuf_size - 1);
errbuf[errbuf_size - 1] = 0;
diff --git a/contrib/binutils/libiberty/rename.c b/contrib/binutils/libiberty/rename.c
index 0563062..399980a 100644
--- a/contrib/binutils/libiberty/rename.c
+++ b/contrib/binutils/libiberty/rename.c
@@ -12,6 +12,7 @@ exists, it is removed.
*/
+#include "ansidecl.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -22,8 +23,8 @@ exists, it is removed.
int
rename (zfrom, zto)
- char *zfrom;
- char *zto;
+ const char *zfrom;
+ const char *zto;
{
if (link (zfrom, zto) < 0)
{
diff --git a/contrib/binutils/libiberty/safe-ctype.c b/contrib/binutils/libiberty/safe-ctype.c
index 0c2be3e..91a0e9a 100644
--- a/contrib/binutils/libiberty/safe-ctype.c
+++ b/contrib/binutils/libiberty/safe-ctype.c
@@ -19,20 +19,109 @@ License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This is a compatible replacement of the standard C library's <ctype.h>
- with the following properties:
-
- - Implements all isxxx() macros required by C99.
- - Also implements some character classes useful when
- parsing C-like languages.
- - Does not change behavior depending on the current locale.
- - Behaves properly for all values in the range of a signed or
- unsigned char. */
+/*
+
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC. (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
+@deffn Extension ISALPHA (@var{c})
+@deffnx Extension ISALNUM (@var{c})
+@deffnx Extension ISBLANK (@var{c})
+@deffnx Extension ISCNTRL (@var{c})
+@deffnx Extension ISDIGIT (@var{c})
+@deffnx Extension ISGRAPH (@var{c})
+@deffnx Extension ISLOWER (@var{c})
+@deffnx Extension ISPRINT (@var{c})
+@deffnx Extension ISPUNCT (@var{c})
+@deffnx Extension ISSPACE (@var{c})
+@deffnx Extension ISUPPER (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}. Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}. For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others. However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA} @tab @kbd{A-Za-z}
+@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
+@item @code{BLANK} @tab @kbd{space tab}
+@item @code{CNTRL} @tab @code{!PRINT}
+@item @code{DIGIT} @tab @kbd{0-9}
+@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
+@item @code{LOWER} @tab @kbd{a-z}
+@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER} @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@deffn Extension ISIDNUM (@var{c})
+@deffnx Extension ISIDST (@var{c})
+@deffnx Extension IS_VSPACE (@var{c})
+@deffnx Extension IS_NVSPACE (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages. They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
+@item @code{IDST} @tab @kbd{A-Za-z_}
+@item @code{VSPACE} @tab @kbd{\r \n}
+@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
+*/
#include "ansidecl.h"
#include <safe-ctype.h>
#include <stdio.h> /* for EOF */
+#if EOF != -1
+ #error "<safe-ctype.h> requires EOF == -1"
+#endif
+
/* Shorthand */
#define bl _sch_isblank
#define cn _sch_iscntrl
@@ -48,25 +137,23 @@ Boston, MA 02111-1307, USA. */
#define xd _sch_isxdigit
/* Masks. */
-#define L lo|is |pr /* lower case letter */
-#define XL lo|is|xd|pr /* lowercase hex digit */
-#define U up|is |pr /* upper case letter */
-#define XU up|is|xd|pr /* uppercase hex digit */
-#define D di |xd|pr /* decimal digit */
-#define P pn |pr /* punctuation */
-#define _ pn|is |pr /* underscore */
-
-#define C cn /* control character */
-#define Z nv |cn /* NUL */
-#define M nv|sp |cn /* cursor movement: \f \v */
-#define V vs|sp |cn /* vertical space: \r \n */
-#define T nv|sp|bl|cn /* tab */
-#define S nv|sp|bl|pr /* space */
+#define L (const unsigned short) (lo|is |pr) /* lower case letter */
+#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */
+#define U (const unsigned short) (up|is |pr) /* upper case letter */
+#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */
+#define D (const unsigned short) (di |xd|pr) /* decimal digit */
+#define P (const unsigned short) (pn |pr) /* punctuation */
+#define _ (const unsigned short) (pn|is |pr) /* underscore */
+
+#define C (const unsigned short) ( cn) /* control character */
+#define Z (const unsigned short) (nv |cn) /* NUL */
+#define M (const unsigned short) (nv|sp |cn) /* cursor movement: \f \v */
+#define V (const unsigned short) (vs|sp |cn) /* vertical space: \r \n */
+#define T (const unsigned short) (nv|sp|bl|cn) /* tab */
+#define S (const unsigned short) (nv|sp|bl|pr) /* space */
/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
const unsigned short _sch_istable[256] =
{
@@ -159,5 +246,9 @@ const unsigned char _sch_toupper[256] =
};
#else
- #error "Unsupported host character set"
-#endif /* not ASCII */
+# if HOST_CHARSET == HOST_CHARSET_EBCDIC
+ #error "FIXME: write tables for EBCDIC"
+# else
+ #error "Unrecognized host character set"
+# endif
+#endif
diff --git a/contrib/binutils/libiberty/sigsetmask.c b/contrib/binutils/libiberty/sigsetmask.c
index f705fbb..4de3e4b 100644
--- a/contrib/binutils/libiberty/sigsetmask.c
+++ b/contrib/binutils/libiberty/sigsetmask.c
@@ -25,8 +25,8 @@ extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
#ifdef SIG_SETMASK
int
-DEFUN(sigsetmask,(set),
- int set)
+sigsetmask (set)
+ int set;
{
sigset_t new;
sigset_t old;
diff --git a/contrib/binutils/libiberty/splay-tree.c b/contrib/binutils/libiberty/splay-tree.c
index 7999447..fc98db1 100644
--- a/contrib/binutils/libiberty/splay-tree.c
+++ b/contrib/binutils/libiberty/splay-tree.c
@@ -234,7 +234,7 @@ splay_tree_xmalloc_allocate (size, data)
int size;
void *data ATTRIBUTE_UNUSED;
{
- return xmalloc (size);
+ return (void *) xmalloc (size);
}
static void
@@ -472,7 +472,7 @@ splay_tree_predecessor (sp, key)
if (comparison < 0)
return sp->root;
- /* Otherwise, find the leftmost element of the right subtree. */
+ /* Otherwise, find the rightmost element of the left subtree. */
node = sp->root->left;
if (node)
while (node->right)
@@ -482,7 +482,7 @@ splay_tree_predecessor (sp, key)
}
/* Return the immediate successor KEY, or NULL if there is no
- predecessor. KEY need not be present in the tree. */
+ successor. KEY need not be present in the tree. */
splay_tree_node
splay_tree_successor (sp, key)
@@ -492,7 +492,7 @@ splay_tree_successor (sp, key)
int comparison;
splay_tree_node node;
- /* If the tree is empty, there is certainly no predecessor. */
+ /* If the tree is empty, there is certainly no successor. */
if (!sp->root)
return NULL;
@@ -505,7 +505,7 @@ splay_tree_successor (sp, key)
if (comparison > 0)
return sp->root;
- /* Otherwise, find the rightmost element of the left subtree. */
+ /* Otherwise, find the leftmost element of the right subtree. */
node = sp->root->right;
if (node)
while (node->left)
diff --git a/contrib/binutils/libiberty/strcasecmp.c b/contrib/binutils/libiberty/strcasecmp.c
index 4bfe650..d2608dc 100644
--- a/contrib/binutils/libiberty/strcasecmp.c
+++ b/contrib/binutils/libiberty/strcasecmp.c
@@ -25,7 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
diff --git a/contrib/binutils/libiberty/strdup.c b/contrib/binutils/libiberty/strdup.c
index 49233ba..a3f17d3 100644
--- a/contrib/binutils/libiberty/strdup.c
+++ b/contrib/binutils/libiberty/strdup.c
@@ -9,13 +9,24 @@ Returns a pointer to a copy of @var{s} in memory obtained from
*/
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
+#include <stddef.h>
+#else
+#define size_t unsigned long
+#endif
+
+extern size_t strlen PARAMS ((const char*));
+extern PTR malloc PARAMS ((size_t));
+extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
+
char *
strdup(s)
- char *s;
+ const char *s;
{
- char *result = (char*)malloc(strlen(s) + 1);
- if (result == (char*)0)
- return (char*)0;
- strcpy(result, s);
- return result;
+ size_t len = strlen (s) + 1;
+ char *result = (char*) malloc (len);
+ if (result == (char*) 0)
+ return (char*) 0;
+ return (char*) memcpy (result, s, len);
}
diff --git a/contrib/binutils/libiberty/strerror.c b/contrib/binutils/libiberty/strerror.c
index 18050c2..83a5992 100644
--- a/contrib/binutils/libiberty/strerror.c
+++ b/contrib/binutils/libiberty/strerror.c
@@ -462,6 +462,8 @@ static int num_error_names = 0;
#ifndef HAVE_SYS_ERRLIST
+#define sys_nerr sys_nerr__
+#define sys_errlist sys_errlist__
static int sys_nerr;
static const char **sys_errlist;
@@ -472,7 +474,6 @@ extern char *sys_errlist[];
#endif
-
/*
NAME
diff --git a/contrib/binutils/libiberty/strncasecmp.c b/contrib/binutils/libiberty/strncasecmp.c
index 77cb421..10feee8 100644
--- a/contrib/binutils/libiberty/strncasecmp.c
+++ b/contrib/binutils/libiberty/strncasecmp.c
@@ -25,7 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
diff --git a/contrib/binutils/libiberty/strncmp.c b/contrib/binutils/libiberty/strncmp.c
index 819cea6..ad87e1fd 100644
--- a/contrib/binutils/libiberty/strncmp.c
+++ b/contrib/binutils/libiberty/strncmp.c
@@ -13,7 +13,7 @@ Compares the first @var{n} bytes of two strings, returning a value as
*/
#include <ansidecl.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
diff --git a/contrib/binutils/libiberty/strsignal.c b/contrib/binutils/libiberty/strsignal.c
index 86c8aca..a8a7d34 100644
--- a/contrib/binutils/libiberty/strsignal.c
+++ b/contrib/binutils/libiberty/strsignal.c
@@ -42,7 +42,7 @@ extern PTR memset ();
#undef sys_nsig
#ifndef NULL
-# ifdef __STDC__
+# ifdef ANSI_PROTOTYPES
# define NULL (void *) 0
# else
# define NULL 0
diff --git a/contrib/binutils/libiberty/strstr.c b/contrib/binutils/libiberty/strstr.c
index 470e04b..a059c7f 100644
--- a/contrib/binutils/libiberty/strstr.c
+++ b/contrib/binutils/libiberty/strstr.c
@@ -27,8 +27,8 @@ strstr (s1, s2)
register char *p = s1;
extern char *strchr ();
extern int strncmp ();
-#if __GNUC__==2
- extern __SIZE_TYPE__ strlen ();
+#if __GNUC__ >= 2
+ extern __SIZE_TYPE__ strlen (const char *);
#endif
register int len = strlen (s2);
diff --git a/contrib/binutils/libiberty/vasprintf.c b/contrib/binutils/libiberty/vasprintf.c
index d438225..d3d4f3a 100644
--- a/contrib/binutils/libiberty/vasprintf.c
+++ b/contrib/binutils/libiberty/vasprintf.c
@@ -1,6 +1,6 @@
/* Like vsprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
- Copyright (C) 1994 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2003 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@ -52,20 +52,20 @@ you pass a pointer to a pointer. This function will compute the size
of the buffer needed, allocate memory with @code{malloc}, and store a
pointer to the allocated memory in @code{*@var{resptr}}. The value
returned is the same as @code{vsprintf} would return. If memory could
-not be allocated, zero is returned and @code{NULL} is stored in
+not be allocated, minus one is returned and @code{NULL} is stored in
@code{*@var{resptr}}.
@end deftypefn
*/
-static int int_vasprintf PARAMS ((char **, const char *, va_list *));
+static int int_vasprintf PARAMS ((char **, const char *, va_list));
static int
int_vasprintf (result, format, args)
char **result;
const char *format;
- va_list *args;
+ va_list args;
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
@@ -73,7 +73,11 @@ int_vasprintf (result, format, args)
int total_width = strlen (format) + 1;
va_list ap;
- memcpy ((PTR) &ap, (PTR) args, sizeof (va_list));
+#ifdef va_copy
+ va_copy (ap, args);
+#else
+ memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list));
+#endif
while (*p != '\0')
{
@@ -135,14 +139,17 @@ int_vasprintf (result, format, args)
p++;
}
}
+#ifdef va_copy
+ va_end (ap);
+#endif
#ifdef TEST
global_total_width = total_width;
#endif
- *result = malloc (total_width);
+ *result = (char *) malloc (total_width);
if (*result != NULL)
- return vsprintf (*result, format, *args);
+ return vsprintf (*result, format, args);
else
- return 0;
+ return -1;
}
int
@@ -155,7 +162,7 @@ vasprintf (result, format, args)
va_list args;
#endif
{
- return int_vasprintf (result, format, &args);
+ return int_vasprintf (result, format, args);
}
#ifdef TEST
diff --git a/contrib/binutils/libiberty/vfprintf.c b/contrib/binutils/libiberty/vfprintf.c
index db7b2ff..18f09d4 100644
--- a/contrib/binutils/libiberty/vfprintf.c
+++ b/contrib/binutils/libiberty/vfprintf.c
@@ -3,7 +3,8 @@
Copyright (C) 1998 Free Software Foundation, Inc.
*/
-#ifdef __STDC__
+#include "ansidecl.h"
+#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
diff --git a/contrib/binutils/libiberty/vprintf.c b/contrib/binutils/libiberty/vprintf.c
index c57c3e4..9487896 100644
--- a/contrib/binutils/libiberty/vprintf.c
+++ b/contrib/binutils/libiberty/vprintf.c
@@ -15,13 +15,13 @@ nonstandard but common function @code{_doprnt}.
*/
-#ifdef __STDC__
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
-#include <ansidecl.h>
#undef vprintf
int
vprintf (format, ap)
diff --git a/contrib/binutils/libiberty/vsprintf.c b/contrib/binutils/libiberty/vsprintf.c
index b69e9bc..9f09d7e 100644
--- a/contrib/binutils/libiberty/vsprintf.c
+++ b/contrib/binutils/libiberty/vsprintf.c
@@ -26,9 +26,13 @@ the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
#include <varargs.h>
+#endif
#include <stdio.h>
-#include <ansidecl.h>
#undef vsprintf
#if defined _IOSTRG && defined _IOWRT
diff --git a/contrib/binutils/libiberty/xatexit.c b/contrib/binutils/libiberty/xatexit.c
index abf3407..075599c 100644
--- a/contrib/binutils/libiberty/xatexit.c
+++ b/contrib/binutils/libiberty/xatexit.c
@@ -27,7 +27,7 @@ failure. If you use @code{xatexit} to register functions, you must use
#include <stdio.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
diff --git a/contrib/binutils/libiberty/xmalloc.c b/contrib/binutils/libiberty/xmalloc.c
index 4c8249a..c3fe1a8 100644
--- a/contrib/binutils/libiberty/xmalloc.c
+++ b/contrib/binutils/libiberty/xmalloc.c
@@ -68,7 +68,7 @@ function will be called to print an error message and terminate execution.
#include <stdio.h>
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
OpenPOWER on IntegriCloud