* configure.in: Detect declaration for canonicalize_file_name.

* utils.c (canonicalize_file_name): Declare, if needed.
        (gdb_realpath): Prefer realpath if available and usable.
        * config.in, configure: Rebuild.
This commit is contained in:
Richard Henderson 2002-03-15 00:44:49 +00:00
parent bd2b03193d
commit a4db0f0748
5 changed files with 467 additions and 413 deletions

View File

@ -1,3 +1,10 @@
2002-03-14 Richard Henderson <rth@redhat.com>
* configure.in: Detect declaration for canonicalize_file_name.
* utils.c (canonicalize_file_name): Declare, if needed.
(gdb_realpath): Prefer realpath if available and usable.
* config.in, configure: Rebuild.
2002-03-14 Richard Henderson <rth@redhat.com>
* dwarf2read.c (read_array_type): Accept DW_FORM_data8 as

View File

@ -457,6 +457,9 @@
/* Define if strstr is not declared in system header files. */
#undef NEED_DECLARATION_STRSTR
/* Define if canonicalize_file_name is not declared in system header files. */
#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T

841
gdb/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -241,7 +241,7 @@ BFD_NEED_DECLARATION(free)
BFD_NEED_DECLARATION(strerror)
BFD_NEED_DECLARATION(strdup)
BFD_NEED_DECLARATION(strstr)
BFD_NEED_DECLARATION(canonicalize_file_name)
# The following save_state_t checkery is only necessary for HPUX
# versions earlier than 10.20. When those fade from memory, this

View File

@ -81,6 +81,11 @@ extern PTR realloc ();
#ifdef NEED_DECLARATION_FREE
extern void free ();
#endif
/* Actually, we'll never have the decl, since we don't define _GNU_SOURCE. */
#if defined(HAVE_CANONICALIZE_FILE_NAME) \
&& defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME)
extern char *canonicalize_file_name (const char *);
#endif
#undef XMALLOC
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
@ -2532,20 +2537,24 @@ string_to_core_addr (const char *my_string)
char *
gdb_realpath (const char *filename)
{
#ifdef HAVE_CANONICALIZE_FILE_NAME
return canonicalize_file_name (filename);
#elif defined (HAVE_REALPATH)
#if defined (PATH_MAX)
#if defined(HAVE_REALPATH)
# if defined (PATH_MAX)
char buf[PATH_MAX];
#elif defined (MAXPATHLEN)
# define USE_REALPATH
# elif defined (MAXPATHLEN)
char buf[MAXPATHLEN];
#elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA)
# define USE_REALPATH
# elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA)
char *buf = alloca ((size_t)pathconf ("/", _PC_PATH_MAX));
#else
#error "Neither PATH_MAX nor MAXPATHLEN defined"
#endif
# define USE_REALPATH
# endif
#endif /* HAVE_REALPATH */
#if defined(USE_REALPATH)
char *rp = realpath (filename, buf);
return xstrdup (rp ? rp : filename);
#elif defined(HAVE_CANONICALIZE_FILE_NAME)
return canonicalize_file_name (filename);
#else
return xstrdup (filename);
#endif