From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id A856F385780B for ; Mon, 7 Jun 2021 05:33:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A856F385780B Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 4A3B9335D28 for ; Mon, 7 Jun 2021 05:33:58 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 1/7] sim: unify platform function & header tests Date: Mon, 7 Jun 2021 01:33:49 -0400 Message-Id: <20210607053355.9965-1-vapier@gentoo.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 05:34:03 -0000 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. --- sim/Makefile.in | 39 +- sim/aarch64/config.in | 93 --- sim/aarch64/configure | 461 +------------- sim/aclocal.m4 | 1 + sim/arm/config.in | 93 --- sim/arm/configure | 461 +------------- sim/avr/config.in | 93 --- sim/avr/configure | 461 +------------- sim/bfin/config.in | 132 ---- sim/bfin/configure | 503 +-------------- sim/bfin/configure.ac | 10 - sim/bpf/config.in | 93 --- sim/bpf/configure | 461 +------------- sim/common/defs.h | 14 +- sim/config.h.in | 285 +++++++++ sim/configure | 1076 +++++++++++++++++++++++++++++---- sim/configure.ac | 3 + sim/cr16/config.in | 93 --- sim/cr16/configure | 461 +------------- sim/cris/config.in | 102 ---- sim/cris/configure | 473 +-------------- sim/cris/configure.ac | 7 - sim/d10v/config.in | 93 --- sim/d10v/configure | 461 +------------- sim/erc32/config.in | 93 --- sim/erc32/configure | 461 +------------- sim/example-synacor/config.in | 93 --- sim/example-synacor/configure | 461 +------------- sim/frv/config.in | 93 --- sim/frv/configure | 461 +------------- sim/ft32/config.in | 93 --- sim/ft32/configure | 461 +------------- sim/h8300/config.in | 96 --- sim/h8300/configure | 466 +------------- sim/h8300/configure.ac | 2 - sim/iq2000/config.in | 93 --- sim/iq2000/configure | 461 +------------- sim/lm32/config.in | 93 --- sim/lm32/configure | 461 +------------- sim/m32c/config.in | 108 ---- sim/m32c/configure | 478 +-------------- sim/m32c/configure.ac | 8 - sim/m32r/config.in | 93 --- sim/m32r/configure | 461 +------------- sim/m4/sim_ac_common.m4 | 44 -- sim/m4/sim_ac_platform.m4 | 94 +++ sim/m68hc11/config.in | 93 --- sim/m68hc11/configure | 461 +------------- sim/mcore/config.in | 93 --- sim/mcore/configure | 461 +------------- sim/microblaze/config.in | 93 --- sim/microblaze/configure | 461 +------------- sim/mips/config.in | 102 ---- sim/mips/configure | 473 +-------------- sim/mips/configure.ac | 1 - sim/mn10300/config.in | 93 --- sim/mn10300/configure | 461 +------------- sim/moxie/config.in | 93 --- sim/moxie/configure | 461 +------------- sim/msp430/config.in | 93 --- sim/msp430/configure | 461 +------------- sim/or1k/config.in | 93 --- sim/or1k/configure | 461 +------------- sim/pru/config.in | 93 --- sim/pru/configure | 461 +------------- sim/riscv/config.in | 93 --- sim/riscv/configure | 461 +------------- sim/rl78/config.in | 93 --- sim/rl78/configure | 461 +------------- sim/rx/config.in | 93 --- sim/rx/configure | 461 +------------- sim/sh/config.in | 93 --- sim/sh/configure | 461 +------------- sim/v850/config.in | 114 ---- sim/v850/configure | 485 +-------------- sim/v850/configure.ac | 3 - 76 files changed, 1431 insertions(+), 17538 deletions(-) create mode 100644 sim/config.h.in create mode 100644 sim/m4/sim_ac_platform.m4 diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac index 8fef4d47d00c..18e82fae66b9 100644 --- a/sim/bfin/configure.ac +++ b/sim/bfin/configure.ac @@ -42,16 +42,6 @@ SIM_AC_OPTION_HARDWARE(\ eth_phy \ ) -AC_CHECK_FUNCS_ONCE([getuid getgid geteuid getegid setuid setgid kill pread]) -AC_CHECK_HEADERS_ONCE(m4_flatten([ - linux/if_tun.h - linux/mii.h - linux/types.h - net/if.h - sys/ioctl.h - sys/mman.h -])) - PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES(SDL, sdl, [ AC_CHECK_LIB(dl, dlopen, [ diff --git a/sim/common/defs.h b/sim/common/defs.h index 957e36d3c93c..4b5da7bfa369 100644 --- a/sim/common/defs.h +++ b/sim/common/defs.h @@ -34,9 +34,21 @@ #undef PACKAGE_URL #undef PACKAGE_VERSION -/* Include sim's various configure tests. */ +/* Include arch-specific sim's various configure tests. */ #include "config.h" +/* Reset macros that our config.h will provide. */ +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_URL +#undef PACKAGE_VERSION + +/* Include common sim's various configure tests. */ +#include "../config.h" + #endif #endif diff --git a/sim/config.h.in b/sim/config.h.in new file mode 100644 index 000000000000..64291f9252dc diff --git a/sim/configure.ac b/sim/configure.ac index 8faef9dcb83b..0ff49b0b678e 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -5,7 +5,10 @@ AC_INIT([sim], [0], [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim], [], [https://sourceware.org/gdb/wiki/Sim/]) +AC_CONFIG_HEADERS([config.h]) + SIM_AC_TOOLCHAIN +SIM_AC_PLATFORM AM_MAINTAINER_MODE AM_INIT_AUTOMAKE diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac index f8aa533a063c..b5eaea7b8adf 100644 --- a/sim/cris/configure.ac +++ b/sim/cris/configure.ac @@ -4,13 +4,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config]) SIM_AC_COMMON -# For dv-rv and rvdummy. -AC_CHECK_HEADERS_ONCE(m4_flatten([ - sys/param.h - sys/select.h - sys/socket.h -])) - SIM_AC_OPTION_ENDIAN(LITTLE) SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) SIM_AC_OPTION_SCACHE(16384) diff --git a/sim/h8300/configure.ac b/sim/h8300/configure.ac index dc24462742dc..43250f817416 100644 --- a/sim/h8300/configure.ac +++ b/sim/h8300/configure.ac @@ -7,6 +7,4 @@ SIM_AC_COMMON SIM_AC_OPTION_ENDIAN(BIG) SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) -AC_CHECK_HEADERS_ONCE(sys/param.h) - SIM_AC_OUTPUT diff --git a/sim/m32c/configure.ac b/sim/m32c/configure.ac index de1587eaac11..4f2c0ace70bb 100644 --- a/sim/m32c/configure.ac +++ b/sim/m32c/configure.ac @@ -23,12 +23,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config]) SIM_AC_COMMON -AC_CHECK_HEADERS_ONCE(m4_flatten([ - termios.h - netinet/in.h - netinet/tcp.h - sys/select.h - sys/socket.h -])) - SIM_AC_OUTPUT diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4 index aa10a6502722..8ff2e2c7c5a5 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 -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif]]) -AC_CHECK_TYPES([__int128]) -AC_CHECK_TYPES(socklen_t, [], [], -[#include -#include -]) - # 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 000000000000..9487c66cc82c --- /dev/null +++ b/sim/m4/sim_ac_platform.m4 @@ -0,0 +1,94 @@ +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 . +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 + chown + 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 +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif]]) + +AC_CHECK_TYPES([__int128]) +AC_CHECK_TYPES(socklen_t, [], [], +[#include +#include +]) + +dnl Types used by common code +AC_TYPE_SIGNAL +]) diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac index fee3816b57af..f4e67376c12e 100644 --- a/sim/mips/configure.ac +++ b/sim/mips/configure.ac @@ -432,6 +432,5 @@ SIM_AC_OPTION_HARDWARE(tx3904cpu tx3904irc tx3904tmr tx3904sio) AC_PATH_X AC_CHECK_LIB(m, fabs) -AC_CHECK_FUNCS(aint anint sqrt) SIM_AC_OUTPUT diff --git a/sim/v850/configure.ac b/sim/v850/configure.ac index f2edf1f7c480..9a7c1ec3df4b 100644 --- a/sim/v850/configure.ac +++ b/sim/v850/configure.ac @@ -9,7 +9,4 @@ SIM_AC_OPTION_ALIGNMENT(,NONSTRICT_ALIGNMENT) SIM_AC_OPTION_RESERVED_BITS SIM_AC_OPTION_BITSIZE(32,31) -AC_CHECK_FUNCS_ONCE(chmod utime fork execve execv chown) -AC_CHECK_HEADERS_ONCE(utime.h) - SIM_AC_OUTPUT -- 2.31.1