aboutsummaryrefslogtreecommitdiff
path: root/sim/m4/sim_ac_platform.m4
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2023-01-04 01:33:29 +0000
committerTsukasa OI <research_trasio@irq.a4lg.com>2023-01-05 03:31:42 +0000
commit9f046489d0e3c4f5128a128ba3ecda3e45bc2544 (patch)
treebbe4fc8e86ab830257a58f8a9895f415832e3722 /sim/m4/sim_ac_platform.m4
parent7cbf35923d31f1f02e69131a9e0f6f065ad8053c (diff)
downloadbinutils-9f046489d0e3c4f5128a128ba3ecda3e45bc2544.zip
binutils-9f046489d0e3c4f5128a128ba3ecda3e45bc2544.tar.gz
binutils-9f046489d0e3c4f5128a128ba3ecda3e45bc2544.tar.bz2
sim: Move getopt checking inside SIM_AC_PLATFORM
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.
Diffstat (limited to 'sim/m4/sim_ac_platform.m4')
-rw-r--r--sim/m4/sim_ac_platform.m414
1 files changed, 14 insertions, 0 deletions
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index 1ea51f0..6356a80 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 <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
])