File oprofile-binutils.patch of Package oprofile

From: Antoine Belvire <antoine.belvire@opensuse.org>
Subject: Fix linking on openSUSE Tumbleweed
Date: Sun Apr 30 17:19:41 UTC 2023
References: <none>
Upstream: no - not sure whether problem is generic or specific to Tumbleweed's binutils
Signed-Off-by: Antoine Belvire <antoine.belvire@opensuse.org>
--
diff -up oprofile-1.4.0/configure.ac.orig oprofile-1.4.0/configure.ac
--- oprofile-1.4.0/configure.ac.orig	2023-04-30 19:27:30.316426363 +0200
+++ oprofile-1.4.0/configure.ac	2023-04-30 19:56:37.828498811 +0200
@@ -333,7 +333,7 @@ AX_CHECK_DOCBOOK
 dnl finally restore the original libs setting
 LIBS="$ORIG_SAVE_LIBS"
 LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
-BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB"
+BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB $SFRAME_LIB"
 POPT_LIBS="-lpopt"
 AC_SUBST(LIBERTY_LIBS)
 AC_SUBST(BFD_LIBS)
diff -up oprofile-1.4.0/m4/binutils.m4.orig oprofile-1.4.0/m4/binutils.m4
--- oprofile-1.4.0/m4/binutils.m4.orig	2023-04-30 18:19:47.848257943 +0200
+++ oprofile-1.4.0/m4/binutils.m4	2023-04-30 21:40:11.412756411 +0200
@@ -10,12 +10,14 @@ AC_CHECK_FUNCS(xmemdup)
 AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
 AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
 
-AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB="",
+AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB=""; SFRAME_LIB="",
 	[AC_CHECK_LIB(z, compress,
-dnl Use a different bfd function here so as not to use cached result from above
-		[AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz",
-			[AC_MSG_ERROR([bfd library not found])], -lz)
-		],
+dnl Use different bfd functions below so as not to use cached results from above
+		[AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz"; SFRAME_LIB="",
+			[AC_CHECK_LIB(bfd, bfd_openstreamr, LIBS="-lbfd -lz -lsframe -lzstd $LIBS"; Z_LIB="-lz"; SFRAME_LIB="-lsframe -lzstd",
+				[AC_MSG_ERROR([bfd library not found])], -lz -lsframe -lzstd)
+			], -lz)
+		],
 		[AC_MSG_ERROR([libz library not found; required by libbfd])])
 	]
 )
openSUSE Build Service is sponsored by