Consolidate definition of USE_WIN32API

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-14  Tom Tromey  <tom@tromey.com>

	* 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-14  Tom Tromey  <tom@tromey.com>

	* configure.ac (LIBS): Use WIN32APILIBS.
	(USE_WIN32API): Don't define.
	* configure: Rebuild.

Change-Id: I40d524d5445ebfb452b36f4d0e102f0b1e1089df
This commit is contained in:
Tom Tromey 2019-10-22 16:22:58 -06:00
parent 25c51f71d5
commit b2ceabe8f0
7 changed files with 55 additions and 37 deletions

View File

@ -1,3 +1,11 @@
2020-01-14 Tom Tromey <tom@tromey.com>
* 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.
2020-01-14 Tom Tromey <tom@tromey.com> 2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild. * configure: Rebuild.

23
gdb/configure vendored
View File

@ -688,12 +688,12 @@ TCL_BIN_DIR
TCL_PATCH_LEVEL TCL_PATCH_LEVEL
TCL_VERSION TCL_VERSION
WIN32LDAPP WIN32LDAPP
WIN32LIBS
GUI_CFLAGS_X GUI_CFLAGS_X
LIBGUI LIBGUI
LTLIBLZMA LTLIBLZMA
LIBLZMA LIBLZMA
HAVE_LIBLZMA HAVE_LIBLZMA
WIN32LIBS
SER_HARDWIRE SER_HARDWIRE
WERROR_CFLAGS WERROR_CFLAGS
WARN_CFLAGS WARN_CFLAGS
@ -13567,6 +13567,16 @@ _ACEOF
fi 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 "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
$as_echo_n "checking for nl_langinfo and CODESET... " >&6; } $as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
@ -16356,15 +16366,8 @@ if test x"$gdb_cv_os_cygwin" = xyes; then
fi fi
# The ser-tcp.c module requires sockets. # The ser-tcp.c module requires sockets.
case ${host} in # Note that WIN32APILIBS is set by GDB_AC_COMMON.
*mingw32*) WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
$as_echo "#define USE_WIN32API 1" >>confdefs.h
WIN32LIBS="$WIN32LIBS -lws2_32"
;;
esac
# Add ELF support to GDB, but only if BFD includes ELF support. # Add ELF support to GDB, but only if BFD includes ELF support.

View File

@ -1827,17 +1827,8 @@ if test x"$gdb_cv_os_cygwin" = xyes; then
fi fi
# The ser-tcp.c module requires sockets. # The ser-tcp.c module requires sockets.
case ${host} in # Note that WIN32APILIBS is set by GDB_AC_COMMON.
*mingw32*) WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
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)
# Add ELF support to GDB, but only if BFD includes ELF support. # 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, GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,

View File

@ -1,3 +1,9 @@
2020-01-14 Tom Tromey <tom@tromey.com>
* configure.ac (LIBS): Use WIN32APILIBS.
(USE_WIN32API): Don't define.
* configure: Rebuild.
2020-01-14 Tom Tromey <tom@tromey.com> 2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild. * configure: Rebuild.

View File

@ -6959,6 +6959,16 @@ _ACEOF
fi 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 "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
$as_echo_n "checking for nl_langinfo and CODESET... " >&6; } $as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
@ -8705,19 +8715,14 @@ esac
if test "${srv_mingwce}" = "yes"; then if test "${srv_mingwce}" = "yes"; then
LIBS="$LIBS -lws2" LIBS="$LIBS -lws2"
elif test "${srv_mingw}" = "yes"; then 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 elif test "${srv_qnx}" = "yes"; then
LIBS="$LIBS -lsocket" LIBS="$LIBS -lsocket"
elif test "${srv_lynxos}" = "yes"; then elif test "${srv_lynxos}" = "yes"; then
LIBS="$LIBS -lnetinet" LIBS="$LIBS -lnetinet"
fi fi
if test "${srv_mingw}" = "yes"; then
$as_echo "#define USE_WIN32API 1" >>confdefs.h
fi
if test "${srv_linux_usrregs}" = "yes"; then if test "${srv_linux_usrregs}" = "yes"; then
$as_echo "#define HAVE_LINUX_USRREGS 1" >>confdefs.h $as_echo "#define HAVE_LINUX_USRREGS 1" >>confdefs.h

View File

@ -248,21 +248,14 @@ esac
if test "${srv_mingwce}" = "yes"; then if test "${srv_mingwce}" = "yes"; then
LIBS="$LIBS -lws2" LIBS="$LIBS -lws2"
elif test "${srv_mingw}" = "yes"; then 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 elif test "${srv_qnx}" = "yes"; then
LIBS="$LIBS -lsocket" LIBS="$LIBS -lsocket"
elif test "${srv_lynxos}" = "yes"; then elif test "${srv_lynxos}" = "yes"; then
LIBS="$LIBS -lnetinet" LIBS="$LIBS -lnetinet"
fi 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 if test "${srv_linux_usrregs}" = "yes"; then
AC_DEFINE(HAVE_LINUX_USRREGS, 1, AC_DEFINE(HAVE_LINUX_USRREGS, 1,
[Define if the target supports PTRACE_PEEKUSR for register ] [Define if the target supports PTRACE_PEEKUSR for register ]

View File

@ -21,6 +21,18 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_HEADER_STDC AC_HEADER_STDC
AC_FUNC_ALLOCA 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 Note that this requires codeset.m4, which is included
dnl by the users of common.m4. dnl by the users of common.m4.
AM_LANGINFO_CODESET AM_LANGINFO_CODESET