From patchwork Thu Jan 9 00:58:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37268 Received: (qmail 79968 invoked by alias); 9 Jan 2020 00:58:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 79922 invoked by uid 89); 9 Jan 2020 00:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.49.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Jan 2020 00:58:12 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id C0A242FD1 for ; Wed, 8 Jan 2020 18:58:10 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id pM9Ki5NSVW4frpM9KiLCrJ; Wed, 08 Jan 2020 18:58:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=snB7IFlLaHMMFLc3S60Z4UBVZZc4BqKsC3ONW0obSe8=; b=ctdYfZJbs6NvYrTt//+FFojZn4 NhW0LnzkDSYdQN2MqYrBsI5U60NZi0+87MADN4WIZjTtJO5LAsxf50rE/NRaeBG5ItqHz233ygEs9 AxKVqDsWx4ctOMn0LsDARo+uM; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:33552 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1ipM9K-004IGu-Iv; Wed, 08 Jan 2020 17:58:10 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 1/6] Consolidate definition of USE_WIN32API Date: Wed, 8 Jan 2020 17:58:02 -0700 Message-Id: <20200109005807.7314-2-tom@tromey.com> In-Reply-To: <20200109005807.7314-1-tom@tromey.com> References: <20200109005807.7314-1-tom@tromey.com> I noticed that USE_WIN32API is defined separately by gdbserver and gdb. However, because it is used by code in gdbsupport, it should be defined by common.m4. This approach ensures that the code will continue to work when it is moved to the top level. gdb/ChangeLog 2020-01-08 Tom Tromey * gdbsupport/common.m4 (GDB_AC_COMMON): Define WIN32APILIBS and USE_WIN32API when needed. * configure.ac (USE_WIN32API): Don't define. (WIN32LIBS): Use WIN32APILIBS. * configure: Rebuild. gdb/gdbserver/ChangeLog 2020-01-08 Tom Tromey * configure.ac (LIBS): Use WIN32APILIBS. (USE_WIN32API): Don't define. * configure: Rebuild. Change-Id: I40d524d5445ebfb452b36f4d0e102f0b1e1089df --- gdb/ChangeLog | 8 ++++++++ gdb/configure | 23 +++++++++++++---------- gdb/configure.ac | 13 ++----------- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/configure | 19 ++++++++++++------- gdb/gdbserver/configure.ac | 11 ++--------- gdb/gdbsupport/common.m4 | 12 ++++++++++++ 7 files changed, 55 insertions(+), 37 deletions(-) diff --git a/gdb/configure b/gdb/configure index b572d414ca5..2c4766028a0 100755 --- a/gdb/configure +++ b/gdb/configure @@ -688,12 +688,12 @@ TCL_BIN_DIR TCL_PATCH_LEVEL TCL_VERSION WIN32LDAPP +WIN32LIBS GUI_CFLAGS_X LIBGUI LTLIBLZMA LIBLZMA HAVE_LIBLZMA -WIN32LIBS SER_HARDWIRE WERROR_CFLAGS WARN_CFLAGS @@ -13567,6 +13567,16 @@ _ACEOF fi + WIN32APILIBS= + case ${host} in + *mingw32*) + +$as_echo "#define USE_WIN32API 1" >>confdefs.h + + WIN32APILIBS="-lws2_32" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 $as_echo_n "checking for nl_langinfo and CODESET... " >&6; } @@ -16355,15 +16365,8 @@ if test x"$gdb_cv_os_cygwin" = xyes; then fi # The ser-tcp.c module requires sockets. -case ${host} in - *mingw32*) - -$as_echo "#define USE_WIN32API 1" >>confdefs.h - - WIN32LIBS="$WIN32LIBS -lws2_32" - ;; -esac - +# Note that WIN32APILIBS is set by GDB_AC_COMMON. +WIN32LIBS="$WIN32LIBS $WIN32APILIBS" # Add ELF support to GDB, but only if BFD includes ELF support. diff --git a/gdb/configure.ac b/gdb/configure.ac index ca0da7980cc..a7b744bf241 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1827,17 +1827,8 @@ if test x"$gdb_cv_os_cygwin" = xyes; then fi # The ser-tcp.c module requires sockets. -case ${host} in - *mingw32*) - AC_DEFINE(USE_WIN32API, 1, - [Define if we should use the Windows API, instead of the - POSIX API. On Windows, we use the Windows API when - building for MinGW, but the POSIX API when building - for Cygwin.]) - WIN32LIBS="$WIN32LIBS -lws2_32" - ;; -esac -AC_SUBST(WIN32LIBS) +# Note that WIN32APILIBS is set by GDB_AC_COMMON. +WIN32LIBS="$WIN32LIBS $WIN32APILIBS" # Add ELF support to GDB, but only if BFD includes ELF support. GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf, diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 4de751b4491..361c1c4cd94 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -6959,6 +6959,16 @@ _ACEOF fi + WIN32APILIBS= + case ${host} in + *mingw32*) + +$as_echo "#define USE_WIN32API 1" >>confdefs.h + + WIN32APILIBS="-lws2_32" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 $as_echo_n "checking for nl_langinfo and CODESET... " >&6; } @@ -8704,19 +8714,14 @@ esac if test "${srv_mingwce}" = "yes"; then LIBS="$LIBS -lws2" elif test "${srv_mingw}" = "yes"; then - LIBS="$LIBS -lws2_32" + # WIN32APILIBS is set by GDB_AC_COMMON. + LIBS="$LIBS $WIN32APILIBS" elif test "${srv_qnx}" = "yes"; then LIBS="$LIBS -lsocket" elif test "${srv_lynxos}" = "yes"; then LIBS="$LIBS -lnetinet" fi -if test "${srv_mingw}" = "yes"; then - -$as_echo "#define USE_WIN32API 1" >>confdefs.h - -fi - if test "${srv_linux_usrregs}" = "yes"; then $as_echo "#define HAVE_LINUX_USRREGS 1" >>confdefs.h diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 817a861a32b..fab765ea38d 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -248,21 +248,14 @@ esac if test "${srv_mingwce}" = "yes"; then LIBS="$LIBS -lws2" elif test "${srv_mingw}" = "yes"; then - LIBS="$LIBS -lws2_32" + # WIN32APILIBS is set by GDB_AC_COMMON. + LIBS="$LIBS $WIN32APILIBS" elif test "${srv_qnx}" = "yes"; then LIBS="$LIBS -lsocket" elif test "${srv_lynxos}" = "yes"; then LIBS="$LIBS -lnetinet" fi -if test "${srv_mingw}" = "yes"; then - AC_DEFINE(USE_WIN32API, 1, - [Define if we should use the Windows API, instead of the - POSIX API. On Windows, we use the Windows API when - building for MinGW, but the POSIX API when building - for Cygwin.]) -fi - if test "${srv_linux_usrregs}" = "yes"; then AC_DEFINE(HAVE_LINUX_USRREGS, 1, [Define if the target supports PTRACE_PEEKUSR for register ] diff --git a/gdb/gdbsupport/common.m4 b/gdb/gdbsupport/common.m4 index c36d84a42be..e49af7c750d 100644 --- a/gdb/gdbsupport/common.m4 +++ b/gdb/gdbsupport/common.m4 @@ -21,6 +21,18 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_HEADER_STDC AC_FUNC_ALLOCA + WIN32APILIBS= + case ${host} in + *mingw32*) + AC_DEFINE(USE_WIN32API, 1, + [Define if we should use the Windows API, instead of the + POSIX API. On Windows, we use the Windows API when + building for MinGW, but the POSIX API when building + for Cygwin.]) + WIN32APILIBS="-lws2_32" + ;; + esac + dnl Note that this requires codeset.m4, which is included dnl by the users of common.m4. AM_LANGINFO_CODESET