aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2024-01-01 20:22:45 -0500
committerMike Frysinger <vapier@gentoo.org>2024-01-01 20:24:00 -0500
commit60fffa9d7faa944b764c0a99099bb849135483f3 (patch)
treeb55ff6754d608e566407aba43499c6c3d6e12b5f
parent8a24c85853650c92d89d97144a768c9e225c5134 (diff)
sim: ppc: always compile in the sysv sem & shm device filesusers/vapier/sim/doc
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.
-rw-r--r--sim/ppc/config.in6
-rwxr-xr-xsim/ppc/configure18
-rw-r--r--sim/ppc/configure.ac16
-rw-r--r--sim/ppc/hw_sem.c10
-rw-r--r--sim/ppc/hw_shm.c10
5 files changed, 46 insertions, 14 deletions
diff --git a/sim/ppc/config.in b/sim/ppc/config.in
index 4f28271351a..c1105f257fa 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -24,6 +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
diff --git a/sim/ppc/configure b/sim/ppc/configure
index 7104a998681..ab908604c5a 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -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
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index b78a09d9b58..9b01aede82c 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -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
diff --git a/sim/ppc/hw_sem.c b/sim/ppc/hw_sem.c
index 937e2ad6f81..c43af3b1d9e 100644
--- a/sim/ppc/hw_sem.c
+++ b/sim/ppc/hw_sem.c
@@ -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_ */
diff --git a/sim/ppc/hw_shm.c b/sim/ppc/hw_shm.c
index c4d5cae8345..0f78ae8c4a9 100644
--- a/sim/ppc/hw_shm.c
+++ b/sim/ppc/hw_shm.c
@@ -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_ */