public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport
@ 2024-01-10  1:58 Mike Frysinger
  2024-01-10  1:58 ` [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE Mike Frysinger
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Mike Frysinger @ 2024-01-10  1:58 UTC (permalink / raw)
  To: gdb-patches

This is used by gdb, gdbsupport, and gdbserver.  We want to use it
in the sim tree too.  Move it to gdbsupport which is meant as the
common sharing space for these projects.
---
 gdb/acinclude.m4                 | 2 +-
 gdbserver/acinclude.m4           | 2 +-
 gdbsupport/Makefile.in           | 7 ++++---
 gdbsupport/acinclude.m4          | 2 +-
 {gdb => gdbsupport}/libiberty.m4 | 0
 5 files changed, 7 insertions(+), 6 deletions(-)
 rename {gdb => gdbsupport}/libiberty.m4 (100%)

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index d505fbbb2676..915082056dd9 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -48,7 +48,7 @@ m4_include([../config/zstd.m4])
 m4_include([../gdbsupport/common.m4])
 
 dnl For libiberty_INIT.
-m4_include(libiberty.m4)
+m4_include(../gdbsupport/libiberty.m4)
 
 dnl For GDB_AC_PTRACE.
 m4_include(../gdbsupport/ptrace.m4)
diff --git a/gdbserver/acinclude.m4 b/gdbserver/acinclude.m4
index 32d5d14ca6ee..db69b7d243b1 100644
--- a/gdbserver/acinclude.m4
+++ b/gdbserver/acinclude.m4
@@ -19,7 +19,7 @@ m4_include(../config/codeset.m4)
 m4_include(../gdbsupport/common.m4)
 
 dnl For libiberty_INIT.
-m4_include(../gdb/libiberty.m4)
+m4_include(../gdbsupport/libiberty.m4)
 
 dnl For GDB_AC_PTRACE.
 m4_include(../gdbsupport/ptrace.m4)
diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
index 070e36a6affa..23f980d1bc1d 100644
--- a/gdbsupport/Makefile.in
+++ b/gdbsupport/Makefile.in
@@ -128,9 +128,10 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/codeset.m4 \
 	$(top_srcdir)/../bfd/bfd.m4 $(top_srcdir)/common.m4 \
 	$(top_srcdir)/../config/ax_pthread.m4 \
 	$(top_srcdir)/../gdb/ax_cxx_compile_stdcxx.m4 \
-	$(top_srcdir)/../gdb/libiberty.m4 $(top_srcdir)/selftest.m4 \
-	$(top_srcdir)/ptrace.m4 $(top_srcdir)/compiler-type.m4 \
-	$(top_srcdir)/warning.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../gdbsupport/libiberty.m4 \
+	$(top_srcdir)/selftest.m4 $(top_srcdir)/ptrace.m4 \
+	$(top_srcdir)/compiler-type.m4 $(top_srcdir)/warning.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
diff --git a/gdbsupport/acinclude.m4 b/gdbsupport/acinclude.m4
index c6276149867e..584d392b996d 100644
--- a/gdbsupport/acinclude.m4
+++ b/gdbsupport/acinclude.m4
@@ -2,7 +2,7 @@ m4_include([../bfd/bfd.m4])
 m4_include([common.m4])
 m4_include([../config/ax_pthread.m4])
 m4_include([../gdb/ax_cxx_compile_stdcxx.m4])
-m4_include([../gdb/libiberty.m4])
+m4_include([../gdbsupport/libiberty.m4])
 m4_include([selftest.m4])
 m4_include([ptrace.m4])
 
diff --git a/gdb/libiberty.m4 b/gdbsupport/libiberty.m4
similarity index 100%
rename from gdb/libiberty.m4
rename to gdbsupport/libiberty.m4
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE
  2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
@ 2024-01-10  1:58 ` Mike Frysinger
  2024-01-10 18:18   ` Tom Tromey
  2024-01-10  1:58 ` [PATCH 3/5] sim: ppc: rework defines.h to handle HAVE symbols defined to 0 Mike Frysinger
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2024-01-10  1:58 UTC (permalink / raw)
  To: gdb-patches

Only check these decls once in case other m4 macros also look for them.
---
 gdb/configure           | 127 ++++++++++++++++++++++------------------
 gdbserver/configure     | 127 ++++++++++++++++++++++------------------
 gdbsupport/configure    | 127 ++++++++++++++++++++++------------------
 gdbsupport/libiberty.m4 |   7 ++-
 4 files changed, 211 insertions(+), 177 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 3db27c981494..c55d17df7356 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -29232,62 +29232,6 @@ done
 # Checks for declarations.  #
 # ------------------------- #
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-fi
-
-
-  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
-ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_BASENAME $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
 if test "x$ac_cv_have_decl_ffs" = xyes; then :
   ac_have_decl=1
@@ -29298,6 +29242,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_FFS $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_asprintf" = xyes; then :
   ac_have_decl=1
@@ -29308,6 +29253,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_ASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vasprintf" = xyes; then :
   ac_have_decl=1
@@ -29318,6 +29264,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_snprintf" = xyes; then :
   ac_have_decl=1
@@ -29328,6 +29275,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SNPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vsnprintf" = xyes; then :
   ac_have_decl=1
@@ -29339,7 +29287,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VSNPRINTF $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtol" = xyes; then :
   ac_have_decl=1
 else
@@ -29349,6 +29297,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoul" = xyes; then :
   ac_have_decl=1
@@ -29359,6 +29308,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOUL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoll" = xyes; then :
   ac_have_decl=1
@@ -29369,6 +29319,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOLL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoull" = xyes; then :
   ac_have_decl=1
@@ -29380,7 +29331,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOULL $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strverscmp" = xyes; then :
   ac_have_decl=1
 else
@@ -29392,6 +29343,66 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+  # Check for presence and size of long long.
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
+ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+
+
+
+
+
 
 ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_snprintf" = xyes; then :
diff --git a/gdbserver/configure b/gdbserver/configure
index f1292f9b7075..6a913189dc5a 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -13875,62 +13875,6 @@ done
 
 LIBS="$old_LIBS"
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-fi
-
-
-  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
-ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_BASENAME $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
 if test "x$ac_cv_have_decl_ffs" = xyes; then :
   ac_have_decl=1
@@ -13941,6 +13885,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_FFS $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_asprintf" = xyes; then :
   ac_have_decl=1
@@ -13951,6 +13896,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_ASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vasprintf" = xyes; then :
   ac_have_decl=1
@@ -13961,6 +13907,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_snprintf" = xyes; then :
   ac_have_decl=1
@@ -13971,6 +13918,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SNPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vsnprintf" = xyes; then :
   ac_have_decl=1
@@ -13982,7 +13930,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VSNPRINTF $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtol" = xyes; then :
   ac_have_decl=1
 else
@@ -13992,6 +13940,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoul" = xyes; then :
   ac_have_decl=1
@@ -14002,6 +13951,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOUL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoll" = xyes; then :
   ac_have_decl=1
@@ -14012,6 +13962,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOLL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoull" = xyes; then :
   ac_have_decl=1
@@ -14023,7 +13974,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOULL $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strverscmp" = xyes; then :
   ac_have_decl=1
 else
@@ -14035,6 +13986,66 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+  # Check for presence and size of long long.
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
+ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+
+
+
+
+
 
 ac_fn_c_check_decl "$LINENO" "perror" "ac_cv_have_decl_perror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_perror" = xyes; then :
diff --git a/gdbsupport/configure b/gdbsupport/configure
index b501b36373f7..83bc7ce83613 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -10417,62 +10417,6 @@ $as_echo "$LINGUAS" >&6; }
 
 fi
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-fi
-
-
-  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
-ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_BASENAME $ac_have_decl
-_ACEOF
 ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
 if test "x$ac_cv_have_decl_ffs" = xyes; then :
   ac_have_decl=1
@@ -10483,6 +10427,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_FFS $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_asprintf" = xyes; then :
   ac_have_decl=1
@@ -10493,6 +10438,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_ASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vasprintf" = xyes; then :
   ac_have_decl=1
@@ -10503,6 +10449,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VASPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_snprintf" = xyes; then :
   ac_have_decl=1
@@ -10513,6 +10460,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SNPRINTF $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
 if test "x$ac_cv_have_decl_vsnprintf" = xyes; then :
   ac_have_decl=1
@@ -10524,7 +10472,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VSNPRINTF $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtol" = xyes; then :
   ac_have_decl=1
 else
@@ -10534,6 +10482,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoul" = xyes; then :
   ac_have_decl=1
@@ -10544,6 +10493,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOUL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoll" = xyes; then :
   ac_have_decl=1
@@ -10554,6 +10504,7 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOLL $ac_have_decl
 _ACEOF
+
 ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoull" = xyes; then :
   ac_have_decl=1
@@ -10565,7 +10516,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRTOULL $ac_have_decl
 _ACEOF
 
-  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strverscmp" = xyes; then :
   ac_have_decl=1
 else
@@ -10577,6 +10528,66 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+  # Check for presence and size of long long.
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
+ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+
+
+
+
+
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
 if test "x$ac_cv_type_size_t" = xyes; then :
 
diff --git a/gdbsupport/libiberty.m4 b/gdbsupport/libiberty.m4
index 73673a918c0e..5345a621a5ab 100644
--- a/gdbsupport/libiberty.m4
+++ b/gdbsupport/libiberty.m4
@@ -25,7 +25,8 @@ AC_DEFUN([libiberty_INIT],
   # Check for presence and size of long long.
   AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
 
-  AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
-  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
-  AC_CHECK_DECLS([strverscmp])
+  AC_CHECK_DECLS([basename(char *)])
+  AC_CHECK_DECLS_ONCE([ffs, asprintf, vasprintf, snprintf, vsnprintf])
+  AC_CHECK_DECLS_ONCE([strtol, strtoul, strtoll, strtoull])
+  AC_CHECK_DECLS_ONCE([strverscmp])
 ])
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] sim: ppc: rework defines.h to handle HAVE symbols defined to 0
  2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
  2024-01-10  1:58 ` [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE Mike Frysinger
@ 2024-01-10  1:58 ` Mike Frysinger
  2024-01-10  1:58 ` [PATCH 4/5] sim: build: switch to gdbsupport/libiberty.m4 Mike Frysinger
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2024-01-10  1:58 UTC (permalink / raw)
  To: gdb-patches

The HAVE_DECL_xxx defines are always defined to 0 or 1.  The current
defines.h logic assumes every HAVE_xxx symbol is only defined iff it's
defined to 1 which causes this to break.  Tweak the sed logic to only
match defines of 1.
---
 sim/Makefile.in  | 2 +-
 sim/ppc/local.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index 1e94771577d9..b407b37803c5 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -5823,7 +5823,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_ppc_TRUE@ppc/defines.h: ppc/stamp-defines ; @true
 @SIM_ENABLE_ARCH_ppc_TRUE@ppc/stamp-defines: config.h Makefile
-@SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_GEN)sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > ppc/defines.hin
+@SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p }' < config.h > ppc/defines.hin
 @SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change ppc/defines.hin ppc/defines.h
 @SIM_ENABLE_ARCH_ppc_TRUE@	$(AM_V_at)touch $@
 
diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
index 3f495cb44c0b..0031753b74bc 100644
--- a/sim/ppc/local.mk
+++ b/sim/ppc/local.mk
@@ -80,7 +80,7 @@ noinst_PROGRAMS += %D%/run
 
 %D%/defines.h: %D%/stamp-defines ; @true
 %D%/stamp-defines: config.h Makefile
-	$(AM_V_GEN)sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > %D%/defines.hin
+	$(AM_V_GEN)$(SED) -n -e '/^#define HAVE_.*1$$/{ s/ 1$$/",/; s/.* HAVE_/"HAVE_/; p }' < config.h > %D%/defines.hin
 	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/defines.hin %D%/defines.h
 	$(AM_V_at)touch $@
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/5] sim: build: switch to gdbsupport/libiberty.m4
  2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
  2024-01-10  1:58 ` [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE Mike Frysinger
  2024-01-10  1:58 ` [PATCH 3/5] sim: ppc: rework defines.h to handle HAVE symbols defined to 0 Mike Frysinger
@ 2024-01-10  1:58 ` Mike Frysinger
  2024-01-10  1:58 ` [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl Mike Frysinger
  2024-01-10 18:18 ` [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Tom Tromey
  4 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2024-01-10  1:58 UTC (permalink / raw)
  To: gdb-patches

Leverage this common logic to find all the libiberty settings rather
than duplicate it ourselves.
---
 sim/Makefile.in           |   1 +
 sim/config.h.in           |  46 +++++
 sim/configure             | 373 ++++++++++++++++++++++++++++++++++++--
 sim/configure.ac          |   3 +
 sim/m4/sim_ac_platform.m4 |   1 -
 5 files changed, 411 insertions(+), 13 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index b407b37803c5..7de345c33566 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -353,6 +353,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/m4/sim_ac_option_warnings.m4 \
 	$(top_srcdir)/m4/sim_ac_platform.m4 \
 	$(top_srcdir)/m4/sim_ac_toolchain.m4 \
+	$(top_srcdir)/../gdbsupport/libiberty.m4 \
 	$(top_srcdir)/frv/acinclude.m4 $(top_srcdir)/mips/acinclude.m4 \
 	$(top_srcdir)/ppc/acinclude.m4 \
 	$(top_srcdir)/riscv/acinclude.m4 $(top_srcdir)/rx/acinclude.m4 \
diff --git a/sim/config.h.in b/sim/config.h.in
index 4e2724603e7c..de84c64f12d4 100644
--- a/sim/config.h.in
+++ b/sim/config.h.in
@@ -37,13 +37,56 @@
 /* Define to 1 if you have the `chmod' function. */
 #undef HAVE_CHMOD
 
+/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ASPRINTF
+
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BASENAME
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
 /* Is the prototype for getopt in <unistd.h> in the expected format? */
 #undef HAVE_DECL_GETOPT
 
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SNPRINTF
+
+/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRTOL
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOLL
+
+/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOUL
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOULL
+
+/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRVERSCMP
+
 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
    */
 #undef HAVE_DECL_TZNAME
 
+/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VASPRINTF
+
+/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VSNPRINTF
+
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
@@ -443,6 +486,9 @@
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
diff --git a/sim/configure b/sim/configure
index e8d7be56b817..29ea7ee95a58 100755
--- a/sim/configure
+++ b/sim/configure
@@ -2585,6 +2585,189 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -8696,16 +8879,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-fi
-
-ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-
 fi
 
 
@@ -12685,7 +12858,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12688 "configure"
+#line 12861 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12791,7 +12964,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12794 "configure"
+#line 12967 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13787,6 +13960,182 @@ fi
 
 
 
+
+
+
+ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
+if test "x$ac_cv_have_decl_ffs" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFS $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_asprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ASPRINTF $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vasprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VASPRINTF $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_snprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SNPRINTF $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vsnprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VSNPRINTF $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtol" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOL $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoul" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOUL $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoll" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOLL $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoull" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOULL $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strverscmp" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRVERSCMP $ac_have_decl
+_ACEOF
+
+
+  # Check for presence and size of long long.
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char *)" | $as_tr_sh`
+ac_fn_c_check_decl "$LINENO" "basename(char *)" "$as_ac_Symbol" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
     # Check whether --enable-maintainer-mode was given.
diff --git a/sim/configure.ac b/sim/configure.ac
index f475ab22dfd6..125eaa5ea310 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -20,6 +20,9 @@ dnl Set the 'development' global before loading the SIM macros.
 SIM_AC_TOOLCHAIN
 SIM_AC_PLATFORM
 
+m4_include([../gdbsupport/libiberty.m4])
+libiberty_INIT
+
 AM_MAINTAINER_MODE
 AM_INIT_AUTOMAKE
 AM_SILENT_RULES([yes])
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index f523f03518bb..fd6daeefbd1c 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -132,7 +132,6 @@ AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
 #include <sys/socket.h>
 ])
-AC_CHECK_TYPES([long long])
 
 dnl Check for struct statfs.
 AC_CACHE_CHECK([for struct statfs],
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl
  2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
                   ` (2 preceding siblings ...)
  2024-01-10  1:58 ` [PATCH 4/5] sim: build: switch to gdbsupport/libiberty.m4 Mike Frysinger
@ 2024-01-10  1:58 ` Mike Frysinger
  2024-01-10 18:19   ` Tom Tromey
  2024-01-10 18:18 ` [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Tom Tromey
  4 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2024-01-10  1:58 UTC (permalink / raw)
  To: gdb-patches

No functional change here, just touch up generated output slightly.
---
 gdb/configure           | 4 +---
 gdbserver/configure     | 4 +---
 gdbsupport/configure    | 4 +---
 gdbsupport/libiberty.m4 | 7 +++----
 sim/configure           | 5 +----
 5 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index c55d17df7356..d0fd1760b889 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -29342,9 +29342,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRVERSCMP $ac_have_decl
 _ACEOF
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+    ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
 if test "x$ac_cv_type_long_long" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
diff --git a/gdbserver/configure b/gdbserver/configure
index 6a913189dc5a..0942ef173d45 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -13985,9 +13985,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRVERSCMP $ac_have_decl
 _ACEOF
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+    ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
 if test "x$ac_cv_type_long_long" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 83bc7ce83613..b45f12de45be 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -10527,9 +10527,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRVERSCMP $ac_have_decl
 _ACEOF
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+    ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
 if test "x$ac_cv_type_long_long" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
diff --git a/gdbsupport/libiberty.m4 b/gdbsupport/libiberty.m4
index 5345a621a5ab..7e784133072d 100644
--- a/gdbsupport/libiberty.m4
+++ b/gdbsupport/libiberty.m4
@@ -16,13 +16,12 @@ dnl You should have received a copy of the GNU General Public License
 dnl along with this program; see the file COPYING3.  If not see
 dnl <http://www.gnu.org/licenses/>.
 dnl
-
+dnl
 dnl Checks for declarations ansidecl.h and libiberty.h themselves
 dnl check with HAVE_DECL_XXX, etc.
-
 AC_DEFUN([libiberty_INIT],
-[
-  # Check for presence and size of long long.
+[dnl
+  dnl Check for presence and size of long long.
   AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
 
   AC_CHECK_DECLS([basename(char *)])
diff --git a/sim/configure b/sim/configure
index 29ea7ee95a58..36cadce3ca21 100755
--- a/sim/configure
+++ b/sim/configure
@@ -13962,7 +13962,6 @@ fi
 
 
 
-
 ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
 if test "x$ac_cv_have_decl_ffs" = xyes; then :
   ac_have_decl=1
@@ -14073,9 +14072,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRVERSCMP $ac_have_decl
 _ACEOF
 
-
-  # Check for presence and size of long long.
-  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+    ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
 if test "x$ac_cv_type_long_long" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport
  2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
                   ` (3 preceding siblings ...)
  2024-01-10  1:58 ` [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl Mike Frysinger
@ 2024-01-10 18:18 ` Tom Tromey
  4 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2024-01-10 18:18 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> This is used by gdb, gdbsupport, and gdbserver.  We want to use it
Mike> in the sim tree too.  Move it to gdbsupport which is meant as the
Mike> common sharing space for these projects.

Thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE
  2024-01-10  1:58 ` [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE Mike Frysinger
@ 2024-01-10 18:18   ` Tom Tromey
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2024-01-10 18:18 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> Only check these decls once in case other m4 macros also look for them.

Makes sense.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl
  2024-01-10  1:58 ` [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl Mike Frysinger
@ 2024-01-10 18:19   ` Tom Tromey
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2024-01-10 18:19 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> No functional change here, just touch up generated output slightly.

Seems fine to me, thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-10 18:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10  1:58 [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Mike Frysinger
2024-01-10  1:58 ` [PATCH 2/5] gdb: libiberty: switch to AC_CHECK_DECLS_ONCE Mike Frysinger
2024-01-10 18:18   ` Tom Tromey
2024-01-10  1:58 ` [PATCH 3/5] sim: ppc: rework defines.h to handle HAVE symbols defined to 0 Mike Frysinger
2024-01-10  1:58 ` [PATCH 4/5] sim: build: switch to gdbsupport/libiberty.m4 Mike Frysinger
2024-01-10  1:58 ` [PATCH 5/5] gdbsupport: tighten up libiberty code a bit with dnl Mike Frysinger
2024-01-10 18:19   ` Tom Tromey
2024-01-10 18:18 ` [PATCH 1/5] gdb: move libiberty.m4 to gdbsupport Tom Tromey

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).