]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: Link ZSTD_LIBS
authorFangrui Song <maskray@google.com>
Tue, 27 Sep 2022 18:42:32 +0000 (11:42 -0700)
committerFangrui Song <i@maskray.me>
Tue, 27 Sep 2022 18:42:32 +0000 (11:42 -0700)
This fixes linker errors in a `../../configure --enable-targets
--enable-sim; make all-gdb` build.

sim/Makefile.in
sim/aclocal.m4
sim/arch-subdir.mk.in
sim/common/Make-common.in
sim/config.h.in
sim/configure
sim/m4/sim_ac_platform.m4
sim/ppc/Makefile.in

index dbbaa84224a3a75f7cc934901c1ce12ecce9b97d..3278febc5e8de7643fb73f7e8dae18dc4798d28c 100644 (file)
@@ -170,7 +170,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/override.m4 \
        $(top_srcdir)/../config/pkg.m4 \
        $(top_srcdir)/../config/plugins.m4 \
-       $(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+       $(top_srcdir)/../config/zlib.m4 \
+       $(top_srcdir)/../config/zstd.m4 $(top_srcdir)/../libtool.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/m4/sim_ac_option_alignment.m4 \
@@ -855,6 +856,8 @@ VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
 WERROR_CFLAGS = @WERROR_CFLAGS@
 XGETTEXT = @XGETTEXT@
+ZSTD_CFLAGS = @ZSTD_CFLAGS@
+ZSTD_LIBS = @ZSTD_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
index 40806b929bf231b6a0bb2b0138b9fa9bcb5fe0d7..5ecf08aa3e9cb92a74ba5e4cdbf73ad402344c53 100644 (file)
@@ -1175,6 +1175,7 @@ m4_include([../config/override.m4])
 m4_include([../config/pkg.m4])
 m4_include([../config/plugins.m4])
 m4_include([../config/zlib.m4])
+m4_include([../config/zstd.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
index c9ba0d53f35b95d01a228b7ec8bda6953736fe1e..f6d8188d1a8e101cfcce53d5b5ebff2b31168d03 100644 (file)
@@ -46,6 +46,7 @@ DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
 
 zlibdir = @zlibdir@
+ZSTD_LIBS = @ZSTD_LIBS@
 @PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
index 74e5dad3049871d295d42a32f328b8d0249d3521..b07ec96e14744eb7172e53d6444776183cf3df19 100644 (file)
@@ -223,7 +223,7 @@ ZLIB = $(zlibdir) -lz
 LIBIBERTY_LIB = ../../libiberty/libiberty.a
 BFD_LIB = ../../bfd/libbfd.a
 OPCODES_LIB = ../../opcodes/libopcodes.a
-CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB)
+CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB) $(ZSTD_LIBS)
 LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
        $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
index 8e84759df047dd5341ee7f7f77b2ba6bde3fa23f..84c363c0aecee5bbda6e08794d50000b748214a6 100644 (file)
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
+/* Define to 1 if zstd is enabled. */
+#undef HAVE_ZSTD
+
 /* Define to 1 if the system has the type `__int128'. */
 #undef HAVE___INT128
 
index b31c2f5d8f39616d5d17a1a9c83570f15dc394b2..75d1935df38a1cb618044051dada8e9a603c818d 100755 (executable)
@@ -879,6 +879,8 @@ SED
 LIBTOOL
 PLUGINS_FALSE
 PLUGINS_TRUE
+ZSTD_LIBS
+ZSTD_CFLAGS
 zlibinc
 zlibdir
 CATOBJEXT
@@ -981,6 +983,7 @@ enable_option_checking
 with_pkgversion
 with_bugurl
 with_system_zlib
+with_zstd
 enable_plugins
 enable_shared
 enable_static
@@ -1025,6 +1028,8 @@ CPP
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
+ZSTD_CFLAGS
+ZSTD_LIBS
 SDL_CFLAGS
 SDL_LIBS
 AS_FOR_TARGET_AARCH64
@@ -1807,6 +1812,8 @@ Optional Packages:
   --with-pkgversion=PKG   Use PKG in the version string in place of "SIM"
   --with-bugurl=URL       Direct users to URL to report a bug
   --with-system-zlib      use installed libz
+  --with-zstd             support zstd compressed debug sections
+                          (default=auto)
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
@@ -1825,6 +1832,8 @@ Some influential environment variables:
               directories to add to pkg-config's search path
   PKG_CONFIG_LIBDIR
               path overriding pkg-config's built-in search path
+  ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
+  ZSTD_LIBS   linker flags for ZSTD, overriding pkg-config
   SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
   SDL_LIBS    linker flags for SDL, overriding pkg-config
   AS_FOR_TARGET_AARCH64
@@ -9065,6 +9074,127 @@ fi
 
 
 
+# Check whether --with-zstd was given.
+if test "${with_zstd+set}" = set; then :
+  withval=$with_zstd;
+else
+  with_zstd=auto
+fi
+
+
+if test "$with_zstd" != no; then :
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd" >&5
+$as_echo_n "checking for libzstd... " >&6; }
+
+if test -n "$ZSTD_CFLAGS"; then
+    pkg_cv_ZSTD_CFLAGS="$ZSTD_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_ZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$ZSTD_LIBS"; then
+    pkg_cv_ZSTD_LIBS="$ZSTD_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_ZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_ZSTD_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+  pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
+
+
+
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               ZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd" 2>&1`
+        else
+               ZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$ZSTD_PKG_ERRORS" >&5
+
+
+    if test "$with_zstd" = yes; then
+      as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+    fi
+
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+    if test "$with_zstd" = yes; then
+      as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5
+    fi
+
+else
+       ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
+       ZSTD_LIBS=$pkg_cv_ZSTD_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+$as_echo "#define HAVE_ZSTD 1" >>confdefs.h
+
+
+fi
+
+fi
+
+
+
   maybe_plugins=no
   for ac_header in dlfcn.h
 do :
@@ -12641,7 +12771,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12644 "configure"
+#line 12774 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12747,7 +12877,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12750 "configure"
+#line 12880 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index aa91c42562e0ddc671f28445be07b4410e7c124e..a91b2334b8476e0e39fab75b229db1e782649018 100644 (file)
@@ -150,6 +150,7 @@ ZW_GNU_GETTEXT_SISTER_DIR
 dnl BFD conditionally uses zlib, so we must link it in if libbfd does, by
 dnl using the same condition.
 AM_ZLIB
+AC_ZSTD
 
 dnl BFD uses libdl when when plugins enabled.
 AC_PLUGINS
index 33d7df953b598b8f43c7c2050bcf478b619aba6d..b0c073b8867a115c1f497c0220cabd97afef4c92 100644 (file)
@@ -522,7 +522,7 @@ PACKAGE_OBJ = @sim_pk_obj@
 
 
 psim$(EXEEXT): $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBINTL_DEP)
-       $(ECHO_CCLD) $(CC) $(CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(ZLIB) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS)
+       $(ECHO_CCLD) $(CC) $(CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(ZLIB) $(ZSTD_LIBS) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS)
 
 run$(EXEEXT): psim$(EXEEXT)
        $(SILENCE) rm -f $@