This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: recent change broke gdb build
On 05/16/2012 08:30 PM, Pedro Alves wrote:
>> > I changed gdb/defs.h to follow BFD's logic for including fopen-*.h.
>> > I don't think it is too good to depend on some other package's configury
>> > like this.
>
> The usual way to do that is to share an .m4 file.
Something like this. Not strictly necessary, as GDB works/builds fine
without this.
config/
2012-05-16 Pedro Alves <palves@redhat.com>
* binary-fopen.m4: New file.
bfd/
2012-05-16 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include ../config/binary-fopen.m4.
(BFD_BINARY_FOPEN): Delete.
* configure.in: Call ACX_BINARY_FOPEN instead of BFD_BINARY_FOPEN.
gdb/
2012-05-16 Pedro Alves <palves@redhat.com>
* configure.ac: Call ACX_BINARY_FOPEN.
* defs.h: Include fopen-bin.h or fopen-same.h depending on
USE_BINARY_FOPEN being defined instead of including fopen-bin.h
depending on FOPEN_RB not being defined.
* config.in: Regenerate.
* configure: Regenerate.
---
bfd/acinclude.m4 | 10 +---------
bfd/configure.in | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index d9813bd..98cf519 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -1,14 +1,6 @@
sinclude([../config/zlib.m4])
-dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
-AC_DEFUN([BFD_BINARY_FOPEN],
-[AC_REQUIRE([AC_CANONICAL_TARGET])
-case "${host}" in
-changequote(,)dnl
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-changequote([,])dnl
- AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
-esac])dnl
+sinclude([../config/binary-fopen.m4])
dnl Get a default for CC_FOR_BUILD to put into Makefile.
AC_DEFUN([BFD_CC_FOR_BUILD],
diff --git a/bfd/configure.in b/bfd/configure.in
index 47631cc..e949d37 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -203,7 +203,7 @@ AC_CHECK_DECLS(ftello64)
AC_CHECK_DECLS(fseeko)
AC_CHECK_DECLS(fseeko64)
-BFD_BINARY_FOPEN
+ACX_BINARY_FOPEN
AC_CHECK_DECLS(ffs)
AC_CHECK_DECLS(free)
diff --git a/config/binary-fopen.m4 b/config/binary-fopen.m4
new file mode 100644
index 0000000..8a9336d
--- /dev/null
+++ b/config/binary-fopen.m4
@@ -0,0 +1,9 @@
+dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
+AC_DEFUN([ACX_BINARY_FOPEN],
+[AC_REQUIRE([AC_CANONICAL_TARGET])
+case "${host}" in
+changequote(,)dnl
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+changequote([,])dnl
+ AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
+esac])dnl
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 9d231e1..85c0267 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -36,6 +36,9 @@ sinclude([../config/codeset.m4])
sinclude([../config/zlib.m4])
+dnl For ACX_BINARY_FOPEN.
+sinclude([../config/binary-fopen.m4])
+
#
# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
# makes configure think it's cross compiling. If --target wasn't used, then
diff --git a/gdb/config.in b/gdb/config.in
index a3bd8dd..ee1961a 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -713,6 +713,9 @@
/* Define if <thread_db.h> has the TD_VERSION error code. */
#undef THREAD_DB_HAS_TD_VERSION
+/* Use b modifier when opening binary files? */
+#undef USE_BINARY_FOPEN
+
/* Define to 1 if the regex included in libiberty should be used. */
#undef USE_INCLUDED_REGEX
diff --git a/gdb/configure b/gdb/configure
index ec0d30b..a5b8bab 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -4360,6 +4360,13 @@ case "x$am_cv_prog_cc_stdc" in
esac
+case "${host}" in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+
+$as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
+ ;;
+esac
+
ac_aux_dir=
for ac_dir in .. "$srcdir"/..; do
for ac_t in install-sh install.sh shtool; do
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 97cd6ee..aecf4b5 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -27,6 +27,7 @@ AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
ACX_LARGEFILE
AM_PROG_CC_STDC
+ACX_BINARY_FOPEN
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_SYSTEM
diff --git a/gdb/defs.h b/gdb/defs.h
index 004f335..eccc651 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -757,16 +757,10 @@ enum val_prettyprint
#include "nm.h"
#endif
-/* Assume that fopen accepts the letter "b" in the mode string.
- It is demanded by ISO C9X, and should be supported on all
- platforms that claim to have a standard-conforming C library. On
- true POSIX systems it will be ignored and have no effect. There
- may still be systems without a standard-conforming C library where
- an ISO C9X compiler (GCC) is available. Known examples are SunOS
- 4.x and 4.3BSD. This assumption means these systems are no longer
- supported. */
-#ifndef FOPEN_RB
-# include "fopen-bin.h"
+#ifdef USE_BINARY_FOPEN
+# include "fopen-bin.h"
+#else
+# include "fopen-same.h"
#endif
/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
--
Pedro Alves