diff options
| author | tv <tv@NetBSD.org> | 1998-08-28 15:39:36 +0000 |
|---|---|---|
| committer | tv <tv@NetBSD.org> | 1998-08-28 15:39:36 +0000 |
| commit | 0f6f61587554fed5fcd5e8a46ada8e9accd83e8a (patch) | |
| tree | b5c7e604c22dce2dd783c97f9e31d5d37293fd77 /gnu | |
| parent | 6c55ff04c2c1269a7f346785c86ca6b20b725ee8 (diff) | |
Update libiberty to that shipped with egcs. Improvements include better
C++ demangling.
Diffstat (limited to 'gnu')
36 files changed, 5573 insertions, 830 deletions
diff --git a/gnu/dist/libiberty/COPYING.LIB b/gnu/dist/libiberty/COPYING.LIB index eb685a5ec98..161a3d1d47b 100644 --- a/gnu/dist/libiberty/COPYING.LIB +++ b/gnu/dist/libiberty/COPYING.LIB @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -464,7 +464,8 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA Also add information on how to contact you by electronic and paper mail. diff --git a/gnu/dist/libiberty/ChangeLog b/gnu/dist/libiberty/ChangeLog index a4aaa919bd3..a58d93877e8 100644 --- a/gnu/dist/libiberty/ChangeLog +++ b/gnu/dist/libiberty/ChangeLog @@ -1,12 +1,521 @@ +Thu Jul 16 17:07:24 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (demangle_nested_args): Make function definition + static to match the prototype. + +1998-07-13 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c: Incorporate changes from GCC version not present in + the libiberty version: + (string): Move definition before work_stuff. + (work_stuff): Add volatile_type, forgetting_types, + previous_argument, and nrepeats fields. + (SCOPE_STRING): New macro. + (demangle_template): Add `remember' parameter. Add comment. + Register the `B' code type here, if remembering. Tidy. Fix crash + on NULL tmpl_argvec. Be consistent with use of tname/trawname. + (demangle_nested_args): New function. + (internal_cplus_demangle): Handle volatile-qualified member + functions. + (mop_up): Delete the previous_argument string if present. + (demangle_signature): Tidy. Handle volatile-qualified member + functions. Handle back-references using the `B' code. Use extra + parameter to demangle_template and SCOPE_STRING where appropriate. + (demangle_template_value_parm): Fix thinko; 'B' is not an integral + code. + (demangle_class): Use SCOPE_STRING. + (gnu_special): Pass additional argument to demangle_template. + Use SCOPE_STRING. + (demangle_qualified): Save qualified types for later + back-references. Handle constructors and destructors for template + types correctly. + (do_type): Tidy. Use SCOPE_STRING. Pass extra argument to + demangle_template. Use demangled_nested_args. Don't remember + qualified types here; that's now done in demangle_qualified. + Similarly for templates. + (do_arg): Improve commment. Handle 'n' repeat code. + (remember_type): Check forgetting_types. + (demangle_args): Deal with 'n' repeat codes. Tidy. + +Sat May 30 22:17:13 1998 Mumit Khan <khan@xraylith.wisc.edu> + + * configure.in (checkfuncs): Add missing "'". + +Fri May 22 11:06:41 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * Makefile.in (distclean): Don't remove alloca-conf.h + +Fri May 22 01:38:07 1998 Hans-Peter Nilsson <hp@axis.se> + + * cplus-dem.c (MBUF_SIZE): Bumped from 512 to 32767. + +Fri May 22 01:19:28 1998 Mike Stump <mrs@wrs.com> + + * Makefile.in: Add a dependency on stamp-picdir for the + objects, so that we can do a parallel build. + +1998-05-21 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (do_type): Handle volatile qualification. + +1998-05-21 Manfred Hollstein <manfred@s-direktnet.de> + + * configure.in: Check for unistd.h as well. + * configure: Rebuild. + * config.in: Rebuild. + * getpagesize.c (GNU_OUR_PAGESIZE): Use sysconf only if _SC_PAGESIZE + is defined in unistd.h. Reformat conditional block for easier reading. + + * config.table (shared): Default to no if ${enable_shared} + is unset or empty; this logic is used by the toplevel + configure scripts, too. + +Sat May 16 14:01:26 1998 Jeffrey A Law (law@cygnus.com) + + * config.table: Add line to set enable_shared in the Makefile + as needed. + +Wed May 13 14:24:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (squangle_mop_up): Change return type to void. + (internal_cplus_demangle): Remove unused parameter `options'. + All callers changed. + (cplus_demangle_opname): Remove function wide variable `int i' and + replace with `size_t i' at each location where it is used. + (cplus_mangle_opname): change type of `i' from int to size_t. + +Wed May 13 13:39:38 1998 Ian Lance Taylor <ian@cygnus.com> + + * alloca-conf.h: Include config.h. Check HAVE_ALLOCA_H rather + than sparc or sun. + * Makefile.in (argv.o): Depend upon config.h and alloca-conf.h. + +Fri May 8 00:23:51 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Set libiberty_topdir correctly when srcdir is + "." and with_target_subdir is not set. + * configure: Rebuild. + +Thu May 7 13:01:44 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Add *-*-mingw32* case. + * configure: Rebuild. + +Wed May 6 11:33:51 1998 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Never use a PIC file for *-*-cygwin32*. + + * Makefile.in (config.status): Depend upon config.table. + + * configure.in: On a cygwin32 host, always compile random, and + don't test for sys_siglist, strsignal, or psignal. + * configure: Rebuild. + + * clock.c: Check HAVE_SYS_PARAM_H rather than NO_SYS_PARAM_H. + * getcwd.c: Likewise. + * getpagesize.c: Likewise. + * getruntime.c: Likewise. + +Tue May 5 18:08:32 1998 Ian Lance Taylor <ian@cygnus.com> + + Use autoconf tests rather than the old dummy.c test: + * configure.in: Add AC_ARG_WITH calls for --with-target-subdir and + --with-newlib. Add AC_CONFIG_HEADER. Use AC_REPLACE_FUNCS for + most functions. Add special cases to handle newlib and VxWorks. + Remove target_makefile_frag. Create stamp-h in AC_OUTPUT if + CONFIG_HEADERS is set. Only call config-ml.in in AC_OUTPUT if + CONFIG_FILES is set; set ac_file before calling it. + * config.table (arm-*-riscix*, *-*-cygwin32): Remove. + (*-*-hpux*, *-*-hiux*, *-*-irix4*, *-*-solaris2*): Remove. + (*-*-sysv4*, *-*-go32, *-*-vxworks5*, *-*-vxworks): Remove + (i[3456]-*-mingw32*): Remove. + * Makefile.in (ERRORS_CC, CONFIG_H, NEEDED_LIST): Remove. + (LIBOBJS): New variable. + (HOST_OFILES, DO_ALSO, STAGESTUFF): Remove. + (all): Depend upon needed-list. Don't check RULE1. + (@target_makefile_frag@): Remove. + (COMPILE.c): Include @DEFS@. + (HFILES): Add alloca-conf.h. + (REQUIRED_OFILES): Remove basename.o. + ($(TARGETLIB)): New target. + (stamp-needed, lneeded-list, needed.awk, stamp-config): Remove. + (lconfig.h, needed2.awk, dummy.o, errors): Remove. + (needed-list, config.h): Rewrite. + (RULE1, $(RULE1), RULE2, $(RULE2)): Remove. + (.always.): Remove. + (Makefile): Set CONFIG_FILES and CONFIG_HEADERS. + (stamp-h): New target. + (atexit.o, clock.o, getcwd.o, getpagesize.o): New targets. + (basename.o): Don't depend upon config.h. + (getruntime.o): Depend upon config.h. + * atexit.c: Include config.h. Check HAVE_ON_EXIT rather than + NEED_on_exit. + * basename.c: Don't include config.h. Don't check NEED_basename. + * clock.c: Include config.h. + * getcwd.c: Likewise. + * getpagesize.c: Likewise. + * getruntime.c: Likewise. Fix checks which set HAVE_GETRUSAGE and + HAVE_TIMES. + * strerror.c: Change uses of NEED_sys_errlist to + HAVE_SYS_ERRLIST. Likewise for NEED_strerror and HAVE_STRERROR. + * strsignal.c: Likewise for NEED_sys_siglist and HAVE_SYS_SIGLIST, + and for NEED_strsignal and HAVE_STRSIGNAL and for NEED_psignal and + HAVE_PSIGNAL. + * acconfig.h: New file. + * dummy.c: Remove. + * functions.def: Remove. + * config/mh-cxux7 (HDEFINES): Remove -DHAVE_SYSCONF. + * config/mh-windows (HDEFINES): Remove. + * config/mh-cygwin32: Remove. + * config/mh-go32: Remove. + * config/mh-irix4: Remove. + * config/mh-riscix: Remove. + * config/mh-sysv4: Remove. + * config/mt-mingw32: Remove. + * config/mt-vxworks5: Remove. + * config.in: New file, generated using autoheader. + * configure: Rebuild. + +Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Rewrite to use autoconf. + * configure: Generate using autoconf. + * config/mh-a68bsd: Remove. + * config/mh-apollo68: Remove. + * config/mh-hpbsd: Remove. + * config/mh-ncr3000: Remove. + * config/mh-sysv: Remove. + * config/mh-aix (RANLIB, INSTALL): Don't define. + * config/mh-cxux7 (RANLIB, INSTALL): Don't define. + * config/mh-irix4 (CC, RANLIB, INSTALL): Don't define. + * config/mh-sysv4 (RANLIB, INSTALL): Don't define. + * config.table: Change config_shell to CONFIG_SHELL, and use + libiberty_topdir to find move-if-change. + (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove. + (i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove. + (*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove. + * Makefile.in (srcdir): Set to @srcdir@. + (VPATH): Likewise. + (prefix, exec_prefix, bindir, libdir): Set to autoconf variables. + (SHELL, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Likewise. + (CC, CFLAGS, RANLIB)): Likewise. + (datadir, man*dir, infodir, includedir, MAKEINFO): Remove. + (target_makefile_frag, host_makefile_frag): Add substitutions. + (INSTALL_DEST): Set to @INSTALL_DEST@. + (Makefile): Depend upon config.status. Don't depend upon + $(host_makefile_frag) or $(target_makefile_frag). + (config.status): New target. + +Sun May 3 17:58:49 1998 Ian Lance Taylor <ian@cygnus.com> + + * config/mt-sunos4: Remove. Should be handled by --with-headers + and --with-libraries options at top level. + * config.table: Never use mt-sunos4. + + * alloca-conf.h: New file, combining alloca-norm.h and + alloca-botch.h. + * alloca-norm.h: Remove. + * alloca-botch.h: Remove. + * configure.in: Set shell variables files and links to empty. + * config.table: Don't set shell variable files. + * configure.bat: Don't create alloca-conf.h. + * makefile.vms: Likewise. + * mpw-config.in: Likewise. + * vmsbuild.com: Likewise. + +Fri May 1 11:41:42 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in ($(HOST_OFILES) $(REQUIRED_OFILES)): Remove old + target depending upon config.h. + (alloca.o): Add target depending upon config.h + (basename.o, choose-temp.o, fnmatch.o): Likewise. + (getopt.o, getopt1.o, pexecute.o, strerror.o): Likewise. + (strsignal.o, xstrerror.o): Likewise. + +Fri May 1 04:26:25 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> + + * cplus-dem.c (cplus_demangle_opname): Initialize work. + +Mon Apr 27 15:53:30 EDT 1998 Andrew MacLeod <amacleod@cygnus.com> + + * cplus-dem.c (demangle_qualified): Replace missing else. + +Sun Apr 26 15:38:50 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * cplus-dem.c (gnu_special): Fix off-by-one bug when checking the + length in the name of a virtual table. + +Wed Apr 22 10:53:49 EDT 1998 Andrew MacLeod <amacleod@cygnus.com> + + * cplus-dem.c (struct work stuff): Add field for B and K mangle codes. + (cplus_demangle_opname): Call mop_up_squangle. + (cplus_demangle): Initialize squangle info, then call + internal_cplus_demangle. (Most code moved there as well) + (internal_cplus_demangle): New function, performs most of what use + to be done in cplus_demangle, but is only called with this file. + (squangle_mop_up): New function to clean up B and K code data. + (mop_up): set pointers to NULL after freeing. + (demangle_signature, demangle_template, demangle_class): Add + switch elements to handle K and B codes. + (demangle_prefix, gnu_special, demangle_qualified): Add + code to handle K and B codes. + (do_type, demangle_fund_type): Handle B and K codes. + (remember_Ktype): New function to store K info. + (register_Btype, remember_Btype): New functions for B codes. + (forget_B_and_K_types): New function to destroy B and K info. + +Fri Apr 10 01:49:10 1998 Jeffrey A Law (law@cygnus.com) + + * COPYING.LIB, choose-temp.c, cplus-dem.c: Sync with egcs & gcc. + +Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * config.table: Make locating frag files failsafe even for the + special case if configuring and building in srcdir. + +Mon Feb 23 14:33:15 1998 Ian Lance Taylor <ian@cygnus.com> + + * choose-temp.c: Fix handling of sys/file.h to work in libiberty. + +Sun Feb 22 18:03:23 1998 Jeffrey A Law (law@cygnus.com) + + * choose-temp.c: Sync with copy in gcc. + +Thu Feb 12 16:29:49 1998 Ian Lance Taylor <ian@cygnus.com> + + * getopt.c: Update to latest FSF version. + * getopt1.c: Likewise. + +Tue Feb 10 16:58:33 1998 Stan Shebs <shebs@andros.cygnus.com> + + * cplus-dem.c (gnu_special): Don't get confused by .<digits> + strings that are not actually lengths. + +Fri Feb 6 01:35:17 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * Makefile.in (FLAGS_TO_PASS): Don't pass PICFLAG. + (.c.o): Check value of enable_shared, not PICFLAG. + (stamp-picdir): Dito. + +Thu Feb 5 18:48:56 1998 Geoffrey Noer <noer@cygnus.com> + + * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES + since it gets built automatically + +Sun Feb 1 02:52:32 1998 Mike Stump <mrs@wrs.com> + + * config.table (vxworks configs): Default to VxWorks 5.x, as that is + the currently shipping OS. + +Tue Jan 27 16:08:20 1998 Pat Rankin <rankin@eql.caltech.edu> + + * vmsbuild.com [REQUIRE_OFILES]: Synchronized with Makefile.in: + Add fnmatch.o and objalloc.o; remove vasprintf.o. + [config.h]: Define NEED_strsignal. + +Mon Jan 19 12:20:01 1998 Ian Lance Taylor <ian@cygnus.com> + + * functions.def: Correct argument types for strerror and + strsignal. Reported by Alex Gutman <agutman@emc.com>. + +Sun Jan 18 15:57:28 1998 Michael Snyder <msnyder@cleaver.cygnus.com> + + * vasprintf.c (int_vasprintf): Increase buffer size for float/double + values. + +Sat Jan 17 22:28:38 1998 Mumit Khan <khan@xraylith.wisc.edu> + J.J. VanderHeijden <J.J.vanderHeijden@student.utwente.nl> + + Add mingw32 support. + * pexecute.c (pexecute): New function for mingw32. Supports pipes. + (pwait): New function for mingw32. + + * config.table (i[3456]86-*-mingw32*): Support for i386-mingw32. + * config/mt-mingw32: New file. + * xmalloc.c (first_break): Not used for mingw32. + (xmalloc_set_program_name): Don't use sbrk on mingw32. + (xmalloc): Likewise. + (xrealloc): Likewise. + +Sat Jan 17 22:28:05 1998 Jeffrey A Law (law@cygnus.com) + + * choose-temp.c: Sync with gcc version. + +Tue Jan 13 18:34:39 1998 Jim Wilson <wilson@cygnus.com> + + * Makefile.in (install_to_libdir, install_to_tooldir): Add MULTISUBDIR + to all filenames in libdir and tooldir. + (distclean): Do MULTICLEAN before deleting Makefile. + (stamp-needed, stamp-config): Add MULTISRCTOP to + pathname for move-if-change. + +Thu Dec 4 17:25:19 1997 Jeffrey A Law (law@cygnus.com) + + * strsignal.c (sys_nsig): Try NSIG and _NSIG. + +Wed Nov 19 13:37:06 1997 Michael Meissner <meissner@cygnus.com> + + * alloca-norm.h (alloca, GCC case): Don't redefine alloca if it + was already defined previously. + +Mon Nov 10 12:48:03 1997 Philippe De Muyter <phdm@macqel.be> + + * Makefile.in (INSTALL): Use ../install-sh, not install. + +Tue Oct 28 23:41:15 1997 Judy Goldberg <jodyg@idt.net> + + * Makefile.in (CFILES): Add pexecute.c. + +Wed Oct 15 19:13:48 1997 Ian Lance Taylor <ian@cygnus.com> + + * asprintf.c: Consistently use either stdarg or varargs. + +Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (demangle_signature): Don't look for return types on + constructors. Handle member template constructors. + +Fri Oct 3 17:53:30 1997 Ian Lance Taylor <ian@cygnus.com> + + * README: Fix configuration instructions. + +Mon Sep 29 12:28:41 1997 Ian Lance Taylor <ian@cygnus.com> + + * pexecute.c: Update to current version from /gd/gnu/lib: + + Mon Sep 29 12:27:59 1997 Ian Lance Taylor <ian@cygnus.com> + + * pexecute.c: Use spawn if __CYGWIN32__. + + 1997-08-08 Paul Eggert <eggert@twinsun.com> + + * pexecute.c: Include "config.h" first, as per autoconf manual. + + Fri Jun 27 15:20:29 1997 Scott Christley <scottc@net-community.com> + + * pexecute.c (fix_argv): New function. + (pexecute): Win32 but not Cygwin32 needs its arguments fixed. + Add underscore to cwait function call. + +Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (demangle_template): Add new parameter. Handle new + template-function mangling. + (consume_count_with_underscores): New function. + (demangle_signature): Handle new name-mangling scheme. + +Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com> + + * asprintf.c: stdarg.h when ALMOST_STDC + * config/mh-windows (EXTRA_OFILES): add asprintf.o and + strncasecmp.o. + +Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * vasprintf.c (vasprintf): Allow for _BSD_VA_LIST_. + + * config.table: Add case for FreeBSD 2.1 and 2.2, needs mh-fbsd21. + + * config/mh-fbsd21 (EXTRA_OFILES): Force vasprintf.o + +Wed Sep 10 12:43:10 1997 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_fund_type): Change "complex" to "__complex". + +Fri Sep 5 16:34:42 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * asprintf.c (asprintf): New file. + * Makefile.in (CFILES): Add asprintf.c + * functions.def: Ditto. + +Thu Aug 28 18:53:34 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * argv.c (dupargv): New function, duplicate an argument vector. + +Tue Aug 19 20:28:45 1997 Geoffrey Noer <noer@cygnus.com> + + * config/mh-cygwin32: also build random.o + +Tue Aug 19 17:10:56 1997 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c: Add 'extern' to prepends_underscore. + +Tue Jul 22 19:05:23 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE> + + * config/mh-go32 (CC, AR, RANLIB): Don't define. + +Tue Jul 22 17:49:54 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (REQUIRED_OFILES): Add pexecute.o. + (pexecute.o): New target. + + * Makefile.in (stamp-needed): New target, replacing needed-list. + (needed-list): Just depend upon stamp-needed. + (stamp-config): New target, replacing config.h. + (config.h): Just depend upon stamp-config. + (mostlyclean): Remove stamp-*. + +Thu Jun 12 11:00:18 1997 Angela Marie Thomas (angela@cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): pass INSTALL, INSTALL_PROGRAM and + INSTALL_DATA for multilibbed installs + +Tue Jun 3 13:21:05 1997 Doug Evans <dje@canuck.cygnus.com> + + Tue Dec 10 09:44:57 1996 Paul Eggert <eggert@twinsun.com> + + * choose-temp.c (choose_temp_base): Don't dump core if TMPDIR is empty. + + * choose-temp.c (try): Insist that temp dir be searchable. + + Wed Oct 23 17:36:39 1996 Doug Rupp (rupp@gnat.com) + + * choose-temp.c (choose_temp_base): On VMS, use proper syntax + for current directory. + + Sat Feb 15 19:03:48 1997 Geoffrey Noer (noer@cygnus.com) + + * pexecute.c: Remove special cases for cygwin32. + (pwait): Remove local definition of `pid'. + + Tue Nov 12 18:26:15 1996 Doug Rupp (rupp@gnat.com) + + * pexecute.c (vfork): Supply new definition for VMS. + (pwait): Use waitpid instead of wait for VMS. + +Tue May 20 14:02:20 1997 Brendan Kehoe <brendan@lisa.cygnus.com> + + * cplus-dem.c (do_type): Handle `J'. + (demangle_fund_type): Print "complex" for it. + +Wed Apr 30 12:15:45 1997 Jason Merrill <jason@yorick.cygnus.com> + + * configure.in: Don't turn on multilib here. + +Mon Apr 28 19:04:31 1997 Michael Snyder <msnyder@cleaver.cygnus.com> + + * obstack.c: move _obstack_memory_used outside of ifdef. Cannot be + elided; needed by gdb and not present in libc. + Thu Apr 24 19:33:47 1997 Ian Lance Taylor <ian@cygnus.com> * Makefile.in (clean): Remove tmpmulti.out. +Tue Apr 22 10:25:15 1997 Fred Fish <fnf@cygnus.com> + + * floatformat.c (floatformat_ieee_double_littlebyte_bigword): + Add new floatformat, mainly for ARM doubles. + Mon Apr 14 12:11:16 1997 Ian Lance Taylor <ian@cygnus.com> * config.table: Use ${config_shell} with ${moveifchange}. From Thomas Graichen <graichen@rzpd.de>. +Fri Apr 4 03:09:24 1997 Ulrich Drepper <drepper@cygnus.com> + + * configure.in: Enable multilibing by default. + Update multilib template to read config-ml.in. + Tue Apr 1 16:26:39 1997 Klaus Kaempf <kkaempf@progis.de> * makefile.vms: Add objalloc. diff --git a/gnu/dist/libiberty/Makefile.in b/gnu/dist/libiberty/Makefile.in index b7f6392e65a..9e6a0077331 100644 --- a/gnu/dist/libiberty/Makefile.in +++ b/gnu/dist/libiberty/Makefile.in @@ -1,6 +1,7 @@ # # Makefile -# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation +# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998 +# Free Software Foundation # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or @@ -19,37 +20,22 @@ # Boston, MA 02111-1307, USA. # -# This file was written, and is maintained by K. Richard Pixley -# <rich@cygnus.com>. +# This file was written by K. Richard Pixley <rich@cygnus.com>. # # Makefile for libiberty directory # -srcdir = . +srcdir = @srcdir@ +VPATH = @srcdir@ -prefix = /usr/local +prefix = @prefix@ -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ -datadir = $(prefix)/share - -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include - -SHELL = /bin/sh +SHELL = @SHELL@ # Multilib support variables. MULTISRCTOP = @@ -59,19 +45,17 @@ MULTISUBDIR = MULTIDO = true MULTICLEAN = true -INSTALL = install -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ -AR = ar +AR = @AR@ AR_FLAGS = rc -ERRORS_CC = $(CC) -CC = cc -CFLAGS = -g +CC = @CC@ +CFLAGS = @CFLAGS@ LIBCFLAGS = $(CFLAGS) -MAKEINFO = makeinfo -RANLIB = ranlib +RANLIB = @RANLIB@ PICFLAG = @@ -79,19 +63,7 @@ MAKEOVERRIDES = TARGETLIB = libiberty.a -CONFIG_H = lconfig.h -NEEDED_LIST = lneeded-list - -# HOST_OFILES contains the list of objects that should be in the -# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES). -# A configuration may override this with a fixed list a object files -# names (hard to maintain), or some other way to generate a list. -HOST_OFILES=`cat needed-list` - -# Extra targets that the top-level target depends on. -# Specifically, what needs to be made before HOST_OFILES can be used. -# Can be empty if HOST_OFILES is just a list of file names. -DO_ALSO = needed-list +LIBOBJS = @LIBOBJS@ # A configuration can specify extra .o files that should be included, # even if they are in libc. (Perhaps the libc version is buggy.) @@ -106,166 +78,96 @@ FLAGS_TO_PASS = \ "LIBCFLAGS=$(LIBCFLAGS)" \ "EXTRA_OFILES=$(EXTRA_OFILES)" \ "HDEFINES=$(HDEFINES)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "LDFLAGS=$(LDFLAGS)" \ "LOADLIBES=$(LOADLIBES)" \ - "PICFLAG=$(PICFLAG)" \ "RANLIB=$(RANLIB)" \ "SHELL=$(SHELL)" -all: stamp-picdir $(TARGETLIB) required-list - @if [ "$(RULE1)" != "not-used" ]; then \ - $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \ - else true; \ - fi +all: stamp-picdir $(TARGETLIB) needed-list required-list + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all .PHONY: check installcheck check installcheck: - -#### Host, target, and site specific Makefile fragments come in here. -### +@host_makefile_frag@ INCDIR=$(srcdir)/$(MULTISRCTOP)../include -COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) +COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) .c.o: - test -z "$(PICFLAG)" || \ + test x"$(enable_shared)" != xyes || \ $(COMPILE.c) $(PICFLAG) $< -o pic/$@ $(COMPILE.c) $< -# The default target just invokes make recursively. -# However, the automatic configuration (in config/mh_default). -# first causes it to figure out the objects missing in libc. info install-info clean-info dvi: # Include files that are in this directory. -HFILES = +HFILES = alloca-conf.h # NOTE: If you add new files to the library, add them to this list -# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'. -CFILES = alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \ - choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \ - getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \ - floatformat.c hex.c index.c insque.c \ - memchr.c memcmp.c memcpy.c memmove.c memset.c objalloc.c \ - obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \ - strcasecmp.c strncasecmp.c \ - strchr.c strdup.c strerror.c strrchr.c strsignal.c \ - strstr.c strtod.c strtol.c strtoul.c tmpnam.c \ - vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \ - xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c +# (alphabetical), and add them to REQUIRED_OFILES or funcs in +# configure.in. +CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \ + bzero.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \ + fnmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \ + getruntime.c floatformat.c hex.c index.c insque.c memchr.c \ + memcmp.c memcpy.c memmove.c memset.c objalloc.c obstack.c \ + pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \ + strcasecmp.c strncasecmp.c strchr.c strdup.c strerror.c \ + strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \ + tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \ + waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c + # These are always included in the library. -REQUIRED_OFILES = argv.o basename.o choose-temp.o concat.o cplus-dem.o \ +REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \ fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \ - floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o \ - xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o - -# Do we want/need any config overrides? -# + floatformat.o objalloc.o obstack.o pexecute.o spaces.o strerror.o \ + strsignal.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o -STAGESTUFF = $(TARGETLIB) *.o +$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) + rm -f $(TARGETLIB) + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) + $(RANLIB) $(TARGETLIB) -INSTALL_DEST = libdir +INSTALL_DEST = @INSTALL_DEST@ install: install_to_$(INSTALL_DEST) install_to_libdir: all - $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n - ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n ) - mv -f $(libdir)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB) + $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n + ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n ) + mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB) @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install install_to_tooldir: all - $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n - ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n ) - mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB) + $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n + ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n ) + mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB) @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install -# The default configuration adds to libiberty all those functions that are -# missing in libc. More precisely, it includes whatever $(CC) fails to find. -# Then a sed+awk combination translates the ld error messages into -# a list of .o files. - -needed-list: stamp-picdir $(NEEDED_LIST) - cp $(NEEDED_LIST) needed-list - -lneeded-list: $(EXTRA_OFILES) needed.awk errors - rm -f lneeded-list - f=""; \ - for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \ - case " $$f " in \ - *" $$i "*) ;; \ - *) f="$$f $$i" ;; \ - esac ; \ - done ; \ +# needed-list is used by libstdc++. +needed-list: Makefile + f="$(LIBOBJS) $(EXTRA_OFILES)"; \ case $$f in \ - *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \ - esac ; \ - echo $$f >>lneeded-list - -# Generate an awk script that looks for functions in functions.def - -needed.awk: $(srcdir)/functions.def Makefile - echo "# !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT!" >needed.awk - grep '^DEF(' < $(srcdir)/functions.def \ - | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \ - >>needed.awk - -config.h: $(CONFIG_H) - cp $(CONFIG_H) config.h - -lconfig.h: needed2.awk errors - echo "/* !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT! */" >lconfig.h - awk -f needed2.awk <errors >>lconfig.h - -# Generate an awk script that looks for variables in functions.def - -needed2.awk: $(srcdir)/functions.def Makefile - echo "# !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT!" >needed2.awk - grep '^DEFVAR(' < $(srcdir)/functions.def \ - | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \ - >>needed2.awk - grep '^DEFFUNC(' < $(srcdir)/functions.def \ - | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \ - >>needed2.awk - -dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def - $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null - -errors: dummy.o $(EXTRA_OFILES) - -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true - -# required-list is used when building a shared bfd/opcodes/libiberty library. + *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \ + esac; \ + echo $$f > needed-list + +# required-list was used when building a shared bfd/opcodes/libiberty +# library. I don't know if it used by anything currently. required-list: Makefile echo $(REQUIRED_OFILES) > required-list -$(HOST_OFILES) $(REQUIRED_OFILES) : config.h - -RULE1 = $(TARGETLIB) -$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always. - @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \ - "HOST_OFILES=$(HOST_OFILES)" - -# Rule invoked by recursive make in $(RULE1). -RULE2 = not-used -$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES) - rm -rf $(TARGETLIB) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(HOST_OFILES) - $(RANLIB) $(TARGETLIB) - stamp-picdir: - if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \ + if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \ mkdir pic; \ else true; fi touch stamp-picdir -.always.: -# Do nothing. - -.PHONY: all etags tags ls clean stage1 stage2 .always. +.PHONY: all etags tags ls clean stage1 stage2 etags tags: TAGS @@ -285,40 +187,56 @@ ls: mostlyclean: rm -rf *.o pic core errs \#* *.E a.out - rm -f needed.awk needed2.awk errors dummy needed-list config.h + rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-* rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir @$(MULTICLEAN) multi-clean DO=mostlyclean clean: mostlyclean rm -f *.a required-list tmpmulti.out @$(MULTICLEAN) multi-clean DO=clean distclean: clean - rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS multilib.out @$(MULTICLEAN) multi-clean DO=distclean + rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out maintainer-clean realclean: distclean force: -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status +Makefile: $(srcdir)/Makefile.in config.status + CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status + +config.h: stamp-h ; @true +stamp-h: config.in config.status + CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status + +config.status: $(srcdir)/configure $(srcdir)/config.table + $(SHELL) ./config.status --recheck + +$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir -argv.o: $(INCDIR)/libiberty.h +alloca.o: config.h +atexit.o: config.h +argv.o: config.h alloca-conf.h $(INCDIR)/libiberty.h basename.o: $(INCDIR)/libiberty.h +choose-temp.o: config.h +clock.o: config.h concat.o: $(INCDIR)/libiberty.h cplus-dem.o: $(INCDIR)/demangle.h fdmatch.o: $(INCDIR)/libiberty.h -fnmatch.o: $(INCDIR)/fnmatch.h -getopt.o: $(INCDIR)/getopt.h -getopt1.o: $(INCDIR)/getopt.h -getruntime.o: $(INCDIR)/libiberty.h +fnmatch.o: config.h $(INCDIR)/fnmatch.h +getcwd.o: config.h +getopt.o: config.h $(INCDIR)/getopt.h +getopt1.o: config.h $(INCDIR)/getopt.h +getpagesize.o: config.h +getruntime.o: config.h $(INCDIR)/libiberty.h hex.o: $(INCDIR)/libiberty.h floatformat.o: $(INCDIR)/floatformat.h objalloc.o: $(INCDIR)/objalloc.h obstack.o: $(INCDIR)/obstack.h +pexecute.o: config.h $(INCDIR)/libiberty.h spaces.o: $(INCDIR)/libiberty.h -strerror.o: $(INCDIR)/libiberty.h -strsignal.o: $(INCDIR)/libiberty.h +strerror.o: config.h $(INCDIR)/libiberty.h +strsignal.o: config.h $(INCDIR)/libiberty.h xatexit.o: $(INCDIR)/libiberty.h xexit.o: $(INCDIR)/libiberty.h xmalloc.o: $(INCDIR)/libiberty.h xstrdup.o: $(INCDIR)/libiberty.h -xstrerror.o: $(INCDIR)/libiberty.h +xstrerror.o: config.h $(INCDIR)/libiberty.h diff --git a/gnu/dist/libiberty/README b/gnu/dist/libiberty/README index 5081bbac196..9f5226a6b1d 100644 --- a/gnu/dist/libiberty/README +++ b/gnu/dist/libiberty/README @@ -11,10 +11,9 @@ Current members include: We expect many of the GNU subroutines that are floating around to eventually arrive here. -To build the library, do: - - ./configure HOSTTYPE - make +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. @@ -28,62 +27,29 @@ that are "optional" will be included in the library only if "needed." To add a new required file, edit Makefile to add the source file name to CFILES and the object file to REQUIRED_OFILES. -Adding a new optional file is more fragile. As a general rule, -an optional file will be included in the library if it provides -functionality missing in the "standard" C library. -For most hosts, the Makefile automatically figures out which -functionality is missing by compiling and linking a dummy test -program, and examining the error messages. - -So to get this to work, you should do the following: - -1) Select one function defined in the file you're adding. -For example, the getcwd function. -2) Add that function to the list in the file functions.def. -3) The name of the new file must be the same as the function -you've chosen with the .c suffix added. E.g. getcwd() must be -defined in getcwd.c. (The file can define other functions as well.) -4) In Makefile.in, add the name of the source file (e.g. getcwd.c) -to CFILES. - -The file you've added (e.g. getcwd.c) should compile and work -on all hosts where it is needed (e.g. not found when linking -the dummy.c program). It does not have to work or even -compile on hosts where it is not needed. +To add a new optional file, it must provide a single function, and the +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. -HOW THE AUTOMATIC CONFIGURATION WORKS -===================================== - -The libiberty.a target (in RULE1) depends on $(DO_ALSO). -For normal configurations, DO_ALSO=needed-list. - -So needed-list is first made. The needed-list rule compiles -dummy.c. Because dummy.c includes functions.def, the -resulting object file will contain a call to each of the -optional functions (for simplicity assume each optional file -defines a single function). This object file will be linked -against the standard libraries (as defined by using $(CC) -and various flags). Any function missing will causes the -linker to emit an error message. We assume the name -of the missing function(s) are in the error message(s). -The awk script find-needed.awk has been generated from -functions.def. It is used to search the linker output -messages for words that match the functions listed in -functions.def. The list of functions found is written -on a single line to the file needed-list. - -After needed-list has been generated, the libiberty.a -target (in RULE1) just calls 'make' recursively. -It passes the contents of needed-list using the -definition (expanded) HOST_OFILES="`cat needed-list`". -It also tells the inferior 'make' to use RULE2. - -The inferior 'make' is very conventional: The main -rule is $(RULE2) (which is libiberty.a). It depends -on a list of object files: $(REQUIRED_OFILES) $(HOST_OFILES) -(and $(EXTRA_OFILES), which is usually empty). The superior -'make' passes in $(HOST_OFILES); the others are fixed -in the Makefile. + * Add the function to the AC_CHECK_FUNCS lists just after the + setting of the funcs shell variable. These AC_CHECK_FUNCS calls + are never executed; they are there to make autoheader work + better. + + * Consider the special cases of building libiberty; as of this + writing, the special cases are newlib and VxWorks. If a + particular special case provides the function, you do not need + to do anything. If it does not provide the function, add the + object file to LIBOBJS, and add the function name to the case + controlling whether to define HAVE_func. + +The optional file you've added (e.g. getcwd.c) should compile and work +on all hosts where it is needed. It does not have to work or even +compile on hosts where it is not needed. ADDING A NEW CONFIGURATION ========================== @@ -96,34 +62,4 @@ If the fully automatic scheme doesn't work, you may be able to get by with defining EXTRA_OFILES in your Makefile stub. This is a list of object file names that should be treated as required for this configuration - they will be included in libiberty.a, -regardless of whatever might be in the C library. Moreover, -when the dummy.c program is linked, it will be linked with -$(EXTRA_OFILES). Therefore, if a function in functions.def -is defined by one of the EXTRA_OFILES, it will not be listed as -"needed". Thus if your hal9000 host needs a special implementation -of getcwd, you can just create hal9000-getcwd.c, and define: - EXTRA_OFILES=hal9000-getcwd.o -Or if you want to use the libiberty version of strstr(), -even though there is a version in the C library (it might be -buggy or slow), just define: - EXTRA_OFILES=strstr.o - -You can create a "manual" host configuration FOO with a file -config/mh-FOO. In it, the HOST_OFILES macro should explicitly -list that subset of the optional files that should be in the -library. You should also set: - DO_ALSO = -This overrides all of the magic needed to automatically -determine which files are "needed." However, keeping that list -up to date is another matter... - -HOW THE MANUAL CONFIGURATION WORKS -================================== - -This also uses a recursive make, but the superior make -does not do anything interesting - it just calls the -inferior make with HOST_OFILES defined as $(HOST_OFILES), -which is the list you created in your configuration. - -You probably don't want to depend on manual configuration, -because keeping the HOST_OFILES list up-to-date will be a pain. +regardless of whatever might be in the C library. diff --git a/gnu/dist/libiberty/acconfig.h b/gnu/dist/libiberty/acconfig.h new file mode 100644 index 00000000000..f7c599df7ac --- /dev/null +++ b/gnu/dist/libiberty/acconfig.h @@ -0,0 +1,11 @@ +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR + +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR diff --git a/gnu/dist/libiberty/alloca-conf.h b/gnu/dist/libiberty/alloca-conf.h new file mode 100644 index 00000000000..4eb87d3cfa4 --- /dev/null +++ b/gnu/dist/libiberty/alloca-conf.h @@ -0,0 +1,24 @@ +#include "config.h" + +#ifdef __GNUC__ +# ifndef alloca +# define alloca __builtin_alloca +# endif +#else /* ! defined (__GNUC__) */ +# ifdef _AIX + #pragma alloca +# else +# ifdef HAVE_ALLOCA_H +# include <alloca.h> +# else /* ! defined (HAVE_ALLOCA_H) */ +# ifdef __STDC__ +extern PTR alloca (size_t); +# else /* ! defined (__STDC__) */ +extern PTR alloca (); +# endif /* ! defined (__STDC__) */ +# endif /* ! defined (HAVE_ALLOCA_H) */ +# ifdef _WIN32 +# include <malloc.h> +# endif +# endif /* ! defined (_AIX) */ +#endif /* ! defined (__GNUC__) */ diff --git a/gnu/dist/libiberty/argv.c b/gnu/dist/libiberty/argv.c index 60694f919bb..195d31019a0 100644 --- a/gnu/dist/libiberty/argv.c +++ b/gnu/dist/libiberty/argv.c @@ -72,6 +72,63 @@ extern char *strdup (); /* Duplicate a string */ NAME + dupargv -- duplicate an argument vector + +SYNOPSIS + + char **dupargv (vector) + char **vector; + +DESCRIPTION + + Duplicate an argument vector. Simply scans through the + vector, duplicating each argument until the + terminating NULL is found. + +RETURNS + + Returns a pointer to the argument vector if + successful. Returns NULL if there is insufficient memory to + complete building the argument vector. + +*/ + +char ** +dupargv (argv) + char **argv; +{ + int argc; + char **copy; + + if (argv == NULL) + return NULL; + + /* the vector */ + for (argc = 0; argv[argc] != NULL; argc++); + copy = (char **) malloc ((argc + 1) * sizeof (char *)); + if (copy == NULL) + return NULL; + + /* the strings */ + for (argc = 0; argv[argc] != NULL; argc++) + { + int len = strlen (argv[argc]); + copy[argc] = malloc (sizeof (char *) * (len + 1)); + if (copy[argc] == NULL) + { + freeargv (copy); + return NULL; + } + strcpy (copy[argc], argv[argc]); + } + copy[argc] = NULL; + return copy; +} + +/* + +NAME + freeargv -- free an argument vector SYNOPSIS diff --git a/gnu/dist/libiberty/asprintf.c b/gnu/dist/libiberty/asprintf.c new file mode 100644 index 00000000000..5aaf3200f0d --- /dev/null +++ b/gnu/dist/libiberty/asprintf.c @@ -0,0 +1,57 @@ +/* Like sprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +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. + +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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +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. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC) +#define USE_STDARG +#endif + +#ifdef USE_STDARG +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +/* VARARGS */ +#ifdef USE_STDARG +int +asprintf (char **buf, const char *fmt, ...) +#else +int +asprintf (buf, fmt, va_alist) + char **buf; + const char *fmt; + va_dcl +#endif +{ + int status; + va_list ap; +#ifdef USE_STDARG + va_start (ap, fmt); +#else + va_start (ap); +#endif + status = vasprintf (buf, fmt, ap); + va_end (ap); + return status; +} diff --git a/gnu/dist/libiberty/atexit.c b/gnu/dist/libiberty/atexit.c index 4463cb69501..137d985e4cb 100644 --- a/gnu/dist/libiberty/atexit.c +++ b/gnu/dist/libiberty/atexit.c @@ -1,7 +1,10 @@ /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ /* This function is in the public domain. --Mike Stump. */ -#ifndef NEED_on_exit +#include "config.h" + +#ifdef HAVE_ON_EXIT + int atexit(f) void (*f)(); @@ -11,4 +14,5 @@ atexit(f) on_exit (f, 0); return 0; } + #endif diff --git a/gnu/dist/libiberty/basename.c b/gnu/dist/libiberty/basename.c index 689b0c2d39a..f544c853910 100644 --- a/gnu/dist/libiberty/basename.c +++ b/gnu/dist/libiberty/basename.c @@ -20,10 +20,6 @@ BUGS #include "ansidecl.h" #include "libiberty.h" -#include "config.h" - -#ifdef NEED_basename - char * basename (name) const char *name; @@ -39,5 +35,3 @@ basename (name) } return (char *) base; } - -#endif diff --git a/gnu/dist/libiberty/clock.c b/gnu/dist/libiberty/clock.c index b60de1657a4..b204566ff25 100644 --- a/gnu/dist/libiberty/clock.c +++ b/gnu/dist/libiberty/clock.c @@ -22,13 +22,15 @@ 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 "config.h" + #ifdef HAVE_GETRUSAGE #include <sys/time.h> #include <sys/resource.h> #endif #ifdef HAVE_TIMES -#ifndef NO_SYS_PARAM_H +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #include <sys/times.h> diff --git a/gnu/dist/libiberty/config.in b/gnu/dist/libiberty/config.in new file mode 100644 index 00000000000..4195348d537 --- /dev/null +++ b/gnu/dist/libiberty/config.in @@ -0,0 +1,191 @@ +/* config.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* 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 alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have <vfork.h>. */ +#undef HAVE_VFORK_H + +/* 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 + +/* If using the C implementation of alloca, 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 you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR + +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the asprintf function. */ +#undef HAVE_ASPRINTF + +/* Define if you have the atexit function. */ +#undef HAVE_ATEXIT + +/* Define if you have the basename function. */ +#undef HAVE_BASENAME + +/* Define if you have the bcmp function. */ +#undef HAVE_BCMP + +/* Define if you have the bcopy function. */ +#undef HAVE_BCOPY + +/* Define if you have the bzero function. */ +#undef HAVE_BZERO + +/* Define if you have the clock function. */ +#undef HAVE_CLOCK + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the getrusage function. */ +#undef HAVE_GETRUSAGE + +/* Define if you have the index function. */ +#undef HAVE_INDEX + +/* Define if you have the insque function. */ +#undef HAVE_INSQUE + +/* Define if you have the memchr function. */ +#undef HAVE_MEMCHR + +/* Define if you have the memcmp function. */ +#undef HAVE_MEMCMP + +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + +/* Define if you have the memmove function. */ +#undef HAVE_MEMMOVE + +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + +/* Define if you have the on_exit function. */ +#undef HAVE_ON_EXIT + +/* Define if you have the psignal function. */ +#undef HAVE_PSIGNAL + +/* Define if you have the random function. */ +#undef HAVE_RANDOM + +/* Define if you have the rename function. */ +#undef HAVE_RENAME + +/* Define if you have the rindex function. */ +#undef HAVE_RINDEX + +/* Define if you have the sigsetmask function. */ +#undef HAVE_SIGSETMASK + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define if you have the strrchr function. */ +#undef HAVE_STRRCHR + +/* Define if you have the strsignal function. */ +#undef HAVE_STRSIGNAL + +/* Define if you have the strstr function. */ +#undef HAVE_STRSTR + +/* Define if you have the strtod function. */ +#undef HAVE_STRTOD + +/* Define if you have the strtol function. */ +#undef HAVE_STRTOL + +/* Define if you have the strtoul function. */ +#undef HAVE_STRTOUL + +/* Define if you have the sysconf function. */ +#undef HAVE_SYSCONF + +/* Define if you have the times function. */ +#undef HAVE_TIMES + +/* Define if you have the tmpnam function. */ +#undef HAVE_TMPNAM + +/* Define if you have the vasprintf function. */ +#undef HAVE_VASPRINTF + +/* Define if you have the vfprintf function. */ +#undef HAVE_VFPRINTF + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the vsprintf function. */ +#undef HAVE_VSPRINTF + +/* Define if you have the waitpid function. */ +#undef HAVE_WAITPID + +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H diff --git a/gnu/dist/libiberty/config.table b/gnu/dist/libiberty/config.table index dba783b489f..828b3b2bfe0 100644 --- a/gnu/dist/libiberty/config.table +++ b/gnu/dist/libiberty/config.table @@ -1,41 +1,10 @@ case "${host}" in rs6000-ibm-aix3.1 | rs6000-ibm-aix) - frag=mh-aix - files=${xsrcdir}alloca-botch.h ;; - *-ibm-aix*) files=${xsrcdir}alloca-botch.h ;; - arm-*-riscix*) frag=mh-riscix ;; - m68k-apollo-bsd*) frag=mh-a68bsd ;; - m68k-apollo-sysv*) frag=mh-apollo68 ;; - i[3456]86-ncr-sysv4*) frag=mh-ncr3000 ;; + frag=mh-aix ;; *-*-cxux7*) frag=mh-cxux7 ;; - *-*-cygwin32) frag=mh-cygwin32 ;; - *-*-dgux*) frag=mh-sysv ;; - hppa*-hp-bsd*) frag=mh-hpbsd ;; - *-*-hpux*) frag=mh-hpux ;; - *-*-hiux*) frag=mh-hpux ;; - *-*-irix4*) frag=mh-irix4 ;; - *-*-irix*) frag=mh-sysv ;; - *-*-m88kbcs*) frag=mh-sysv ;; - *-*-solaris2*) frag=mh-sysv4 ;; - *-*-sysv4*) frag=mh-sysv4 ;; - *-*-sysv*) frag=mh-sysv ;; - *-*-go32) frag=mh-go32 ;; + *-*-freebsd2.1.*) frag=mh-fbsd21 ;; + *-*-freebsd2.2.*) frag=mh-fbsd21 ;; i[345]86-*-windows*) frag=mh-windows ;; - - *-*-vxworks5*) - # VxWorks 5 needs special action, because the usual - # autoconfiguration scheme does not work. - frag=mt-vxworks5 - ;; -esac - -# Try to handle funky case of solaris 2 -> sun 4. -case "${host}" in - sparc-sun-sunos4.1.3) - if [ "${with_cross_host}" != "${host}" ] ; then - frag=mt-sunos4 - fi - ;; esac frags=$frag @@ -44,10 +13,12 @@ frags=$frag case "${enable_shared}" in yes) shared=yes ;; no) shared=no ;; + "") shared=no ;; *) shared=yes ;; esac if [ "${shared}" = "yes" ]; then case "${host}" in + *-*-cygwin32*) ;; hppa*-*-*) frags="${frags} ../../config/mh-papic" ;; i[3456]86-*-*) frags="${frags} ../../config/mh-x86pic" ;; *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;; @@ -57,6 +28,14 @@ fi echo "# Warning: this fragment is automatically generated" > temp-frag for frag in ${frags}; do + case ${frag} in + ../* ) + if [ ${srcdir} = . ]; then + [ -n "${with_target_subdir}" ] && frag=../${frag} + [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag} + fi + ;; + esac frag=${srcdir}/${xsrcdir}config/$frag if [ -f ${frag} ]; then echo "Appending ${frag} to xhost-mkfrag" @@ -65,5 +44,12 @@ for frag in ${frags}; do fi done +# record if we want to build shared libs. +if [ "${shared}" = "yes" ]; then + echo enable_shared = yes >> temp-frag +else + echo enable_shared = no >> temp-frag +fi + frag=xhost-mkfrag -${config_shell} ${moveifchange} temp-frag xhost-mkfrag +${CONFIG_SHELL} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag diff --git a/gnu/dist/libiberty/config/mh-aix b/gnu/dist/libiberty/config/mh-aix index c7b848d976a..6b645058fa9 100644 --- a/gnu/dist/libiberty/config/mh-aix +++ b/gnu/dist/libiberty/config/mh-aix @@ -1,6 +1,5 @@ +# This file is only needed by AIX 3.1. HDEFINES = -D__IEEE_BIG_ENDIAN -RANLIB=true -INSTALL=cp # Most releases of AIX 3.1 include an incorrect internal version of copysign # in libc.a for use by some libc public functions including modf. The public diff --git a/gnu/dist/libiberty/config/mh-cxux7 b/gnu/dist/libiberty/config/mh-cxux7 index 6d4d30bf46f..a924b0853fc 100644 --- a/gnu/dist/libiberty/config/mh-cxux7 +++ b/gnu/dist/libiberty/config/mh-cxux7 @@ -1,3 +1 @@ -HDEFINES = -DHAVE_SYSCONF -DHARRIS_FLOAT_FORMAT -RANLIB=true -INSTALL = cp +HDEFINES = -DHARRIS_FLOAT_FORMAT diff --git a/gnu/dist/libiberty/config/mh-fbsd21 b/gnu/dist/libiberty/config/mh-fbsd21 new file mode 100644 index 00000000000..1375a780bef --- /dev/null +++ b/gnu/dist/libiberty/config/mh-fbsd21 @@ -0,0 +1 @@ +EXTRA_OFILES=vasprintf.o diff --git a/gnu/dist/libiberty/config/mh-windows b/gnu/dist/libiberty/config/mh-windows index f20c51f2191..3ff5f794e9f 100644 --- a/gnu/dist/libiberty/config/mh-windows +++ b/gnu/dist/libiberty/config/mh-windows @@ -1,2 +1 @@ -HDEFINES=-DNEED_basename -DNEED_sys_siglist -DNEED_strsignal -DNO_SYS_FILE_H -EXTRA_OFILES=strcasecmp.o vasprintf.o +EXTRA_OFILES=asprintf.o strcasecmp.o strncasecmp.o vasprintf.o diff --git a/gnu/dist/libiberty/configure b/gnu/dist/libiberty/configure new file mode 100644 index 00000000000..7de36aa2149 --- /dev/null +++ b/gnu/dist/libiberty/configure @@ -0,0 +1,2747 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-target-subdir=SUBDIR Configuring with a cross compiler" +ac_help="$ac_help + --with-newlib Configuring with newlib" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +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" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*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" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # 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 + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # 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 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # 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'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*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" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + 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" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; 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 + +# 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 +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" ;; + 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 + +# 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 + +# 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=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +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 + + + +# Check whether --with-target-subdir or --without-target-subdir was given. +if test "${with_target_subdir+set}" = set; then + withval="$with_target_subdir" + : +fi + +# Check whether --with-newlib or --without-newlib was given. +if test "${with_newlib+set}" = set; then + withval="$with_newlib" + : +fi + + +if test "${srcdir}" = "."; then + if test -z "${with_target_subdir}"; then + libiberty_topdir="${srcdir}/.." + else + if test "${with_target_subdir}" != "."; then + libiberty_topdir="${srcdir}/${with_multisrctop}../.." + else + libiberty_topdir="${srcdir}/${with_multisrctop}.." + fi + fi +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 + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -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; } +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. + + + +# 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:581: checking host system type" >&5 + +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 + +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 + + + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:604: checking build system type" >&5 + +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. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:630: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:" + for ac_dir in $PATH; 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" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# 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:661: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:" + for ac_dir in $PATH; 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" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # 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:692: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:" + for ac_dir in $PATH; 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=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +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. + + + + +# 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:736: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:" + for ac_dir in $PATH; 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" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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:765: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; 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" +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 + # 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="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:813: 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 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + 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:837: 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 +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:866: 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 +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + + + + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# 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:904: checking for a BSD compatible install" >&5 +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="${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 + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. 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" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +. ${srcdir}/config.table +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:963: 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 978 "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:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 995 "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:1001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1027: 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 1032 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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" +fi +rm -f conftest* +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 +fi +done + + +# This is the list of functions which libiberty will provide if they +# are not available on the host. + +funcs="asprintf" +funcs="$funcs atexit" +funcs="$funcs basename" +funcs="$funcs bcmp" +funcs="$funcs bcopy" +funcs="$funcs bzero" +funcs="$funcs clock" +funcs="$funcs getcwd" +funcs="$funcs getpagesize" +funcs="$funcs index" +funcs="$funcs insque" +funcs="$funcs memchr" +funcs="$funcs memcmp" +funcs="$funcs memcpy" +funcs="$funcs memmove" +funcs="$funcs memset" +funcs="$funcs random" +funcs="$funcs rename" +funcs="$funcs rindex" +funcs="$funcs sigsetmask" +funcs="$funcs strcasecmp" +funcs="$funcs strchr" +funcs="$funcs strdup" +funcs="$funcs strncasecmp" +funcs="$funcs strrchr" +funcs="$funcs strstr" +funcs="$funcs strtod" +funcs="$funcs strtol" +funcs="$funcs strtoul" +funcs="$funcs tmpnam" +funcs="$funcs vasprintf" +funcs="$funcs vfprintf" +funcs="$funcs vprintf" +funcs="$funcs vsprintf" +funcs="$funcs waitpid" + +# Also in the old function.def file: alloca, vfork, getopt. + +vars="sys_errlist sys_nerr sys_siglist" + +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times" + +# 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 bzero clock getcwd +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1115: 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 1120 "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:1143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 getpagesize index insque memchr memcmp memcpy memmove +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1170: 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 1175 "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:1198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 memset random rename rindex sigsetmask strcasecmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1225: 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 1230 "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:1253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 strchr strdup strncasecmp strrchr strstr strtod strtol +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1280: 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 1285 "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:1308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1335: 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 1340 "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:1363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_SIGLIST 1 +EOF + + for ac_func in getrusage on_exit psignal strerror strsignal sysconf times +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1402: 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 1407 "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:1430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 + +fi + +# For each of these functions, if the host does not provide the +# function we want to put FN.o in LIBOBJS, and if the host does +# provide the function, we want to define HAVE_FN in config.h. Also, +# if the host does not provide alloca, we set ALLOCA to alloca.o + +setobjs= +if test -n "${with_target_subdir}"; then + + # We are being configured with a cross compiler. AC_REPLACE_FUNCS + # may not work correctly, because the compiler may not be able to + # link executables. + + # If we are being configured for newlib, we know which functions + # newlib provide and which ones we will be expected to provide. + + if test "x${with_newlib}" = "xyes"; then + ALLOCA="alloca.o" + LIBOBJS="basename.o insque.o random.o strdup.o vasprintf.o" + + for f in $funcs; do + case "$f" in + basename | insque | random | strdup | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + ;; + esac + done + + # newlib doesnt provide any of the variables in $vars, so we + # dont have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + cat >> confdefs.h <<\EOF +#define HAVE_STRERROR 1 +EOF + + + setobjs=yes + + fi +fi + +if test -z "${setobjs}"; then + case "${host}" in + + *-*-vxworks*) + # 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" + for f in $funcs; do + case "$f" in + basename | getpagesize | insque | random | strcasecmp) + ;; + strncasecmp | strdup | vfork | waitpid | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + ;; + esac + done + + # VxWorks doesn't provide any of the variables in $vars, so we + # don't have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + cat >> confdefs.h <<\EOF +#define HAVE_STRERROR 1 +EOF + + + setobjs=yes + ;; + + esac +fi + +if test -z "${setobjs}"; then + + case "${host}" in + + *-*-cygwin32*) + # The cygwin32 library actually uses a couple of files from + # libiberty when it is built. If we are building a native + # cygwin32, and we run the tests, we will appear to have these + # files. However, when we go on to build winsup, we will wind up + # with a library which does not have the files, since they should + # have come from libiberty. + + # We handle this by removing the functions the winsup library + # provides from our shell variables, so that they appear to be + # missing. + + funcs="`echo $funcs | sed -e 's/random//'`" + LIBOBJS="$LIBOBJS random.o" + vars="`echo $vars | sed -e 's/sys_siglist//'`" + checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" + ;; + + *-*-mingw32*) + # Under mingw32, sys_nerr and sys_errlist exist, but they are + # macros, so the test below won't find them. + vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + ;; + + esac + + # 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:1584: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <<EOF +#line 1594 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:1598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 +fi +rm -fr conftest* + +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:1618: 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 +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1625: 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 1630 "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:1653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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}.o" +fi +done + + + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:1682: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1687 "configure" +#include "confdefs.h" +#include <alloca.h> +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:1694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:1715: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1720 "configure" +#include "confdefs.h" + +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1775: 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 +else + cat > conftest.$ac_ext <<EOF +#line 1780 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + 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 +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:1805: 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 1810 "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:1833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 +#define CRAY_STACKSEG_END $ac_func +EOF + + 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:1860: 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 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext <<EOF +#line 1868 "configure" +#include "confdefs.h" +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:1887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +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 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1909: 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 +else + cat > conftest.$ac_ext <<EOF +#line 1914 "configure" +#include "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:1922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + 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 +fi +rm -f conftest* + +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 1939 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1957 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 1978 "configure" +#include "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); } + +EOF +if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:2013: 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 +else + cat > conftest.$ac_ext <<EOF +#line 2018 "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 "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:2047: 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 +else + cat > conftest.$ac_ext <<EOF +#line 2052 "configure" +#include "confdefs.h" +#include <vfork.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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" +fi +rm -f conftest* +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 + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for working vfork""... $ac_c" 1>&6 +echo "configure:2082: 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:2088: 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 2093 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vfork(); 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 vfork(); + +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_vfork) || defined (__stub___vfork) +choke me +#else +vfork(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* +fi + +if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + +ac_cv_func_vfork_works=$ac_cv_func_vfork +else + cat > conftest.$ac_ext <<EOF +#line 2138 "configure" +#include "confdefs.h" +/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef 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 +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + 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. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || 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. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +EOF +if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +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 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 +if test $ac_cv_func_vfork_works = no; then + cat >> confdefs.h <<\EOF +#define vfork fork +EOF + +fi + + if test $ac_cv_func_vfork_works = no; then + LIBOBJS="$LIBOBJS vfork.o" + fi + for v in $vars; do + echo $ac_n "checking for $v""... $ac_c" 1>&6 +echo "configure:2260: 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 2265 "configure" +#include "confdefs.h" +int *p; +int main() { +extern int $v; p = &$v; +; return 0; } +EOF +if { (eval echo configure:2272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + 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" +fi +rm -f conftest* +fi + + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then + echo "$ac_t""yes" 1>&6 + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + else + echo "$ac_t""no" 1>&6 + fi + done + for ac_func in $checkfuncs +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2298: 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 2303 "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:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 + +fi + +# Install a library built with a cross compiler in $(tooldir) rather +# than $(libdir). +if test -z "${with_target_subdir}"; then + INSTALL_DEST=libdir +else + INSTALL_DEST=tooldir +fi + + +# We need multilib support, but only if configuring for the target. +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. +# +# 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. +# +EOF +# 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) 2>&1 | grep ac_space` 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 + if test -w $cache_file; then + 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. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +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} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# 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. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +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.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# 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%@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%@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%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@CPP@%$CPP%g +s%@LIBOBJS@%$LIBOBJS%g +s%@ALLOCA@%$ALLOCA%g +s%@INSTALL_DEST@%$INSTALL_DEST%g + +CEOF +EOF + +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 + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + 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` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"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" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # 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= + fi + + 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" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + 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= ;; + 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* + +# 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_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 + # 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" ;; + 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 + +# 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. + +rm -f conftest.tail +while : +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 + 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 + 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 + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libiberty_topdir=${libiberty_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${libiberty_topdir}/config-ml.in + fi +fi +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/gnu/dist/libiberty/configure.bat b/gnu/dist/libiberty/configure.bat index ed33777174b..18881ac2f75 100644 --- a/gnu/dist/libiberty/configure.bat +++ b/gnu/dist/libiberty/configure.bat @@ -5,7 +5,6 @@ echo Configuring libiberty for go32 copy Makefile.dos Makefile
echo #define NEED_sys_siglist 1 >> config.h
echo #define NEED_psignal 1 >> config.h
-update alloca-normal.h alloca-conf.h
goto exit
:h8300
diff --git a/gnu/dist/libiberty/configure.in b/gnu/dist/libiberty/configure.in index b8fe5fe6921..b81e009bb58 100644 --- a/gnu/dist/libiberty/configure.in +++ b/gnu/dist/libiberty/configure.in @@ -1,78 +1,328 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. +dnl Process this file with autoconf to produce a configure script -configdirs= -srctrigger=getopt1.c -srcname="-liberty library" +AC_PREREQ(2.5) +AC_INIT(pexecute.c) -# per-host: +dnl We use these options to decide which functions to include. +AC_ARG_WITH(target-subdir, +[ --with-target-subdir=SUBDIR Configuring with a cross compiler]) +AC_ARG_WITH(newlib, +[ --with-newlib Configuring with newlib]) -files="alloca-norm.h" -links="alloca-conf.h" +if test "${srcdir}" = "."; then + if test -z "${with_target_subdir}"; then + libiberty_topdir="${srcdir}/.." + else + if test "${with_target_subdir}" != "."; then + libiberty_topdir="${srcdir}/${with_multisrctop}../.." + else + libiberty_topdir="${srcdir}/${with_multisrctop}.." + fi + fi +else + libiberty_topdir="${srcdir}/.." +fi +AC_CONFIG_AUX_DIR($libiberty_topdir) + +AC_CANONICAL_HOST + +dnl When we start using automake: +dnl AM_INIT_AUTOMAKE(libiberty, 1.0) + +dnl These must be called before AM_PROG_LIBTOOL, because it may want +dnl to call AC_CHECK_PROG. +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +# 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 +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= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_ISC_POSIX + +dnl When we start using libtool: +dnl Default to a non shared library. This may be overridden by the +dnl configure option --enable-shared. +dnl AM_DISABLE_SHARED + +dnl When we start using libtool: +dnl AM_PROG_LIBTOOL + +dnl When we start using automake: +dnl AM_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_HEADER(config.h:config.in) + +dnl When we start using automake: +dnl AM_MAINTAINER_MODE +dnl AM_EXEEXT + +dnl When we start using automake: +dnl AM_PROG_INSTALL +AC_PROG_INSTALL . ${srcdir}/config.table host_makefile_frag=${frag} +AC_SUBST_FILE(host_makefile_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. +AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h) + +# This is the list of functions which libiberty will provide if they +# are not available on the host. + +funcs="asprintf" +funcs="$funcs atexit" +funcs="$funcs basename" +funcs="$funcs bcmp" +funcs="$funcs bcopy" +funcs="$funcs bzero" +funcs="$funcs clock" +funcs="$funcs getcwd" +funcs="$funcs getpagesize" +funcs="$funcs index" +funcs="$funcs insque" +funcs="$funcs memchr" +funcs="$funcs memcmp" +funcs="$funcs memcpy" +funcs="$funcs memmove" +funcs="$funcs memset" +funcs="$funcs random" +funcs="$funcs rename" +funcs="$funcs rindex" +funcs="$funcs sigsetmask" +funcs="$funcs strcasecmp" +funcs="$funcs strchr" +funcs="$funcs strdup" +funcs="$funcs strncasecmp" +funcs="$funcs strrchr" +funcs="$funcs strstr" +funcs="$funcs strtod" +funcs="$funcs strtol" +funcs="$funcs strtoul" +funcs="$funcs tmpnam" +funcs="$funcs vasprintf" +funcs="$funcs vfprintf" +funcs="$funcs vprintf" +funcs="$funcs vsprintf" +funcs="$funcs waitpid" + +# Also in the old function.def file: alloca, vfork, getopt. + +vars="sys_errlist sys_nerr sys_siglist" -# per-target: - -# post-target: - -# If this is the target libiberty, check at compile time whether we are using -# newlib. If we are, we already know the files we need, since the linker -# will fail when run on some of the newlib targets. -if [ -n "${with_target_subdir}" ] ; then - cat > Makefile.tem <<'!EOF!' -CONFIG_H = xconfig.h -NEEDED_LIST = xneeded-list - -xconfig.h: Makefile - if [ -f ../newlib/Makefile ]; then \ - echo "#define NEED_sys_nerr 1" >xconfig.h; \ - echo "#define NEED_sys_errlist 1" >>xconfig.h; \ - echo "#define NEED_sys_siglist 1" >>xconfig.h; \ - echo "#define NEED_strsignal 1" >>xconfig.h; \ - echo "#define NEED_psignal 1" >>xconfig.h; \ - else \ - $(MAKE) $(FLAGS_TO_PASS) lconfig.h; \ - cp lconfig.h xconfig.h; \ - fi - -xneeded-list: Makefile - if [ -f ../newlib/Makefile ]; then \ - echo insque.o random.o strdup.o alloca.o vasprintf.o >xneeded-list; \ - else \ - $(MAKE) $(FLAGS_TO_PASS) lneeded-list; \ - cp lneeded-list xneeded-list; \ - fi -!EOF! -sed -e "/^####/ r Makefile.tem" \ - -e '/INSTALL_DEST =/s/libdir/tooldir/' ${Makefile} > Makefile.tem3 -mv Makefile.tem3 ${Makefile} -rm -f Makefile.tem +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times" + +# 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 + AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero clock getcwd) + AC_CHECK_FUNCS(getpagesize index insque memchr memcmp memcpy memmove) + AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp) + AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol) + AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid) + AC_DEFINE(HAVE_SYS_ERRLIST) + AC_DEFINE(HAVE_SYS_NERR) + AC_DEFINE(HAVE_SYS_SIGLIST) + AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times) fi -# We need multilib support, but only if configuring for the target. -if [ -n "${with_target_subdir}" ] ; then - case ${srcdir} in - .) - if [ "${with_target_subdir}" != "." ] ; then - - # Set MULTISRCTOP to the value we need if we are not doing - # multilib. This will be overridden if --enable-multilib was - # used. - sed -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ../:" \ - ${Makefile} > Makefile.tem - rm -f ${Makefile} - mv Makefile.tem ${Makefile} - - . ${srcdir}/${with_multisrctop}../../config-ml.in - else - . ${srcdir}/${with_multisrctop}../config-ml.in - fi +# For each of these functions, if the host does not provide the +# function we want to put FN.o in LIBOBJS, and if the host does +# provide the function, we want to define HAVE_FN in config.h. Also, +# if the host does not provide alloca, we set ALLOCA to alloca.o + +setobjs= +if test -n "${with_target_subdir}"; then + + # We are being configured with a cross compiler. AC_REPLACE_FUNCS + # may not work correctly, because the compiler may not be able to + # link executables. + + # If we are being configured for newlib, we know which functions + # newlib provide and which ones we will be expected to provide. + + if test "x${with_newlib}" = "xyes"; then + ALLOCA="alloca.o" + LIBOBJS="basename.o insque.o random.o strdup.o vasprintf.o" + + for f in $funcs; do + case "$f" in + basename | insque | random | strdup | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # newlib doesnt provide any of the variables in $vars, so we + # dont have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + AC_DEFINE(HAVE_STRERROR) + + setobjs=yes + + fi +fi + +if test -z "${setobjs}"; then + case "${host}" in + + *-*-vxworks*) + # 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" + for f in $funcs; do + case "$f" in + basename | getpagesize | insque | random | strcasecmp) + ;; + strncasecmp | strdup | vfork | waitpid | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # VxWorks doesn't provide any of the variables in $vars, so we + # don't have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + AC_DEFINE(HAVE_STRERROR) + + setobjs=yes + ;; + + esac +fi + +if test -z "${setobjs}"; then + + case "${host}" in + + *-*-cygwin32*) + # The cygwin32 library actually uses a couple of files from + # libiberty when it is built. If we are building a native + # cygwin32, and we run the tests, we will appear to have these + # files. However, when we go on to build winsup, we will wind up + # with a library which does not have the files, since they should + # have come from libiberty. + + # We handle this by removing the functions the winsup library + # provides from our shell variables, so that they appear to be + # missing. + + funcs="`echo $funcs | sed -e 's/random//'`" + LIBOBJS="$LIBOBJS random.o" + vars="`echo $vars | sed -e 's/sys_siglist//'`" + checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" ;; - *) - . ${srcdir}/../config-ml.in + + *-*-mingw32*) + # Under mingw32, sys_nerr and sys_errlist exist, but they are + # macros, so the test below won't find them. + vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" + AC_DEFINE(HAVE_SYS_NERR) + AC_DEFINE(HAVE_SYS_ERRLIST) ;; + esac + + # We haven't set the list of objects yet. Use the standard autoconf + # tests. This will only work if the compiler works. + AC_PROG_CC_WORKS + AC_REPLACE_FUNCS($funcs) + AC_FUNC_ALLOCA + AC_FUNC_VFORK + if test $ac_cv_func_vfork_works = no; then + LIBOBJS="$LIBOBJS vfork.o" + fi + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + AC_CHECK_FUNCS($checkfuncs) fi + +# Install a library built with a cross compiler in $(tooldir) rather +# than $(libdir). +if test -z "${with_target_subdir}"; then + INSTALL_DEST=libdir +else + INSTALL_DEST=tooldir +fi +AC_SUBST(INSTALL_DEST) + +# We need multilib support, but only if configuring for the target. +AC_OUTPUT(Makefile, +[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${libiberty_topdir}/config-ml.in + fi +fi], +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libiberty_topdir=${libiberty_topdir} +) diff --git a/gnu/dist/libiberty/cplus-dem.c b/gnu/dist/libiberty/cplus-dem.c index 9579021aa9b..c5d76a73e50 100644 --- a/gnu/dist/libiberty/cplus-dem.c +++ b/gnu/dist/libiberty/cplus-dem.c @@ -1,5 +1,5 @@ /* Demangler for GNU C++ - Copyright 1989, 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling @@ -29,9 +29,14 @@ Boston, MA 02111-1307, USA. */ try not to break either. */ #include <ctype.h> +#include <sys/types.h> #include <string.h> #include <stdio.h> +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + #include <demangle.h> #undef CURRENT_DEMANGLING_STYLE #define CURRENT_DEMANGLING_STYLE work->options @@ -89,6 +94,13 @@ set_cplus_marker_for_demangling (ch) cplus_markers[0] = ch; } +typedef struct string /* Beware: these aren't required to be */ +{ /* '\0' terminated. */ + char *b; /* pointer to start of string */ + char *p; /* pointer after last character */ + char *e; /* pointer after end of allocated space */ +} string; + /* Stuff that is shared between sub-routines. Using a shared structure allows cplus_demangle to be reentrant. */ @@ -96,12 +108,26 @@ struct work_stuff { int options; char **typevec; + char **ktypevec; + char **btypevec; + int numk; + int numb; + int ksize; + int bsize; int ntypes; int typevec_size; int constructor; int destructor; int static_type; /* A static member function */ int const_type; /* A const member function */ + int volatile_type; /* A volatile member function */ + char **tmpl_argvec; /* Template function arguments. */ + int ntmpl_args; /* The number of template function arguments. */ + int forgetting_types; /* Nonzero if we are not remembering the types + we see. */ + string* previous_argument; /* The last function argument demangled. */ + int nrepeats; /* The number of times to repeat the previous + argument. */ }; #define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) @@ -190,22 +216,20 @@ static const struct optable {"min", "<?", 0}, /* old */ {"mn", "<?", DMGL_ANSI}, /* pseudo-ansi */ {"nop", "", 0}, /* old (for operator=) */ - {"rm", "->*", DMGL_ANSI} /* ansi */ + {"rm", "->*", DMGL_ANSI}, /* ansi */ + {"sz", "sizeof ", DMGL_ANSI} /* pseudo-ansi */ }; -typedef struct string /* Beware: these aren't required to be */ -{ /* '\0' terminated. */ - char *b; /* pointer to start of string */ - char *p; /* pointer after last character */ - char *e; /* pointer after end of allocated space */ -} string; - #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)) + +/* The scope separator appropriate for the language being demangled. */ +#define SCOPE_STRING(work) "::" #define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */ #define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */ @@ -215,14 +239,24 @@ typedef struct string /* Beware: these aren't required to be */ static char * mop_up PARAMS ((struct work_stuff *, string *, int)); +static void +squangle_mop_up PARAMS ((struct work_stuff *)); + #if 0 static int -demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *)); +demangle_method_args PARAMS ((struct work_stuff *, const char **, string *)); #endif +static char * +internal_cplus_demangle PARAMS ((struct work_stuff *, const char *)); + +static int +demangle_template_template_parm PARAMS ((struct work_stuff *work, + const char **, string *)); + static int demangle_template PARAMS ((struct work_stuff *work, const char **, string *, - string *)); + string *, int, int)); static int arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **, @@ -254,7 +288,7 @@ static int gnu_special PARAMS ((struct work_stuff *, const char **, string *)); static int -arm_special PARAMS ((struct work_stuff *, const char **, string *)); +arm_special PARAMS ((const char **, string *)); static void string_need PARAMS ((string *, int)); @@ -294,10 +328,16 @@ get_count PARAMS ((const char **, int *)); static int consume_count PARAMS ((const char **)); +static int +consume_count_with_underscores PARAMS ((const char**)); + static int demangle_args PARAMS ((struct work_stuff *, const char **, string *)); static int +demangle_nested_args PARAMS ((struct work_stuff*, const char**, string*)); + +static int do_type PARAMS ((struct work_stuff *, const char **, string *)); static int @@ -311,11 +351,27 @@ static void remember_type PARAMS ((struct work_stuff *, const char *, int)); static void +remember_Btype PARAMS ((struct work_stuff *, const char *, int, int)); + +static int +register_Btype PARAMS ((struct work_stuff *)); + +static void +remember_Ktype PARAMS ((struct work_stuff *, const char *, int)); + +static void forget_types PARAMS ((struct work_stuff *)); static void +forget_B_and_K_types PARAMS ((struct work_stuff *)); + +static void string_prepends PARAMS ((string *, string *)); +static int +demangle_template_value_parm PARAMS ((struct work_stuff*, + const char**, string*)); + /* Translate count to integer, consuming tokens in the process. Conversion terminates on the first non-digit character. Trying to consume something that isn't a count results in @@ -336,13 +392,49 @@ consume_count (type) return (count); } + +/* Like consume_count, but for counts that are preceded and followed + by '_' if they are greater than 10. Also, -1 is returned for + failure, since 0 can be a valid value. */ + +static int +consume_count_with_underscores (mangled) + const char **mangled; +{ + int idx; + + if (**mangled == '_') + { + (*mangled)++; + if (!isdigit (**mangled)) + return -1; + + idx = consume_count (mangled); + if (**mangled != '_') + /* The trailing underscore was missing. */ + return -1; + + (*mangled)++; + } + else + { + if (**mangled < '0' || **mangled > '9') + return -1; + + idx = **mangled - '0'; + (*mangled)++; + } + + return idx; +} + int cplus_demangle_opname (opname, result, options) const char *opname; char *result; int options; { - int len, i, len1, ret; + int len, len1, ret; string type; struct work_stuff work[1]; const char *tem; @@ -350,6 +442,7 @@ cplus_demangle_opname (opname, result, options) len = strlen(opname); result[0] = '\0'; ret = 0; + memset ((char *) work, 0, sizeof (work)); work->options = options; if (opname[0] == '_' && opname[1] == '_' @@ -373,6 +466,7 @@ cplus_demangle_opname (opname, result, options) if (opname[4] == '\0') { /* Operator. */ + size_t i; for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { if (strlen (optable[i].in) == 2 @@ -390,6 +484,7 @@ cplus_demangle_opname (opname, result, options) if (opname[2] == 'a' && opname[5] == '\0') { /* Assignment. */ + size_t i; for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { if (strlen (optable[i].in) == 3 @@ -413,6 +508,7 @@ cplus_demangle_opname (opname, result, options) if (len >= 10 /* op$assign_ */ && memcmp (opname + 3, "assign_", 7) == 0) { + size_t i; for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { len1 = len - 10; @@ -429,6 +525,7 @@ cplus_demangle_opname (opname, result, options) } else { + size_t i; for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { len1 = len - 3; @@ -456,6 +553,7 @@ cplus_demangle_opname (opname, result, options) ret = 1; } } + squangle_mop_up (work); return ret; } @@ -470,7 +568,7 @@ cplus_mangle_opname (opname, options) const char *opname; int options; { - int i; + size_t i; int len; len = strlen (opname); @@ -517,18 +615,47 @@ cplus_demangle (mangled, options) const char *mangled; int options; { + char *ret; + struct work_stuff work[1]; + memset ((char *) work, 0, sizeof (work)); + work -> options = options; + if ((work -> options & DMGL_STYLE_MASK) == 0) + work -> options |= (int) current_demangling_style & DMGL_STYLE_MASK; + + ret = internal_cplus_demangle (work, mangled); + squangle_mop_up (work); + return (ret); +} + + +/* 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 + calls go directly to this routine to avoid resetting that info. */ + +static char * +internal_cplus_demangle (work, mangled) + struct work_stuff *work; + const char *mangled; +{ + string decl; int success = 0; - struct work_stuff work[1]; char *demangled = NULL; + int s1,s2,s3,s4; + int saved_volatile_type; + s1 = work->constructor; + s2 = work->destructor; + s3 = work->static_type; + s4 = work->const_type; + saved_volatile_type = work->volatile_type; + work->constructor = work->destructor = 0; + work->static_type = work->const_type = 0; + work->volatile_type = 0; if ((mangled != NULL) && (*mangled != '\0')) { - memset ((char *) work, 0, sizeof (work)); - work -> options = options; - if ((work->options & DMGL_STYLE_MASK) == 0) - work->options |= (int)current_demangling_style & DMGL_STYLE_MASK; - string_init (&decl); /* First check to see if gnu style demangling is active and if the @@ -552,19 +679,44 @@ cplus_demangle (mangled, options) } if (work->constructor == 2) { - string_prepend(&decl, "global constructors keyed to "); + string_prepend (&decl, "global constructors keyed to "); work->constructor = 0; } else if (work->destructor == 2) { - string_prepend(&decl, "global destructors keyed to "); + string_prepend (&decl, "global destructors keyed to "); work->destructor = 0; } demangled = mop_up (work, &decl, success); } + work->constructor = s1; + work->destructor = s2; + work->static_type = s3; + work->const_type = s4; + work->volatile_type = saved_volatile_type; return (demangled); } + +/* Clear out and squangling related storage */ +static void +squangle_mop_up (work) + struct work_stuff *work; +{ + /* clean up the B and K type mangling types. */ + forget_B_and_K_types (work); + if (work -> btypevec != NULL) + { + free ((char *) work -> btypevec); + } + if (work -> ktypevec != NULL) + { + free ((char *) work -> ktypevec); + } +} + +/* Clear out any mangled storage */ + static char * mop_up (work, declp, success) struct work_stuff *work; @@ -579,8 +731,25 @@ mop_up (work, declp, success) if (work -> typevec != NULL) { free ((char *) work -> typevec); + work -> typevec = NULL; } - + if (work->tmpl_argvec) + { + int i; + + for (i = 0; i < work->ntmpl_args; i++) + if (work->tmpl_argvec[i]) + free ((char*) work->tmpl_argvec[i]); + + free ((char*) work->tmpl_argvec); + work->tmpl_argvec = NULL; + } + if (work->previous_argument) + { + string_delete (work->previous_argument); + free ((char*) work->previous_argument); + } + /* If demangling was successful, ensure that the demangled string is null terminated and return it. Otherwise, free the demangling decl. */ @@ -635,6 +804,7 @@ demangle_signature (work, mangled, declp) int success = 1; int func_done = 0; int expect_func = 0; + int expect_return_type = 0; const char *oldmangled = NULL; string trawname; string tname; @@ -647,9 +817,15 @@ demangle_signature (work, mangled, declp) oldmangled = *mangled; success = demangle_qualified (work, mangled, declp, 1, 0); if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } + remember_type (work, oldmangled, *mangled - oldmangled); + if (AUTO_DEMANGLING || GNU_DEMANGLING) + expect_func = 1; + oldmangled = NULL; + break; + + case 'K': + oldmangled = *mangled; + success = demangle_qualified (work, mangled, declp, 1, 0); if (AUTO_DEMANGLING || GNU_DEMANGLING) { expect_func = 1; @@ -668,13 +844,16 @@ demangle_signature (work, mangled, declp) break; case 'C': - /* a const member function */ + case 'V': + if (**mangled == 'C') + work -> const_type = 1; + else + work->volatile_type = 1; + + /* a qualified member function */ if (oldmangled == NULL) - { - oldmangled = *mangled; - } + oldmangled = *mangled; (*mangled)++; - work -> const_type = 1; break; case '0': case '1': case '2': case '3': case '4': @@ -694,7 +873,21 @@ demangle_signature (work, mangled, declp) } oldmangled = NULL; break; - + + case 'B': + { + string s; + success = do_type (work, mangled, &s); + if (success) + { + string_append (&s, SCOPE_STRING (work)); + string_prepends (declp, &s); + } + oldmangled = NULL; + expect_func = 1; + } + break; + case 'F': /* Function */ /* ARM style demangling includes a specific 'F' character after @@ -726,12 +919,13 @@ demangle_signature (work, mangled, declp) { oldmangled = *mangled; } - success = demangle_template (work, mangled, &tname, &trawname); + success = demangle_template (work, mangled, &tname, + &trawname, 1, 1); if (success) { remember_type (work, oldmangled, *mangled - oldmangled); } - string_append(&tname, "::"); + string_append(&tname, SCOPE_STRING (work)); string_prepends(declp, &tname); if (work -> destructor & 1) { @@ -751,14 +945,44 @@ demangle_signature (work, mangled, declp) break; case '_': - /* At the outermost level, we cannot have a return type specified, - so if we run into another '_' at this point we are dealing with - a mangled name that is either bogus, or has been mangled by - some algorithm we don't know how to deal with. So just - reject the entire demangling. */ - success = 0; + if (GNU_DEMANGLING && expect_return_type) + { + /* Read the return type. */ + string return_type; + string_init (&return_type); + + (*mangled)++; + success = do_type (work, mangled, &return_type); + APPEND_BLANK (&return_type); + + string_prepends (declp, &return_type); + string_delete (&return_type); + break; + } + else + /* At the outermost level, we cannot have a return type specified, + so if we run into another '_' at this point we are dealing with + a mangled name that is either bogus, or has been mangled by + some algorithm we don't know how to deal with. So just + reject the entire demangling. */ + success = 0; break; + case 'H': + if (GNU_DEMANGLING) + { + /* A G++ template function. Read the template arguments. */ + success = demangle_template (work, mangled, declp, 0, 0, + 0); + if (!(work->constructor & 1)) + expect_return_type = 1; + (*mangled)++; + break; + } + else + /* fall through */ + {;} + default: if (AUTO_DEMANGLING || GNU_DEMANGLING) { @@ -785,6 +1009,10 @@ demangle_signature (work, mangled, declp) { func_done = 1; success = demangle_args (work, mangled, declp); + /* Since template include the mangling of their return types, + we must set expect_func to 0 so that we don't try do + demangle more arguments the next time we get here. */ + expect_func = 0; } } } @@ -802,13 +1030,12 @@ demangle_signature (work, mangled, declp) } } if (success && work -> static_type && PRINT_ARG_TYPES) - { - string_append (declp, " static"); - } + string_append (declp, " static"); if (success && work -> const_type && PRINT_ARG_TYPES) - { - string_append (declp, " const"); - } + string_append (declp, " const"); + else if (success && work->volatile_type && PRINT_ARG_TYPES) + string_append (declp, " volatile"); + return (success); } @@ -838,44 +1065,420 @@ demangle_method_args (work, mangled, declp) #endif static int -demangle_template (work, mangled, tname, trawname) +demangle_template_template_parm (work, mangled, tname) + struct work_stuff *work; + const char **mangled; + string *tname; +{ + int i; + int r; + int need_comma = 0; + int success = 1; + string temp; + + string_append (tname, "template <"); + /* get size of template parameter list */ + if (get_count (mangled, &r)) + { + for (i = 0; i < r; i++) + { + if (need_comma) + { + string_append (tname, ", "); + } + + /* Z for type parameters */ + if (**mangled == 'Z') + { + (*mangled)++; + string_append (tname, "class"); + } + /* z for template parameters */ + else if (**mangled == 'z') + { + (*mangled)++; + success = + demangle_template_template_parm (work, mangled, tname); + if (!success) + { + break; + } + } + else + { + /* temp is initialized in do_type */ + success = do_type (work, mangled, &temp); + if (success) + { + string_appends (tname, &temp); + } + string_delete(&temp); + if (!success) + { + break; + } + } + need_comma = 1; + } + + } + if (tname->p[-1] == '>') + string_append (tname, " "); + string_append (tname, "> class"); + return (success); +} + +static int +demangle_integral_value (work, mangled, s) + struct work_stuff *work; + const char** mangled; + string* s; +{ + int success; + + if (**mangled == 'E') + { + int need_operator = 0; + + success = 1; + string_appendn (s, "(", 1); + (*mangled)++; + while (success && **mangled != 'W' && **mangled != '\0') + { + if (need_operator) + { + size_t i; + size_t len; + + success = 0; + + len = strlen (*mangled); + + for (i = 0; + i < sizeof (optable) / sizeof (optable [0]); + ++i) + { + size_t l = strlen (optable[i].in); + + if (l <= len + && memcmp (optable[i].in, *mangled, l) == 0) + { + string_appendn (s, " ", 1); + string_append (s, optable[i].out); + string_appendn (s, " ", 1); + success = 1; + (*mangled) += l; + break; + } + } + + if (!success) + break; + } + else + need_operator = 1; + + success = demangle_template_value_parm (work, mangled, s); + } + + if (**mangled != 'W') + success = 0; + else + { + string_appendn (s, ")", 1); + (*mangled)++; + } + } + else if (**mangled == 'Q' || **mangled == 'K') + success = demangle_qualified (work, mangled, s, 0, 1); + else + { + success = 0; + + if (**mangled == 'm') + { + string_appendn (s, "-", 1); + (*mangled)++; + } + while (isdigit (**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + success = 1; + } + } + + return success; +} + +static int +demangle_template_value_parm (work, mangled, s) + struct work_stuff *work; + const char **mangled; + string* s; +{ + const char *old_p = *mangled; + int is_pointer = 0; + int is_real = 0; + int is_integral = 0; + int is_char = 0; + int is_bool = 0; + int done = 0; + int success = 1; + + while (*old_p && !done) + { + switch (*old_p) + { + case 'P': + case 'p': + case 'R': + done = is_pointer = 1; + break; + case 'C': /* const */ + case 'S': /* explicitly signed [char] */ + case 'U': /* unsigned */ + case 'V': /* volatile */ + case 'F': /* function */ + case 'M': /* member function */ + case 'O': /* ??? */ + case 'J': /* complex */ + old_p++; + continue; + case 'E': /* expression */ + case 'Q': /* qualified name */ + case 'K': /* qualified name */ + done = is_integral = 1; + break; + case 'B': /* remembered type */ + case 'T': /* remembered type */ + abort (); + break; + case 'v': /* void */ + abort (); + break; + case 'x': /* long long */ + case 'l': /* long */ + case 'i': /* int */ + case 's': /* short */ + case 'w': /* wchar_t */ + done = is_integral = 1; + break; + case 'b': /* bool */ + done = is_bool = 1; + break; + case 'c': /* char */ + done = is_char = 1; + break; + case 'r': /* long double */ + case 'd': /* double */ + case 'f': /* float */ + done = is_real = 1; + break; + default: + /* it's probably user defined type, let's assume + it's integral, it seems hard to figure out + what it really is */ + done = is_integral = 1; + } + } + if (**mangled == 'Y') + { + /* The next argument is a template parameter. */ + int idx; + + (*mangled)++; + idx = consume_count_with_underscores (mangled); + if (idx == -1 + || (work->tmpl_argvec && idx >= work->ntmpl_args) + || consume_count_with_underscores (mangled) == -1) + return -1; + if (work->tmpl_argvec) + string_append (s, work->tmpl_argvec[idx]); + else + { + char buf[10]; + sprintf(buf, "T%d", idx); + string_append (s, buf); + } + } + else if (is_integral) + success = demangle_integral_value (work, mangled, s); + else if (is_char) + { + char tmp[2]; + int val; + if (**mangled == 'm') + { + string_appendn (s, "-", 1); + (*mangled)++; + } + string_appendn (s, "'", 1); + val = consume_count(mangled); + if (val == 0) + return -1; + tmp[0] = (char)val; + tmp[1] = '\0'; + string_appendn (s, &tmp[0], 1); + string_appendn (s, "'", 1); + } + else if (is_bool) + { + int val = consume_count (mangled); + if (val == 0) + string_appendn (s, "false", 5); + else if (val == 1) + string_appendn (s, "true", 4); + else + success = 0; + } + else if (is_real) + { + if (**mangled == 'm') + { + string_appendn (s, "-", 1); + (*mangled)++; + } + while (isdigit (**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + } + if (**mangled == '.') /* fraction */ + { + string_appendn (s, ".", 1); + (*mangled)++; + while (isdigit (**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + } + } + if (**mangled == 'e') /* exponent */ + { + string_appendn (s, "e", 1); + (*mangled)++; + while (isdigit (**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + } + } + } + else if (is_pointer) + { + int symbol_len = consume_count (mangled); + if (symbol_len == 0) + return -1; + if (symbol_len == 0) + string_appendn (s, "0", 1); + else + { + char *p = xmalloc (symbol_len + 1), *q; + strncpy (p, *mangled, symbol_len); + p [symbol_len] = '\0'; + q = internal_cplus_demangle (work, p); + string_appendn (s, "&", 1); + if (q) + { + string_append (s, q); + free (q); + } + else + string_append (s, p); + free (p); + } + *mangled += symbol_len; + } + + return success; +} + +/* Demangle the template name in MANGLED. The full name of the + template (e.g., S<int>) is placed in TNAME. The name without the + template parameters (e.g. S) is placed in TRAWNAME if TRAWNAME is + non-NULL. If IS_TYPE is nonzero, this template is a type template, + not a function template. If both IS_TYPE and REMEMBER are nonzero, + the tmeplate is remembered in the list of back-referenceable + types. */ + +static int +demangle_template (work, mangled, tname, trawname, is_type, remember) struct work_stuff *work; const char **mangled; string *tname; string *trawname; + int is_type; + int remember; { int i; - int is_pointer; - int is_real; - int is_integral; - int is_char; - int is_bool; int r; int need_comma = 0; int success = 0; - int done; - const char *old_p; const char *start; - int symbol_len; string temp; + int bindex; (*mangled)++; - start = *mangled; - /* get template name */ - if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r) + if (is_type) { - return (0); + if (remember) + bindex = register_Btype (work); + start = *mangled; + /* get template name */ + if (**mangled == 'z') + { + int idx; + (*mangled)++; + (*mangled)++; + + idx = consume_count_with_underscores (mangled); + if (idx == -1 + || (work->tmpl_argvec && idx >= work->ntmpl_args) + || consume_count_with_underscores (mangled) == -1) + return (0); + + if (work->tmpl_argvec) + { + string_append (tname, work->tmpl_argvec[idx]); + if (trawname) + string_append (trawname, work->tmpl_argvec[idx]); + } + else + { + char buf[10]; + sprintf(buf, "T%d", idx); + string_append (tname, buf); + if (trawname) + string_append (trawname, buf); + } + } + else + { + if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r) + { + return (0); + } + string_appendn (tname, *mangled, r); + if (trawname) + string_appendn (trawname, *mangled, r); + *mangled += r; + } } - if (trawname) - string_appendn (trawname, *mangled, r); - string_appendn (tname, *mangled, r); - *mangled += r; string_append (tname, "<"); /* get size of template parameter list */ if (!get_count (mangled, &r)) { return (0); } + if (!is_type) + { + /* Create an array for saving the template argument values. */ + work->tmpl_argvec = (char**) xmalloc (r * sizeof (char *)); + work->ntmpl_args = r; + for (i = 0; i < r; i++) + work->tmpl_argvec[i] = 0; + } for (i = 0; i < r; i++) { if (need_comma) @@ -891,6 +1494,15 @@ demangle_template (work, mangled, tname, trawname) if (success) { string_appends (tname, &temp); + + if (!is_type) + { + /* Save the template argument. */ + int len = temp.p - temp.b; + work->tmpl_argvec[i] = xmalloc (len + 1); + memcpy (work->tmpl_argvec[i], temp.b, len); + work->tmpl_argvec[i][len] = '\0'; + } } string_delete(&temp); if (!success) @@ -898,22 +1510,46 @@ demangle_template (work, mangled, tname, trawname) break; } } + /* z for template parameters */ + else if (**mangled == 'z') + { + int r2; + (*mangled)++; + success = demangle_template_template_parm (work, mangled, tname); + + if (success + && (r2 = consume_count (mangled)) > 0 && strlen (*mangled) >= r2) + { + string_append (tname, " "); + string_appendn (tname, *mangled, r2); + if (!is_type) + { + /* Save the template argument. */ + int len = r2; + work->tmpl_argvec[i] = xmalloc (len + 1); + memcpy (work->tmpl_argvec[i], *mangled, len); + work->tmpl_argvec[i][len] = '\0'; + } + *mangled += r2; + } + if (!success) + { + break; + } + } else { + string param; + string* s; + /* otherwise, value parameter */ - old_p = *mangled; - is_pointer = 0; - is_real = 0; - is_integral = 0; - is_char = 0; - is_bool = 0; - done = 0; + /* temp is initialized in do_type */ success = do_type (work, mangled, &temp); /* if (success) { - string_appends (tname, &temp); + string_appends (s, &temp); } */ string_delete(&temp); @@ -922,164 +1558,36 @@ demangle_template (work, mangled, tname, trawname) break; } /* - string_append (tname, "="); + string_append (s, "="); */ - while (*old_p && !done) - { - switch (*old_p) - { - case 'P': - case 'p': - case 'R': - done = is_pointer = 1; - break; - case 'C': /* const */ - case 'S': /* explicitly signed [char] */ - case 'U': /* unsigned */ - case 'V': /* volatile */ - case 'F': /* function */ - case 'M': /* member function */ - case 'O': /* ??? */ - old_p++; - continue; - case 'Q': /* qualified name */ - done = is_integral = 1; - break; - case 'T': /* remembered type */ - abort (); - break; - case 'v': /* void */ - abort (); - break; - case 'x': /* long long */ - case 'l': /* long */ - case 'i': /* int */ - case 's': /* short */ - case 'w': /* wchar_t */ - done = is_integral = 1; - break; - case 'b': /* bool */ - done = is_bool = 1; - break; - case 'c': /* char */ - done = is_char = 1; - break; - case 'r': /* long double */ - case 'd': /* double */ - case 'f': /* float */ - done = is_real = 1; - break; - default: - /* it's probably user defined type, let's assume - it's integral, it seems hard to figure out - what it really is */ - done = is_integral = 1; - } - } - if (is_integral) - { - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } - else if (is_char) + + if (!is_type) { - char tmp[2]; - int val; - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - string_appendn (tname, "'", 1); - val = consume_count(mangled); - if (val == 0) - { - success = 0; - break; - } - tmp[0] = (char)val; - tmp[1] = '\0'; - string_appendn (tname, &tmp[0], 1); - string_appendn (tname, "'", 1); - } - else if (is_bool) - { - int val = consume_count (mangled); - if (val == 0) - string_appendn (tname, "false", 5); - else if (val == 1) - string_appendn (tname, "true", 4); - else - success = 0; + s = ¶m; + string_init (s); } - else if (is_real) + else + s = tname; + + success = demangle_template_value_parm (work, mangled, s); + + if (!success) { - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (tname, ".", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (tname, "e", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } + if (!is_type) + string_delete (s); + success = 0; + break; } - else if (is_pointer) + + if (!is_type) { - symbol_len = consume_count (mangled); - if (symbol_len == 0) - { - success = 0; - break; - } - if (symbol_len == 0) - string_appendn (tname, "0", 1); - else - { - char *p = xmalloc (symbol_len + 1), *q; - strncpy (p, *mangled, symbol_len); - p [symbol_len] = '\0'; - q = cplus_demangle (p, work->options); - string_appendn (tname, "&", 1); - if (q) - { - string_append (tname, q); - free (q); - } - else - string_append (tname, p); - free (p); - } - *mangled += symbol_len; + int len = s->p - s->b; + work->tmpl_argvec[i] = xmalloc (len + 1); + memcpy (work->tmpl_argvec[i], s->b, len); + work->tmpl_argvec[i][len] = '\0'; + + string_appends (tname, s); + string_delete (s); } } need_comma = 1; @@ -1088,6 +1596,9 @@ demangle_template (work, mangled, tname, trawname) string_append (tname, " "); string_append (tname, ">"); + if (is_type && remember) + remember_Btype (work, tname->b, LEN_STRING (tname), bindex); + /* if (work -> static_type) { @@ -1223,9 +1734,11 @@ demangle_class (work, mangled, declp) string *declp; { int success = 0; + int btype; string class_name; string_init (&class_name); + btype = register_Btype (work); if (demangle_class_name (work, mangled, &class_name)) { if ((work->constructor & 1) || (work->destructor & 1)) @@ -1241,7 +1754,9 @@ demangle_class (work, mangled, declp) work -> constructor -= 1; } } - string_prepend (declp, "::"); + remember_Ktype (work, class_name.b, LEN_STRING(&class_name)); + remember_Btype (work, class_name.b, LEN_STRING(&class_name), btype); + string_prepend (declp, SCOPE_STRING (work)); string_prepends (declp, &class_name); success = 1; } @@ -1362,8 +1877,9 @@ demangle_prefix (work, mangled, declp) success = 0; } } - else if ((scan == *mangled) && - (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't'))) + else if ((scan == *mangled) + && (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't') + || (scan[2] == 'K') || (scan[2] == 'H'))) { /* The ARM says nothing about the mangling of local variables. But cfront mangles local variables by prepending __<nesting_level> @@ -1380,7 +1896,8 @@ demangle_prefix (work, mangled, declp) { /* A GNU style constructor starts with __[0-9Qt]. But cfront uses names like __Q2_3foo3bar for nested type names. So don't accept - this style of constructor for cfront demangling. */ + this style of constructor for cfront demangling. A GNU + style member-template constructor starts with 'H'. */ if (!(LUCID_DEMANGLING || ARM_DEMANGLING)) work -> constructor += 1; *mangled = scan + 2; @@ -1392,7 +1909,7 @@ demangle_prefix (work, mangled, declp) then find the next "__" that separates the prefix from the signature. */ if (!(ARM_DEMANGLING || LUCID_DEMANGLING) - || (arm_special (work, mangled, declp) == 0)) + || (arm_special (mangled, declp) == 0)) { while (*scan == '_') { @@ -1509,15 +2026,26 @@ gnu_special (work, mangled, declp) switch (**mangled) { case 'Q': + case 'K': success = demangle_qualified (work, mangled, declp, 0, 1); break; case 't': - success = demangle_template (work, mangled, declp, 0); + success = demangle_template (work, mangled, declp, 0, 1, + 1); break; default: if (isdigit(*mangled[0])) { n = consume_count(mangled); + /* We may be seeing a too-large size, or else a + ".<digits>" indicating a static local symbol. In + any case, declare victory and move on; *don't* try + to use n to allocate. */ + if (n > strlen (*mangled)) + { + success = 1; + break; + } } else { @@ -1531,7 +2059,7 @@ gnu_special (work, mangled, declp) { if (p != NULL) { - string_append (declp, "::"); + string_append (declp, SCOPE_STRING (work)); (*mangled)++; } } @@ -1553,10 +2081,11 @@ gnu_special (work, mangled, declp) switch (**mangled) { case 'Q': + case 'K': success = demangle_qualified (work, mangled, declp, 0, 1); break; case 't': - success = demangle_template (work, mangled, declp, 0); + success = demangle_template (work, mangled, declp, 0, 1, 1); break; default: n = consume_count (mangled); @@ -1568,7 +2097,7 @@ gnu_special (work, mangled, declp) /* Consumed everything up to the cplus_marker, append the variable name. */ (*mangled)++; - string_append (declp, "::"); + string_append (declp, SCOPE_STRING (work)); n = strlen (*mangled); string_appendn (declp, *mangled, n); (*mangled) += n; @@ -1581,7 +2110,7 @@ gnu_special (work, mangled, declp) else if (strncmp (*mangled, "__thunk_", 8) == 0) { int delta = ((*mangled) += 8, consume_count (mangled)); - char *method = cplus_demangle (++*mangled, work->options); + char *method = internal_cplus_demangle (work, ++*mangled); if (method) { char buf[50]; @@ -1605,10 +2134,11 @@ gnu_special (work, mangled, declp) switch (**mangled) { case 'Q': + case 'K': success = demangle_qualified (work, mangled, declp, 0, 1); break; case 't': - success = demangle_template (work, mangled, declp, 0); + success = demangle_template (work, mangled, declp, 0, 1, 1); break; default: success = demangle_fund_type (work, mangled, declp); @@ -1635,8 +2165,8 @@ LOCAL FUNCTION SYNOPSIS static int - arm_special (struct work_stuff *work, const char **mangled, - string *declp); + arm_special (const char **mangled, + string *declp); DESCRIPTION @@ -1650,8 +2180,7 @@ DESCRIPTION */ static int -arm_special (work, mangled, declp) - struct work_stuff *work; +arm_special (mangled, declp) const char **mangled; string *declp; { @@ -1740,15 +2269,35 @@ demangle_qualified (work, mangled, result, isfuncname, append) int isfuncname; int append; { - int qualifiers; - int namelength; + int qualifiers = 0; int success = 1; const char *p; char num[2]; string temp; + string last_name; + int bindex = register_Btype (work); + + /* We only make use of ISFUNCNAME if the entity is a constructor or + destructor. */ + isfuncname = (isfuncname + && ((work->constructor & 1) || (work->destructor & 1))); string_init (&temp); - switch ((*mangled)[1]) + string_init (&last_name); + + if ((*mangled)[0] == 'K') + { + /* Squangling qualified name reuse */ + int idx; + (*mangled)++; + idx = consume_count_with_underscores (mangled); + if (idx == -1 || idx > work -> numk) + success = 0; + else + string_append (&temp, work -> ktypevec[idx]); + } + else + switch ((*mangled)[1]) { case '_': /* GNU mangled name with more than 9 classes. The count is preceded @@ -1806,62 +2355,81 @@ demangle_qualified (work, mangled, result, isfuncname, append) while (qualifiers-- > 0) { + int remember_K = 1; + string_clear (&last_name); + if (*mangled[0] == '_') - *mangled = *mangled + 1; + (*mangled)++; + if (*mangled[0] == 't') { - success = demangle_template(work, mangled, &temp, 0); + /* Here we always append to TEMP since we will want to use + the template name without the template parameters as a + constructor or destructor name. The appropriate + (parameter-less) value is returned by demangle_template + in LAST_NAME. We do not remember the template type here, + in order to match the G++ mangling algorithm. */ + success = demangle_template(work, mangled, &temp, + &last_name, 1, 0); + if (!success) + break; + } + else if (*mangled[0] == 'K') + { + int idx; + (*mangled)++; + idx = consume_count_with_underscores (mangled); + if (idx == -1 || idx > work->numk) + success = 0; + else + string_append (&temp, work->ktypevec[idx]); + remember_K = 0; + if (!success) break; } else - { - namelength = consume_count (mangled); - if (strlen (*mangled) < namelength) - { - /* Simple sanity check failed */ - success = 0; - break; - } - string_appendn (&temp, *mangled, namelength); - *mangled += namelength; + { + success = do_type (work, mangled, &last_name); + if (!success) + break; + string_appends (&temp, &last_name); } + + if (remember_K) + remember_Ktype (work, temp.b, LEN_STRING (&temp)); + if (qualifiers > 0) - { - string_appendn (&temp, "::", 2); - } + string_append (&temp, SCOPE_STRING (work)); } + remember_Btype (work, temp.b, LEN_STRING (&temp), bindex); + /* If we are using the result as a function name, we need to append the appropriate '::' separated constructor or destructor name. We do this here because this is the most convenient place, where we already have a pointer to the name and the length of the name. */ - if (isfuncname && (work->constructor & 1 || work->destructor & 1)) + if (isfuncname) { - string_appendn (&temp, "::", 2); + string_append (&temp, SCOPE_STRING (work)); if (work -> destructor & 1) - { - string_append (&temp, "~"); - } - string_appendn (&temp, (*mangled) - namelength, namelength); + string_append (&temp, "~"); + string_appends (&temp, &last_name); } /* Now either prepend the temp buffer to the result, or append it, depending upon the state of the append flag. */ if (append) - { - string_appends (result, &temp); - } + string_appends (result, &temp); else { if (!STRING_EMPTY (result)) - { - string_appendn (&temp, "::", 2); - } + string_append (&temp, SCOPE_STRING (work)); string_prepends (result, &temp); } + string_delete (&last_name); string_delete (&temp); return (success); } @@ -1934,7 +2502,9 @@ do_type (work, mangled, result) const char *remembered_type; int constp; int volatilep; + string btype; + string_init (&btype); string_init (&decl); string_init (result); @@ -2006,15 +2576,14 @@ do_type (work, mangled, result) /* After picking off the function args, we expect to either find the function return type (preceded by an '_') or the end of the string. */ - if (!demangle_args (work, mangled, &decl) + if (!demangle_nested_args (work, mangled, &decl) || (**mangled != '_' && **mangled != '\0')) { success = 0; + break; } if (success && (**mangled == '_')) - { - (*mangled)++; - } + (*mangled)++; break; case 'M': @@ -2032,7 +2601,7 @@ do_type (work, mangled, result) } string_append (&decl, ")"); - string_prepend (&decl, "::"); + string_prepend (&decl, SCOPE_STRING (work)); if (isdigit (**mangled)) { n = consume_count (mangled); @@ -2048,7 +2617,8 @@ do_type (work, mangled, result) { string temp; string_init (&temp); - success = demangle_template (work, mangled, &temp, NULL); + success = demangle_template (work, mangled, &temp, + NULL, 1, 1); if (success) { string_prependn (&decl, temp.b, temp.p - temp.b); @@ -2076,7 +2646,7 @@ do_type (work, mangled, result) break; } } - if ((member && !demangle_args (work, mangled, &decl)) + if ((member && !demangle_nested_args (work, mangled, &decl)) || **mangled != '_') { success = 0; @@ -2104,7 +2674,7 @@ do_type (work, mangled, result) break; case 'C': - (*mangled)++; + case 'V': /* if ((*mangled)[1] == 'P') { @@ -2115,8 +2685,10 @@ do_type (work, mangled, result) { string_prepend (&decl, " "); } - string_prepend (&decl, "const"); + string_prepend (&decl, + (**mangled) == 'C' ? "const" : "volatile"); } + (*mangled)++; break; /* } @@ -2133,9 +2705,53 @@ do_type (work, mangled, result) { /* A qualified name, such as "Outer::Inner". */ case 'Q': - success = demangle_qualified (work, mangled, result, 0, 1); + case 'K': + { + success = demangle_qualified (work, mangled, result, 0, 1); + break; + } + + /* A back reference to a previously seen squangled type */ + case 'B': + (*mangled)++; + if (!get_count (mangled, &n) || n >= work -> numb) + success = 0; + else + { + string_append (result, work->btypevec[n]); + } break; + case 'X': + case 'Y': + /* A template parm. We substitute the corresponding argument. */ + { + int idx; + + (*mangled)++; + idx = consume_count_with_underscores (mangled); + + if (idx == -1 + || (work->tmpl_argvec && idx >= work->ntmpl_args) + || consume_count_with_underscores (mangled) == -1) + { + success = 0; + break; + } + + if (work->tmpl_argvec) + string_append (result, work->tmpl_argvec[idx]); + else + { + char buf[10]; + sprintf(buf, "T%d", idx); + string_append (result, buf); + } + + success = 1; + } + break; + default: success = demangle_fund_type (work, mangled, result); break; @@ -2178,6 +2794,8 @@ demangle_fund_type (work, mangled, result) { int done = 0; int success = 1; + string btype; + string_init (&btype); /* First pick off any type qualifiers. There can be more than one. */ @@ -2211,6 +2829,11 @@ demangle_fund_type (work, mangled, result) string_append (result, "volatile"); } break; + case 'J': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "__complex"); + break; default: done = 1; break; @@ -2298,15 +2921,26 @@ demangle_fund_type (work, mangled, result) case '7': case '8': case '9': - APPEND_BLANK (result); - if (!demangle_class_name (work, mangled, result)) { - --result->p; - success = 0; + { + int bindex = register_Btype (work); + string btype; + string_init (&btype); + if (demangle_class_name (work, mangled, &btype)) { + remember_Btype (work, btype.b, LEN_STRING (&btype), bindex); + APPEND_BLANK (result); + string_appends (result, &btype); + } + else + success = 0; + string_delete (&btype); + break; } - break; case 't': - success = demangle_template(work,mangled, result, 0); - break; + { + success = demangle_template (work, mangled, &btype, 0, 1, 1); + string_appends (result, &btype); + break; + } default: success = 0; break; @@ -2315,7 +2949,9 @@ demangle_fund_type (work, mangled, result) return (success); } -/* `result' will be initialized in do_type; it will be freed on failure */ +/* Demangle the next argument, given by MANGLED into RESULT, which + *should be an uninitialized* string. It will be initialized here, + and free'd should anything go wrong. */ static int do_arg (work, mangled, result) @@ -2323,17 +2959,67 @@ do_arg (work, mangled, result) const char **mangled; string *result; { + /* Remember where we started so that we can record the type, for + non-squangling type remembering. */ const char *start = *mangled; - if (!do_type (work, mangled, result)) + string_init (result); + + if (work->nrepeats > 0) { - return (0); + --work->nrepeats; + + if (work->previous_argument == 0) + return 0; + + /* We want to reissue the previous type in this argument list. */ + string_appends (result, work->previous_argument); + return 1; + } + + if (**mangled == 'n') + { + /* A squangling-style repeat. */ + (*mangled)++; + work->nrepeats = consume_count(mangled); + + if (work->nrepeats == 0) + /* This was not a repeat count after all. */ + return 0; + + if (work->nrepeats > 9) + { + if (**mangled != '_') + /* The repeat count should be followed by an '_' in this + case. */ + return 0; + else + (*mangled)++; + } + + /* Now, the repeat is all set up. */ + return do_arg (work, mangled, result); } + + /* Save the result in WORK->previous_argument so that we can find it + if it's repeated. Note that saving START is not good enough: we + 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); else { - remember_type (work, start, *mangled - start); - return (1); + work->previous_argument = (string*) xmalloc (sizeof (string)); + string_init (work->previous_argument); } + + if (!do_type (work, mangled, work->previous_argument)) + return 0; + + string_appends (result, work->previous_argument); + + remember_type (work, start, *mangled - start); + return 1; } static void @@ -2344,20 +3030,23 @@ remember_type (work, start, len) { char *tem; + if (work->forgetting_types) + return; + if (work -> ntypes >= work -> typevec_size) { if (work -> typevec_size == 0) { work -> typevec_size = 3; - work -> typevec = - (char **) xmalloc (sizeof (char *) * work -> typevec_size); + work -> typevec + = (char **) xmalloc (sizeof (char *) * work -> typevec_size); } else { work -> typevec_size *= 2; - work -> typevec = - (char **) xrealloc ((char *)work -> typevec, - sizeof (char *) * work -> typevec_size); + work -> typevec + = (char **) xrealloc ((char *)work -> typevec, + sizeof (char *) * work -> typevec_size); } } tem = xmalloc (len + 1); @@ -2366,6 +3055,112 @@ remember_type (work, start, len) work -> typevec[work -> ntypes++] = tem; } + +/* Remember a K type class qualifier. */ +static void +remember_Ktype (work, start, len) + struct work_stuff *work; + const char *start; + int len; +{ + char *tem; + + if (work -> numk >= work -> ksize) + { + if (work -> ksize == 0) + { + work -> ksize = 5; + work -> ktypevec + = (char **) xmalloc (sizeof (char *) * work -> ksize); + } + else + { + work -> ksize *= 2; + work -> ktypevec + = (char **) xrealloc ((char *)work -> ktypevec, + sizeof (char *) * work -> ksize); + } + } + tem = xmalloc (len + 1); + memcpy (tem, start, len); + tem[len] = '\0'; + work -> ktypevec[work -> numk++] = tem; +} + +/* Register a B code, and get an index for it. B codes are registered + as they are seen, rather than as they are completed, so map<temp<char> > + registers map<temp<char> > as B0, and temp<char> as B1 */ + +static int +register_Btype (work) + struct work_stuff *work; +{ + int ret; + + if (work -> numb >= work -> bsize) + { + if (work -> bsize == 0) + { + work -> bsize = 5; + work -> btypevec + = (char **) xmalloc (sizeof (char *) * work -> bsize); + } + else + { + work -> bsize *= 2; + work -> btypevec + = (char **) xrealloc ((char *)work -> btypevec, + sizeof (char *) * work -> bsize); + } + } + ret = work -> numb++; + work -> btypevec[ret] = NULL; + return(ret); +} + +/* Store a value into a previously registered B code type. */ + +static void +remember_Btype (work, start, len, index) + struct work_stuff *work; + const char *start; + int len, index; +{ + char *tem; + + tem = xmalloc (len + 1); + memcpy (tem, start, len); + tem[len] = '\0'; + work -> btypevec[index] = tem; +} + +/* Lose all the info related to B and K type codes. */ +static void +forget_B_and_K_types (work) + struct work_stuff *work; +{ + int i; + + while (work -> numk > 0) + { + i = --(work -> numk); + if (work -> ktypevec[i] != NULL) + { + free (work -> ktypevec[i]); + work -> ktypevec[i] = NULL; + } + } + + while (work -> numb > 0) + { + i = --(work -> numb); + if (work -> btypevec[i] != NULL) + { + free (work -> btypevec[i]); + work -> btypevec[i] = NULL; + } + } +} /* Forget the remembered types, but not the type vector itself. */ static void @@ -2417,8 +3212,8 @@ forget_types (work) foo__FiR3fooT1T2T1T2 __ct__3fooFiR3fooT1T2T1T2 - Note that g++ bases it's type numbers starting at zero and counts all - previously seen types, while lucid/ARM bases it's type numbers starting + Note that g++ bases its type numbers starting at zero and counts all + previously seen types, while lucid/ARM bases its type numbers starting at one and only considers types after it has seen the 'F' character indicating the start of the function args. For lucid/ARM style, we account for this difference by discarding any previously seen types when @@ -2449,7 +3244,8 @@ demangle_args (work, mangled, declp) } } - while (**mangled != '_' && **mangled != '\0' && **mangled != 'e') + while ((**mangled != '_' && **mangled != '\0' && **mangled != 'e') + || work->nrepeats > 0) { if ((**mangled == 'N') || (**mangled == 'T')) { @@ -2496,7 +3292,7 @@ demangle_args (work, mangled, declp) { return (0); } - while (--r >= 0) + while (work->nrepeats > 0 || --r >= 0) { tem = work -> typevec[t]; if (need_comma && PRINT_ARG_TYPES) @@ -2517,18 +3313,12 @@ demangle_args (work, mangled, declp) } else { - if (need_comma & PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } + if (need_comma && PRINT_ARG_TYPES) + string_append (declp, ", "); if (!do_arg (work, mangled, &arg)) - { - return (0); - } + return (0); if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } + string_appends (declp, &arg); string_delete (&arg); need_comma = 1; } @@ -2554,6 +3344,44 @@ demangle_args (work, mangled, declp) return (1); } +/* Like demangle_args, but for demangling the argument lists of function + and method pointers or references, not top-level declarations. */ + +static int +demangle_nested_args (work, mangled, declp) + struct work_stuff *work; + const char **mangled; + string *declp; +{ + string* saved_previous_argument; + int result; + int saved_nrepeats; + + /* The G++ name-mangling algorithm does not remember types on nested + argument lists, unless -fsquangling is used, and in that case the + type vector updated by remember_type is not used. So, we turn + off remembering of types here. */ + ++work->forgetting_types; + + /* For the repeat codes used with -fsquangling, we must keep track of + the last argument. */ + saved_previous_argument = work->previous_argument; + saved_nrepeats = work->nrepeats; + work->previous_argument = 0; + work->nrepeats = 0; + + /* Actually demangle the arguments. */ + result = demangle_args (work, mangled, declp); + + /* Restore the previous_argument field. */ + if (work->previous_argument) + string_delete (work->previous_argument); + work->previous_argument = saved_previous_argument; + work->nrepeats = saved_nrepeats; + + return result; +} + static void demangle_function_name (work, mangled, declp, scan) struct work_stuff *work; @@ -2561,8 +3389,7 @@ demangle_function_name (work, mangled, declp, scan) string *declp; const char *scan; { - int i; - int len; + size_t i; string type; const char *tem; @@ -2609,7 +3436,7 @@ demangle_function_name (work, mangled, declp, scan) { for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { - len = declp->p - declp->b - 10; + int len = declp->p - declp->b - 10; if (strlen (optable[i].in) == len && memcmp (optable[i].in, declp->b + 10, len) == 0) { @@ -2860,6 +3687,12 @@ string_prependn (p, s, n) #ifdef MAIN +#include "getopt.h" + +static char *program_name; +static char *program_version = VERSION; +static int flags = DMGL_PARAMS | DMGL_ANSI; + static void demangle_it PARAMS ((char *)); static void usage PARAMS ((FILE *, int)); static void fatal PARAMS ((char *)); @@ -2870,7 +3703,7 @@ demangle_it (mangled_name) { char *result; - result = cplus_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI); + result = cplus_demangle (mangled_name, flags); if (result == NULL) { printf ("%s\n", mangled_name); @@ -2882,11 +3715,6 @@ demangle_it (mangled_name) } } -#include "getopt.h" - -static char *program_name; -static char *program_version = VERSION; - static void usage (stream, status) FILE *stream; @@ -2894,13 +3722,13 @@ usage (stream, status) { fprintf (stream, "\ Usage: %s [-_] [-n] [-s {gnu,lucid,arm}] [--strip-underscores]\n\ -[--no-strip-underscores] [--format={gnu,lucid,arm}]\n\ -[--help] [--version] [arg...]\n", + [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\ + [--help] [--version] [arg...]\n", program_name); exit (status); } -#define MBUF_SIZE 512 +#define MBUF_SIZE 32767 char mbuffer[MBUF_SIZE]; /* Defined in the automatically-generated underscore.c. */ @@ -2917,6 +3745,15 @@ static struct option long_options[] = { {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."); +} + int main (argc, argv) int argc; @@ -2929,7 +3766,7 @@ main (argc, argv) strip_underscore = prepends_underscore; - while ((c = getopt_long (argc, argv, "_ns:", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "_ns:j", long_options, (int *) 0)) != EOF) { switch (c) { @@ -3005,8 +3842,7 @@ main (argc, argv) mbuffer[i] = 0; - result = cplus_demangle (mbuffer + skip_first, - DMGL_PARAMS | DMGL_ANSI); + result = cplus_demangle (mbuffer + skip_first, flags); if (result) { if (mbuffer[0] == '.') diff --git a/gnu/dist/libiberty/floatformat.c b/gnu/dist/libiberty/floatformat.c index a012064bb19..7f6086f4306 100644 --- a/gnu/dist/libiberty/floatformat.c +++ b/gnu/dist/libiberty/floatformat.c @@ -51,6 +51,14 @@ const struct floatformat floatformat_ieee_double_little = floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no }; +/* floatformat for IEEE double, little endian byte order, with big endian word + ordering, as on the ARM. */ + +const struct floatformat floatformat_ieee_double_littlebyte_bigword = +{ + floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no +}; + const struct floatformat floatformat_i387_ext = { floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, diff --git a/gnu/dist/libiberty/getcwd.c b/gnu/dist/libiberty/getcwd.c index 60c1dd84eed..06d55c04f58 100644 --- a/gnu/dist/libiberty/getcwd.c +++ b/gnu/dist/libiberty/getcwd.c @@ -20,7 +20,9 @@ BUGS */ -#ifndef NO_SYS_PARAM_H +#include "config.h" + +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #include <errno.h> diff --git a/gnu/dist/libiberty/getopt1.c b/gnu/dist/libiberty/getopt1.c index c3400e5b643..af8e6819657 100644 --- a/gnu/dist/libiberty/getopt1.c +++ b/gnu/dist/libiberty/getopt1.c @@ -1,35 +1,31 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 - Free Software Foundation, Inc. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License - as published by the Free Software Foundation; either version 2, or - (at your option) any later version. + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + 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 Library General Public License for more details. + GNU General Public License for more details. - You should have received a copy of the GNU Library General Public License + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ #include <config.h> -#else -#include "config.h" -#endif #endif #include "getopt.h" -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const @@ -46,19 +42,22 @@ (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. */ -/* Many versions of the Linux C library include older, broken versions - of these routines, which will break the linker's command-line - parsing. */ -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || defined (__linux__) +#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> -#else -char *getenv (); #endif #ifndef NULL @@ -93,7 +92,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index) } -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* Not ELIDE_CODE. */ #ifdef TEST @@ -124,7 +123,7 @@ main (argc, argv) c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); - if (c == EOF) + if (c == -1) break; switch (c) diff --git a/gnu/dist/libiberty/getpagesize.c b/gnu/dist/libiberty/getpagesize.c index e9784b8520b..564d6c02312 100644 --- a/gnu/dist/libiberty/getpagesize.c +++ b/gnu/dist/libiberty/getpagesize.c @@ -28,36 +28,43 @@ BUGS #ifndef VMS +#include "config.h" + #include <sys/types.h> -#ifndef NO_SYS_PARAM_H +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif -#ifdef HAVE_SYSCONF +#undef GNU_OUR_PAGESIZE +#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H) #include <unistd.h> +#ifdef _SC_PAGESIZE #define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE) -#else -#ifdef PAGESIZE -#define GNU_OUR_PAGESIZE PAGESIZE -#else /* no PAGESIZE */ -#ifdef EXEC_PAGESIZE -#define GNU_OUR_PAGESIZE EXEC_PAGESIZE -#else /* no EXEC_PAGESIZE */ -#ifdef NBPG -#define GNU_OUR_PAGESIZE (NBPG * CLSIZE) -#ifndef CLSIZE -#define CLSIZE 1 -#endif /* CLSIZE */ -#else /* no NBPG */ -#ifdef NBPC -#define GNU_OUR_PAGESIZE NBPC -#else /* no NBPC */ -#define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */ -#endif /* NBPC */ -#endif /* NBPG */ -#endif /* EXEC_PAGESIZE */ -#endif /* PAGESIZE */ -#endif /* HAVE_SYSCONF */ +#endif +#endif + +#ifndef GNU_OUR_PAGESIZE +# ifdef PAGESIZE +# define GNU_OUR_PAGESIZE PAGESIZE +# else /* no PAGESIZE */ +# ifdef EXEC_PAGESIZE +# define GNU_OUR_PAGESIZE EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define GNU_OUR_PAGESIZE (NBPG * CLSIZE) +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define GNU_OUR_PAGESIZE NBPC +# else /* no NBPC */ +# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */ +# endif /* NBPC */ +# endif /* NBPG */ +# endif /* EXEC_PAGESIZE */ +# endif /* PAGESIZE */ +#endif /* GNU_OUR_PAGESIZE */ int getpagesize () diff --git a/gnu/dist/libiberty/getruntime.c b/gnu/dist/libiberty/getruntime.c index 1be3b4c4a2a..86162225901 100644 --- a/gnu/dist/libiberty/getruntime.c +++ b/gnu/dist/libiberty/getruntime.c @@ -17,6 +17,8 @@ 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. */ +#include "config.h" + #include "ansidecl.h" #include "libiberty.h" @@ -26,23 +28,13 @@ Boston, MA 02111-1307, USA. */ #include <time.h> -/* These should go away when libiberty uses autoconf. */ - -#if defined(__sun__) && !defined(__svr4__) -#define HAVE_GETRUSAGE -#endif - -#ifdef HAVE_SYSCONF -#define HAVE_TIMES -#endif - #ifdef HAVE_GETRUSAGE #include <sys/time.h> #include <sys/resource.h> #endif #ifdef HAVE_TIMES -#ifndef NO_SYS_PARAM_H +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #include <sys/times.h> diff --git a/gnu/dist/libiberty/makefile.vms b/gnu/dist/libiberty/makefile.vms index 6f49ee1b1ea..b61b51290da 100644 --- a/gnu/dist/libiberty/makefile.vms +++ b/gnu/dist/libiberty/makefile.vms @@ -23,15 +23,11 @@ libiberty.olb: config.h alloca-conf.h $(OBJS) purge lib/create libiberty *.obj -alloca-conf.h: alloca-norm.h - $(CP) $< $@ - config.h: config.h-vms $(CP) $< $@ clean: $$ purge - $(RM) alloca-conf.h; $(RM) config.h; $(RM) *.obj; $(RM) libiberty.olb; diff --git a/gnu/dist/libiberty/mpw-config.in b/gnu/dist/libiberty/mpw-config.in index 829d8e730d4..2a21802148d 100644 --- a/gnu/dist/libiberty/mpw-config.in +++ b/gnu/dist/libiberty/mpw-config.in @@ -1,7 +1,5 @@ # MPW configuration fragment for libiberty. -forward-include "{srcdir}"alloca-norm.h alloca-conf.h - Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new MoveIfChange "{o}"config.new "{o}"config.h diff --git a/gnu/dist/libiberty/mpw.c b/gnu/dist/libiberty/mpw.c index 4380da45203..59c06ba3950 100644 --- a/gnu/dist/libiberty/mpw.c +++ b/gnu/dist/libiberty/mpw.c @@ -54,7 +54,7 @@ mpwify_filename(char *unixname, char *macname) } j = 0; /* If you're going to end up with one or more colons in the middle of a - a path after an all-Unix relative path is translated, you must add a + path after an all-Unix relative path is translated, you must add a colon on the front, so that the first component is not thought to be a disk name. */ if (unixname[0] != '/' && ! strchr (unixname, ':') && strchr (unixname, '/')) diff --git a/gnu/dist/libiberty/obstack.c b/gnu/dist/libiberty/obstack.c index 2ccf5901576..a6880caaa6c 100644 --- a/gnu/dist/libiberty/obstack.c +++ b/gnu/dist/libiberty/obstack.c @@ -39,6 +39,23 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif #endif +/* CYGNUS LOCAL (not to be elided!) */ + +int +_obstack_memory_used (h) + struct obstack *h; +{ + register struct _obstack_chunk* lp; + register int nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +/* END CYGNUS LOCAL */ #ifndef ELIDE_CODE @@ -379,24 +396,6 @@ obstack_free (h, obj) abort (); } -/* CYGNUS LOCAL */ - -int -_obstack_memory_used (h) - struct obstack *h; -{ - register struct _obstack_chunk* lp; - register int nbytes = 0; - - for (lp = h->chunk; lp != 0; lp = lp->prev) - { - nbytes += lp->limit - (char *) lp; - } - return nbytes; -} - -/* END CYGNUS LOCAL */ - #if 0 /* These are now turned off because the applications do not use it and it uses bcopy via obstack_grow, which causes trouble on sysV. */ diff --git a/gnu/dist/libiberty/pexecute.c b/gnu/dist/libiberty/pexecute.c index 7ffe9caead5..fbbea409147 100644 --- a/gnu/dist/libiberty/pexecute.c +++ b/gnu/dist/libiberty/pexecute.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -23,11 +23,14 @@ Boston, MA 02111-1307, USA. */ /* This file lives in at least two places: libiberty and gcc. Don't change one without the other. */ +#ifdef IN_GCC +#include "config.h" +#endif + #include <stdio.h> #include <errno.h> #ifdef IN_GCC -#include "config.h" #include "gansidecl.h" /* ??? Need to find a suitable header file. */ #define PEXECUTE_FIRST 1 @@ -217,12 +220,16 @@ pwait (pid, status, flags) #endif /* MSDOS */ -#if defined (_WIN32) && !defined (__CYGWIN32__) +#if defined (_WIN32) #include <process.h> -/* ??? Why are these __spawnv{,p} and not _spawnv{,p}? */ -extern int __spawnv (); -extern int __spawnvp (); + +#ifdef __CYGWIN32__ + +#define fix_argv(argvec) (argvec) + +extern int _spawnv (); +extern int _spawnvp (); int pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) @@ -237,29 +244,204 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) abort (); - pid = (flags & PEXECUTE_SEARCH ? __spawnvp : __spawnv) (_P_NOWAIT, program, argv); + pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) + (_P_NOWAIT, program, fix_argv(argv)); + if (pid == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + return pid; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + /* ??? Here's an opportunity to canonicalize the values in STATUS. + Needed? */ + return cwait (status, pid, WAIT_CHILD); +} + +#else /* ! __CYGWIN32__ */ + +/* This is a kludge to get around the Microsoft C spawn functions' propensity + to remove the outermost set of double quotes from all arguments. */ + +const char * const * +fix_argv (argvec) + char **argvec; +{ + int i; + + for (i = 1; argvec[i] != 0; i++) + { + int len, j; + char *temp, *newtemp; + + temp = argvec[i]; + len = strlen (temp); + for (j = 0; j < len; j++) + { + if (temp[j] == '"') + { + newtemp = xmalloc (len + 2); + strncpy (newtemp, temp, j); + newtemp [j] = '\\'; + strncpy (&newtemp [j+1], &temp [j], len-j); + newtemp [len+1] = 0; + temp = newtemp; + len++; + j++; + } + } + + argvec[i] = temp; + } + + return (const char * const *) argvec; +} + +#include <io.h> +#include <fcntl.h> +#include <signal.h> + +/* mingw32 headers may not define the following. */ + +#ifndef _P_WAIT +# define _P_WAIT 0 +# define _P_NOWAIT 1 +# define _P_OVERLAY 2 +# define _P_NOWAITO 3 +# define _P_DETACH 4 + +# define WAIT_CHILD 0 +# define WAIT_GRANDCHILD 1 +#endif + +/* Win32 supports pipes */ +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + int pid; + int pdes[2], org_stdin, org_stdout; + int input_desc, output_desc; + int retries, sleep_interval; + + /* Pipe waiting from last process, to be used as input for the next one. + Value is STDIN_FILE_NO if no pipe is waiting + (i.e. the next command is the first of a group). */ + static int last_pipe_input; + + /* If this is the first process, initialize. */ + if (flags & PEXECUTE_FIRST) + last_pipe_input = STDIN_FILE_NO; + + input_desc = last_pipe_input; + + /* If this isn't the last process, make a pipe for its output, + and record it as waiting to be the input to the next process. */ + if (! (flags & PEXECUTE_LAST)) + { + if (_pipe (pdes, 256, O_BINARY) < 0) + { + *errmsg_fmt = "pipe"; + *errmsg_arg = NULL; + return -1; + } + output_desc = pdes[WRITE_PORT]; + last_pipe_input = pdes[READ_PORT]; + } + else + { + /* Last process. */ + output_desc = STDOUT_FILE_NO; + last_pipe_input = STDIN_FILE_NO; + } + + if (input_desc != STDIN_FILE_NO) + { + org_stdin = dup (STDIN_FILE_NO); + dup2 (input_desc, STDIN_FILE_NO); + close (input_desc); + } + + if (output_desc != STDOUT_FILE_NO) + { + org_stdout = dup (STDOUT_FILE_NO); + dup2 (output_desc, STDOUT_FILE_NO); + close (output_desc); + } + + pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) + (_P_NOWAIT, program, fix_argv(argv)); + + if (input_desc != STDIN_FILE_NO) + { + dup2 (org_stdin, STDIN_FILE_NO); + close (org_stdin); + } + + if (output_desc != STDOUT_FILE_NO) + { + dup2 (org_stdout, STDOUT_FILE_NO); + close (org_stdout); + } + if (pid == -1) { *errmsg_fmt = install_error_msg; *errmsg_arg = program; return -1; } + return pid; } +/* MS CRTDLL doesn't return enough information in status to decide if the + child exited due to a signal or not, rather it simply returns an + integer with the exit code of the child; eg., if the child exited with + an abort() call and didn't have a handler for SIGABRT, it simply returns + with status = 3. We fix the status code to conform to the usual WIF* + macros. Note that WIFSIGNALED will never be true under CRTDLL. */ + int pwait (pid, status, flags) int pid; int *status; int flags; { + int termstat; + + pid = _cwait (&termstat, pid, WAIT_CHILD); + /* ??? Here's an opportunity to canonicalize the values in STATUS. Needed? */ - int pid = cwait (status, pid, WAIT_CHILD); + + /* cwait returns the child process exit code in termstat. + A value of 3 indicates that the child caught a signal, but not + which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we + report SIGABRT. */ + if (termstat == 3) + *status = SIGABRT; + else + *status = (((termstat) & 0xff) << 8); + return pid; } -#endif /* WIN32 */ +#endif /* ! defined (__CYGWIN32__) */ + +#endif /* _WIN32 */ #ifdef OS2 @@ -433,11 +615,16 @@ pfinish () /* include for Unix-like environments but not for Dos-like environments */ #if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \ - && (defined (__CYGWIN32__) || ! defined (_WIN32)) + && ! defined (_WIN32) +#ifdef VMS +#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \ + lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1) +#else #ifdef USG #define vfork fork #endif +#endif extern int execv (); extern int execvp (); @@ -566,8 +753,12 @@ pwait (pid, status, flags) { /* ??? Here's an opportunity to canonicalize the values in STATUS. Needed? */ +#ifdef VMS + pid = waitpid (-1, status, 0); +#else pid = wait (status); +#endif return pid; } -#endif /* ! __MSDOS__ && ! OS2 && ! MPW && (__CYGWIN32___ || ! _WIN32) */ +#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */ diff --git a/gnu/dist/libiberty/strerror.c b/gnu/dist/libiberty/strerror.c index f5e2eebee2e..644cc75462a 100644 --- a/gnu/dist/libiberty/strerror.c +++ b/gnu/dist/libiberty/strerror.c @@ -7,7 +7,7 @@ #include "config.h" -#ifndef NEED_sys_errlist +#ifdef HAVE_SYS_ERRLIST /* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least) might declare sys_errlist in a way that the compiler might consider incompatible with our later declaration, perhaps by using const @@ -19,7 +19,7 @@ #include <stdio.h> #include <errno.h> -#ifndef NEED_sys_errlist +#ifdef HAVE_SYS_ERRLIST #undef sys_errlist #endif @@ -55,12 +55,12 @@ struct error_info { int value; /* The numeric value from <errno.h> */ const char *name; /* The equivalent symbolic value */ -#ifdef NEED_sys_errlist +#ifndef HAVE_SYS_ERRLIST const char *msg; /* Short message about this value */ #endif }; -#ifdef NEED_sys_errlist +#ifndef HAVE_SYS_ERRLIST # define ENTRY(value, name, msg) {value, name, msg} #else # define ENTRY(value, name, msg) {value, name} @@ -455,7 +455,7 @@ static int num_error_names = 0; same name, it differs from other implementations in that it is dynamically initialized rather than statically initialized. */ -#ifdef NEED_sys_errlist +#ifndef HAVE_SYS_ERRLIST static int sys_nerr; static const char **sys_errlist; @@ -532,7 +532,7 @@ init_error_tables () } } -#ifdef NEED_sys_errlist +#ifndef HAVE_SYS_ERRLIST /* Now attempt to allocate the sys_errlist table, zero it out, and then initialize it from the statically initialized error_table. */ @@ -595,7 +595,7 @@ errno_max () return (maxsize - 1); } -#ifdef NEED_strerror +#ifndef HAVE_STRERROR /* @@ -634,7 +634,7 @@ strerror (errnoval) char *msg; static char buf[32]; -#ifdef NEED_sys_errlist +#ifndef HAVE_SYS_ERRLIST if (error_names == NULL) { @@ -668,7 +668,7 @@ strerror (errnoval) return (msg); } -#endif /* NEED_strerror */ +#endif /* ! HAVE_STRERROR */ /* diff --git a/gnu/dist/libiberty/strsignal.c b/gnu/dist/libiberty/strsignal.c index 7d40b4cedff..c7bb10c441c 100644 --- a/gnu/dist/libiberty/strsignal.c +++ b/gnu/dist/libiberty/strsignal.c @@ -64,12 +64,12 @@ struct signal_info { int value; /* The numeric value from <signal.h> */ const char *name; /* The equivalent symbolic value */ -#ifdef NEED_sys_siglist +#ifndef HAVE_SYS_SIGLIST const char *msg; /* Short message about this value */ #endif }; -#ifdef NEED_sys_siglist +#ifndef HAVE_SYS_SIGLIST # define ENTRY(value, name, msg) {value, name, msg} #else # define ENTRY(value, name, msg) {value, name} @@ -236,14 +236,20 @@ static int num_signal_names = 0; same name, it differs from other implementations in that it is dynamically initialized rather than statically initialized. */ -#ifdef NEED_sys_siglist +#ifndef HAVE_SYS_SIGLIST static int sys_nsig; static const char **sys_siglist; #else +#ifdef NSIG static int sys_nsig = NSIG; +#else +#ifdef _NSIG +static int sys_nsig = _NSIG; +#endif +#endif extern const char * const sys_siglist[]; #endif @@ -313,7 +319,7 @@ init_signal_tables () } } -#ifdef NEED_sys_siglist +#ifndef HAVE_SYS_SIGLIST /* Now attempt to allocate the sys_siglist table, zero it out, and then initialize it from the statically initialized signal_table. */ @@ -408,7 +414,7 @@ DESCRIPTION */ -#ifdef NEED_strsignal +#ifndef HAVE_STRSIGNAL const char * strsignal (signo) @@ -417,7 +423,7 @@ strsignal (signo) const char *msg; static char buf[32]; -#ifdef NEED_sys_siglist +#ifndef HAVE_SYS_SIGLIST if (signal_names == NULL) { @@ -446,7 +452,7 @@ strsignal (signo) return (msg); } -#endif /* NEED_strsignal */ +#endif /* ! HAVE_STRSIGNAL */ /* @@ -574,7 +580,7 @@ DESCRIPTION followed by a newline. */ -#ifdef NEED_psignal +#ifndef HAVE_PSIGNAL void psignal (signo, message) @@ -595,7 +601,7 @@ psignal (signo, message) } } -#endif /* NEED_psignal */ +#endif /* ! HAVE_PSIGNAL */ /* A simple little main that does nothing but print all the signal translations diff --git a/gnu/dist/libiberty/vasprintf.c b/gnu/dist/libiberty/vasprintf.c index 3794cbd2c4f..da83db2ea75 100644 --- a/gnu/dist/libiberty/vasprintf.c +++ b/gnu/dist/libiberty/vasprintf.c @@ -74,7 +74,7 @@ int_vasprintf (result, format, args) } while (strchr ("hlL", *p)) ++p; - /* Should be big enough for any format specifier except %s. */ + /* Should be big enough for any format specifier except %s and floats. */ total_width += 30; switch (*p) { @@ -93,6 +93,9 @@ int_vasprintf (result, format, args) case 'g': case 'G': (void) va_arg (ap, double); + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; break; case 's': total_width += strlen (va_arg (ap, char *)); @@ -118,7 +121,11 @@ int vasprintf (result, format, args) char **result; const char *format; +#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) + _BSD_VA_LIST_ args; +#else va_list args; +#endif { return int_vasprintf (result, format, &args); } diff --git a/gnu/dist/libiberty/vmsbuild.com b/gnu/dist/libiberty/vmsbuild.com index 9400b45723a..4fede380bfd 100644 --- a/gnu/dist/libiberty/vmsbuild.com +++ b/gnu/dist/libiberty/vmsbuild.com @@ -13,9 +13,9 @@ $ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build $ $! manually copied from Makefile.in $ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "- - + "fdmatch.o getopt.o getopt1.o getruntime.o hex.o "- - + "floatformat.o obstack.o spaces.o strerror.o strsignal.o "- - + "vasprintf.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o" + + "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "- + + "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "- + + "xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o" $! anything not caught by link+search of dummy.* should be added here $ EXTRA_OFILES = "" $! @@ -28,10 +28,9 @@ $ ECHO "Starting libiberty build..." $ create config.h /* libiberty config.h for VMS */ #define NEED_sys_siglist +#define NEED_strsignal #define NEED_psignal #define NEED_basename -$ if f$search("alloca-conf.h").eqs."" then - - copy alloca-norm.h alloca-conf.h $ LIBR 'WORK_LIB' /Create $ $! first pass: compile "required" modules diff --git a/gnu/dist/libiberty/xmalloc.c b/gnu/dist/libiberty/xmalloc.c index c479b1f9e95..b88105a9b74 100644 --- a/gnu/dist/libiberty/xmalloc.c +++ b/gnu/dist/libiberty/xmalloc.c @@ -42,16 +42,22 @@ PTR sbrk PARAMS ((ptrdiff_t)); /* The program name if set. */ static const char *name = ""; -/* The initial sbrk, set when the program name is set. */ +#if ! defined (_WIN32) || defined (__CYGWIN32__) +/* The initial sbrk, set when the program name is set. Not used for win32 + ports other than cygwin32. */ static char *first_break = NULL; +#endif void xmalloc_set_program_name (s) const char *s; { name = s; +#if ! defined (_WIN32) || defined (__CYGWIN32__) + /* Win32 ports other than cygwin32 don't have brk() */ if (first_break == NULL) first_break = (char *) sbrk (0); +#endif /* ! _WIN32 || __CYGWIN32 __ */ } PTR @@ -65,6 +71,7 @@ xmalloc (size) newmem = malloc (size); if (!newmem) { +#if ! defined (_WIN32) || defined (__CYGWIN32__) extern char **environ; size_t allocated; @@ -76,6 +83,12 @@ xmalloc (size) "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* ! _WIN32 || __CYGWIN32 __ */ xexit (1); } return (newmem); @@ -96,6 +109,7 @@ xrealloc (oldmem, size) newmem = realloc (oldmem, size); if (!newmem) { +#ifndef __MINGW32__ extern char **environ; size_t allocated; @@ -107,6 +121,12 @@ xrealloc (oldmem, size) "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not reallocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* __MINGW32__ */ xexit (1); } return (newmem); |
