]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: Move getopt checking inside SIM_AC_PLATFORM
authorTsukasa OI <research_trasio@irq.a4lg.com>
Wed, 4 Jan 2023 01:33:29 +0000 (01:33 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Thu, 5 Jan 2023 03:31:42 +0000 (03:31 +0000)
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
sim/configure.ac
sim/m4/sim_ac_platform.m4

index 57223f4524507679cfa995c0623357f3d8418321..bcbe473bb042b5c79a9b1d3a33f4d91a1b6dcefe 100755 (executable)
 
 
 
+{ $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
-
 
 
 
index 45a9e1303045ec2dc61c864ccf4ac9601477ea4f..714754ea9f3c7ee1116699daef56f166fcd55d7c 100644 (file)
@@ -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
index 1ea51f02c48c45293f74171aa883d89a3b529db8..6356a80e16ff9e5b9fb353260167d608b366c48b 100644 (file)
@@ -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 <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
 ])