From 4346565dd36e1b847206dc35de1e65bd787a3473 Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Tue, 27 Dec 2022 09:57:45 -0800 Subject: [PATCH] flux: ensure flux_job_timeleft() is available flux_job_timeleft() was introduced in flux-core 0.47.0, so check the flux-core version in the spec file, and check the function is available when configure is run. --- config/x_ac_flux_job_timeleft.m4 | 30 ++++++++++++++++++++++++++++++ configure.ac | 1 + libyogrt.spec.in | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 config/x_ac_flux_job_timeleft.m4 diff --git a/config/x_ac_flux_job_timeleft.m4 b/config/x_ac_flux_job_timeleft.m4 new file mode 100644 index 0000000..c7b8356 --- /dev/null +++ b/config/x_ac_flux_job_timeleft.m4 @@ -0,0 +1,30 @@ +##***************************************************************************** +# SYNOPSIS: +# X_AC_FLUX_JOB_TIMELEFT() +# +# DESCRIPTION: +# Check flux_job_timeleft() is present +##***************************************************************************** + +AC_DEFUN([X_AC_FLUX_JOB_TIMELEFT], [ + AS_IF([test "$FLUX_LIBADD"],[ + AC_MSG_CHECKING([Whether flux_job_timeleft() is present.]) + LIBS="$FLUX_LIBS $FLUX_LIBADD $LIBS" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [[#include ]], + [[double tl = flux_job_timeleft(NULL, NULL, NULL);]] + )], + [x_ac_cv_flux_job_timeleft=1], + [x_ac_cv_flux_job_timeleft=0] + ) + AS_IF([test "x$x_ac_cv_flux_job_timeleft" = x1], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([flux_job_timeleft() is required. Update to a newer flux or use --without-flux.]) + ] + ) + ]) + +]) diff --git a/configure.ac b/configure.ac index 35de624..72d97eb 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,7 @@ X_AC_LCRM X_AC_MOAB X_AC_LSF X_AC_FLUX +X_AC_FLUX_JOB_TIMELEFT aix_64bit_mode=no using_aix=no diff --git a/libyogrt.spec.in b/libyogrt.spec.in index d101a4e..dcfe1c0 100644 --- a/libyogrt.spec.in +++ b/libyogrt.spec.in @@ -85,7 +85,7 @@ SLURM plugin for libyogrt %package flux Summary: libyogrt plugin for Flux Group: System Environment/Base -BuildRequires: flux-core +BuildRequires: flux-core >= 0.47.0 Requires: flux-core Requires: libyogrt = %{version} %description flux