Re: [hpux] Fix build problem on hpux

Randolph Chung
2006-03-10T00:19:33Z

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

> This can't be right. The point is to add -D_XOPEN_SOURCE_EXTENDED
> whenever we compile *on* HP-UX, not whenever we're targeting HP-UX.
> This should be handled using autoconf, much in the same way as we do
> for _GNU_SOURCE, since it affects the functionality made available by
> the OS.

How about this instead?

randolph

[-- Attachment #2: hpcomp.diff --]
[-- Type: text/x-patch, Size: 2536 bytes --]

2005-03-09 Randolph Chung <tausq@debian.org>

* hpread.c (hpread_start_psymtab): Remove hpread_psymtab_to_symtab
declaration.
* acinclude.m4 (gdb_AC_HPUX): Define.
* config.in (_XOPEN_SOURCE_EXTENDED): Define if needed.
* configure.ac: Call gdb_AC_HPUX.
* configure: Regenerate.

Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.58
diff -u -p -r1.58 hpread.c
--- hpread.c 17 Dec 2005 22:34:01 -0000 1.58
+++ hpread.c 9 Mar 2006 15:28:16 -0000
@@ -2385,7 +2386,6 @@ hpread_start_psymtab (struct objfile *ob
struct partial_symbol **static_syms)
{
int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- extern void hpread_psymtab_to_symtab ();
struct partial_symtab *result =
start_psymtab_common (objfile, objfile->section_offsets,
filename, textlow, global_syms, static_syms);
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.13
diff -u -p -r1.13 acinclude.m4
--- acinclude.m4 17 Dec 2005 22:33:59 -0000 1.13
+++ acinclude.m4 10 Mar 2006 00:16:44 -0000
@@ -987,3 +987,14 @@ if test x = y ; then
fi
])

+AC_DEFUN(gdb_AC_HPUX,
+[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
+AC_BEFORE([$0], [AC_TRY_RUN])dnl
+AC_MSG_CHECKING(for HPUX)
+AC_EGREP_CPP(yes,
+[#ifdef _HPUX_SOURCE
+ yes
+#endif
+], [AC_MSG_RESULT(yes); AC_DEFINE(_XOPEN_SOURCE_EXTENDED)], AC_MSG_RESULT(no))
+])
+
Index: config.in
===================================================================
RCS file: /cvs/src/src/gdb/config.in,v
retrieving revision 1.82
diff -u -p -r1.82 config.in
--- config.in 3 Jul 2005 16:05:11 -0000 1.82
+++ config.in 10 Mar 2006 00:16:44 -0000
@@ -607,6 +607,13 @@
# undef _ALL_SOURCE
#endif

+/* Define to 1 if on HPUX.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _XOPEN_SOURCE_EXTENDED
+# undef _XOPEN_SOURCE_EXTENDED
+#endif
+
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.30
diff -u -p -r1.30 configure.ac
--- configure.ac 21 Feb 2006 21:02:25 -0000 1.30
+++ configure.ac 10 Mar 2006 00:18:27 -0000
@@ -30,6 +30,7 @@ AM_MAINTAINER_MODE
AC_PROG_CC
AC_GNU_SOURCE
AC_AIX
+gdb_AC_HPUX
AC_ISC_POSIX
AM_PROG_CC_STDC