public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim: bfin: move pkg-config & SDL checks to common code
@ 2021-06-26 21:07 Mike Frysinger
  2021-06-26 21:07 ` [PATCH 2/2] sim: erc32: merge with common configure script Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-06-26 21:07 UTC (permalink / raw)
  To: gdb-patches

This reduces the unique logic in bfin/configure to make it easier to
(eventually) unify it entirely.
---
 sim/Makefile.in            |    6 +
 sim/aclocal.m4             |    1 +
 sim/arch-subdir.mk.in      |    2 +
 sim/bfin/Makefile.in       |    4 +-
 sim/bfin/aclocal.m4        |    1 -
 sim/bfin/configure         | 1181 +-----------------------------------
 sim/bfin/configure.ac      |   10 -
 sim/configure              |  285 ++++++++-
 sim/m4/sim_ac_platform.m4  |    9 +
 sim/m4/sim_ac_toolchain.m4 |    1 +
 10 files changed, 304 insertions(+), 1196 deletions(-)

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index f145f1a3c6bd..0689dbc29ed1 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -49,6 +49,8 @@ zlibdir = @zlibdir@
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
 INTL_CFLAGS = @INCINTL@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
 
 COMMON_LIBS = @LIBS@
 WARN_CFLAGS = @WARN_CFLAGS@
diff --git a/sim/bfin/Makefile.in b/sim/bfin/Makefile.in
index 57b9b5eb0625..f61e1e1206f0 100644
--- a/sim/bfin/Makefile.in
+++ b/sim/bfin/Makefile.in
@@ -59,8 +59,8 @@ SIM_EXTRA_HW_DEVICES = \
 	bfin_wp \
 	eth_phy
 
-SIM_EXTRA_CFLAGS = @SDL_CFLAGS@
-SIM_EXTRA_LIBS = @SDL_LIBS@ -lm
+SIM_EXTRA_CFLAGS = $(SDL_CFLAGS)
+SIM_EXTRA_LIBS = $(SDL_LIBS) -lm
 
 ## COMMON_POST_CONFIG_FRAG
 
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index ab3bd5b0b99d..6cf5c4879584 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -4,14 +4,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
 SIM_AC_OPTION_DEFAULT_MODEL(bf537)
 
-PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES(SDL, sdl, [
-	AC_CHECK_LIB(dl, dlopen, [
-		SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL"
-		SDL_LIBS="-ldl"
-		], [SDL_CFLAGS= SDL_LIBS=])
-	], [:])
-AC_SUBST(SDL_CFLAGS)
-AC_SUBST(SDL_LIBS)
-
 SIM_AC_OUTPUT
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index b7573567d24c..2a84a0130a33 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -162,4 +162,13 @@ AC_CHECK_LIB(socket, bind)
 AC_CHECK_LIB(nsl, gethostbyname)
 AC_CHECK_LIB(m, fabs)
 AC_CHECK_LIB(m, log2)
+
+PKG_CHECK_MODULES(SDL, sdl, [dnl
+  AC_CHECK_LIB(dl, dlopen, [dnl
+    SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL"
+    SDL_LIBS="-ldl"
+    ], [SDL_CFLAGS= SDL_LIBS=])
+  ], [:])
+AC_SUBST(SDL_CFLAGS)
+AC_SUBST(SDL_LIBS)
 ])
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
index 47b992880f07..fdd540606072 100644
--- a/sim/m4/sim_ac_toolchain.m4
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -49,6 +49,7 @@ AC_SUBST(LDFLAGS_FOR_BUILD)
 AC_SUBST(CFLAGS)
 AC_CHECK_TOOL(AR, ar)
 AC_PROG_RANLIB
+PKG_PROG_PKG_CONFIG
 
 # Require C11 or newer.  Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
 # AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] sim: erc32: merge with common configure script
  2021-06-26 21:07 [PATCH 1/2] sim: bfin: move pkg-config & SDL checks to common code Mike Frysinger
@ 2021-06-26 21:07 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-06-26 21:07 UTC (permalink / raw)
  To: gdb-patches

Move the unique library tests to the common code so we can delete
the erc32 configure logic entirely.
---
 sim/Makefile.in           |    8 +-
 sim/arch-subdir.mk.in     |    3 +
 sim/configure             |  165 +-
 sim/configure.ac          |    2 +-
 sim/erc32/Makefile.in     |    4 -
 sim/erc32/aclocal.m4      |   15 -
 sim/erc32/configure       | 4233 -------------------------------------
 sim/erc32/configure.ac    |   47 -
 sim/m4/sim_ac_platform.m4 |   28 +
 9 files changed, 200 insertions(+), 4305 deletions(-)
 delete mode 100644 sim/erc32/aclocal.m4
 delete mode 100755 sim/erc32/configure
 delete mode 100644 sim/erc32/configure.ac

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index 0689dbc29ed1..efd91e76b1c3 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -51,6 +51,9 @@ LIBINTL_DEP = @LIBINTL_DEP@
 INTL_CFLAGS = @INCINTL@
 SDL_CFLAGS = @SDL_CFLAGS@
 SDL_LIBS = @SDL_LIBS@
+TERMCAP_LIB = @TERMCAP_LIB@
+READLINE_LIB = @READLINE_LIB@
+READLINE_CFLAGS = @READLINE_CFLAGS@
 
 COMMON_LIBS = @LIBS@
 WARN_CFLAGS = @WARN_CFLAGS@
diff --git a/sim/configure.ac b/sim/configure.ac
index 3632b559bf0f..15b2b65c87e8 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -139,7 +139,7 @@ if test "${enable_sim}" != no; then
     SIM_TARGET([rl78-*-*], [rl78])
     SIM_TARGET([rx-*-*], [rx])
     SIM_TARGET([sh*-*-*], [sh])
-    SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32], [true])
+    SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32])
     SIM_TARGET([powerpc*-*-*], [ppc], [true])
     SIM_TARGET([v850*-*-*], [v850], [true], [sim_igen=yes])
   done
diff --git a/sim/erc32/Makefile.in b/sim/erc32/Makefile.in
index 278b4792daeb..9ca0e3519a27 100644
--- a/sim/erc32/Makefile.in
+++ b/sim/erc32/Makefile.in
@@ -18,11 +18,7 @@
 
 ## COMMON_PRE_CONFIG_FRAG
 
-TERMCAP_LIB = @TERMCAP@
-
 READLINE_SRC = $(srcroot)/readline/readline
-READLINE_LIB = @READLINE@
-READLINE_CFLAGS = @READLINE_CFLAGS@
 
 SIM_OBJS = exec.o erc32.o func.o help.o float.o interf.o
 SIM_RUN_OBJS = sis.o
diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
deleted file mode 100644
index db6b98efa2e4..000000000000
--- a/sim/erc32/configure.ac
+++ /dev/null
@@ -1,47 +0,0 @@
-dnl Copyright (C) 1996-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 Process this file with autoconf to produce a configure script.
-AC_INIT(Makefile.in)
-AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-
-# In the Cygwin environment, we need some additional flags.
-AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin,
-[AC_EGREP_CPP(lose, [
-#ifdef __CYGWIN__
-lose
-#endif],[sim_cv_os_cygwin=yes],[sim_cv_os_cygwin=no])])
-
-# Keep in sync with gdb's configure.ac list.
-AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses],
-  [TERMCAP=$ac_cv_search_tgetent], [TERMCAP=""])
-if test x$sim_cv_os_cygwin = xyes; then
-  TERMCAP="${TERMCAP} -luser32"
-fi
-AC_SUBST(TERMCAP)
-
-# We prefer the in-tree readline.  Top-level dependencies make sure
-# src/readline (if it's there) is configured before src/sim.
-if test -r ../../readline/Makefile; then
-  READLINE=../../readline/readline/libreadline.a
-  READLINE_CFLAGS='-I$(READLINE_SRC)/..'
-else
-  AC_CHECK_LIB(readline, readline, READLINE=-lreadline,
-	       AC_ERROR([the required "readline" library is missing]), $TERMCAP)
-  READLINE_CFLAGS=
-fi
-AC_SUBST(READLINE)
-AC_SUBST(READLINE_CFLAGS)
-SIM_AC_OUTPUT
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index 2a84a0130a33..b0abe62a51f3 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -171,4 +171,32 @@ PKG_CHECK_MODULES(SDL, sdl, [dnl
   ], [:])
 AC_SUBST(SDL_CFLAGS)
 AC_SUBST(SDL_LIBS)
+
+dnl In the Cygwin environment, we need some additional flags.
+AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin,
+[AC_EGREP_CPP(lose, [
+#ifdef __CYGWIN__
+lose
+#endif],[sim_cv_os_cygwin=yes],[sim_cv_os_cygwin=no])])
+
+dnl Keep in sync with gdb's configure.ac list.
+AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses],
+  [TERMCAP_LIB=$ac_cv_search_tgetent], [TERMCAP_LIB=""])
+if test x$sim_cv_os_cygwin = xyes; then
+  TERMCAP_LIB="${TERMCAP_LIB} -luser32"
+fi
+AC_SUBST(TERMCAP_LIB)
+
+dnl We prefer the in-tree readline.  Top-level dependencies make sure
+dnl src/readline (if it's there) is configured before src/sim.
+if test -r ../readline/Makefile; then
+  READLINE_LIB=../../readline/readline/libreadline.a
+  READLINE_CFLAGS='-I$(READLINE_SRC)/..'
+else
+  AC_CHECK_LIB(readline, readline, READLINE_LIB=-lreadline,
+	       AC_ERROR([the required "readline" library is missing]), $TERMCAP_LIB)
+  READLINE_CFLAGS=
+fi
+AC_SUBST(READLINE_LIB)
+AC_SUBST(READLINE_CFLAGS)
 ])
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-26 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 21:07 [PATCH 1/2] sim: bfin: move pkg-config & SDL checks to common code Mike Frysinger
2021-06-26 21:07 ` [PATCH 2/2] sim: erc32: merge with common configure script Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).