[PATCH/submitted,5/5] sim: ppc: hoist sysv tests to top-level

Message ID 20240102053026.20425-5-vapier@gentoo.org
State New
Headers
Series [PATCH/submitted,1/5] sim: ppc: fix bad AC_CACHE_CHECK call with semun |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Mike Frysinger Jan. 2, 2024, 5:30 a.m. UTC
  Now that the sysv tests turn into config.h defines and everything
checks that, we can move the tests to the top-level and out of the
ppc subdir.
---
 sim/config.h.in           |   9 +++
 sim/configure             | 132 +++++++++++++++++++++++++++++++++++++-
 sim/m4/sim_ac_platform.m4 |  55 ++++++++++++++++
 sim/ppc/config.in         |   9 ---
 sim/ppc/configure         | 127 +-----------------------------------
 sim/ppc/configure.ac      |  54 ----------------
 6 files changed, 195 insertions(+), 191 deletions(-)
  

Patch

diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index f45321763fa7..dcab5b2862d9 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -133,6 +133,61 @@  AC_CHECK_TYPES(socklen_t, [], [],
 #include <sys/socket.h>
 ])
 
+dnl Some System V related checks.
+AC_CACHE_CHECK([if union semun defined],
+  [sim_cv_has_union_semun],
+  [AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>], [
+  union semun arg;
+], [sim_cv_has_union_semun="yes"], [sim_cv_has_union_semun="no"])])
+AS_IF([test x"$sim_cv_has_union_semun" = x"yes"], [dnl
+  AC_DEFINE(HAVE_UNION_SEMUN, 1,
+	    [Define if union semun is defined in <sys/sem.h>])
+])
+
+AC_CACHE_CHECK([whether System V semaphores are supported],
+  [sim_cv_sysv_sem],
+  [AC_TRY_COMPILE([
+  #include <sys/types.h>
+  #include <sys/ipc.h>
+  #include <sys/sem.h>
+#ifndef HAVE_UNION_SEMUN
+  union semun {
+    int val;
+    struct semid_ds *buf;
+    ushort *array;
+  };
+#endif], [
+  union semun arg;
+  int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400);
+  if (id == -1)
+    return 1;
+  arg.val = 0; /* avoid implicit type cast to union */
+  if (semctl(id, 0, IPC_RMID, arg) == -1)
+    return 1;
+], [sim_cv_sysv_sem="yes"], [sim_cv_sysv_sem="no"])])
+AS_IF([test x"$sim_cv_sysv_sem" = x"yes"], [dnl
+  AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported])
+])
+
+AC_CACHE_CHECK([whether System V shared memory is supported],
+  [sim_cv_sysv_shm],
+  [AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>], [
+  int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400);
+  if (id == -1)
+    return 1;
+  if (shmctl(id, IPC_RMID, 0) == -1)
+    return 1;
+], [sim_cv_sysv_shm="yes"], [sim_cv_sysv_shm="no"])])
+AS_IF([test x"$sim_cv_sysv_shm" = x"yes"], [dnl
+  AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported])
+])
+
 dnl Types used by common code
 AC_TYPE_GETGROUPS
 AC_TYPE_MODE_T
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9b01aede82cd..06be2c960768 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -96,60 +96,6 @@  case "${target}" in
 esac
 ])dnl
 
-AC_CACHE_CHECK([if union semun defined],
-  [ac_cv_has_union_semun],
-  [AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>],
-[union semun arg ;],
-[ac_cv_has_union_semun="yes"],
-[ac_cv_has_union_semun="no"])])
-AS_IF([test x"$ac_cv_has_union_semun" = x"yes"], [dnl
-  AC_DEFINE(HAVE_UNION_SEMUN, 1,
-	    [Define if union semun is defined in <sys/sem.h>])
-])
-
-AC_CACHE_CHECK([whether System V semaphores are supported],
-  [ac_cv_sysv_sem],
-  [AC_TRY_COMPILE([
-  #include <sys/types.h>
-  #include <sys/ipc.h>
-  #include <sys/sem.h>
-#ifndef HAVE_UNION_SEMUN
-  union semun {
-    int val;
-    struct semid_ds *buf;
-    ushort *array;
-  };
-#endif], [
-  union semun arg;
-  int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400);
-  if (id == -1)
-    return 1;
-  arg.val = 0; /* avoid implicit type cast to union */
-  if (semctl(id, 0, IPC_RMID, arg) == -1)
-    return 1;
-], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])])
-AS_IF([test x"$ac_cv_sysv_sem" = x"yes"], [dnl
-  AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported])
-])
-
-AC_CACHE_CHECK(whether System V shared memory is supported,
-ac_cv_sysv_shm,
-[AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>], [
-  int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400);
-  if (id == -1)
-    return 1;
-  if (shmctl(id, IPC_RMID, 0) == -1)
-    return 1;
-], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])])
-AS_IF([test x"$ac_cv_sysv_shm" = x"yes"], [dnl
-  AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported])
-])
 
 AC_ARG_ENABLE(sim-hardware,
 [  --enable-sim-hardware=list		Specify the hardware to be included in the build.],