@@ -425,12 +425,10 @@ main (int argc, char **argv)
char *target;
int c;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -723,12 +723,10 @@ main (int argc, char **argv)
char *inarch_filename;
int i;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -25,16 +25,9 @@
#include "bfd.h"
#include "libiberty.h"
#include "filenames.h"
-
-#include <time.h> /* ctime, maybe time_t */
+#include <time.h>
#include <assert.h>
#include "bucomm.h"
-
-#ifndef HAVE_TIME_T_IN_TIME_H
-#ifndef HAVE_TIME_T_IN_TYPES_H
-typedef long time_t;
-#endif
-#endif
/* Error reporting. */
@@ -488,12 +488,10 @@ main (int ac, char **av)
{ NULL, no_argument, 0, 0 }
};
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -23,7 +23,6 @@ AC_INIT([binutils], BFD_VERSION)
AC_CONFIG_SRCDIR(ar.c)
AC_CANONICAL_TARGET
-AC_ISC_POSIX
AM_INIT_AUTOMAKE
@@ -162,14 +161,18 @@ esac
AC_SUBST(DEMANGLER_NAME)
AC_CHECK_SIZEOF([long])
-AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
-
-AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
+AC_CHECK_SIZEOF([long long])
+
+# We use headers from include/ that check various HAVE_*_H macros, thus
+# should ensure they are set by configure. This is true even when C99
+# guarantees they are available.
+# plugin-api.h tests HAVE_STDINT_H and HAVE_INTTYPES_H
+# Besides those, we need to check anything used in binutils/ not in C99.
+AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h sys/param.h \
+ sys/stat.h sys/types.h unistd.h)
AC_HEADER_SYS_WAIT
-ACX_HEADER_STRING
-AC_FUNC_ALLOCA
AC_FUNC_MMAP
-AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
+AC_CHECK_FUNCS(getc_unlocked sbrk utimes)
AC_CHECK_FUNC([mkstemp],
AC_DEFINE([HAVE_MKSTEMP], 1,
[Define to 1 if you have the `mkstemp' function.]))
@@ -190,26 +193,6 @@ AC_SEARCH_LIBS(frexp, m)
AM_LC_MESSAGES
-AC_MSG_CHECKING(for time_t in time.h)
-AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
-bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
-AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
-if test $bu_cv_decl_time_t_time_h = yes; then
- AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
- [Is the type time_t defined in <time.h>?])
-fi
-
-AC_MSG_CHECKING(for time_t in sys/types.h)
-AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
-bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
-AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
-if test $bu_cv_decl_time_t_types_h = yes; then
- AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
- [Is the type time_t defined in <sys/types.h>?])
-fi
-
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
@@ -236,8 +219,7 @@ if test $bu_cv_header_utime_h = yes; then
AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
fi
-AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
- sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
+AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy])
# Link in zlib if we can. This allows us to read compressed debug
# sections. This is used only by readelf.c (objdump uses bfd for
@@ -3779,12 +3779,10 @@ main (int ac, char **av)
program_name = av[0];
oav = av;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -630,12 +630,10 @@ main (int argc, char **argv)
prog_name = argv[0];
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -36,9 +36,7 @@
#include <elfutils/debuginfod.h>
#endif
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
@@ -215,7 +213,7 @@ get_encoded_value (unsigned char **pdata,
return val;
}
-#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG
+#if SIZEOF_LONG_LONG > SIZEOF_LONG
# ifndef __MINGW32__
# define DWARF_VMA_FMT "ll"
# define DWARF_VMA_FMT_LONG "%16.16llx"
@@ -959,12 +959,10 @@ main (int argc, char ** argv)
{
int c, status;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -633,7 +633,6 @@ non_numeric_forward (const void *P_x, const void *P_y)
if (xn == NULL)
return -1;
-#ifdef HAVE_STRCOLL
/* Solaris 2.5 has a bug in strcoll.
strcoll returns invalid values when confronted with empty strings. */
if (*yn == '\0')
@@ -642,9 +641,6 @@ non_numeric_forward (const void *P_x, const void *P_y)
return -1;
return strcoll (xn, yn);
-#else
- return strcmp (xn, yn);
-#endif
}
static int
@@ -1788,13 +1784,11 @@ main (int argc, char **argv)
int c;
int retval;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
setlocale (LC_COLLATE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -6016,12 +6016,10 @@ copy_main (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -5135,12 +5135,10 @@ main (int argc, char **argv)
char *target = default_target;
bool seenflag = false;
-#if defined (HAVE_SETLOCALE)
-#if defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -44,9 +44,7 @@
#include <assert.h>
#include <time.h>
#include <zlib.h>
-#ifdef HAVE_WCHAR_H
#include <wchar.h>
-#endif
#if __GNUC__ >= 2
/* Define BFD64 here, even if our default architecture is 32 bit ELF
@@ -21748,12 +21746,10 @@ main (int argc, char ** argv)
{
int err;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -134,12 +134,10 @@ main (int argc, char **argv)
int temp;
int c;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -1722,12 +1722,10 @@ main (int ac, char **av)
char *input_file;
char *output_file;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -149,9 +149,7 @@ main (int argc, char **argv)
char *s;
int numeric_opt = 0;
-#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -610,61 +608,42 @@ print_strings (const char *filename, FILE *stream, file_ptr address,
switch (address_radix)
{
case 8:
-#ifdef HAVE_LONG_LONG
if (sizeof (start) > sizeof (long))
{
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
printf ("%7llo ", (unsigned long long) start);
-# else
+#else
printf ("%7I64o ", (unsigned long long) start);
-# endif
+#endif
}
else
-#elif !BFD_HOST_64BIT_LONG
- if (start != (unsigned long) start)
- printf ("++%7lo ", (unsigned long) start);
- else
-#endif
- printf ("%7lo ", (unsigned long) start);
+ printf ("%7lo ", (unsigned long) start);
break;
case 10:
-#ifdef HAVE_LONG_LONG
if (sizeof (start) > sizeof (long))
{
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
printf ("%7llu ", (unsigned long long) start);
-# else
+#else
printf ("%7I64d ", (unsigned long long) start);
-# endif
+#endif
}
else
-#elif !BFD_HOST_64BIT_LONG
- if (start != (unsigned long) start)
- printf ("++%7lu ", (unsigned long) start);
- else
-#endif
- printf ("%7ld ", (long) start);
+ printf ("%7ld ", (long) start);
break;
case 16:
-#ifdef HAVE_LONG_LONG
if (sizeof (start) > sizeof (long))
{
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
printf ("%7llx ", (unsigned long long) start);
-# else
+#else
printf ("%7I64x ", (unsigned long long) start);
-# endif
+#endif
}
else
-#elif !BFD_HOST_64BIT_LONG
- if (start != (unsigned long) start)
- printf ("%lx%8.8lx ", (unsigned long) (start >> 32),
- (unsigned long) (start & 0xffffffff));
- else
-#endif
- printf ("%7lx ", (unsigned long) start);
+ printf ("%7lx ", (unsigned long) start);
break;
}
@@ -20,50 +20,21 @@
#ifndef _BIN_SYSDEP_H
#define _BIN_SYSDEP_H
-#include "alloca-conf.h"
-#include "ansidecl.h"
+#include "config.h"
#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-
-#include "bfdver.h"
-
-#include <stdarg.h>
-
-#ifdef USE_BINARY_FOPEN
-#include "fopen-bin.h"
-#else
-#include "fopen-same.h"
#endif
-
-#include <errno.h>
-#ifndef errno
-extern int errno;
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
#endif
-
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-
-#ifdef STRING_WITH_STRINGS
-#include <string.h>
-#include <strings.h>
-#else
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#else
-extern char *strchr ();
-extern char *strrchr ();
-#endif
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#else
@@ -72,8 +43,13 @@ extern char *strrchr ();
#endif
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
+#include "ansidecl.h"
+#include "bfdver.h"
+
+#ifdef USE_BINARY_FOPEN
+#include "fopen-bin.h"
+#else
+#include "fopen-same.h"
#endif
#include "binary-io.h"
@@ -82,40 +58,16 @@ extern char *strrchr ();
extern char *stpcpy (char *, const char *);
#endif
-#if !HAVE_DECL_STRSTR
-extern char *strstr ();
-#endif
-
#ifdef HAVE_SBRK
#if !HAVE_DECL_SBRK
extern char *sbrk ();
#endif
#endif
-#if !HAVE_DECL_GETENV
-extern char *getenv ();
-#endif
-
#if !HAVE_DECL_ENVIRON
extern char **environ;
#endif
-#if !HAVE_DECL_FPRINTF
-extern int fprintf (FILE *, const char *, ...);
-#endif
-
-#if !HAVE_DECL_SNPRINTF
-extern int snprintf(char *, size_t, const char *, ...);
-#endif
-
-#if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
-#endif
-
-#if !HAVE_DECL_STRNLEN
-size_t strnlen (const char *, size_t);
-#endif
-
#ifndef O_RDONLY
#define O_RDONLY 0
#endif
@@ -134,18 +86,16 @@ size_t strnlen (const char *, size_t);
#define SEEK_END 2
#endif
-#ifdef HAVE_LOCALE_H
-# ifndef ENABLE_NLS
- /* The Solaris version of locale.h always includes libintl.h. If we have
- been configured with --disable-nls then ENABLE_NLS will not be defined
- and the dummy definitions of bindtextdomain (et al) below will conflict
- with the defintions in libintl.h. So we define these values to prevent
- the bogus inclusion of libintl.h. */
-# define _LIBINTL_H
-# define _LIBGETTEXT_H
-# endif
-# include <locale.h>
+#ifndef ENABLE_NLS
+ /* The Solaris version of locale.h always includes libintl.h. If we have
+ been configured with --disable-nls then ENABLE_NLS will not be defined
+ and the dummy definitions of bindtextdomain (et al) below will conflict
+ with the defintions in libintl.h. So we define these values to prevent
+ the bogus inclusion of libintl.h. */
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
#endif
+#include <locale.h>
#ifdef ENABLE_NLS
# include <libintl.h>
@@ -175,9 +125,7 @@ size_t strnlen (const char *, size_t);
#define BUFSIZE 8192
/* For PATH_MAX. */
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef PATH_MAX
/* For MAXPATHLEN. */
@@ -193,7 +141,7 @@ size_t strnlen (const char *, size_t);
# endif
#endif
-#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG
+#if SIZEOF_LONG_LONG > SIZEOF_LONG
/* We can't use any bfd types here since readelf may define BFD64 and
objdump may not. */
#define HOST_WIDEST_INT long long
@@ -659,12 +659,10 @@ main (int ac, char **av)
{NULL, no_argument, 0, 0}
};
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -22,14 +22,7 @@
/* Note: config.h is #included via syslex_wrap.c. */
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
#include "sysinfo.h"
#ifndef YY_NO_UNPUT
@@ -941,12 +941,10 @@ main (int argc, char **argv)
char *target, *input_filename;
int verbose;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -823,12 +823,10 @@ main (int argc, char **argv)
rc_res_directory *resources;
int use_temp_file;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);