From patchwork Tue Jan 2 05:30:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83099 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B12EE385843E for ; Tue, 2 Jan 2024 06:31:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 201E43858C41 for ; Tue, 2 Jan 2024 06:30:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 201E43858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 201E43858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; cv=none; b=js7BdceZuDQBBdOxAlRESUgENSZIOK30zaZWdxH6hF9HXhaWW5nwMr5PqgFlBqvfteJ5oh/J23P+45yaQsMKHfVIBgvFzE6/YvU5379sBRSXzQalId7rrMGqlsm4uy3mBWawSMmbShm1Uh0CZP8LPi/jDJUYQO8PlQZ+Ha/LZYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; c=relaxed/simple; bh=kYAsqK+P4v3QZqAeHEiEEfVwX9ChyZm6vAsF1oK2cW0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kCBkeBirChpWdRT/wW4La2h4JDEazvgxZbGyKExgf3QDPIS2tMk9H3Xd4T9Ywvp0wuXcSIQtHilzxQr+T9xHHy0JyRkX49cvxp9DA8wv3hj0NgdbPVoOS62H1u3BseT4QUZki8uRlFwa+OPBYloBXEpNKlsc8ufmKN1WszApx7c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id A846E3408DD; Tue, 2 Jan 2024 06:30:31 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 2/5] sim: ppc: merge System V semaphores checks Date: Tue, 2 Jan 2024 00:30:23 -0500 Message-ID: <20240102053026.20425-2-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102053026.20425-1-vapier@gentoo.org> References: <20240102053026.20425-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Compile tests can use earlier defines, so hoist the HAVE_UNION_SEMUN define to before the semaphore check, and use it in the test so that we can merge the 2 versions into one. This also defines HAVE_UNION_SEMUN even when ac_cv_sysv_sem is not set, but that's OK as this define is only about a type existing, not about whether the overall code is usable. --- sim/ppc/configure | 54 ++++---------------------------------------- sim/ppc/configure.ac | 42 +++++++--------------------------- 2 files changed, 13 insertions(+), 83 deletions(-) diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 1f61ff1bacef..50afce74303d 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -105,33 +105,12 @@ AC_CACHE_CHECK([if union semun defined], [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 ]) +]) - -if test "$ac_cv_has_union_semun" = "yes"; then - AC_CACHE_CHECK(whether System V semaphores are supported, - ac_cv_sysv_sem, - [ - AC_TRY_RUN( - [ - #include - #include - #include - int main () { - union semun arg ; - - int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); - if (id == -1) - exit(1); - arg.val = 0; /* avoid implicit type cast to union */ - if (semctl(id, 0, IPC_RMID, arg) == -1) - exit(1); - exit(0); - } - ], - ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) - ]) -else # semun is not defined - AC_CACHE_CHECK(whether System V semaphores are supported, +AC_CACHE_CHECK([whether System V semaphores are supported], ac_cv_sysv_sem, [ AC_TRY_RUN( @@ -139,11 +118,13 @@ else # semun is not defined #include #include #include +#ifndef HAVE_UNION_SEMUN union semun { int val; struct semid_ds *buf; ushort *array; }; +#endif int main () { union semun arg ; @@ -157,8 +138,7 @@ else # semun is not defined } ], ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) - ]) -fi +]) AC_CACHE_CHECK(whether System V shared memory is supported, ac_cv_sysv_shm, @@ -185,12 +165,6 @@ else sim_sysv_ipc_hw=""; fi -if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then - AC_DEFINE(HAVE_UNION_SEMUN, 1, - [Define if union semun is defined in ]) -fi - - 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}"