From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7896) id 9EAB63858D35; Thu, 5 Jan 2023 03:36:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EAB63858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672889773; bh=0o4/QJ6C7z5nKbzju7d9v6gtYyt1B7602U3nK6E29D8=; h=From:To:Subject:Date:From; b=EzkZkfi0ll/V0vl5tb7pfuv7TBnuP5CkswZT2SCodQEC9ZGTjD7h+nHKy/i9TX/K6 3pllNgZMaI+e+z10yEJAf2MhBbnP9I/soBXmGd0ZCSWwEIN82NbRjVSpIB+SddCd+D fxJH43GkXRZWnfFpOMQvUk3wAhmHAhb03PSAL3O8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tsukasa OI To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim: Move getopt checking inside SIM_AC_PLATFORM X-Act-Checkin: binutils-gdb X-Git-Author: Tsukasa OI X-Git-Refname: refs/heads/master X-Git-Oldrev: 7cbf35923d31f1f02e69131a9e0f6f065ad8053c X-Git-Newrev: 9f046489d0e3c4f5128a128ba3ecda3e45bc2544 Message-Id: <20230105033613.9EAB63858D35@sourceware.org> Date: Thu, 5 Jan 2023 03:36:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9f046489d0e3= c4f5128a128ba3ecda3e45bc2544 commit 9f046489d0e3c4f5128a128ba3ecda3e45bc2544 Author: Tsukasa OI Date: Wed Jan 4 01:33:29 2023 +0000 sim: Move getopt checking inside SIM_AC_PLATFORM =20 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). =20 It also regenerates configuration files using the maintainer mode. Diff: --- sim/configure | 64 +++++++++++++++++++++++--------------------= ---- sim/configure.ac | 10 -------- sim/m4/sim_ac_platform.m4 | 14 +++++++++++ 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/sim/configure b/sim/configure index 57223f45245..bcbe473bb04 100755 --- a/sim/configure +++ b/sim/configure @@ -13517,6 +13517,38 @@ fi =20 =20 =20 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a known getopt proto= type 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=3Dyes +else + sim_cv_decl_getopt_unistd_h=3Dno +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_unist= d_h" >&5 +$as_echo "$sim_cv_decl_getopt_unistd_h" >&6; } +if test $sim_cv_decl_getopt_unistd_h =3D yes; then + +$as_echo "#define HAVE_DECL_GETOPT 1" >>confdefs.h + +fi + =20 =20 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable mainta= iner-specific portions of Makefiles" >&5 @@ -16300,38 +16332,6 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; } fi =20 =20 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a known getopt proto= type 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=3Dyes -else - sim_cv_decl_getopt_unistd_h=3Dno -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_unist= d_h" >&5 -$as_echo "$sim_cv_decl_getopt_unistd_h" >&6; } -if test $sim_cv_decl_getopt_unistd_h =3D yes; then - -$as_echo "#define HAVE_DECL_GETOPT 1" >>confdefs.h - -fi - =20 =20 =20 diff --git a/sim/configure.ac b/sim/configure.ac index 45a9e130304..714754ea9f3 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 =20 -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 get= opt (int, char *const*, const char *);])], -sim_cv_decl_getopt_unistd_h=3Dyes, sim_cv_decl_getopt_unistd_h=3Dno)]) -AC_MSG_RESULT($sim_cv_decl_getopt_unistd_h) -if test $sim_cv_decl_getopt_unistd_h =3D 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 mac= ros dnl but always used by common/Make-common.in. So we have to subst here ev= en 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 1ea51f02c48..6356a80e16f 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -201,4 +201,18 @@ 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. The purpose of this is to sync with other Binutils +dnl components and this logic is copied from ld/configure.ac. +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 get= opt (int, char *const*, const char *);])], +sim_cv_decl_getopt_unistd_h=3Dyes, sim_cv_decl_getopt_unistd_h=3Dno)]) +AC_MSG_RESULT($sim_cv_decl_getopt_unistd_h) +if test $sim_cv_decl_getopt_unistd_h =3D yes; then + AC_DEFINE([HAVE_DECL_GETOPT], 1, + [Is the prototype for getopt in in the expected format?]) +fi ])