]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: ppc: always compile in the sysv sem & shm device files
authorMike Frysinger <vapier@gentoo.org>
Tue, 2 Jan 2024 01:22:45 +0000 (20:22 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 2 Jan 2024 05:29:28 +0000 (00:29 -0500)
Move the stub logic to the device files themselves.  This makes the
configure & build logic more static which will make it easier to move
to the top-level build, and matches what we did with the common/ hw
tree already.

This also decouples the logic from the two -- in the past, you needed
both sem & shm in order to enable the device models, but now each one
is tied to its own independent knob.  Practically speaking, this will
probably not make a difference, but it simplifies the build a bit.

sim/ppc/config.in
sim/ppc/configure
sim/ppc/configure.ac
sim/ppc/hw_sem.c
sim/ppc/hw_shm.c

index 4f28271351ae3dc0f2d2665da35b5b07f17ee260..c1105f257fae4632c60a24ebf6e468a94f33b70c 100644 (file)
 /* 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
 
index 7104a998681d443a838cc5c6845e17b5c7f60447..ab908604c5a865893c65204ab1d1d7732929cee9 100755 (executable)
@@ -3220,6 +3220,12 @@ 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; }
@@ -3255,16 +3261,16 @@ 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
+
 
-if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
-  sim_sysv_ipc_hw=",sem,shm";
-else
-  sim_sysv_ipc_hw="";
 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${sim_sysv_ipc_hw}"
+  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"
 case "${enableval}" in
   yes) ;;
   no)  as_fn_error $? "\"List of hardware must be specified for --enable-sim-hardware\"" "$LINENO" 5; hardware="";;
@@ -3278,7 +3284,7 @@ if test x"$silent" != x"yes" && test x"$hardware" != x""; then
   echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
 fi
 else
-  hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
+  hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
 if test x"$silent" != x"yes"; then
index b78a09d9b587e1b05fb0c8a938458e4e90855a3d..9b01aede82cd29cd343ebe431e7d4dc9263bc991 100644 (file)
@@ -131,6 +131,9 @@ AC_CACHE_CHECK([whether System V semaphores are supported],
   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,
@@ -144,16 +147,13 @@ ac_cv_sysv_shm,
   if (shmctl(id, IPC_RMID, 0) == -1)
     return 1;
 ], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])])
-
-if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
-  sim_sysv_ipc_hw=",sem,shm";
-else
-  sim_sysv_ipc_hw="";
-fi
+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.],
-[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
+[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
 case "${enableval}" in
   yes) ;;
   no)  AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
@@ -165,7 +165,7 @@ sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
   echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
-fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
+fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
 if test x"$silent" != x"yes"; then
index 937e2ad6f812120c444514abf2684e866d43e731..c43af3b1d9ed1230e3fdce2294020ec5a648774c 100644 (file)
@@ -84,6 +84,8 @@
 
    */
 
+#ifdef HAVE_SYSV_SEM
+
 typedef struct _hw_sem_device {
   unsigned_word physical_address;
   key_t key;
@@ -278,4 +280,12 @@ const device_descriptor hw_sem_device_descriptor[] = {
   { NULL },
 };
 
+#else
+
+const device_descriptor hw_sem_device_descriptor[] = {
+  { NULL },
+};
+
+#endif /* HAVE_SYSV_SEM */
+
 #endif /* _HW_SEM_C_ */
index c4d5cae8345342dae12be0bd0744bd270bd013c5..0f78ae8c4a9aa76fe3624b7ecd62adfefe03dd59 100644 (file)
@@ -77,6 +77,8 @@
 
    */
 
+#ifdef HAVE_SYSV_SHM
+
 typedef struct _hw_shm_device {
   unsigned_word physical_address;
   char *shm_address;
@@ -222,4 +224,12 @@ const device_descriptor hw_shm_device_descriptor[] = {
   { NULL },
 };
 
+#else
+
+const device_descriptor hw_shm_device_descriptor[] = {
+  { NULL },
+};
+
+#endif /* HAVE_SYSV_SHM */
+
 #endif /* _HW_SHM_C_ */