aboutsummaryrefslogtreecommitdiff
path: root/sim/m4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-17 20:34:52 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-12 10:45:36 -0400
commitb15c5d7a516d4e3466753e19df77d34b404d397e (patch)
treee521402caee20cf6415ae90fe68f2e8e23d9f68f /sim/m4
parent8c60e272c73b8021601f6e091879bc0fa1c5ab45 (diff)
downloadgdb-b15c5d7a516d4e3466753e19df77d34b404d397e.zip
gdb-b15c5d7a516d4e3466753e19df77d34b404d397e.tar.gz
gdb-b15c5d7a516d4e3466753e19df77d34b404d397e.tar.bz2
sim: unify platform function & header tests
Move the various platform tests up a level to avoid duplication across the ports. When building multiple versions, this speeds things up a bit. For now we move the obvious stuff up a level, but we don't turn own the config.h entirely just yet -- we still have some tests related to libraries that need consideration.
Diffstat (limited to 'sim/m4')
-rw-r--r--sim/m4/sim_ac_common.m444
-rw-r--r--sim/m4/sim_ac_platform.m493
2 files changed, 93 insertions, 44 deletions
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index aa10a65..8ff2e2c 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -40,47 +40,6 @@ dnl to see if there are intl libraries we should link against.
ALL_LINGUAS=
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
-# Check for common headers.
-# NB: You can assume C11 headers exist.
-AC_CHECK_HEADERS_ONCE(m4_flatten([
- dlfcn.h
- fcntl.h
- fpu_control.h
- unistd.h
- sys/mman.h
- sys/resource.h
- sys/stat.h
-]))
-AC_CHECK_FUNCS_ONCE(m4_flatten([
- __setfpucw
- ftruncate
- getrusage
- lstat
- mmap
- munmap
- posix_fallocate
- sigaction
- strsignal
- time
- truncate
-]))
-AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
-[struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
-[struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
-[struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime],
-[struct stat.st_mtime], [struct stat.st_ctime]], [], [],
-[[#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif]])
-AC_CHECK_TYPES([__int128])
-AC_CHECK_TYPES(socklen_t, [], [],
-[#include <sys/types.h>
-#include <sys/socket.h>
-])
-
# Check for socket libraries
AC_CHECK_LIB(socket, bind)
AC_CHECK_LIB(nsl, gethostbyname)
@@ -213,9 +172,6 @@ ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
-dnl Types used by common code
-AC_TYPE_SIGNAL
-
dnl Detect exe extension
AC_EXEEXT
]) dnl End of SIM_AC_COMMON
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
new file mode 100644
index 0000000..c68aef1
--- /dev/null
+++ b/sim/m4/sim_ac_platform.m4
@@ -0,0 +1,93 @@
+dnl Copyright (C) 1997-2021 Free Software Foundation, Inc.
+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
+dnl Check for various platform settings.
+AC_DEFUN([SIM_AC_PLATFORM],
+[dnl
+dnl Check for common headers.
+dnl NB: You can assume C11 headers exist.
+AC_CHECK_HEADERS_ONCE(m4_flatten([
+ dlfcn.h
+ fcntl.h
+ fpu_control.h
+ termios.h
+ unistd.h
+ utime.h
+ linux/if_tun.h
+ linux/mii.h
+ linux/types.h
+ net/if.h
+ netinet/in.h
+ netinet/tcp.h
+ sys/ioctl.h
+ sys/mman.h
+ sys/param.h
+ sys/resource.h
+ sys/select.h
+ sys/socket.h
+ sys/stat.h
+]))
+
+AC_CHECK_FUNCS_ONCE(m4_flatten([
+ __setfpucw
+ aint
+ anint
+ chmod
+ execv
+ execve
+ fork
+ ftruncate
+ geteuid
+ getegid
+ getgid
+ getrusage
+ getuid
+ kill
+ lstat
+ mmap
+ munmap
+ posix_fallocate
+ pread
+ setuid
+ setgid
+ sigaction
+ sqrt
+ strsignal
+ time
+ truncate
+ utime
+]))
+
+AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
+[struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
+[struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
+[struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime],
+[struct stat.st_mtime], [struct stat.st_ctime]], [], [],
+[[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif]])
+
+AC_CHECK_TYPES([__int128])
+AC_CHECK_TYPES(socklen_t, [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+dnl Types used by common code
+AC_TYPE_SIGNAL
+])