From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B7d7ChTetGPS4Q4AWB0awg (envelope-from ) for ; Tue, 03 Jan 2023 21:01:56 -0500 Received: by simark.ca (Postfix, from userid 112) id 202931E222; Tue, 3 Jan 2023 21:01:56 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=fHsm76im; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B368A1E110 for ; Tue, 3 Jan 2023 21:01:55 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E1B343858C78 for ; Wed, 4 Jan 2023 02:01:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1B343858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672797714; bh=FOaRVhpVyN5AXOQVwkTSsg6KOCQwn0gt1KJGOP93AT4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=fHsm76imoAsqE1anqZMB3QHgaq7ii6HCMonPYUFyH8ge/N5akk41YeXEUn9xTWm5n Od5p3jRsdIhEfne6rREewXoJlVAImsGdgVEfPUtWAikvq5xJDwUr0EEDaiq9hWflQj zZr4fUPZKOuj2MNhvfo6guYKDhBKZ1irKUJAJ4co= Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id B9DE23858D1E for ; Wed, 4 Jan 2023 02:01:31 +0000 (GMT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id BDD47300089; Wed, 4 Jan 2023 02:01:28 +0000 (UTC) To: Mike Frysinger Cc: Tsukasa OI , gdb-patches@sourceware.org Subject: [PATCH] sim: Move getopt checking inside SIM_AC_PLATFORM Date: Wed, 4 Jan 2023 02:01:13 +0000 Message-Id: <624505e8cc2a5551bef5de4e7c5fa0a0c21f3875.1672797663.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tsukasa OI via Gdb-patches Reply-To: Tsukasa OI Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" From: Tsukasa OI This commit moves getopt declaration checker originally in sim/ configure.ac; added in commit 340aa4f6872c ("sim: Check known getopt definition existence") to sim/m4/sim_ac_platform.m4 (inside the SIM_AC_PLATFORM macro). It also regenerates configuration files using the maintainer mode. --- sim/configure | 64 +++++++++++++++++++-------------------- sim/configure.ac | 10 ------ sim/m4/sim_ac_platform.m4 | 13 ++++++++ 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/sim/configure b/sim/configure index 57223f452450..bcbe473bb042 100755 --- a/sim/configure +++ b/sim/configure @@ -13517,6 +13517,38 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a known getopt prototype in unistd.h" >&5 +$as_echo_n "checking for a known getopt prototype in unistd.h... " >&6; } +if ${sim_cv_decl_getopt_unistd_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +extern int getopt (int, char *const*, const char *); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sim_cv_decl_getopt_unistd_h=yes +else + sim_cv_decl_getopt_unistd_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_decl_getopt_unistd_h" >&5 +$as_echo "$sim_cv_decl_getopt_unistd_h" >&6; } +if test $sim_cv_decl_getopt_unistd_h = yes; then + +$as_echo "#define HAVE_DECL_GETOPT 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -16300,38 +16332,6 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a known getopt prototype in unistd.h" >&5 -$as_echo_n "checking for a known getopt prototype in unistd.h... " >&6; } -if ${sim_cv_decl_getopt_unistd_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -extern int getopt (int, char *const*, const char *); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - sim_cv_decl_getopt_unistd_h=yes -else - sim_cv_decl_getopt_unistd_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_decl_getopt_unistd_h" >&5 -$as_echo "$sim_cv_decl_getopt_unistd_h" >&6; } -if test $sim_cv_decl_getopt_unistd_h = yes; then - -$as_echo "#define HAVE_DECL_GETOPT 1" >>confdefs.h - -fi - diff --git a/sim/configure.ac b/sim/configure.ac index 45a9e1303045..714754ea9f3c 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -187,16 +187,6 @@ SIM_AC_OPTION_STDIO SIM_AC_OPTION_TRACE SIM_AC_OPTION_WARNINGS -AC_MSG_CHECKING(for a known getopt prototype in unistd.h) -AC_CACHE_VAL(sim_cv_decl_getopt_unistd_h, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [extern int getopt (int, char *const*, const char *);])], -sim_cv_decl_getopt_unistd_h=yes, sim_cv_decl_getopt_unistd_h=no)]) -AC_MSG_RESULT($sim_cv_decl_getopt_unistd_h) -if test $sim_cv_decl_getopt_unistd_h = yes; then - AC_DEFINE([HAVE_DECL_GETOPT], 1, - [Is the prototype for getopt in in the expected format?]) -fi - dnl These are unfortunate. They are conditionally called by other sim macros dnl but always used by common/Make-common.in. So we have to subst here even dnl when the rest of the code is in the respective macros. Once we merge the diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index 1ea51f02c48c..97e5e910e49b 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -201,4 +201,17 @@ else fi AC_SUBST(READLINE_LIB) AC_SUBST(READLINE_CFLAGS) + +dnl Determine whether we have a known getopt prototype in unistd.h +dnl to make sure that we have correct getopt declaration on +dnl include/getopt.h. +AC_MSG_CHECKING(for a known getopt prototype in unistd.h) +AC_CACHE_VAL(sim_cv_decl_getopt_unistd_h, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [extern int getopt (int, char *const*, const char *);])], +sim_cv_decl_getopt_unistd_h=yes, sim_cv_decl_getopt_unistd_h=no)]) +AC_MSG_RESULT($sim_cv_decl_getopt_unistd_h) +if test $sim_cv_decl_getopt_unistd_h = yes; then + AC_DEFINE([HAVE_DECL_GETOPT], 1, + [Is the prototype for getopt in in the expected format?]) +fi ]) base-commit: e346efcde0fd60c8b010cfc5b14dc0e725bc9e75 -- 2.39.0