public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] introduce common.m4
@ 2013-11-05 18:23 Tom Tromey
  2013-11-05 18:23 ` [PATCH v2 2/6] remove link.h checks Tom Tromey
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 18:23 UTC (permalink / raw)
  To: gdb-patches

This series is an updated version of my earlier patch to add a
"common.m4":

    https://sourceware.org/ml/gdb-patches/2013-04/msg00739.html

The idea behind common.m4 is to have all configury needed by common in
a single place.  This avoids having to add parallel checks by hand to
both gdb and gdbserver's configure scripts.

I believe this version addresses Pedro's comments.  Now the
"redundant" checks are not removed; instead, each configure script
checks for what it needs.

Eventually I think it makes sense to move gnulib, the common bits, and
gdbserver to be top-level subdirectories in src.  This was difficult
before, due to CVS modules; but now it is much simpler to do, and I
think has benefits in terms of clarity and modularity.  When this is
done, common.m4 will continue to exist, at least in the short term, so
that macros used by its headers are still properly defined by its
users.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 2/6] remove link.h checks
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
@ 2013-11-05 18:23 ` Tom Tromey
  2013-11-05 19:10   ` Pedro Alves
  2013-11-05 18:24 ` [PATCH v2 1/6] introduce common.m4 Tom Tromey
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 18:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The removal of solib-sunos.c also removed the last user of various
macros defined by configure.

This patch removes the corresponding configure code.

2013-11-05  Tom Tromey  <tromey@redhat.com>

	* configure, config.in: Rebuild.
	* configure.ac: Remove all link.h-related checks.
---
 gdb/ChangeLog    |   5 ++
 gdb/config.in    |  21 --------
 gdb/configure    | 162 -------------------------------------------------------
 gdb/configure.ac |  83 ----------------------------
 4 files changed, 5 insertions(+), 266 deletions(-)

diff --git a/gdb/config.in b/gdb/config.in
index 03b0972..7905468 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -225,9 +225,6 @@
 /* Define to 1 if you have the `w' library (-lw). */
 #undef HAVE_LIBW
 
-/* Define to 1 if you have the <link.h> header file. */
-#undef HAVE_LINK_H
-
 /* Define to 1 if you have the <linux/perf_event.h> header file. */
 #undef HAVE_LINUX_PERF_EVENT_H
 
@@ -423,17 +420,6 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
-/* Define if <sys/link.h> has struct link_map32 */
-#undef HAVE_STRUCT_LINK_MAP32
-
-/* Define if <link.h> exists and defines struct link_map which has members
-   with an ``lm_'' prefix. (For SunOS.) */
-#undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS
-
-/* Define if <link.h> exists and defines struct link_map which has members
-   with an ``l_'' prefix. (For Solaris, SVR4, and SVR4-like systems.) */
-#undef HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS
-
 /* Define to 1 if your system has struct lwp. */
 #undef HAVE_STRUCT_LWP
 
@@ -446,10 +432,6 @@
 /* Define to 1 if `struct reg' is a member of `r_gs'. */
 #undef HAVE_STRUCT_REG_R_GS
 
-/* Define if <link.h> exists and defines a struct so_map which has members
-   with an ``som_'' prefix. (Found on older *BSD systems.) */
-#undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
-
 /* Define to 1 if `struct stat' is a member of `st_blksize'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
@@ -804,9 +786,6 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
-/* Define if <sys/link.h> has link_map32 (solaris sparc-64 target) */
-#undef _SYSCALL32
-
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
diff --git a/gdb/configure b/gdb/configure
index 9d58b11..8844c90 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -8936,25 +8936,6 @@ fi
 
 done
 
-for ac_header in link.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "link.h" "ac_cv_header_link_h" "#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_NLIST_H
-# include <nlist.h>
-#endif
-
-"
-if test "x$ac_cv_header_link_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LINK_H 1
-_ACEOF
-
-fi
-
-done
-
 for ac_header in sys/proc.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "sys/proc.h" "ac_cv_header_sys_proc_h" "#if HAVE_SYS_PARAM_H
@@ -12016,149 +11997,6 @@ $as_echo "#define HAVE_PROCFS_PIOCSET 1" >>confdefs.h
   fi
 fi
 
-if test ${host} = ${target} ; then
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for member l_addr in struct link_map" >&5
-$as_echo_n "checking for member l_addr in struct link_map... " >&6; }
-  if test "${gdb_cv_have_struct_link_map_with_l_members+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <link.h>
-int
-main ()
-{
-struct link_map lm; (void) lm.l_addr;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gdb_cv_have_struct_link_map_with_l_members=yes
-else
-  gdb_cv_have_struct_link_map_with_l_members=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_struct_link_map_with_l_members" >&5
-$as_echo "$gdb_cv_have_struct_link_map_with_l_members" >&6; }
-  if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
-
-$as_echo "#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1" >>confdefs.h
-
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for member lm_addr in struct link_map" >&5
-$as_echo_n "checking for member lm_addr in struct link_map... " >&6; }
-  if test "${gdb_cv_have_struct_link_map_with_lm_members+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <link.h>
-int
-main ()
-{
-struct link_map lm; (void) lm.lm_addr;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gdb_cv_have_struct_link_map_with_lm_members=yes
-else
-  gdb_cv_have_struct_link_map_with_lm_members=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_struct_link_map_with_lm_members" >&5
-$as_echo "$gdb_cv_have_struct_link_map_with_lm_members" >&6; }
-  if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
-
-$as_echo "#define HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS 1" >>confdefs.h
-
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for member som_addr in struct so_map" >&5
-$as_echo_n "checking for member som_addr in struct so_map... " >&6; }
-  if test "${gdb_cv_have_struct_so_map_with_som_members+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#ifdef HAVE_NLIST_H
-#include <nlist.h>
-#endif
-#include <link.h>
-int
-main ()
-{
-struct so_map lm; (void) lm.som_addr;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gdb_cv_have_struct_so_map_with_som_members=yes
-else
-  gdb_cv_have_struct_so_map_with_som_members=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_struct_so_map_with_som_members" >&5
-$as_echo "$gdb_cv_have_struct_so_map_with_som_members" >&6; }
-  if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
-
-$as_echo "#define HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS 1" >>confdefs.h
-
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct link_map32 in sys/link.h" >&5
-$as_echo_n "checking for struct link_map32 in sys/link.h... " >&6; }
-  if test "${gdb_cv_have_struct_link_map32+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _SYSCALL32
-#include <sys/link.h>
-int
-main ()
-{
-struct link_map32 l;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gdb_cv_have_struct_link_map32=yes
-else
-  gdb_cv_have_struct_link_map32=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_struct_link_map32" >&5
-$as_echo "$gdb_cv_have_struct_link_map32" >&6; }
-  if test $gdb_cv_have_struct_link_map32 = yes; then
-
-$as_echo "#define HAVE_STRUCT_LINK_MAP32 1" >>confdefs.h
-
-
-$as_echo "#define _SYSCALL32 1" >>confdefs.h
-
-  fi
-fi
-
 # Check if the compiler supports the `long long' type.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long support in compiler" >&5
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 3558d6a..8f9e1e2 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1084,14 +1084,6 @@ AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_serv
 		  sys/types.h sys/wait.h wait.h termios.h termio.h \
 		  sgtty.h unistd.h elf_hp.h locale.h \
 		  dlfcn.h sys/un.h linux/perf_event.h])
-AC_CHECK_HEADERS(link.h, [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_NLIST_H
-# include <nlist.h>
-#endif
-])
 AC_CHECK_HEADERS(sys/proc.h, [], [],
 [#if HAVE_SYS_PARAM_H
 # include <sys/param.h>
@@ -1478,81 +1470,6 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then
   fi
 fi
 
-dnl For native ports (host == target), check to see what kind of
-dnl legacy link.h support is needed.  (See solib-legacy.c.)
-if test ${host} = ${target} ; then
-  dnl Check for struct link_map with l_ members which are indicative
-  dnl of SVR4-like shared libraries
-
-  AC_MSG_CHECKING(for member l_addr in struct link_map)
-  AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
-    [AC_TRY_COMPILE([#include <link.h>],
-                    [struct link_map lm; (void) lm.l_addr;],
-                    gdb_cv_have_struct_link_map_with_l_members=yes,
-                    gdb_cv_have_struct_link_map_with_l_members=no)])
-  AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
-  if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
-    AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS,1,
-    [Define if <link.h> exists and defines struct link_map which has
-     members with an ``l_'' prefix.  (For Solaris, SVR4, and
-     SVR4-like systems.)])
-  fi
-
-  dnl Check for struct link_map with lm_ members which are indicative
-  dnl of SunOS-like shared libraries
-
-  AC_MSG_CHECKING(for member lm_addr in struct link_map)
-  AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
-    [AC_TRY_COMPILE([#include <sys/types.h>
-#include <link.h>],
-                    [struct link_map lm; (void) lm.lm_addr;],
-                    gdb_cv_have_struct_link_map_with_lm_members=yes,
-                    gdb_cv_have_struct_link_map_with_lm_members=no)])
-  AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
-  if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
-    AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS, 1,
-    [Define if <link.h> exists and defines struct link_map which has
-     members with an ``lm_'' prefix.  (For SunOS.)])
-  fi
-
-  dnl Check for struct so_map with som_ members which are found on 
-  dnl some *BSD systems.
-
-  AC_MSG_CHECKING(for member som_addr in struct so_map)
-  AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
-    [AC_TRY_COMPILE([#include <sys/types.h>
-#ifdef HAVE_NLIST_H
-#include <nlist.h>
-#endif
-#include <link.h>],
-                    [struct so_map lm; (void) lm.som_addr;],
-                    gdb_cv_have_struct_so_map_with_som_members=yes,
-                    gdb_cv_have_struct_so_map_with_som_members=no)])
-  AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
-  if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
-    AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS, 1,
-    [Define if <link.h> exists and defines a struct so_map which has
-     members with an ``som_'' prefix.  (Found on older *BSD systems.)])
-  fi
-
-  dnl Check for struct link_map32 type, which allows a 64-bit Solaris
-  dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
-
-  AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
-  AC_CACHE_VAL(gdb_cv_have_struct_link_map32, 
-    [AC_TRY_COMPILE([#define _SYSCALL32
-#include <sys/link.h>], [struct link_map32 l;],
-     gdb_cv_have_struct_link_map32=yes,
-     gdb_cv_have_struct_link_map32=no)])
-  AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
-  if test $gdb_cv_have_struct_link_map32 = yes; then
-    AC_DEFINE(HAVE_STRUCT_LINK_MAP32, 1,
-    [Define if <sys/link.h> has struct link_map32])
-    AC_DEFINE(_SYSCALL32, 1,
-    [Define if <sys/link.h> has link_map32 (solaris sparc-64 target)])
-  fi
-fi
-
 # Check if the compiler supports the `long long' type.
 
 AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/6] introduce common.m4
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
  2013-11-05 18:23 ` [PATCH v2 2/6] remove link.h checks Tom Tromey
@ 2013-11-05 18:24 ` Tom Tromey
  2013-11-05 19:09   ` Pedro Alves
  2013-11-05 18:25 ` [PATCH v2 4/6] gdb configure updates Tom Tromey
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 18:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each configure.ac doing the
proper checks independently.

This patch introduces common/common.m4 which consolidates the checks
assumed by code in common.

The rule I propose is that if something is needed or used by common,
it should be checked for by common.m4.  However, if the check is also
needed by gdb or gdbserver, then it should be duplicated there.

Built and regtested on x86-64 Fedora 18 (though this is hardly the
most strenuous case) and using the Fedora 18 mingw cross compilers.  I
also examined the config.in diffs to ensure that symbols did not go
missing.

2013-11-04  Tom Tromey  <tromey@redhat.com>

	* acinclude.m4: Include common.m4.
	* common/common.m4: New file.
	* configure, config.in: Rebuild.
	* configure.ac: Use GDB_AC_COMMON.

2013-11-04  Tom Tromey  <tromey@redhat.com>

	* acinclude.m4: Include common.m4, codeset.m4.
	* configure, config.in: Rebuild.
	* configure.ac: Use GDB_AC_COMMON.
---
 gdb/ChangeLog              |   7 +
 gdb/acinclude.m4           |   2 +
 gdb/common/common.m4       |  36 +++
 gdb/configure              | 549 ++++++++++++++++++++++++++++++++++++++++++++
 gdb/configure.ac           |   1 +
 gdb/gdbserver/ChangeLog    |   6 +
 gdb/gdbserver/acinclude.m4 |   2 +
 gdb/gdbserver/config.in    |  18 ++
 gdb/gdbserver/configure    | 550 +++++++++++++++++++++++++++++++++++++++++++++
 gdb/gdbserver/configure.ac |   2 +
 10 files changed, 1173 insertions(+)
 create mode 100644 gdb/common/common.m4

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index a05eb4d..be1c019 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -52,6 +52,8 @@ sinclude([../config/codeset.m4])
 
 sinclude([../config/zlib.m4])
 
+m4_include([common/common.m4])
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/common/common.m4 b/gdb/common/common.m4
new file mode 100644
index 0000000..ad2f293
--- /dev/null
+++ b/gdb/common/common.m4
@@ -0,0 +1,36 @@
+dnl Autoconf configure snippets for common.
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GDB.
+dnl 
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Invoke configury needed by the files in 'common'.
+AC_DEFUN([GDB_AC_COMMON], [
+  AC_HEADER_STDC
+  AC_HEADER_DIRENT
+  AC_FUNC_ALLOCA
+
+  AM_LANGINFO_CODESET
+
+  AC_CHECK_HEADERS(linux/perf_event.h locale.h memory.h signal.h dnl
+                   string.h strings.h dnl
+		   sys/resource.h sys/socket.h sys/syscall.h dnl
+		   sys/un.h sys/wait.h dnl
+		   thread_db.h wait.h)
+
+  AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair])
+
+  AC_CHECK_DECLS([strerror, strstr])
+])
diff --git a/gdb/configure b/gdb/configure
index 7a5eb7f..9d58b11 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -10229,6 +10229,555 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
   fi
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+  ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_ac_Header=yes"
+else
+  eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+  # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+			  if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_working_alloca_h=yes
+else
+  ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+				    if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_func_alloca_works=yes
+else
+  ac_cv_func_alloca_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if test "${ac_cv_os_cray+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then :
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_c_stack_direction=0
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  return find_stack_direction () < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_stack_direction=1
+else
+  ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
+$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
+if test "${am_cv_langinfo_codeset+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <langinfo.h>
+int
+main ()
+{
+char* cs = nl_langinfo(CODESET);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_langinfo_codeset=yes
+else
+  am_cv_langinfo_codeset=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5
+$as_echo "$am_cv_langinfo_codeset" >&6; }
+  if test $am_cv_langinfo_codeset = yes; then
+
+$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
+
+  fi
+
+
+  for ac_header in linux/perf_event.h locale.h memory.h signal.h                    string.h strings.h 		   sys/resource.h sys/socket.h sys/syscall.h 		   sys/un.h sys/wait.h 		   thread_db.h wait.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+  for ac_func in fdwalk getrlimit pipe pipe2 socketpair
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+  ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strerror" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strstr" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRSTR $ac_have_decl
+_ACEOF
+
+
+
 # Check the return and argument types of ptrace.  No canned test for
 # this, so roll our own.
 gdb_ptrace_headers='
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e5984df..3558d6a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1168,6 +1168,7 @@ AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
 		setrlimit getrlimit posix_madvise waitpid lstat \
 		fdwalk pipe2 ptrace64])
 AM_LANGINFO_CODESET
+GDB_AC_COMMON
 
 # Check the return and argument types of ptrace.  No canned test for
 # this, so roll our own.
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index 4008d96..634fd03 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -12,8 +12,10 @@ sinclude(../../config/override.m4)
 dnl For ACX_PKGVERSION and ACX_BUGURL.
 sinclude(../../config/acx.m4)
 
+m4_include(../../config/codeset.m4)
 m4_include(../../config/depstand.m4)
 m4_include(../../config/lead-dot.m4)
+m4_include(../common/common.m4)
 
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 9398413..bd5c586 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -70,9 +70,15 @@
 /* Define to 1 if you have the `fdwalk' function. */
 #undef HAVE_FDWALK
 
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+#undef HAVE_LANGINFO_CODESET
+
 /* Define to 1 if you have the `dl' library (-ldl). */
 #undef HAVE_LIBDL
 
@@ -94,6 +100,9 @@
 /* Define if the target supports PTRACE_PEEKUSR for register access. */
 #undef HAVE_LINUX_USRREGS
 
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
 /* Define if <thread_db.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
@@ -118,6 +127,9 @@
 /* Define if you support the personality syscall. */
 #undef HAVE_PERSONALITY
 
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
+
 /* Define to 1 if you have the `pipe2' function. */
 #undef HAVE_PIPE2
 
@@ -155,6 +167,9 @@
 /* Define to 1 if you have the <signal.h> header file. */
 #undef HAVE_SIGNAL_H
 
+/* Define to 1 if you have the `socketpair' function. */
+#undef HAVE_SOCKETPAIR
+
 /* Define to 1 if the system has the type `socklen_t'. */
 #undef HAVE_SOCKLEN_T
 
@@ -193,6 +208,9 @@
 /* Define to 1 if you have the <sys/reg.h> header file. */
 #undef HAVE_SYS_REG_H
 
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 55dba84..a4ea2ca 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4922,6 +4922,556 @@ done
 
 
 
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+  ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_ac_Header=yes"
+else
+  eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+  # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+			  if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_working_alloca_h=yes
+else
+  ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+				    if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_func_alloca_works=yes
+else
+  ac_cv_func_alloca_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if test "${ac_cv_os_cray+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then :
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_c_stack_direction=0
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  return find_stack_direction () < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_stack_direction=1
+else
+  ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
+$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
+if test "${am_cv_langinfo_codeset+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <langinfo.h>
+int
+main ()
+{
+char* cs = nl_langinfo(CODESET);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_langinfo_codeset=yes
+else
+  am_cv_langinfo_codeset=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5
+$as_echo "$am_cv_langinfo_codeset" >&6; }
+  if test $am_cv_langinfo_codeset = yes; then
+
+$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
+
+  fi
+
+
+  for ac_header in linux/perf_event.h locale.h memory.h signal.h                    string.h strings.h 		   sys/resource.h sys/socket.h sys/syscall.h 		   sys/un.h sys/wait.h 		   thread_db.h wait.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+  for ac_func in fdwalk getrlimit pipe pipe2 socketpair
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+  ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strerror" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strstr" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRSTR $ac_have_decl
+_ACEOF
+
+
+
 # Check for UST
 ustlibs=""
 ustinc=""
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index c167508..086457c 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -88,6 +88,8 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
 AC_CHECK_FUNCS(pread pwrite pread64 readlink fdwalk pipe2)
 AC_REPLACE_FUNCS(vasprintf vsnprintf)
 
+GDB_AC_COMMON
+
 # Check for UST
 ustlibs=""
 ustinc=""
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 4/6] gdb configure updates
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
  2013-11-05 18:23 ` [PATCH v2 2/6] remove link.h checks Tom Tromey
  2013-11-05 18:24 ` [PATCH v2 1/6] introduce common.m4 Tom Tromey
@ 2013-11-05 18:25 ` Tom Tromey
  2013-11-05 19:10   ` Pedro Alves
  2013-11-05 19:09 ` [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c Tom Tromey
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 18:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Now that the configury needed for the "common" and "target"
directories is in common.m4, some code in gdb's configure.ac is
redundant.

I ran this script after making an "ID" file using mkid:

   sed -n 's/^.*\(HAVE_[A-Z0-9_]*\).*$/\1/p' config.in |
   while read x; do
     echo ===== $x
     gid $x | egrep -v '^(testsuite|gnulib|common|target|gdbserver)/'
   done

This finds all the spots using HAVE_ defines, and, more importantly,
makes it clear which defines aren't used in the main parts of gdb.

From this I came up with this patch to remove all the unused bits.

There are a few that are subtly used -- for example the configure
script sometimes checks internal configure cache variables, meaning
some checks cannot be removed.

2013-11-05  Tom Tromey  <tromey@redhat.com>

	* configure, config.in: Rebuild.
	* configure.ac: Remove unused configury.
---
 gdb/ChangeLog    |   5 ++
 gdb/config.in    |  23 -------
 gdb/configure    | 206 +++----------------------------------------------------
 gdb/configure.ac |  40 +++--------
 4 files changed, 22 insertions(+), 252 deletions(-)

diff --git a/gdb/config.in b/gdb/config.in
index 7905468..ada9b3b 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -92,10 +92,6 @@
    */
 #undef HAVE_DECL_FREE
 
-/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't.
-   */
-#undef HAVE_DECL_GETOPT
-
 /* Define to 1 if you have the declaration of `getthrds', and to 0 if you
    don't. */
 #undef HAVE_DECL_GETTHRDS
@@ -124,10 +120,6 @@
    */
 #undef HAVE_DECL_STRSTR
 
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
-   don't. */
-#undef HAVE_DECL_VSNPRINTF
-
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
@@ -291,9 +283,6 @@
 /* Define to 1 if you have the `pread64' function. */
 #undef HAVE_PREAD64
 
-/* Define if <sys/procfs.h> has prfpregset32_t. */
-#undef HAVE_PRFPREGSET32_T
-
 /* Define if <sys/procfs.h> has prfpregset_t. */
 #undef HAVE_PRFPREGSET_T
 
@@ -303,15 +292,9 @@
 /* Define if <sys/procfs.h> has prgregset_t. */
 #undef HAVE_PRGREGSET_T
 
-/* Define if ioctl argument PIOCSET is available. */
-#undef HAVE_PROCFS_PIOCSET
-
 /* Define to 1 if you have the <proc_service.h> header file. */
 #undef HAVE_PROC_SERVICE_H
 
-/* Define if <sys/procfs.h> has prrun_t. */
-#undef HAVE_PRRUN_T
-
 /* Define if <sys/procfs.h> has prsysent_t. */
 #undef HAVE_PRSYSENT_T
 
@@ -327,9 +310,6 @@
 /* Define if <sys/procfs.h> has psaddr_t. */
 #undef HAVE_PSADDR_T
 
-/* Define if <sys/procfs.h> has pstatus_t. */
-#undef HAVE_PSTATUS_T
-
 /* Define to 1 if you have the `ptrace64' function. */
 #undef HAVE_PTRACE64
 
@@ -447,9 +427,6 @@
 /* Define to 1 if `struct user_regs_struct' is a member of `gs_base'. */
 #undef HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE
 
-/* Define to 1 if you have the `syscall' function. */
-#undef HAVE_SYSCALL
-
 /* Define to 1 if you have the <sys/debugreg.h> header file. */
 #undef HAVE_SYS_DEBUGREG_H
 
diff --git a/gdb/configure b/gdb/configure
index 8844c90..1728d09 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -8914,15 +8914,15 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 fi
 
 # elf_hp.h is for HP/UX 64-bit shared library support.
-for ac_header in nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \
-                  thread_db.h signal.h stddef.h \
-		  stdlib.h string.h memory.h strings.h sys/fault.h \
+for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
+                  thread_db.h stddef.h \
+		  stdlib.h sys/fault.h \
 		  sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
 		  sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
 		  sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
-		  sys/types.h sys/wait.h wait.h termios.h termio.h \
-		  sgtty.h unistd.h elf_hp.h locale.h \
-		  dlfcn.h sys/un.h linux/perf_event.h
+		  termios.h termio.h \
+		  sgtty.h unistd.h elf_hp.h \
+		  dlfcn.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -9045,36 +9045,6 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_REALLOC $ac_have_decl
 _ACEOF
-ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR $ac_have_decl
-_ACEOF
-ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strstr" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRSTR $ac_have_decl
-_ACEOF
-ac_fn_c_check_decl "$LINENO" "getopt" "ac_cv_have_decl_getopt" "$ac_includes_default"
-if test "x$ac_cv_have_decl_getopt" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_GETOPT $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_snprintf" = x""yes; then :
   ac_have_decl=1
@@ -9085,16 +9055,6 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SNPRINTF $ac_have_decl
 _ACEOF
-ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
-if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VSNPRINTF $ac_have_decl
-_ACEOF
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5
@@ -10159,10 +10119,10 @@ fi
 for ac_func in canonicalize_file_name realpath getrusage getuid getgid \
 		pipe poll pread pread64 pwrite readlink resize_term \
 		sbrk setpgid setpgrp setsid \
-		sigaction sigprocmask sigsetmask socketpair syscall \
+		sigaction sigprocmask sigsetmask socketpair \
 		ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
 		setrlimit getrlimit posix_madvise waitpid lstat \
-		fdwalk pipe2 ptrace64
+		ptrace64
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -11396,80 +11356,6 @@ $as_echo "#define _KMEMUSER 1" >>confdefs.h
 fi
 
 if test "$ac_cv_header_sys_procfs_h" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pstatus_t in sys/procfs.h" >&5
-$as_echo_n "checking for pstatus_t in sys/procfs.h... " >&6; }
- if test "${bfd_cv_have_sys_procfs_type_pstatus_t+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#define _SYSCALL32
-/* Needed for new procfs interface on sparc-solaris.  */
-#define _STRUCTURED_PROC 1
-#include <sys/procfs.h>
-int
-main ()
-{
-pstatus_t avar
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  bfd_cv_have_sys_procfs_type_pstatus_t=yes
-else
-  bfd_cv_have_sys_procfs_type_pstatus_t=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
- if test $bfd_cv_have_sys_procfs_type_pstatus_t = yes; then
-
-$as_echo "#define HAVE_PSTATUS_T 1" >>confdefs.h
-
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_pstatus_t" >&5
-$as_echo "$bfd_cv_have_sys_procfs_type_pstatus_t" >&6; }
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prrun_t in sys/procfs.h" >&5
-$as_echo_n "checking for prrun_t in sys/procfs.h... " >&6; }
- if test "${bfd_cv_have_sys_procfs_type_prrun_t+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#define _SYSCALL32
-/* Needed for new procfs interface on sparc-solaris.  */
-#define _STRUCTURED_PROC 1
-#include <sys/procfs.h>
-int
-main ()
-{
-prrun_t avar
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  bfd_cv_have_sys_procfs_type_prrun_t=yes
-else
-  bfd_cv_have_sys_procfs_type_prrun_t=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prrun_t = yes; then
-
-$as_echo "#define HAVE_PRRUN_T 1" >>confdefs.h
-
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_prrun_t" >&5
-$as_echo "$bfd_cv_have_sys_procfs_type_prrun_t" >&6; }
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gregset_t in sys/procfs.h" >&5
 $as_echo_n "checking for gregset_t in sys/procfs.h... " >&6; }
  if test "${bfd_cv_have_sys_procfs_type_gregset_t+set}" = set; then :
@@ -11655,43 +11541,6 @@ $as_echo "#define HAVE_PRGREGSET32_T 1" >>confdefs.h
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_prgregset32_t" >&5
 $as_echo "$bfd_cv_have_sys_procfs_type_prgregset32_t" >&6; }
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prfpregset32_t in sys/procfs.h" >&5
-$as_echo_n "checking for prfpregset32_t in sys/procfs.h... " >&6; }
- if test "${bfd_cv_have_sys_procfs_type_prfpregset32_t+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#define _SYSCALL32
-/* Needed for new procfs interface on sparc-solaris.  */
-#define _STRUCTURED_PROC 1
-#include <sys/procfs.h>
-int
-main ()
-{
-prfpregset32_t avar
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  bfd_cv_have_sys_procfs_type_prfpregset32_t=yes
-else
-  bfd_cv_have_sys_procfs_type_prfpregset32_t=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prfpregset32_t = yes; then
-
-$as_echo "#define HAVE_PRFPREGSET32_T 1" >>confdefs.h
-
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_prfpregset32_t" >&5
-$as_echo "$bfd_cv_have_sys_procfs_type_prfpregset32_t" >&6; }
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lwpid_t in sys/procfs.h" >&5
 $as_echo_n "checking for lwpid_t in sys/procfs.h... " >&6; }
  if test "${bfd_cv_have_sys_procfs_type_lwpid_t+set}" = set; then :
@@ -11956,45 +11805,6 @@ $as_echo "#define PRFPREGSET_T_BROKEN 1" >>confdefs.h
 
     fi
   fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
-$as_echo_n "checking for PIOCSET ioctl entry in sys/procfs.h... " >&6; }
-  if test "${gdb_cv_have_procfs_piocset+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/procfs.h>
-
-int
-main ()
-{
-
-    int dummy;;
-    dummy = ioctl(0, PIOCSET, &dummy);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gdb_cv_have_procfs_piocset=yes
-else
-  gdb_cv_have_procfs_piocset=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_procfs_piocset" >&5
-$as_echo "$gdb_cv_have_procfs_piocset" >&6; }
-  if test $gdb_cv_have_procfs_piocset = yes; then
-
-$as_echo "#define HAVE_PROCFS_PIOCSET 1" >>confdefs.h
-
-  fi
 fi
 
 # Check if the compiler supports the `long long' type.
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 8f9e1e2..10fe947 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1075,15 +1075,15 @@ fi
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 # elf_hp.h is for HP/UX 64-bit shared library support.
-AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \
-                  thread_db.h signal.h stddef.h \
-		  stdlib.h string.h memory.h strings.h sys/fault.h \
+AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
+                  thread_db.h stddef.h \
+		  stdlib.h sys/fault.h \
 		  sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
 		  sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
 		  sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
-		  sys/types.h sys/wait.h wait.h termios.h termio.h \
-		  sgtty.h unistd.h elf_hp.h locale.h \
-		  dlfcn.h sys/un.h linux/perf_event.h])
+		  termios.h termio.h \
+		  sgtty.h unistd.h elf_hp.h \
+		  dlfcn.h])
 AC_CHECK_HEADERS(sys/proc.h, [], [],
 [#if HAVE_SYS_PARAM_H
 # include <sys/param.h>
@@ -1117,8 +1117,7 @@ AC_CHECK_HEADERS(term.h, [], [],
 # Checks for declarations.  #
 # ------------------------- #
 
-AC_CHECK_DECLS([free, malloc, realloc, strerror, strstr, getopt,
-                snprintf, vsnprintf])
+AC_CHECK_DECLS([free, malloc, realloc, snprintf])
 AM_LC_MESSAGES
 
 # ----------------------- #
@@ -1155,10 +1154,10 @@ AC_FUNC_VFORK
 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
 		pipe poll pread pread64 pwrite readlink resize_term \
 		sbrk setpgid setpgrp setsid \
-		sigaction sigprocmask sigsetmask socketpair syscall \
+		sigaction sigprocmask sigsetmask socketpair \
 		ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
 		setrlimit getrlimit posix_madvise waitpid lstat \
-		fdwalk pipe2 ptrace64])
+		ptrace64])
 AM_LANGINFO_CODESET
 GDB_AC_COMMON
 
@@ -1408,14 +1407,11 @@ if test "${target}" = "${host}"; then
 fi
 
 if test "$ac_cv_header_sys_procfs_h" = yes; then
-  BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
-  BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
   BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
-  BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
@@ -1450,24 +1446,6 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then
       [Define if the prfpregset_t type is broken.])
     fi
   fi
-
-  dnl Check for PIOCSET ioctl entry 
-
-  AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
-  AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
-  [AC_TRY_COMPILE([#include <unistd.h>
-#include <sys/types.h>
-#include <sys/procfs.h>
-], [
-    int dummy;;
-    dummy = ioctl(0, PIOCSET, &dummy);
-  ],
-  gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
-  AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
-  if test $gdb_cv_have_procfs_piocset = yes; then
-    AC_DEFINE(HAVE_PROCFS_PIOCSET, 1,
-    [Define if ioctl argument PIOCSET is available.])
-  fi
 fi
 
 # Check if the compiler supports the `long long' type.
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/6] introduce common.m4
  2013-11-05 18:24 ` [PATCH v2 1/6] introduce common.m4 Tom Tromey
@ 2013-11-05 19:09   ` Pedro Alves
  2013-11-05 20:03     ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2013-11-05 19:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 06:23 PM, Tom Tromey wrote:
> 2013-11-04  Tom Tromey  <tromey@redhat.com>
> 
> 	* acinclude.m4: Include common.m4.
> 	* common/common.m4: New file.
> 	* configure, config.in: Rebuild.
> 	* configure.ac: Use GDB_AC_COMMON.
> 
> 2013-11-04  Tom Tromey  <tromey@redhat.com>
> 
> 	* acinclude.m4: Include common.m4, codeset.m4.

HAVE_LANGINFO_CODESET is used by common/gdb_locale.h,
and GDB_AC_COMMON uses AM_LANGINFO_CODESET.  Shouldn't
codeset.m4 then be included by common.m4 instead?

> 	* configure, config.in: Rebuild.
> 	* configure.ac: Use GDB_AC_COMMON.

(In cases like these, it's useful to include an indication
of which ChangeLog file each entry goes to.  The above
is a case where that wasn't immediately obvious.)

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
                   ` (2 preceding siblings ...)
  2013-11-05 18:25 ` [PATCH v2 4/6] gdb configure updates Tom Tromey
@ 2013-11-05 19:09 ` Tom Tromey
  2013-11-05 19:49   ` Pedro Alves
  2013-11-05 19:10 ` [PATCH v2 0/6] introduce common.m4 Pedro Alves
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 19:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

m32c-tdep.c is the last user of HAVE_STRING_H in gdb proper.  It
really ought to be using gdb_string.h instead, as the rest of gdb
does.

2013-11-05  Tom Tromey  <tromey@redhat.com>

	* m32c-tdep.c: Use gdb_string.h.
---
 gdb/ChangeLog   | 4 ++++
 gdb/m32c-tdep.c | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index a147c94..1b0eba5 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -21,10 +21,7 @@
 
 #include <stdarg.h>
 
-#if defined (HAVE_STRING_H)
-#include <string.h>
-#endif
-
+#include "gdb_string.h"
 #include "gdb_assert.h"
 #include "elf-bfd.h"
 #include "elf/m32c.h"
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/6] introduce common.m4
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
                   ` (3 preceding siblings ...)
  2013-11-05 19:09 ` [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c Tom Tromey
@ 2013-11-05 19:10 ` Pedro Alves
  2013-11-05 20:04 ` [PATCH v2 5/6] fix a comment in configure.ac Tom Tromey
  2013-11-05 21:10 ` [PATCH v2 6/6] remove unused gdbserver configury Tom Tromey
  6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-11-05 19:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 06:23 PM, Tom Tromey wrote:

> I believe this version addresses Pedro's comments.  

I think so to.

Thanks for doing this.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/6] gdb configure updates
  2013-11-05 18:25 ` [PATCH v2 4/6] gdb configure updates Tom Tromey
@ 2013-11-05 19:10   ` Pedro Alves
  0 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-11-05 19:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 06:23 PM, Tom Tromey wrote:

> 2013-11-05  Tom Tromey  <tromey@redhat.com>
> 
> 	* configure, config.in: Rebuild.
> 	* configure.ac: Remove unused configury.

I'm not going to bother checking what was removed,
but this does sound great.

Thanks!

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/6] remove link.h checks
  2013-11-05 18:23 ` [PATCH v2 2/6] remove link.h checks Tom Tromey
@ 2013-11-05 19:10   ` Pedro Alves
  0 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-11-05 19:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 06:23 PM, Tom Tromey wrote:
> The removal of solib-sunos.c also removed the last user of various
> macros defined by configure.
> 
> This patch removes the corresponding configure code.
> 
> 2013-11-05  Tom Tromey  <tromey@redhat.com>
> 
> 	* configure, config.in: Rebuild.
> 	* configure.ac: Remove all link.h-related checks.

Looks good to me.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c
  2013-11-05 19:09 ` [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c Tom Tromey
@ 2013-11-05 19:49   ` Pedro Alves
  0 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-11-05 19:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 06:23 PM, Tom Tromey wrote:
> m32c-tdep.c is the last user of HAVE_STRING_H in gdb proper.  It
> really ought to be using gdb_string.h instead, as the rest of gdb
> does.
> 
> 2013-11-05  Tom Tromey  <tromey@redhat.com>
> 
> 	* m32c-tdep.c: Use gdb_string.h.

Looks obviously good to me.

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/6] introduce common.m4
  2013-11-05 19:09   ` Pedro Alves
@ 2013-11-05 20:03     ` Tom Tromey
  2013-11-08 12:46       ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 20:03 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> HAVE_LANGINFO_CODESET is used by common/gdb_locale.h,
Pedro> and GDB_AC_COMMON uses AM_LANGINFO_CODESET.  Shouldn't
Pedro> codeset.m4 then be included by common.m4 instead?

It's also needed by gdb/charset.c, so technically it should be included
in both places.  However it seems strange to include the file twice, and
reasonably harmless the way it is.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 5/6] fix a comment in configure.ac
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
                   ` (4 preceding siblings ...)
  2013-11-05 19:10 ` [PATCH v2 0/6] introduce common.m4 Pedro Alves
@ 2013-11-05 20:04 ` Tom Tromey
  2013-11-05 21:10 ` [PATCH v2 6/6] remove unused gdbserver configury Tom Tromey
  6 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 20:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

My grepping around showed that HAVE_MULTIPLE_PROC_FDS is only ever
mentioned in a comment in configure.ac.  Since the macro is long dead,
let's remove the last mention.

2013-11-05  Tom Tromey  <tromey@redhat.com>

	* configure: Rebuild.
	* configure.ac: Remove mentions of HAVE_MULTIPLE_PROC_FDS.
---
 gdb/ChangeLog    | 5 +++++
 gdb/config.in    | 3 +--
 gdb/configure.ac | 6 ++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gdb/config.in b/gdb/config.in
index ada9b3b..7dfb5c7 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -571,8 +571,7 @@
    moved. */
 #undef JIT_READER_DIR_RELOCATABLE
 
-/* Define if you want to use new multi-fd /proc interface (replaces
-   HAVE_MULTIPLE_PROC_FDS as well as other macros). */
+/* Define if you want to use new multi-fd /proc interface. */
 #undef NEW_PROC_API
 
 /* Name of this package. */
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 10fe947..34908ab 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1389,13 +1389,11 @@ if test "${target}" = "${host}"; then
   case "${host}" in
   *-*-sysv4.2* | *-*-sysv5* )
       AC_DEFINE(NEW_PROC_API, 1,
-      [Define if you want to use new multi-fd /proc interface
-       (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
+      [Define if you want to use new multi-fd /proc interface.])
       ;;
   *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]]*)
       AC_DEFINE(NEW_PROC_API, 1,
-      [Define if you want to use new multi-fd /proc interface
-       (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
+      [Define if you want to use new multi-fd /proc interface.])
       ;;
   mips-sgi-irix5*)
       # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 6/6] remove unused gdbserver configury
  2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
                   ` (5 preceding siblings ...)
  2013-11-05 20:04 ` [PATCH v2 5/6] fix a comment in configure.ac Tom Tromey
@ 2013-11-05 21:10 ` Tom Tromey
  6 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2013-11-05 21:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This updates gdbserver's configure.ac to remove checks that aren't
directly needed by gdbserver.

2013-11-05  Tom Tromey  <tromey@redhat.com>

	* configure, config.in: Rebuild.
	* configure.ac: Remove unused configury.
---
 gdb/gdbserver/ChangeLog    |  5 ++++
 gdb/gdbserver/config.in    |  6 ----
 gdb/gdbserver/configure    | 69 ++--------------------------------------------
 gdb/gdbserver/configure.ac | 25 +++--------------
 4 files changed, 11 insertions(+), 94 deletions(-)

diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index bd5c586..d0976c1 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -58,9 +58,6 @@
 /* Define if <sys/procfs.h> has elf_fpregset_t. */
 #undef HAVE_ELF_FPREGSET_T
 
-/* Define if errno is available */
-#undef HAVE_ERRNO
-
 /* Define to 1 if you have the <errno.h> header file. */
 #undef HAVE_ERRNO_H
 
@@ -256,9 +253,6 @@
 /* Define to 1 if you have the <wait.h> header file. */
 #undef HAVE_WAIT_H
 
-/* Checking if errno must be defined */
-#undef MUST_DEFINE_ERRNO
-
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index a4ea2ca..6bef97c 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4873,7 +4873,7 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach
   cd "$ac_popdir"
 
 
-for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h thread_db.h linux/elf.h 		 stdlib.h 		 errno.h fcntl.h signal.h sys/file.h malloc.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h sys/wait.h wait.h sys/un.h 		 linux/perf_event.h sys/syscall.h
+for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h linux/elf.h 		 stdlib.h 		 errno.h fcntl.h signal.h sys/file.h malloc.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -4887,7 +4887,7 @@ fi
 
 done
 
-for ac_func in pread pwrite pread64 readlink fdwalk pipe2
+for ac_func in pread pwrite pread64 readlink
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -5627,61 +5627,6 @@ done
 
 LIBS="$old_LIBS"
 
-have_errno=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for errno" >&5
-$as_echo_n "checking for errno... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
-int
-main ()
-{
-static int x; x = errno;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - in errno.h" >&5
-$as_echo "yes - in errno.h" >&6; };
-$as_echo "#define HAVE_ERRNO 1" >>confdefs.h
- have_errno=yes
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-if test $have_errno = no; then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
-int
-main ()
-{
-extern int errno; static int x; x = errno;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - must define" >&5
-$as_echo "yes - must define" >&6; };
-$as_echo "#define HAVE_ERRNO 1" >>confdefs.h
-
-$as_echo "#define MUST_DEFINE_ERRNO 1" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-
 ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strerror" = x""yes; then :
   ac_have_decl=1
@@ -5692,16 +5637,6 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRERROR $ac_have_decl
 _ACEOF
-ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strstr" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRSTR $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "perror" "ac_cv_have_decl_perror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_perror" = x""yes; then :
   ac_have_decl=1
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 086457c..3bed876 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -79,13 +79,12 @@ AC_PROG_MAKE_SET
 ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"])
 
 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
-		 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
+		 proc_service.h sys/procfs.h linux/elf.h dnl
 		 stdlib.h dnl
 		 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
-		 netinet/tcp.h arpa/inet.h sys/wait.h wait.h sys/un.h dnl
-		 linux/perf_event.h sys/syscall.h)
-AC_CHECK_FUNCS(pread pwrite pread64 readlink fdwalk pipe2)
+		 netinet/tcp.h arpa/inet.h)
+AC_CHECK_FUNCS(pread pwrite pread64 readlink)
 AC_REPLACE_FUNCS(vasprintf vsnprintf)
 
 GDB_AC_COMMON
@@ -189,23 +188,7 @@ LIBS="$LIBS -ldl"
 AC_CHECK_FUNCS(dladdr)
 LIBS="$old_LIBS"
 
-have_errno=no
-AC_MSG_CHECKING(for errno)
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [static int x; x = errno;],
-  [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes])
-if test $have_errno = no; then
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [extern int errno; static int x; x = errno;],
-  [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) AC_DEFINE(MUST_DEFINE_ERRNO, 1, [Checking if errno must be defined])],
-  [AC_MSG_RESULT(no)])
-fi
-
-AC_CHECK_DECLS([strerror, strstr, perror, vasprintf, vsnprintf])
+AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
 
 AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/6] introduce common.m4
  2013-11-05 20:03     ` Tom Tromey
@ 2013-11-08 12:46       ` Pedro Alves
  2013-11-08 19:32         ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2013-11-08 12:46 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/05/2013 07:52 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> HAVE_LANGINFO_CODESET is used by common/gdb_locale.h,
> Pedro> and GDB_AC_COMMON uses AM_LANGINFO_CODESET.  Shouldn't
> Pedro> codeset.m4 then be included by common.m4 instead?
> 
> It's also needed by gdb/charset.c, so technically it should be included
> in both places.  However it seems strange to include the file twice, and
> reasonably harmless the way it is.

Hmm, but then this goes against the "each module includes what
it needs" philosophy.  Does including the file twice actually result
in expanding the file twice, or does m4 make sure it's included
only once?

If we do go with gdbserver including this directly, then I think
it'd be good to add a comment about the dependency here:

> +++ b/gdb/gdbserver/acinclude.m4
> @@ -12,8 +12,10 @@ sinclude(../../config/override.m4)
>  dnl For ACX_PKGVERSION and ACX_BUGURL.
>  sinclude(../../config/acx.m4)
>
> +m4_include(../../config/codeset.m4)
>  m4_include(../../config/depstand.m4)
>  m4_include(../../config/lead-dot.m4)
> +m4_include(../common/common.m4)

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/6] introduce common.m4
  2013-11-08 12:46       ` Pedro Alves
@ 2013-11-08 19:32         ` Tom Tromey
  2013-11-08 20:10           ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-11-08 19:32 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Hmm, but then this goes against the "each module includes what
Pedro> it needs" philosophy.  Does including the file twice actually result
Pedro> in expanding the file twice, or does m4 make sure it's included
Pedro> only once?

It warns.
I couldn't find a way to include a file just once.

Pedro> If we do go with gdbserver including this directly, then I think
Pedro> it'd be good to add a comment about the dependency here:

Will do.
I'll add a note to common.m4 as well.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/6] introduce common.m4
  2013-11-08 19:32         ` Tom Tromey
@ 2013-11-08 20:10           ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2013-11-08 20:10 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro> If we do go with gdbserver including this directly, then I think
Pedro> it'd be good to add a comment about the dependency here:

Tom> Will do.
Tom> I'll add a note to common.m4 as well.

Here is the updated version of this patch.

I'm going to check this series in now.

Tom

commit 3266f10be2daf35319101f299ae988aa2bbd5297
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 24 10:45:45 2013 -0600

    introduce common.m4
    
    It has bothered me for a while that files in common/ use macros
    defined via autoconf checks, but rely on each configure.ac doing the
    proper checks independently.
    
    This patch introduces common/common.m4 which consolidates the checks
    assumed by code in common.
    
    The rule I propose is that if something is needed or used by common,
    it should be checked for by common.m4.  However, if the check is also
    needed by gdb or gdbserver, then it should be duplicated there.
    
    Built and regtested on x86-64 Fedora 18 (though this is hardly the
    most strenuous case) and using the Fedora 18 mingw cross compilers.  I
    also examined the config.in diffs to ensure that symbols did not go
    missing.
    
    2013-11-08  Tom Tromey  <tromey@redhat.com>
    
    	* acinclude.m4: Include common.m4.
    	* common/common.m4: New file.
    	* configure, config.in: Rebuild.
    	* configure.ac: Use GDB_AC_COMMON.
    
    2013-11-08  Tom Tromey  <tromey@redhat.com>
    
    	* acinclude.m4: Include common.m4, codeset.m4.
    	* configure, config.in: Rebuild.
    	* configure.ac: Use GDB_AC_COMMON.

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index a05eb4d..be1c019 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -52,6 +52,8 @@ sinclude([../config/codeset.m4])
 
 sinclude([../config/zlib.m4])
 
+m4_include([common/common.m4])
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/common/common.m4 b/gdb/common/common.m4
new file mode 100644
index 0000000..20fbb44
--- /dev/null
+++ b/gdb/common/common.m4
@@ -0,0 +1,38 @@
+dnl Autoconf configure snippets for common.
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GDB.
+dnl 
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Invoke configury needed by the files in 'common'.
+AC_DEFUN([GDB_AC_COMMON], [
+  AC_HEADER_STDC
+  AC_HEADER_DIRENT
+  AC_FUNC_ALLOCA
+
+  dnl Note that this requires codeset.m4, which is included
+  dnl by the users of common.m4.
+  AM_LANGINFO_CODESET
+
+  AC_CHECK_HEADERS(linux/perf_event.h locale.h memory.h signal.h dnl
+                   string.h strings.h dnl
+		   sys/resource.h sys/socket.h sys/syscall.h dnl
+		   sys/un.h sys/wait.h dnl
+		   thread_db.h wait.h)
+
+  AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair])
+
+  AC_CHECK_DECLS([strerror, strstr])
+])
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e5984df..3558d6a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1168,6 +1168,7 @@ AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
 		setrlimit getrlimit posix_madvise waitpid lstat \
 		fdwalk pipe2 ptrace64])
 AM_LANGINFO_CODESET
+GDB_AC_COMMON
 
 # Check the return and argument types of ptrace.  No canned test for
 # this, so roll our own.
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index 4008d96..744871a 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -15,6 +15,11 @@ sinclude(../../config/acx.m4)
 m4_include(../../config/depstand.m4)
 m4_include(../../config/lead-dot.m4)
 
+dnl codeset.m4 is needed for common.m4, but not for
+dnl anything else in gdbserver.
+m4_include(../../config/codeset.m4)
+m4_include(../common/common.m4)
+
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
 
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index c167508..086457c 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -88,6 +88,8 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
 AC_CHECK_FUNCS(pread pwrite pread64 readlink fdwalk pipe2)
 AC_REPLACE_FUNCS(vasprintf vsnprintf)
 
+GDB_AC_COMMON
+
 # Check for UST
 ustlibs=""
 ustinc=""

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-11-08 19:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 18:23 [PATCH v2 0/6] introduce common.m4 Tom Tromey
2013-11-05 18:23 ` [PATCH v2 2/6] remove link.h checks Tom Tromey
2013-11-05 19:10   ` Pedro Alves
2013-11-05 18:24 ` [PATCH v2 1/6] introduce common.m4 Tom Tromey
2013-11-05 19:09   ` Pedro Alves
2013-11-05 20:03     ` Tom Tromey
2013-11-08 12:46       ` Pedro Alves
2013-11-08 19:32         ` Tom Tromey
2013-11-08 20:10           ` Tom Tromey
2013-11-05 18:25 ` [PATCH v2 4/6] gdb configure updates Tom Tromey
2013-11-05 19:10   ` Pedro Alves
2013-11-05 19:09 ` [PATCH v2 3/6] use gdb_string.h in m32c-tdep.c Tom Tromey
2013-11-05 19:49   ` Pedro Alves
2013-11-05 19:10 ` [PATCH v2 0/6] introduce common.m4 Pedro Alves
2013-11-05 20:04 ` [PATCH v2 5/6] fix a comment in configure.ac Tom Tromey
2013-11-05 21:10 ` [PATCH v2 6/6] remove unused gdbserver configury Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).