diff options
author | Mike Frysinger <vapier@gentoo.org> | 2024-01-01 23:15:46 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-02 00:29:29 -0500 |
commit | d472066471d9c932cc34e1097a8c53a902781cce (patch) | |
tree | 59013af44a3dfff393d145c31bb6b0bc30bd30f3 /sim/m4 | |
parent | bc756034ee870319fffc2b03c3ca18391823b51a (diff) | |
download | binutils-d472066471d9c932cc34e1097a8c53a902781cce.zip binutils-d472066471d9c932cc34e1097a8c53a902781cce.tar.gz binutils-d472066471d9c932cc34e1097a8c53a902781cce.tar.bz2 |
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.
Diffstat (limited to 'sim/m4')
-rw-r--r-- | sim/m4/sim_ac_platform.m4 | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index f453217..dcab5b2 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 |