From 5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 26 May 2000 13:11:57 +0000 Subject: [PATCH] Eli Zaretskii's DOSish file name patches. --- bfd/ChangeLog | 19 ++ bfd/aoutx.h | 6 +- bfd/archive.c | 35 ++- bfd/cache.c | 10 +- bfd/sysdep.h | 19 +- binutils/ChangeLog | 39 +++ binutils/ar.c | 62 +++- binutils/arsup.c | 15 +- binutils/bucomm.c | 22 +- binutils/config.in | 3 + binutils/configure | 2 +- binutils/configure.in | 2 +- binutils/ieee.c | 41 ++- binutils/objcopy.c | 13 +- binutils/strings.c | 20 ++ gprof/ChangeLog | 36 +++ gprof/configure | 694 ++++++++++++------------------------------ gprof/configure.in | 1 + gprof/gconfig.in | 3 + gprof/gmon_io.c | 3 + gprof/gmon_io.h | 18 ++ gprof/gprof.texi | 91 +++--- gprof/hertz.c | 16 +- gprof/search_list.c | 2 +- gprof/search_list.h | 8 + gprof/source.c | 50 ++- gprof/sym_ids.c | 5 +- include/ChangeLog | 6 + include/filenames.h | 51 ++++ ld/ChangeLog | 5 + ld/ldmain.c | 11 +- 31 files changed, 692 insertions(+), 616 deletions(-) create mode 100644 include/filenames.h diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9b51a5f5d20..ad7ba442019 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +2000-05-26 Alan Modra + + * sysdep.h (gettext, dgettext, dcgettext, textdomain, + bindtextdomain): Replace defines with those from intl/libgettext.h + to quieten gcc warnings. + +2000-05-26 Eli Zaretskii + + * aoutx.h (find_nearest_line): Use IS_ABSOLUTE_PATH. + + * archive.c (normalize, bfd_bsd_truncate_arname, + bfd_gnu_truncate_arname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support + file names with backslashes. + + * cache.c (bfd_open_file) [__MSDOS__]: Don't unlink the file + before opening it. + + * sysdep.h: Include filenames.h. + 2000-05-26 Alan Modra * opncls.c (bfd_close_all_done): Mask file perms with 0777 not 0x777. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 01dd9eee4c0..4b0940d7ad5 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1,5 +1,5 @@ /* BFD semi-generic back-end for a.out binaries. - Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 + Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Written by Cygnus Support. @@ -2833,7 +2833,7 @@ NAME(aout,find_nearest_line) } if (main_file_name == NULL - || main_file_name[0] == '/' + || IS_ABSOLUTE_PATH (main_file_name) || directory_name == NULL) filelen = 0; else @@ -2857,7 +2857,7 @@ NAME(aout,find_nearest_line) if (main_file_name != NULL) { - if (main_file_name[0] == '/' || directory_name == NULL) + if (IS_ABSOLUTE_PATH (main_file_name) || directory_name == NULL) *filename_ptr = main_file_name; else { diff --git a/bfd/archive.c b/bfd/archive.c index 1e1c9fa8f20..5709f26e272 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -1,5 +1,5 @@ /* BFD back-end for archive files (libraries). - Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 + Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. @@ -1183,6 +1183,17 @@ normalize (abfd, file) { const char *filename = strrchr (file, '/'); + +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (file, '\\'); + if (bslash > filename) + filename = bslash; + if (filename == NULL && file[0] != '\0' && file[1] == ':') + filename = file + 1; + } +#endif if (filename != (char *) NULL) filename++; else @@ -1566,6 +1577,17 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr) CONST char *filename = strrchr (pathname, '/'); int maxlen = ar_maxnamelen (abfd); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (pathname, '\\'); + if (bslash > filename) + filename = bslash; + if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':') + filename = pathname + 1; + } +#endif + if (filename == NULL) filename = pathname; else @@ -1606,6 +1628,17 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr) CONST char *filename = strrchr (pathname, '/'); int maxlen = ar_maxnamelen (abfd); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (pathname, '\\'); + if (bslash > filename) + filename = bslash; + if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':') + filename = pathname + 1; + } +#endif + if (filename == NULL) filename = pathname; else diff --git a/bfd/cache.c b/bfd/cache.c index ad3140e1ed7..91b6c610854 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -1,5 +1,6 @@ /* BFD library -- caching of file descriptors. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000 + Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of BFD, the Binary File Descriptor library. @@ -300,10 +301,17 @@ bfd_open_file (abfd) So we unlink the output file if and only if it has non-zero size. */ +#ifndef __MSDOS__ + /* Don't do this for MSDOS: it doesn't care about overwriting + a running binary, but if this file is already open by + another BFD, we will be in deep trouble if we delete an + open file. In fact, objdump does just that if invoked with + the --info option. */ struct stat s; if (stat (abfd->filename, &s) == 0 && s.st_size != 0) unlink (abfd->filename); +#endif abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB); abfd->opened_once = true; } diff --git a/bfd/sysdep.h b/bfd/sysdep.h index 0a58983fa2d..77b5e50a9c3 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -1,5 +1,5 @@ /* sysdep.h -- handle host dependencies for the BFD library - Copyright 1995, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -102,6 +102,8 @@ extern char *strrchr (); #define SEEK_CUR 1 #endif +#include "filenames.h" + #ifdef NEED_DECLARATION_STRSTR extern char *strstr (); #endif @@ -131,14 +133,13 @@ extern char *getenv (); #define N_(String) (String) #endif #else -/* Stubs that do something close enough. */ -#define textdomain(String) (String) -#define gettext(String) (String) -#define dgettext(Domain,Message) (Message) -#define dcgettext(Domain,Message,Type) (Message) -#define bindtextdomain(Domain,Directory) (Domain) -#define _(String) (String) -#define N_(String) (String) +# define gettext(Msgid) (Msgid) +# define dgettext(Domainname, Msgid) (Msgid) +# define dcgettext(Domainname, Msgid, Category) (Msgid) +# define textdomain(Domainname) while (0) /* nothing */ +# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ +# define _(String) (String) +# define N_(String) (String) #endif #endif /* ! defined (BFD_SYSDEP_H) */ diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6365b7121f6..6702d7c412c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,42 @@ +2000-05-26 Eli Zaretskii + + * ar.c: Include filenames.h. + (normalize) [HAVE_DOS_BASED_FILE_SYSTEM]: Support backslashes + and drive letters in file names. + (main): Support backslashes and drive letters in argv[0]. Drop + the .exe suffix, if any, in argv[0] if is_ranlib is negative. Use + FILENAME_CMP instead of strcmp to compare file names. + (open_inarch) [__GO32__]: Don't ifdef errno != ENOENT test for + DJGPP v2. + (do_quick_append) [__GO32__]: Ditto. + (get_pos_bfd, delete_members, move_members, replace_members): + Compare file names with FILENAME_CMP. + + * bucomm.c: Include filenames.h. + (make_tempname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support mixed + forward/backward slashes and drive letters in file names. + + * ieee.c (ieee_start_compilation_unit, ieee_add_bb11): Support + mixed forward/backward slashes and drive letters in file names. + + * strings.c (O_BINARY, setmode, SET_BINARY): Define. + (main) [SET_BINARY]: Use SET_BINARY to switch stdin into binary + mode. + + * objcopy.c: Include filenames.h. + (main) [HAVE_DOS_BASED_FILE_SYSTEM]: Drop the .exe suffix + before comparing to "strip". + Use FILENAME_CMP to compare file names. + + * arsup.c: Include filenames.h. + (map_over_list, ar_delete, ar_replace, ar_extract): Use + FILENAME_CMP to compare file names. + (ar_open): Prepend "tmp-" instead of appending "-tmp", to create + the temporary file name. + + * configure.in: Check for setmode. + * configure: Regenerate. + 2000-05-24 Alan Modra * objdump.c (display_target_list): Close the bfd. diff --git a/binutils/ar.c b/binutils/ar.c index 17388a49901..d67f4b37929 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aout/ar.h" #include "libbfd.h" #include "arsup.h" +#include "filenames.h" #include #ifdef __GO32___ @@ -215,7 +216,7 @@ map_over_members (arch, function, files, count) bfd_stat_arch_elt (head, &buf); } if ((head->filename != NULL) && - (!strcmp (normalize (*files, arch), head->filename))) + (!FILENAME_CMP (normalize (*files, arch), head->filename))) { ++match_count; if (counted_name_mode @@ -302,6 +303,16 @@ normalize (file, abfd) return file; filename = strrchr (file, '/'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (file, '\\'); + if (bslash > filename) + filename = bslash; + if (filename == NULL && file[0] != '\0' && file[1] == ':') + filename = file + 1; + } +#endif if (filename != (char *) NULL) filename++; else @@ -377,12 +388,22 @@ main (argc, argv) char *temp; temp = strrchr (program_name, '/'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (program_name, '\\'); + if (bslash > temp) + temp = bslash; + if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':') + temp = program_name + 1; + } +#endif if (temp == NULL) temp = program_name; else ++temp; if (strlen (temp) >= 6 - && strcmp (temp + strlen (temp) - 6, "ranlib") == 0) + && FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0) is_ranlib = 1; else is_ranlib = 0; @@ -697,12 +718,15 @@ open_inarch (archive_filename, file) if (stat (archive_filename, &sbuf) != 0) { -#ifndef __GO32__ +#if !defined(__GO32__) || defined(__DJGPP__) + + /* FIXME: I don't understand why this fragment was ifndef'ed + away for __GO32__; perhaps it was in the days of DJGPP v1.x. + stat() works just fine in v2.x, so I think this should be + removed. For now, I enable it for DJGPP v2. -- EZ. */ /* KLUDGE ALERT! Temporary fix until I figger why - * stat() is wrong ... think it's buried in GO32's IDT - * - Jax - */ + stat() is wrong ... think it's buried in GO32's IDT - Jax */ if (errno != ENOENT) bfd_fatal (archive_filename); #endif @@ -932,12 +956,18 @@ do_quick_append (archive_filename, files_to_append) if (stat (archive_filename, &sbuf) != 0) { -#ifndef __GO32__ +#if !defined(__GO32__) || defined(__DJGPP__) + + /* FIXME: I don't understand why this fragment was ifndef'ed + away for __GO32__; perhaps it was in the days of DJGPP v1.x. + stat() works just fine in v2.x, so I think this should be + removed. For now, I enable it for DJGPP v2. + + (And yes, I know this is all unused, but somebody, someday, + might wish to resurrect this again... -- EZ. */ /* KLUDGE ALERT! Temporary fix until I figger why - * stat() is wrong ... think it's buried in GO32's IDT - * - Jax - */ + stat() is wrong ... think it's buried in GO32's IDT - Jax */ if (errno != ENOENT) bfd_fatal (archive_filename); @@ -1107,7 +1137,7 @@ get_pos_bfd (contents, default_pos, default_posname) else { for (; *after_bfd; after_bfd = &(*after_bfd)->next) - if (strcmp ((*after_bfd)->filename, realposname) == 0) + if (FILENAME_CMP ((*after_bfd)->filename, realposname) == 0) { if (realpos == pos_after) after_bfd = &(*after_bfd)->next; @@ -1147,7 +1177,7 @@ delete_members (arch, files_to_delete) current_ptr_ptr = &(arch->next); while (*current_ptr_ptr) { - if (strcmp (normalize (*files_to_delete, arch), + if (FILENAME_CMP (normalize (*files_to_delete, arch), (*current_ptr_ptr)->filename) == 0) { ++match_count; @@ -1204,8 +1234,8 @@ move_members (arch, files_to_move) while (*current_ptr_ptr) { bfd *current_ptr = *current_ptr_ptr; - if (strcmp (normalize (*files_to_move, arch), - current_ptr->filename) == 0) + if (FILENAME_CMP (normalize (*files_to_move, arch), + current_ptr->filename) == 0) { /* Move this file to the end of the list - first cut from where it is. */ @@ -1260,8 +1290,8 @@ replace_members (arch, files_to_move, quick) /* For compatibility with existing ar programs, we permit the same file to be added multiple times. */ - if (strcmp (normalize (*files_to_move, arch), - normalize (current->filename, arch)) == 0 + if (FILENAME_CMP (normalize (*files_to_move, arch), + normalize (current->filename, arch)) == 0 && current->arelt_data != NULL) { if (newer_only) diff --git a/binutils/arsup.c b/binutils/arsup.c index d6809fc4749..eebee997715 100644 --- a/binutils/arsup.c +++ b/binutils/arsup.c @@ -1,5 +1,5 @@ /* arsup.c - Archive support for MRI compatibility - Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 + Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -31,6 +31,7 @@ style librarian command syntax + 1 word LIST #include "arsup.h" #include "libiberty.h" #include "bucomm.h" +#include "filenames.h" static void map_over_list PARAMS ((bfd *, void (*function) (bfd *, bfd *), struct list *)); @@ -76,7 +77,7 @@ map_over_list (arch, function, list) for (head = arch->next; head; head = head->next) { if (head->filename != NULL - && strcmp (ptr->name, head->filename) == 0) + && FILENAME_CMP (ptr->name, head->filename) == 0) { found = true; function (head, prev); @@ -160,7 +161,9 @@ DEFUN(ar_open,(name, t), { char *tname = (char *) xmalloc (strlen (name) + 10); real_name = name; - sprintf(tname, "%s-tmp", name); + /* Prepend tmp- to the beginning, to avoid file-name clashes after + truncation on filesystems with limited namespaces (DOS). */ + sprintf(tname, "tmp-%s", name); obfd = bfd_openw(tname, NULL); if (!obfd) { @@ -289,7 +292,7 @@ DEFUN(ar_delete, (list), bfd **prev = &(obfd->archive_head); int found = 0; while (member) { - if (strcmp(member->filename, list->name) == 0) { + if (FILENAME_CMP(member->filename, list->name) == 0) { *prev = member->next; found = 1; } @@ -346,7 +349,7 @@ DEFUN(ar_replace, (list), int found = 0; while (member) { - if (strcmp(member->filename, list->name) == 0) + if (FILENAME_CMP(member->filename, list->name) == 0) { /* Found the one to replace */ bfd *abfd = bfd_openr(list->name, 0); @@ -437,7 +440,7 @@ DEFUN(ar_extract,(list), int found = 0; while (member && !found) { - if (strcmp(member->filename, list->name) == 0) + if (FILENAME_CMP(member->filename, list->name) == 0) { extract_file(member); found = 1; diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 3406e1d6e60..76ffa60a172 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -25,6 +25,7 @@ #include "bfd.h" #include "libiberty.h" #include "bucomm.h" +#include "filenames.h" #include #include /* ctime, maybe time_t */ @@ -214,9 +215,15 @@ make_tempname (filename) char *tmpname; char *slash = strrchr (filename, '/'); -#if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32) - if (slash == NULL) - slash = strrchr (filename, '\\'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ + char *bslash = strrchr (filename, '\\'); + if (bslash > slash) + slash = bslash; + if (slash == NULL && filename[0] != '\0' && filename[1] == ':') + slash = filename + 1; + } #endif if (slash != (char *) NULL) @@ -225,8 +232,15 @@ make_tempname (filename) c = *slash; *slash = 0; - tmpname = xmalloc (strlen (filename) + sizeof (template) + 1); + tmpname = xmalloc (strlen (filename) + sizeof (template) + 2); strcpy (tmpname, filename); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + /* If tmpname is "X:", appending a slash will make it a root + directory on drive X, which is NOT the same as the current + directory on drive X. */ + if (tmpname[1] == ':' && tmpname[2] == '\0') + strcat (tmpname, "."); +#endif strcat (tmpname, "/"); strcat (tmpname, template); mktemp (tmpname); diff --git a/binutils/config.in b/binutils/config.in index 3c26c5c509b..7b70d16d867 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -82,6 +82,9 @@ /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE +/* Define if you have the setmode function. */ +#undef HAVE_SETMODE + /* Define if you have the stpcpy function. */ #undef HAVE_STPCPY diff --git a/binutils/configure b/binutils/configure index 43fe8a69ceb..21270e927ee 100755 --- a/binutils/configure +++ b/binutils/configure @@ -4325,7 +4325,7 @@ EOF fi -for ac_func in sbrk utimes +for ac_func in sbrk utimes setmode do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:4332: checking for $ac_func" >&5 diff --git a/binutils/configure.in b/binutils/configure.in index 27a14866adc..6b5ae243bab 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -96,7 +96,7 @@ AC_SUBST(DEMANGLER_NAME) AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) AC_HEADER_SYS_WAIT AC_FUNC_ALLOCA -AC_CHECK_FUNCS(sbrk utimes) +AC_CHECK_FUNCS(sbrk utimes setmode) # Some systems have frexp only in -lm, not in -lc. AC_SEARCH_LIBS(frexp, m) diff --git a/binutils/ieee.c b/binutils/ieee.c index a3bb93b8d7f..27409cc9ae0 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -1,5 +1,5 @@ /* ieee.c -- Read and write IEEE-695 debugging information. - Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -30,6 +30,7 @@ #include "libiberty.h" #include "debug.h" #include "budbg.h" +#include "filenames.h" /* This structure holds an entry on the block stack. */ @@ -4926,6 +4927,7 @@ ieee_start_compilation_unit (p, filename) { struct ieee_handle *info = (struct ieee_handle *) p; const char *modname; + const char *backslash; char *c, *s; unsigned int nindx; @@ -4937,16 +4939,20 @@ ieee_start_compilation_unit (p, filename) info->filename = filename; modname = strrchr (filename, '/'); + /* We could have a mixed forward/back slash case. */ + backslash = strrchr (modname, '\\'); + if (backslash > modname) + modname = backslash; + if (modname != NULL) ++modname; +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + else if (filename[0] && filename[1] == ':') + modname = filename + 2; +#endif else - { - modname = strrchr (filename, '\\'); - if (modname != NULL) - ++modname; - else - modname = filename; - } + modname = filename; + c = xstrdup (modname); s = strrchr (c, '.'); if (s != NULL) @@ -5194,22 +5200,25 @@ ieee_add_bb11 (info, sec, low, high) } else { - const char *filename, *modname; + const char *filename, *modname, *backslash; char *c, *s; /* Start the enclosing BB10 block. */ filename = bfd_get_filename (info->abfd); modname = strrchr (filename, '/'); + backslash = strrchr (modname, '\\'); + if (backslash > modname) + modname = backslash; + if (modname != NULL) ++modname; +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + else if (filename[0] && filename[1] == ':') + modname = filename + 2; +#endif else - { - modname = strrchr (filename, '\\'); - if (modname != NULL) - ++modname; - else - modname = filename; - } + modname = filename; + c = xstrdup (modname); s = strrchr (c, '.'); if (s != NULL) diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 36d5f4c76e3..b8a49c8a344 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1,5 +1,5 @@ /* objcopy.c -- copy object file from input to output, optionally massaging it. - Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -25,6 +25,7 @@ #include "getopt.h" #include "libiberty.h" #include "budbg.h" +#include "filenames.h" #include /* A list of symbols to explicitly strip out, or to keep. A linked @@ -2253,7 +2254,15 @@ main (argc, argv) if (is_strip < 0) { int i = strlen (program_name); - is_strip = (i >= 5 && strcmp (program_name + i - 5, "strip") == 0); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + /* Drop the .exe suffix, if any. */ + if (i > 4 && FILENAME_CMP (program_name + i - 4, ".exe") == 0) + { + i -= 4; + program_name[i] = '\0'; + } +#endif + is_strip = (i >= 5 && FILENAME_CMP (program_name + i - 5, "strip") == 0); } if (is_strip) diff --git a/binutils/strings.c b/binutils/strings.c index ab845b04d42..54f29e43abb 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -59,6 +59,23 @@ #include "bucomm.h" #include "libiberty.h" +/* Some platforms need to put stdin into binary mode, to read + binary files. */ +#ifdef HAVE_SETMODE +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#define setmode _setmode +#else +#define O_BINARY 0 +#endif +#endif +#if O_BINARY +#include +#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0) +#endif +#endif + #ifdef isascii #define isgraphic(c) (isascii (c) && isprint (c)) #else @@ -218,6 +235,9 @@ main (argc, argv) if (optind >= argc) { datasection_only = false; +#ifdef SET_BINARY + SET_BINARY (fileno (stdin)); +#endif print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL); files_given = true; } diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 5889caa8d23..da4f002ed44 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,39 @@ +2000-05-26 Alan Modra + + * gprof.h: Remove most nls defines. They are pulled in by + bfd/sysdep.h. #include "ansidecl.h" not + +2000-05-26 Eli Zaretskii + + * gprof.texi: Fix numerous typos. Mention some DOS/Windows related + issues. + + * configure.in: Check for setmode function. + * configure: Regenerate. + + * gmon_io.h (SET_BINARY) [HAVE_SETMODE]: Define. + + * gmon_io.c (gmon_out_read) [SET_BINARY]: Switch stdin into binary + mode. + + * source.c: Include filenames.h and sys/stat.h. + (source_file_lookup_path, source_file_lookup_name): Use + FILENAME_CMP to compare file names. + (annotate_source) [__MSDOS__]: If "filename-ann" would overwrite + "filename", replace the extension with ".ann". + [HAVE_DOS_BASED_FILE_SYSTEM]: Support file names with + backslashes and drive letters. + Use IS_ABSOLUTE_PATH. + + * search_list.h (PATH_SEP_CHAR): Define. + + * search_list.c (search_list_append): Use PATH_SEP_CHAR. + + * hertz.c (HERTZ) [__MSDOS__]: Don't define unless they have + neither HAVE_SETITIMER nor HAVE_SYSCONF. + [HAVE_SETITIMER]: If they define both HAVE_SETITIMER and + HAVE_SYSCONF, try setitimer and fall back on sysconf. + Fri Apr 7 15:56:57 2000 Andrew Cagney * configure.in (WARN_CFLAGS): Set to -W -Wall by default. Add diff --git a/gprof/configure b/gprof/configure index 47f93c6023e..899b640c076 100755 --- a/gprof/configure +++ b/gprof/configure @@ -20,7 +20,7 @@ ac_help="$ac_help ac_help="$ac_help --with-gnu-ld assume the C compiler uses GNU ld [default=no]" ac_help="$ac_help - --disable-libtool-lock force libtool not to do file locking" + --disable-libtool-lock avoid locking (might break parallel builds)" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help @@ -1232,7 +1232,7 @@ echo "configure:1232: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. - /* | [A-Za-z]:[\\/]*) + [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` @@ -1261,10 +1261,10 @@ if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. @@ -1289,9 +1289,8 @@ else echo "$ac_t""no" 1>&6 fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } - echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1295: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1294: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1307,7 +1306,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1311: checking for BSD-compatible nm" >&5 +echo "configure:1310: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1315,10 +1314,10 @@ else # Let the user override the test. ac_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored @@ -1342,213 +1341,8 @@ fi NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6 -echo "configure:1349: checking command to parse $NM output" >&5 -if eval "test \"`echo '$''{'ac_cv_sys_global_symbol_pipe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # These are sane defaults that work on at least a few old systems. -# {They come from Ultrix. What could be older than Ultrix?!! ;)} - -# Character class describing NM global symbol codes. -ac_symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -ac_symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Define system-specific variables. -case "$host_os" in -aix*) - ac_symcode='[BCDT]' - ;; -cygwin* | mingw*) - ac_symcode='[ABCDGISTW]' - ;; -hpux*) - ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; -irix*) - ac_symcode='[BCDEGRST]' - ;; -solaris*) - ac_symcode='[BDT]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - ac_symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* \($ac_symcode\) *\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'" - - # Check to see that the pipe works correctly. - ac_pipe_works=no - rm -f conftest.$ac_ext - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - # Now try to grab the symbols. - ac_nlist=conftest.nm - - if { (eval echo configure:1416: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then - - # Try sorting and uniquifying the output. - if sort "$ac_nlist" | uniq > "$ac_nlist"T; then - mv -f "$ac_nlist"T "$ac_nlist" - else - rm -f "$ac_nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then - if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c' - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftestm.$ac_objext - ac_save_LIBS="$LIBS" - ac_save_CFLAGS="$CFLAGS" - LIBS="conftestm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_pipe_works=yes - else - echo "configure: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$ac_save_LIBS" - CFLAGS="$ac_save_CFLAGS" - else - echo "cannot find nm_test_func in $ac_nlist" >&5 - fi - else - echo "cannot find nm_test_var in $ac_nlist" >&5 - fi - else - echo "cannot run $ac_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - rm -rf conftest* - - # Do not use the global_symbol_pipe unless it works. - if test "$ac_pipe_works" = yes; then - if test x"$ac_symprfx" = x"_"; then - ac_cv_sys_symbol_underscore=yes - else - ac_cv_sys_symbol_underscore=no - fi - break - else - ac_cv_sys_global_symbol_pipe= - fi -done - -fi - - -ac_result=yes -if test -z "$ac_cv_sys_global_symbol_pipe"; then - ac_result=no -fi -echo "$ac_t""$ac_result" 1>&6 - -echo $ac_n "checking for _ prefix in compiled symbols""... $ac_c" 1>&6 -echo "configure:1514: checking for _ prefix in compiled symbols" >&5 -if eval "test \"`echo '$''{'ac_cv_sys_symbol_underscore'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_sys_symbol_underscore=no -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - # Now try to grab the symbols. - ac_nlist=conftest.nm - if { (eval echo configure:1526: \"$NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5; } && test -s "$ac_nlist"; then - # See whether the symbols have a leading underscore. - if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then - ac_cv_sys_symbol_underscore=yes - else - if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then - : - else - echo "configure: cannot find nm_test_func in $ac_nlist" >&5 - fi - fi - else - echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&5 - fi -else - echo "configure: failed program was:" >&5 - cat conftest.c >&5 -fi -rm -rf conftest* - -fi - -echo "$ac_t""$ac_cv_sys_symbol_underscore" 1>&6 -USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no} - echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1552: checking whether ln -s works" >&5 +echo "configure:1346: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1568,30 +1362,37 @@ else echo "$ac_t""no" 1>&6 fi -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + # Some flags need to be propagated to the compiler or linker for good # libtool support. -case "$host" in +case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 1594 "configure"' > conftest.$ac_ext - if { (eval echo configure:1595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 1395 "configure"' > conftest.$ac_ext + if { (eval echo configure:1396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -1612,19 +1413,19 @@ case "$host" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:1616: checking whether the C compiler needs -belf" >&5 +echo "configure:1417: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -1643,161 +1444,9 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 fi ;; -*-*-cygwin*) - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1651: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_DLLTOOL"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1683: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="dlltool" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false" -fi -fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - DLLTOOL="false" -fi -fi - -# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1718: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ac_tool_prefix}as" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_AS"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1750: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="as" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false" -fi -fi -AS="$ac_cv_prog_AS" -if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - AS="false" -fi -fi - - - ;; esac -# enable the --disable-libtool-lock switch - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - need_locks=$enableval -else - need_locks=yes -fi - - -if test x"$need_locks" = xno; then - libtool_flags="$libtool_flags --disable-lock" -fi - # Save cache, so that ltconfig can load it cat > confcache <<\EOF @@ -1850,10 +1499,11 @@ rm -f confcache # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -DLLTOOL="$DLLTOOL" AS="$AS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || { echo "configure: error: libtool configure failed" 1>&2; exit 1; } # Reload cache, that may have been modified by ltconfig @@ -1884,7 +1534,7 @@ exec 5>>./config.log # 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:1888: checking for $ac_word" >&5 +echo "configure:1538: 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 @@ -1914,7 +1564,7 @@ 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:1918: checking for $ac_word" >&5 +echo "configure:1568: 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 @@ -1965,7 +1615,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1969: checking for $ac_word" >&5 +echo "configure:1619: 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 @@ -1997,7 +1647,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2001: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1651: 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. @@ -2008,12 +1658,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2012 "configure" +#line 1662 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2039,12 +1689,12 @@ 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:2043: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1693: 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 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2048: checking whether we are using GNU C" >&5 +echo "configure:1698: 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 @@ -2053,7 +1703,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1707: \"$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 @@ -2072,7 +1722,7 @@ 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:2076: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1726: 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 @@ -2115,7 +1765,7 @@ fi # 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:2119: checking for a BSD compatible install" >&5 +echo "configure:1769: 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 @@ -2169,7 +1819,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:2173: checking for POSIXized ISC" >&5 +echo "configure:1823: 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 @@ -2189,10 +1839,65 @@ else ISC= fi +for ac_func in setmode +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1846: 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 < +/* 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:1874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + ALL_LINGUAS= echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2196: checking how to run the C preprocessor" >&5 +echo "configure:1901: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2207,13 +1912,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2224,13 +1929,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2241,13 +1946,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2272,12 +1977,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2276: checking for ANSI C header files" >&5 +echo "configure:1981: 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 < #include @@ -2285,7 +1990,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2302,7 +2007,7 @@ 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 @@ -2320,7 +2025,7 @@ 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 @@ -2341,7 +2046,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2352,7 +2057,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2376,12 +2081,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2380: checking for working const" >&5 +echo "configure:2085: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2451,21 +2156,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2455: checking for inline" >&5 +echo "configure:2160: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2491,12 +2196,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2495: checking for off_t" >&5 +echo "configure:2200: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2524,12 +2229,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2528: checking for size_t" >&5 +echo "configure:2233: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2559,19 +2264,19 @@ fi # 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:2563: checking for working alloca.h" >&5 +echo "configure:2268: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2592,12 +2297,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2596: checking for alloca" >&5 +echo "configure:2301: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2657,12 +2362,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2661: checking whether alloca needs Cray hooks" >&5 +echo "configure:2366: 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 <&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:2691: checking for $ac_func" >&5 +echo "configure:2396: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2742,7 +2447,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2746: checking stack direction for C alloca" >&5 +echo "configure:2451: 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 @@ -2750,7 +2455,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2794,17 +2499,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2798: checking for $ac_hdr" >&5 +echo "configure:2503: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2833,12 +2538,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2837: checking for $ac_func" >&5 +echo "configure:2542: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2886,7 +2591,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2890: checking for working mmap" >&5 +echo "configure:2595: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2894,7 +2599,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3062,17 +2767,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3066: checking for $ac_hdr" >&5 +echo "configure:2771: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3102,12 +2807,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3106: checking for $ac_func" >&5 +echo "configure:2811: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3159,12 +2864,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3163: checking for $ac_func" >&5 +echo "configure:2868: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3221,19 +2926,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3225: checking for LC_MESSAGES" >&5 +echo "configure:2930: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3254,7 +2959,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3258: checking whether NLS is requested" >&5 +echo "configure:2963: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3274,7 +2979,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3278: checking whether included gettext is requested" >&5 +echo "configure:2983: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3293,17 +2998,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3297: checking for libintl.h" >&5 +echo "configure:3002: checking for libintl.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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3320,19 +3025,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3324: checking for gettext in libc" >&5 +echo "configure:3029: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3348,7 +3053,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3352: checking for bindtextdomain in -lintl" >&5 +echo "configure:3057: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3356,7 +3061,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3383,19 +3088,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3387: checking for gettext in libintl" >&5 +echo "configure:3092: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3423,7 +3128,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3427: checking for $ac_word" >&5 +echo "configure:3132: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3457,12 +3162,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3461: checking for $ac_func" >&5 +echo "configure:3166: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3512,7 +3217,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3516: checking for $ac_word" >&5 +echo "configure:3221: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3548,7 +3253,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3552: checking for $ac_word" >&5 +echo "configure:3257: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3580,7 +3285,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -3620,7 +3325,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3624: checking for $ac_word" >&5 +echo "configure:3329: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3654,7 +3359,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3658: checking for $ac_word" >&5 +echo "configure:3363: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3690,7 +3395,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3694: checking for $ac_word" >&5 +echo "configure:3399: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3780,7 +3485,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:3784: checking for catalogs to be installed" >&5 +echo "configure:3489: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -3808,17 +3513,17 @@ echo "configure:3784: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:3812: checking for linux/version.h" >&5 +echo "configure:3517: checking for linux/version.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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3527: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3881,7 +3586,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:3885: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:3590: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -3904,12 +3609,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:3908: checking for Cygwin environment" >&5 +echo "configure:3613: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -3937,19 +3642,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:3941: checking for mingw32 environment" >&5 +echo "configure:3646: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -3968,7 +3673,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:3972: checking for executable suffix" >&5 +echo "configure:3677: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3978,7 +3683,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:3982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:3687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -4183,12 +3888,7 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@RANLIB@%$RANLIB%g s%@CC@%$CC%g -s%@LD@%$LD%g -s%@NM@%$NM%g -s%@USE_SYMBOL_UNDERSCORE@%$USE_SYMBOL_UNDERSCORE%g s%@LN_S@%$LN_S%g -s%@DLLTOOL@%$DLLTOOL%g -s%@AS@%$AS%g s%@LIBTOOL@%$LIBTOOL%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g diff --git a/gprof/configure.in b/gprof/configure.in index 3d530b279d9..8c44a682685 100644 --- a/gprof/configure.in +++ b/gprof/configure.in @@ -18,6 +18,7 @@ AC_PROG_CC AC_PROG_INSTALL AC_ISC_POSIX +AC_CHECK_FUNCS(setmode) ALL_LINGUAS= CY_GNU_GETTEXT diff --git a/gprof/gconfig.in b/gprof/gconfig.in index 347e8e0fbb7..b528f4be885 100644 --- a/gprof/gconfig.in +++ b/gprof/gconfig.in @@ -73,6 +73,9 @@ /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE +/* Define if you have the setmode function. */ +#undef HAVE_SETMODE + /* Define if you have the stpcpy function. */ #undef HAVE_STPCPY diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c index 7e0a1a0a81b..f2ac524ac6f 100644 --- a/gprof/gmon_io.c +++ b/gprof/gmon_io.c @@ -72,6 +72,9 @@ DEFUN (gmon_out_read, (filename), const char *filename) if (strcmp (filename, "-") == 0) { ifp = stdin; +#ifdef SET_BINARY + SET_BINARY (fileno (stdin)); +#endif } else { diff --git a/gprof/gmon_io.h b/gprof/gmon_io.h index bf257a49df6..06bca377b48 100644 --- a/gprof/gmon_io.h +++ b/gprof/gmon_io.h @@ -4,6 +4,24 @@ #include "bfd.h" #include "gmon.h" +/* Some platforms need to put stdin into binary mode, to read + binary files. */ +#include "sysdep.h" +#ifdef HAVE_SETMODE +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#define setmode _setmode +#else +#define O_BINARY 0 +#endif +#endif +#if O_BINARY +#include +#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0) +#endif +#endif + #define INPUT_HISTOGRAM (1<<0) #define INPUT_CALL_GRAPH (1<<1) #define INPUT_BB_COUNTS (1<<2) diff --git a/gprof/gprof.texi b/gprof/gprof.texi index b4606b42f4b..6e1cfd01990 100644 --- a/gprof/gprof.texi +++ b/gprof/gprof.texi @@ -16,7 +16,7 @@ END-INFO-DIR-ENTRY @ifinfo This file documents the gprof profiler of the GNU system. -Copyright (C) 1988, 1992, 1997, 1998, 1999 Free Software Foundation, Inc. +Copyright (C) 1988, 92, 97, 98, 99, 2000 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -53,11 +53,8 @@ can use it to determine which parts of a program are taking most of the execution time. We assume that you know how to write, compile, and execute programs. @sc{gnu} @code{gprof} was written by Jay Fenlason. -This manual was edited January 1993 by Jeffrey Osier -and updated September 1997 by Brent Baccala. - @vskip 0pt plus 1filll -Copyright @copyright{} 1988, 1992, 1997, 1998 Free Software Foundation, Inc. +Copyright @copyright{} 1988, 92, 97, 98, 99, 2000 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -89,8 +86,6 @@ can use it to determine which parts of a program are taking most of the execution time. We assume that you know how to write, compile, and execute programs. @sc{gnu} @code{gprof} was written by Jay Fenlason. -This manual was updated August 1997 by Brent Baccala. - @menu * Introduction:: What profiling means, and why it is useful. @@ -303,7 +298,7 @@ The order of these options does not matter. * Output Options:: Controlling @code{gprof}'s output style * Analysis Options:: Controlling how @code{gprof} analyses its data * Miscellaneous Options:: -* Depricated Options:: Options you no longer need to use, but which +* Deprecated Options:: Options you no longer need to use, but which have been retained for compatibility * Symspecs:: Specifying functions to include or exclude @end menu @@ -344,7 +339,7 @@ The @samp{-C} option causes @code{gprof} to print a tally of functions and the number of times each was called. If @var{symspec} is specified, print tally only for matching symbols. -If the profile data file contains basic-block count records, specifing +If the profile data file contains basic-block count records, specifying the @samp{-l} option, along with @samp{-C}, will cause basic-block execution counts to be tallied and displayed. @@ -358,7 +353,7 @@ call graph, and basic-block count records is displayed. @itemx --directory-path=@var{dirs} The @samp{-I} option specifies a list of search directories in which to find source files. Environment variable @var{GPROF_PATH} -can also be used to convery this information. +can also be used to convey this information. Used mostly for annotated source output. @item -J[@var{symspec}] @@ -407,10 +402,15 @@ but excludes matching symbols. @item -y @itemx --separate-files This option affects annotated source output only. -Normally, gprof prints annotated source files +Normally, @code{gprof} prints annotated source files to standard-output. If this option is specified, -annotated source for a file named @file{path/filename} -is generated in the file @file{filename-ann}. +annotated source for a file named @file{path/@var{filename}} +is generated in the file @file{@var{filename}-ann}. If the underlying +filesystem would truncate @file{@var{filename}-ann} so that it +overwrites the original @file{@var{filename}}, @code{gprof} generates +annotated source in the file @file{@var{filename}.ann} instead (if the +original file name has an extension, that extension is @emph{replaced} +with @file{.ann}). @item -Z[@var{symspec}] @itemx --no-exec-counts[=@var{symspec}] @@ -456,7 +456,8 @@ c-decl.o:00000000 T print_lang_type @end group @end smallexample -GNU @code{nm} @samp{--extern-only} @samp{--defined-only} @samp{-v} @samp{--print-file-name} can be used to create @var{map_file}. +To create a @var{map_file} with @sc{gnu} @code{nm}, type a command like +@kbd{nm --extern-only --defined-only -v --print-file-name program-name}. @item -T @itemx --traditional @@ -565,7 +566,7 @@ that had no time spent in them. This is useful in conjunction with the @end table -@node Miscellaneous Options,Depricated Options,Analysis Options,Invoking +@node Miscellaneous Options,Deprecated Options,Analysis Options,Invoking @section Miscellaneous Options @table @code @@ -601,8 +602,8 @@ number, and then exit. @end table -@node Depricated Options,Symspecs,Miscellaneous Options,Invoking -@section Depricated Options +@node Deprecated Options,Symspecs,Miscellaneous Options,Invoking +@section Deprecated Options @table @code @@ -653,7 +654,7 @@ gprof -e boring -f foo -f bar myprogram > gprof.output lists in the call graph all functions that were reached from either @code{foo} or @code{bar} and were not reachable from @code{boring}. -@node Symspecs,,Depricated Options,Invoking +@node Symspecs,,Deprecated Options,Invoking @section Symspecs Many of the output options allow functions to be included or excluded @@ -672,7 +673,7 @@ Here are some sample symspecs: @table @samp @item main.c Selects everything in file @file{main.c}---the -dot in the string tells gprof to interpret +dot in the string tells @code{gprof} to interpret the string as a filename, rather than as a function name. To select a file whose name does not contain a dot, a trailing colon @@ -691,11 +692,13 @@ Sometimes, function names contain dots. In such cases, it is necessary to add a leading colon to the name. For example, @samp{:.mul} selects function @samp{.mul}. -In some object file formats, symbols have a leading underscore. gprof -will normally not print these underscores. However, you must use the -underscore when you name a symbol in a symspec. You can use the -@code{nm} program to see whether symbols have underscores for the object -file format you are using. +In some object file formats, symbols have a leading underscore. +@code{gprof} will normally not print these underscores. When you name a +symbol in a symspec, you should type it exactly as @code{gprof} prints +it in its output. For example, if the compiler produces a symbol +@samp{_main} from your @code{main} function, @code{gprof} still prints +it as @samp{main} in its output, so you should use @samp{main} in +symspecs. @item main.c:main Selects function @samp{main} in file @file{main.c}. @@ -769,7 +772,7 @@ Each sample counts as 0.01 seconds. The functions are sorted by first by decreasing run-time spent in them, then by decreasing number of calls, then alphabetically by name. The functions @samp{mcount} and @samp{profil} are part of the profiling -aparatus and appear in every flat profile; their time gives a measure of +apparatus and appear in every flat profile; their time gives a measure of the amount of overhead due to profiling. Just before the column headers, a statement appears indicating @@ -781,10 +784,10 @@ suggesting a 100 Hz sampling rate. The program's total execution time was 0.06 seconds, as indicated by the @samp{cumulative seconds} field. Since each sample counted for 0.01 seconds, this means only six samples -were taken during the run. Two of the samples occured while the +were taken during the run. Two of the samples occurred while the program was in the @samp{open} function, as indicated by the @samp{self seconds} field. Each of the other four samples -occured one each in @samp{offtime}, @samp{memccpy}, @samp{write}, +occurred one each in @samp{offtime}, @samp{memccpy}, @samp{write}, and @samp{mcount}. Since only six samples were taken, none of these values can be regarded as particularly reliable. @@ -1019,7 +1022,7 @@ of the amount of time spent within calls to @code{report} from @code{main}. @item called Two numbers: the number of times @code{report} was called from @code{main}, -followed by the total number of nonrecursive calls to @code{report} from +followed by the total number of non-recursive calls to @code{report} from all its callers. @item name and index number @@ -1078,7 +1081,7 @@ of the total time spent in calls to @code{report} from @code{main}. @item called Two numbers, the number of calls to @code{report} from @code{main} -followed by the total number of nonrecursive calls to @code{report}. +followed by the total number of non-recursive calls to @code{report}. This ratio is used to determine how much of @code{report}'s @code{self} and @code{children} time gets credited to @code{main}. @xref{Assumptions}. @@ -1211,7 +1214,7 @@ The @code{calls} field in the primary line for the cycle has two numbers: first, the number of times functions in the cycle were called by functions outside the cycle; second, the number of times they were called by functions in the cycle (including times when a function in the cycle calls -itself). This is a generalization of the usual split into nonrecursive and +itself). This is a generalization of the usual split into non-recursive and recursive calls. The @code{calls} field of a subroutine-line for a cycle member in the @@ -1275,7 +1278,7 @@ index % time self children called name Now let's look at some of @code{gprof}'s output from the same program run, this time with line-by-line profiling enabled. Note that @code{ct_init}'s four histogram hits are broken down into four lines of source code - one hit -occured on each of lines 349, 351, 382 and 385. In the call graph, +occurred on each of lines 349, 351, 382 and 385. In the call graph, note how @code{ct_init}'s 13327 calls to @code{init_block} are broken down into one call from line 396, 3071 calls from line 384, 3730 calls @@ -1328,7 +1331,7 @@ number of times it was called. You may also need to specify the Compiling with @samp{gcc @dots{} -g -pg -a} augments your program with basic-block counting code, in addition to function counting code. This enables @code{gprof} to determine how many times each line -of code was exeucted. +of code was executed. For example, consider the following function, taken from gzip, with line numbers added: @@ -1364,7 +1367,7 @@ the fifth basic-block. The compiler may also generate additional basic-blocks to handle various special cases. A program augmented for basic-block counting can be analyzed with -@code{gprof -l -A}. I also suggest use of the @samp{-x} option, +@samp{gprof -l -A}. I also suggest use of the @samp{-x} option, which ensures that each line of code is labeled at least once. Here is @code{updcrc}'s annotated source listing for a sample @code{gzip} run: @@ -1526,7 +1529,7 @@ but not necessarily those that consumed the most time. @item How do I find which lines in my program called a particular function? -Use @code{gprof -l} and lookup the function in the call graph. +Use @samp{gprof -l} and lookup the function in the call graph. The callers will be broken down by function and line number. @item How do I analyze a program that runs for less than a second? @@ -1582,7 +1585,7 @@ in the form @samp{from/to}, instead of @samp{from to}. @item In the annotated source listing, if there are multiple basic blocks on the same line, -@sc{gnu} @code{gprof} prints all of their counts, seperated by commas. +@sc{gnu} @code{gprof} prints all of their counts, separated by commas. @ignore - it does this now @item @@ -1601,7 +1604,7 @@ tables without skipping the blurbs. @chapter Details of Profiling @menu -* Implementation:: How a program collets profiling information +* Implementation:: How a program collects profiling information * File Format:: Format of @samp{gmon.out} files * Internals:: @code{gprof}'s internal operation * Debugging:: Using @code{gprof}'s @samp{-d} option @@ -1624,14 +1627,14 @@ is responsible for recording in an in-memory call graph table both its parent routine (the child) and its parent's parent. This is typically done by examining the stack frame to find both the address of the child, and the return address in the original parent. -Since this is a very machine-dependant operation, @code{mcount} +Since this is a very machine-dependent operation, @code{mcount} itself is typically a short assembly-language stub routine that extracts the required information, and then calls @code{__mcount_internal} (a normal C function) with two arguments - @code{frompc} and @code{selfpc}. @code{__mcount_internal} is responsible for maintaining the in-memory call graph, which records @code{frompc}, @code{selfpc}, -and the number of times each of these call arcs was transversed. +and the number of times each of these call arcs was traversed. GCC Version 2 provides a magical function (@code{__builtin_return_address}), which allows a generic @code{mcount} function to extract the @@ -1724,7 +1727,7 @@ load due to other users won't directly affect the output you get. The old BSD-derived file format used for profile data does not contain a magic cookie that allows to check whether a data file really is a -gprof file. Furthermore, it does not provide a version number, thus +@code{gprof} file. Furthermore, it does not provide a version number, thus rendering changes to the file format almost impossible. @sc{gnu} @code{gprof} uses a new file format that provides these features. For backward compatibility, @sc{gnu} @code{gprof} continues to support the old BSD-derived @@ -1827,7 +1830,7 @@ Next, the BFD library is called to open the object file, verify that it is an object file, and read its symbol table (@code{core.c:core_init}), using @code{bfd_canonicalize_symtab} after mallocing -an appropiate sized array of asymbols. At this point, +an appropriately sized array of symbols. At this point, function mappings are read (if the @samp{--file-ordering} option has been specified), and the core text space is read into memory (if the @samp{-c} option was given). @@ -1845,7 +1848,7 @@ In either case, two passes are made through the symbol table - one to count the size of the symbol table required, and the other to actually read the symbols. In between the two passes, a single array of type @code{Sym} is created of -the appropiate length. +the appropriate length. Finally, @code{symtab.c:symtab_finalize} is called to sort the symbol table and remove duplicate entries (entries with the same memory address). @@ -1931,7 +1934,7 @@ cause each of two adjacent lines to be credited with half a hit, for example. If call graph data is present, @code{cg_arcs.c:cg_assemble} is called. -First, if @samp{-c} was specified, a machine-dependant +First, if @samp{-c} was specified, a machine-dependent routine (@code{find_call}) scans through each symbol's machine code, looking for subroutine call instructions, and adding them to the call graph with a zero call count. @@ -1945,14 +1948,14 @@ Cycles are also detected at this point, all members of which are assigned the same topological number. Two passes are now made through this sorted array of symbol pointers. The first pass, from end to beginning (parents to children), -computes the fraction of child time to propogate to each parent +computes the fraction of child time to propagate to each parent and a print flag. The print flag reflects symspec handling of INCL_GRAPH/EXCL_GRAPH, with a parent's include or exclude (print or no print) property being propagated to its children, unless they themselves explicitly appear in INCL_GRAPH or EXCL_GRAPH. A second pass, from beginning to end (children to parents) actually -propogates the timings along the call graph, subject +propagates the timings along the call graph, subject to a check against INCL_TIME/EXCL_TIME. With the print flag, fractions, and timings now stored in the symbol structures, the topological sort array is now discarded, and a diff --git a/gprof/hertz.c b/gprof/hertz.c index 75314acc0c3..a7fc14ed7f8 100644 --- a/gprof/hertz.c +++ b/gprof/hertz.c @@ -19,10 +19,6 @@ #include "hertz.h" -#ifdef __MSDOS__ -#define HERTZ 18 -#endif - int hertz () { @@ -38,17 +34,19 @@ hertz () tim.it_value.tv_usec = 0; setitimer (ITIMER_REAL, &tim, 0); setitimer (ITIMER_REAL, 0, &tim); - if (tim.it_interval.tv_usec < 2) + if (tim.it_interval.tv_usec >= 2) { - return HZ_WRONG; + return 1000000 / tim.it_interval.tv_usec; } - return 1000000 / tim.it_interval.tv_usec; -#else /* ! defined (HAVE_SETITIMER) */ +#endif /* ! defined (HAVE_SETITIMER) */ #if defined (HAVE_SYSCONF) && defined (_SC_CLK_TCK) return sysconf (_SC_CLK_TCK); #else /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */ +#ifdef __MSDOS__ + return 18; +#else /* ! defined (__MSDOS__) */ return HZ_WRONG; +#endif /* ! defined (__MSDOS__) */ #endif /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */ -#endif /* ! defined (HAVE_SETITIMER) */ #endif /* ! defined (HERTZ) */ } diff --git a/gprof/search_list.c b/gprof/search_list.c index d475dbf6a48..ca2928935c0 100644 --- a/gprof/search_list.c +++ b/gprof/search_list.c @@ -15,7 +15,7 @@ DEFUN (search_list_append, (list, paths), do { beg = colon + 1; - colon = strchr (beg, ':'); + colon = strchr (beg, PATH_SEP_CHAR); if (colon) { len = colon - beg; diff --git a/gprof/search_list.h b/gprof/search_list.h index 54dfe3590f7..6f5acae934f 100644 --- a/gprof/search_list.h +++ b/gprof/search_list.h @@ -1,6 +1,14 @@ #ifndef search_list_h #define search_list_h +/* Non-Posix systems use semi-colon as directory separator in lists, + since colon is part of drive letter spec. */ +#if defined (__MSDOS__) || defined (_WIN32) +#define PATH_SEP_CHAR ';' +#else +#define PATH_SEP_CHAR ':' +#endif + typedef struct search_list_elem { struct search_list_elem *next; diff --git a/gprof/source.c b/gprof/source.c index 4901a04b037..49ba57e61da 100644 --- a/gprof/source.c +++ b/gprof/source.c @@ -1,8 +1,11 @@ /* * Keeps track of source files. */ +#include + #include "gprof.h" #include "libiberty.h" +#include "filenames.h" #include "search_list.h" #include "source.h" @@ -25,7 +28,7 @@ DEFUN (source_file_lookup_path, (path), const char *path) for (sf = first_src_file; sf; sf = sf->next) { - if (strcmp (path, sf->name) == 0) + if (FILENAME_CMP (path, sf->name) == 0) { break; } @@ -66,7 +69,7 @@ DEFUN (source_file_lookup_name, (filename), const char *filename) { fname = sf->name; } - if (strcmp (filename, fname) == 0) + if (FILENAME_CMP (filename, fname) == 0) { break; } @@ -95,7 +98,7 @@ DEFUN (annotate_source, (sf, max_width, annote, arg), * open succeeds or reaching end of list: */ strcpy (fname, sf->name); - if (sf->name[0] == '/') + if (IS_ABSOLUTE_PATH (sf->name)) { sle = 0; /* don't use search list for absolute paths */ } @@ -112,6 +115,15 @@ DEFUN (annotate_source, (sf, max_width, annote, arg), if (!sle && !name_only) { name_only = strrchr (sf->name, '/'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + char *bslash = strrchr (sf->name, '\\'); + if (bslash > name_only) + name_only = bslash; + if (name_only == NULL && sf->name[0] != '\0' && sf->name[1] == ':') + name_only = (char *)sf->name + 1; + } +#endif if (name_only) { /* try search-list again, but this time with name only: */ @@ -122,6 +134,11 @@ DEFUN (annotate_source, (sf, max_width, annote, arg), if (sle) { strcpy (fname, sle->path); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + /* d:foo is not the same thing as d:/foo! */ + if (fname[strlen (fname) - 1] == ':') + strcat (fname, "."); +#endif strcat (fname, "/"); if (name_only) { @@ -156,6 +173,15 @@ DEFUN (annotate_source, (sf, max_width, annote, arg), /* create annotation files in the current working directory: */ filename = strrchr (sf->name, '/'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + char *bslash = strrchr (sf->name, '\\'); + if (bslash > filename) + filename = bslash; + if (filename == NULL && sf->name[0] != '\0' && sf->name[1] == ':') + filename = sf->name + 1; + } +#endif if (filename) { ++filename; @@ -167,6 +193,24 @@ DEFUN (annotate_source, (sf, max_width, annote, arg), strcpy (fname, filename); strcat (fname, EXT_ANNO); +#ifdef __MSDOS__ + { + /* foo.cpp-ann can overwrite foo.cpp due to silent truncation of + file names on 8+3 filesystems. Their `stat' better be good... */ + struct stat buf1, buf2; + + if (stat (filename, &buf1) == 0 + && stat (fname, &buf2) == 0 + && buf1.st_ino == buf2.st_ino) + { + char *dot = strrchr (fname, '.'); + + if (dot) + *dot = '\0'; + strcat (fname, ".ann"); + } + } +#endif ofp = fopen (fname, "w"); if (!ofp) { diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c index 412c8d48279..1e05914c952 100644 --- a/gprof/sym_ids.c +++ b/gprof/sym_ids.c @@ -201,7 +201,10 @@ DEFUN (match, (pattern, sym), Sym * pattern AND Sym * sym) { return (pattern->file ? pattern->file == sym->file : TRUE) && (pattern->line_num ? pattern->line_num == sym->line_num : TRUE) - && (pattern->name ? strcmp (pattern->name, sym->name) == 0 : TRUE); + && (pattern->name + ? strcmp (pattern->name, + sym->name+(discard_underscores && sym->name[0] == '_')) == 0 + : TRUE); } diff --git a/include/ChangeLog b/include/ChangeLog index 76e73fb4eac..1937bcaf54a 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2000-05-26 Eli Zaretskii + + * filenames.h: New file. + (HAVE_DOS_BASED_FILE_SYSTEM, IS_DIR_SEPARATOR) + (IS_ABSOLUTE_PATH, FILENAME_CMP): New macros. + 2000-05-17 S. Bharadwaj Yadavalli Rick Gorton diff --git a/include/filenames.h b/include/filenames.h new file mode 100644 index 00000000000..ba933c8530e --- /dev/null +++ b/include/filenames.h @@ -0,0 +1,51 @@ +/* Macros for taking apart, interpreting and processing file names. + + These are here because some non-Posix (a.k.a. DOSish) systems have + drive letter brain-damage at the beginning of an absolute file name, + use forward- and back-slash in path names interchangeably, and + some of them have case-insensitive file names. + + Copyright 2000 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef FILENAMES_H +#define FILENAMES_H + +#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) + +#ifndef HAVE_DOS_BASED_FILE_SYSTEM +#define HAVE_DOS_BASED_FILE_SYSTEM 1 +#endif + +#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') +/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is + only semi-absolute. This is because the users of IS_ABSOLUTE_PATH + want to know whether to prepend the current working directory to + a file name, which should not be done with a name like d:foo. */ +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) +#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) + +#else /* not DOSish */ + +#define IS_DIR_SEPARATOR(c) ((c) == '/') +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) +#define FILENAME_CMP(s1, s2) strcmp(s1, s2) + +#endif /* not DOSish */ + +#endif /* FILENAMES_H */ diff --git a/ld/ChangeLog b/ld/ChangeLog index f0f2b6b851b..87fe27bae3c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2000-05-26 Eli Zaretskii + + * ldmain.c: Include filenames.h. + (set_scripts_dir): Support backslashes in program name. + 2000-05-22 Igor Shevlyakov * ldmain.c (main): When deciding if ".text" section should be diff --git a/ld/ldmain.c b/ld/ldmain.c index 73725949d2f..48f35efdfab 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -1,5 +1,5 @@ /* Main program of GNU linker. - Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Written by Steve Chamberlain steve@cygnus.com @@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "libiberty.h" #include "progress.h" #include "bfdlink.h" +#include "filenames.h" #include "ld.h" #include "ldmain.h" @@ -569,6 +570,14 @@ set_scripts_dir () /* Look for "ldscripts" in the dir where our binary is. */ end = strrchr (program_name, '/'); +#ifdef HAVE_DOS_BASED_FILE_SYSTEM + { + /* We could have \foo\bar, or /foo\bar. */ + char *bslash = strrchr (program_name, '\\'); + if (bslash > end) + end = bslash; + } +#endif if (end == NULL) { -- 2.30.2