This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: introduce common.m4

It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each 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; but that code outside this
directory also be free to use these results.  This means that removing
checks from common.m4 must first be preceded by looking at uses in gdb
and gdbserver.  I think this is pretty easy to do -- easier than what
we are doing now -- and I have documented the requirement.

This process revealed a few things not checked for in gdbserver
(nothing too crucial I think) and also that the decl check for getopt
was dead.

I wrote GDB_AC_COMMON by looking for HAVE_ symbols in common/*.[ch].
I did not look for library dependencies, so it is possible that
something is missing.  I think it is worthwhile to have this in place
now, even if it is not perfect, because it gives us a place to make
future improvements.

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 diffs to ensure that symbols did not go


	* acinclude.m4: Include common.m4.
	* common/common.m4: New file.
	* configure, Rebuild.
	* configure: Move some checks to common.m4.  Use GDB_AC_COMMON.

	* acinclude.m4: Include common.m4, codeset.m4.
	* configure, Rebuild.
	* configure: Move some checks to common.m4.  Use GDB_AC_COMMON.
 gdb/acinclude.m4           |   2 +
 gdb/common/common.m4       |  37 +++
 gdb/              |   4 -
 gdb/configure              | 591 ++++++++++++++++++++++++++++++++++++++++-----
 gdb/           |  23 +-
 gdb/gdbserver/acinclude.m4 |   2 +
 gdb/gdbserver/    |  18 ++
 gdb/gdbserver/configure    | 574 +++++++++++++++++++++++++++++++++++++++++--
 gdb/gdbserver/ |  16 +-
 9 files changed, 1166 insertions(+), 101 deletions(-)
 create mode 100644 gdb/common/common.m4

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 25caddd..21d1013 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -49,6 +49,8 @@ sinclude([../config/codeset.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..facaaa8
--- /dev/null
+++ b/gdb/common/common.m4
@@ -0,0 +1,37 @@
+dnl Autoconf configure snippets for common.
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
+dnl This file is part of GDB.
+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 This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl GNU General Public License for more details.
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <>.
+dnl Invoke configury needed by the files in 'common'.
+dnl Note that if something is not needed here, you must
+dnl first check whether it is also needed by gdb or gdbserver.
+dnl They are free to reuse results from tests performed here.
+  AC_CHECK_HEADERS(linux/perf_event.h locale.h memory.h signal.h dnl
+                   string.h strings.h sys/resource.h 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/ b/gdb/
index bb7fbdd..3873e4b 100644
--- a/gdb/
+++ b/gdb/
@@ -1083,14 +1083,12 @@ AC_HEADER_DIRENT
 # 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 proc_service.h \
-                  thread_db.h signal.h stddef.h \
-		  stdlib.h string.h memory.h strings.h sys/fault.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/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])
+		  sys/types.h termios.h termio.h \
+		  sgtty.h unistd.h elf_hp.h dlfcn.h])
 AC_CHECK_HEADERS(link.h, [], [],
 # include <sys/types.h>
@@ -1132,8 +1130,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, vsnprintf])
 # ----------------------- #
@@ -1168,13 +1165,13 @@ AC_FUNC_ALLOCA
 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
-		pipe poll pread pread64 pwrite readlink resize_term \
+		poll pread pread64 pwrite readlink resize_term \
 		sbrk setpgid setpgrp setsid \
-		sigaction sigprocmask sigsetmask socketpair syscall \
+		sigaction sigprocmask sigsetmask syscall \
 		ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
-		setrlimit getrlimit posix_madvise waitpid lstat \
-		fdwalk pipe2])
+		setrlimit posix_madvise waitpid lstat])
 # 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 0e0bdc8..6d7b0e2 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -9,8 +9,10 @@ sinclude(../../config/override.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/ b/gdb/gdbserver/
index b9928d7..0b479f3 100644
--- a/gdb/gdbserver/
+++ b/gdb/gdbserver/
@@ -63,16 +63,16 @@ AC_PROG_MAKE_SET
 # build it in the same directory, when building in the source dir.
 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
-		 stdlib.h unistd.h dnl
-		 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
+AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h dnl
+		 proc_service.h sys/procfs.h linux/elf.h dnl
+		 stdlib.h unistd.h errno.h fcntl.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)
-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)
 # Check for UST
@@ -188,7 +188,7 @@ AC_TRY_LINK([
-AC_CHECK_DECLS([strerror, strstr, perror, vasprintf, vsnprintf])
+AC_CHECK_DECLS([perror, vasprintf, vsnprintf])
 AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]