public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: ppc: hoist sysv tests to top-level
@ 2024-01-02  6:31 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2024-01-02  6:31 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d472066471d9c932cc34e1097a8c53a902781cce

commit d472066471d9c932cc34e1097a8c53a902781cce
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Mon Jan 1 23:15:46 2024 -0500

    sim: ppc: hoist sysv tests to top-level
    
    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.

Diff:
---
 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(-)

diff --git a/sim/config.h.in b/sim/config.h.in
index c51b7bcb4aa..c276035ea9a 100644
--- a/sim/config.h.in
+++ b/sim/config.h.in
@@ -273,6 +273,12 @@
 /* Define to 1 if you have the `symlink' function. */
 #undef HAVE_SYMLINK
 
+/* Define if System V semaphores are supported */
+#undef HAVE_SYSV_SEM
+
+/* Define if System V shared memory is supported */
+#undef HAVE_SYSV_SHM
+
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 #undef HAVE_SYS_DIR_H
@@ -361,6 +367,9 @@
 /* Define to 1 if you have the `umask' function. */
 #undef HAVE_UMASK
 
+/* Define if union semun is defined in <sys/sem.h> */
+#undef HAVE_UNION_SEMUN
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
diff --git a/sim/configure b/sim/configure
index 9fae4e9a386..a30598675ca 100755
--- a/sim/configure
+++ b/sim/configure
@@ -8625,6 +8625,134 @@ _ACEOF
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if union semun defined" >&5
+$as_echo_n "checking if union semun defined... " >&6; }
+if ${sim_cv_has_union_semun+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+int
+main ()
+{
+
+  union semun arg;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  sim_cv_has_union_semun="yes"
+else
+  sim_cv_has_union_semun="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_has_union_semun" >&5
+$as_echo "$sim_cv_has_union_semun" >&6; }
+if test x"$sim_cv_has_union_semun" = x"yes"; then :
+
+$as_echo "#define HAVE_UNION_SEMUN 1" >>confdefs.h
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V semaphores are supported" >&5
+$as_echo_n "checking whether System V semaphores are supported... " >&6; }
+if ${sim_cv_sysv_sem+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  #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
+int
+main ()
+{
+
+  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;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  sim_cv_sysv_sem="yes"
+else
+  sim_cv_sysv_sem="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_sysv_sem" >&5
+$as_echo "$sim_cv_sysv_sem" >&6; }
+if test x"$sim_cv_sysv_sem" = x"yes"; then :
+
+$as_echo "#define HAVE_SYSV_SEM 1" >>confdefs.h
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V shared memory is supported" >&5
+$as_echo_n "checking whether System V shared memory is supported... " >&6; }
+if ${sim_cv_sysv_shm+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+int
+main ()
+{
+
+  int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400);
+  if (id == -1)
+    return 1;
+  if (shmctl(id, IPC_RMID, 0) == -1)
+    return 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  sim_cv_sysv_shm="yes"
+else
+  sim_cv_sysv_shm="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_sysv_shm" >&5
+$as_echo "$sim_cv_sysv_shm" >&6; }
+if test x"$sim_cv_sysv_shm" = x"yes"; then :
+
+$as_echo "#define HAVE_SYSV_SHM 1" >>confdefs.h
+
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
 $as_echo_n "checking type of array argument to getgroups... " >&6; }
 if ${ac_cv_type_getgroups+:} false; then :
@@ -12292,7 +12420,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12295 "configure"
+#line 12423 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12398,7 +12526,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12401 "configure"
+#line 12529 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index f45321763fa..dcab5b2862d 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/config.in b/sim/ppc/config.in
index c1105f257fa..9e3d284db82 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -24,21 +24,12 @@
 /* Define if struct statfs is defined in <sys/mount.h> */
 #undef HAVE_STRUCT_STATFS
 
-/* Define if System V semaphores are supported */
-#undef HAVE_SYSV_SEM
-
-/* Define if System V shared memory is supported */
-#undef HAVE_SYSV_SHM
-
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
-/* Define if union semun is defined in <sys/sem.h> */
-#undef HAVE_UNION_SEMUN
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
diff --git a/sim/ppc/configure b/sim/ppc/configure
index ab908604c5a..e945220713c 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -3142,132 +3142,6 @@ esac
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if union semun defined" >&5
-$as_echo_n "checking if union semun defined... " >&6; }
-if ${ac_cv_has_union_semun+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-int
-main ()
-{
-union semun arg ;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_has_union_semun="yes"
-else
-  ac_cv_has_union_semun="no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_has_union_semun" >&5
-$as_echo "$ac_cv_has_union_semun" >&6; }
-if test x"$ac_cv_has_union_semun" = x"yes"; then :
-
-$as_echo "#define HAVE_UNION_SEMUN 1" >>confdefs.h
-
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V semaphores are supported" >&5
-$as_echo_n "checking whether System V semaphores are supported... " >&6; }
-if ${ac_cv_sysv_sem+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-  #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
-int
-main ()
-{
-
-  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;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sysv_sem="yes"
-else
-  ac_cv_sysv_sem="no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_sem" >&5
-$as_echo "$ac_cv_sysv_sem" >&6; }
-if test x"$ac_cv_sysv_sem" = x"yes"; then :
-
-$as_echo "#define HAVE_SYSV_SEM 1" >>confdefs.h
-
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V shared memory is supported" >&5
-$as_echo_n "checking whether System V shared memory is supported... " >&6; }
-if ${ac_cv_sysv_shm+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-int
-main ()
-{
-
-  int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400);
-  if (id == -1)
-    return 1;
-  if (shmctl(id, IPC_RMID, 0) == -1)
-    return 1;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sysv_shm="yes"
-else
-  ac_cv_sysv_shm="no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_shm" >&5
-$as_echo "$ac_cv_sysv_shm" >&6; }
-if test x"$ac_cv_sysv_shm" = x"yes"; then :
-
-$as_echo "#define HAVE_SYSV_SHM 1" >>confdefs.h
-
-
-fi
-
 # Check whether --enable-sim-hardware was given.
 if test "${enable_sim_hardware+set}" = set; then :
   enableval=$enable_sim_hardware; hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
@@ -3499,6 +3373,7 @@ ac_config_headers="$ac_config_headers config.h:config.in"
 sim_termio=""
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios" >&5
 $as_echo_n "checking for struct termios... " >&6; }
+
 if ${ac_cv_termios_struct+:} false; then :
   $as_echo_n "(cached) " >&6
 else
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9b01aede82c..06be2c96076 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.],

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-02  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02  6:31 [binutils-gdb] sim: ppc: hoist sysv tests to top-level Michael 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).