public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Tsukasa OI <research_trasio@irq.a4lg.com>, gdb-patches@sourceware.org
Subject: [PATCH] sim: Move getopt checking inside SIM_AC_PLATFORM
Date: Wed,  4 Jan 2023 02:01:13 +0000	[thread overview]
Message-ID: <624505e8cc2a5551bef5de4e7c5fa0a0c21f3875.1672797663.git.research_trasio@irq.a4lg.com> (raw)

From: Tsukasa OI <research_trasio@irq.a4lg.com>

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 <unistd.h>
+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 <unistd.h>
-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 <unistd.h>], [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 <unistd.h> 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 <unistd.h>], [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 <unistd.h> in the expected format?])
+fi
 ])

base-commit: e346efcde0fd60c8b010cfc5b14dc0e725bc9e75
-- 
2.39.0


             reply	other threads:[~2023-01-04  2:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  2:01 Tsukasa OI [this message]
2023-01-04  3:07 ` Mike Frysinger
2023-01-05  3:38   ` Tsukasa OI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=624505e8cc2a5551bef5de4e7c5fa0a0c21f3875.1672797663.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).