Use pkg-config instead of papi_version_check

This commit is contained in:
Aleix Boné 2025-12-09 14:16:19 +01:00
parent 1e36c3b204
commit fad79643fa
No known key found for this signature in database
4 changed files with 138 additions and 5 deletions

View File

@ -0,0 +1,67 @@
diff --git a/m4/papi.m4 b/m4/papi.m4
--- a/m4/papi.m4
+++ b/m4/papi.m4
@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI],
else
PKG_CHECK_MODULES(
[papi],
- [papi],
+ [papi >= 5.6.0],
[
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([retrieved from pkg-config])
papi_CPPFLAGS="${papi_CFLAGS}"
ac_use_papi=yes
+ ac_papi_version_correct=yes
], [
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([not available])
@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI],
fi
if test x"${ac_use_papi}" = x"yes" ; then
- if test x"${ac_cv_use_papi_prefix}" != x"" ; then
- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
- else
- papiBinary=papi_version
- fi
- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ if test x"${ac_cv_use_papi_prefix}" != x"" ; then
+ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
+ else
+ papiBinary=papi_version
+ fi
+ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
- AX_COMPARE_VERSION(
- [[${papiVersion}]],
- [[ge]],
- [[5.6.0]],
- [[ac_papi_version_correct=yes]],
- [[ac_papi_version_correct=no]]
- )
+ AX_COMPARE_VERSION(
+ [[${papiVersion}]],
+ [[ge]],
+ [[5.6.0]],
+ [[ac_papi_version_correct=yes]],
+ [[ac_papi_version_correct=no]]
+ )
- if test x"${ac_papi_version_correct}" != x"yes" ; then
- AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
- ac_use_papi=no
- else
- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
- AC_MSG_RESULT([${ac_papi_version_correct}])
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
+ ac_use_papi=no
+ else
+ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
+ AC_MSG_RESULT([${ac_papi_version_correct}])
+ fi
fi
fi

View File

@ -96,17 +96,14 @@ in
separateDebugInfo = true;
strictDeps = true;
patches = [ ./check-papi-version-with-pkgconfig.patch ];
nativeBuildInputs = [
autoconf
automake
libtool
pkg-config
# TODO: papi_version is needed for configure:
# ./configure: line 27378: papi_version: command not found
# This probably breaks cross-compilation
] ++ lib.optionals enablePapi [ papi ];
];
buildInputs = [
boost

View File

@ -0,0 +1,68 @@
diff --git a/m4/papi.m4 b/m4/papi.m4
index de905848..fa3db9a1 100644
--- a/m4/papi.m4
+++ b/m4/papi.m4
@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI],
else
PKG_CHECK_MODULES(
[papi],
- [papi],
+ [papi >= 5.6.0],
[
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([retrieved from pkg-config])
papi_CFLAGS="${papi_CFLAGS}"
ac_use_papi=yes
+ ac_papi_version_correct=yes
], [
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([not available])
@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI],
fi
if test x"${ac_use_papi}" = x"yes" ; then
- if test x"${ac_cv_use_papi_prefix}" != x"" ; then
- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
- else
- papiBinary=papi_version
- fi
- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ if test x"${ac_cv_use_papi_prefix}" != x"" ; then
+ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
+ else
+ papiBinary=papi_version
+ fi
+ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
- AX_COMPARE_VERSION(
- [[${papiVersion}]],
- [[ge]],
- [[5.6.0]],
- [[ac_papi_version_correct=yes]],
- [[ac_papi_version_correct=no]]
- )
+ AX_COMPARE_VERSION(
+ [[${papiVersion}]],
+ [[ge]],
+ [[5.6.0]],
+ [[ac_papi_version_correct=yes]],
+ [[ac_papi_version_correct=no]]
+ )
- if test x"${ac_papi_version_correct}" != x"yes" ; then
- AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
- ac_use_papi=no
- else
- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
- AC_MSG_RESULT([${ac_papi_version_correct}])
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
+ ac_use_papi=no
+ else
+ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
+ AC_MSG_RESULT([${ac_papi_version_correct}])
+ fi
fi
fi

View File

@ -47,6 +47,7 @@ in
dontStrip = true;
separateDebugInfo = true;
strictDeps = true;
patches = [ ./check-papi-version-with-pkgconfig.patch ];
configureFlags = [
"--with-ovni=${ovni}"
"CACHELINE_WIDTH=${toString cacheline}"