Skip to content

Commit 8dadc9e

Browse files
authored
Merge pull request ibmruntimes#357 from keithc-ca/crac-criu
Improve interaction between CRIU and CRaC configuration options
2 parents 7d002c3 + 5fc4c65 commit 8dadc9e

File tree

1 file changed

+66
-38
lines changed

1 file changed

+66
-38
lines changed

closed/autoconf/custom-hook.m4

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
4040
OPENJ9_PLATFORM_SETUP
4141
OPENJ9_CONFIGURE_CMAKE
4242
OPENJ9_CONFIGURE_COMPILERS
43-
OPENJ9_CONFIGURE_CRAC_SUPPORT
44-
OPENJ9_CONFIGURE_CRIU_SUPPORT
43+
OPENJ9_CONFIGURE_CRAC_AND_CRIU_SUPPORT
4544
OPENJ9_CONFIGURE_CUDA
4645
OPENJ9_CONFIGURE_DDR
4746
OPENJ9_CONFIGURE_DEMOS
@@ -343,57 +342,86 @@ AC_DEFUN([OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU],
343342
esac
344343
])
345344

346-
AC_DEFUN([OPENJ9_CONFIGURE_CRAC_SUPPORT],
345+
AC_DEFUN([OPENJ9_CONFIGURE_CRAC_AND_CRIU_SUPPORT],
347346
[
348-
AC_MSG_CHECKING([for CRAC support])
349-
AC_ARG_ENABLE([crac-support], [AS_HELP_STRING([--enable-crac-support], [enable CRAC support @<:@platform dependent@:>@])])
350-
OPENJ9_ENABLE_CRAC_SUPPORT=false
347+
AC_ARG_ENABLE([crac-support], [AS_HELP_STRING([--enable-crac-support], [enable CRaC support @<:@platform dependent@:>@])])
348+
AC_ARG_ENABLE([criu-support], [AS_HELP_STRING([--enable-criu-support], [enable CRIU support @<:@platform dependent@:>@])])
349+
350+
# Complain about explicitly requested, but illegal combinations.
351+
if test "x$enable_crac_support" = xyes && test "x$enable_criu_support" = xno ; then
352+
AC_MSG_ERROR([--enable-crac-support requires CRIU support])
353+
fi
354+
355+
# Compute platform-specific defaults.
356+
case "$OPENJ9_PLATFORM_CODE" in
357+
xa64)
358+
default_crac=yes
359+
default_criu=yes
360+
;;
361+
xl64|xr64|xz64)
362+
default_crac=no
363+
default_criu=yes
364+
;;
365+
*)
366+
default_crac=no
367+
default_criu=no
368+
;;
369+
esac
351370
371+
# Capture the origin of each setting.
352372
if test "x$enable_crac_support" = xyes ; then
353-
AC_MSG_RESULT([yes (explicitly enabled)])
354-
OPENJ9_ENABLE_CRAC_SUPPORT=true
373+
origin_crac="explicitly enabled"
355374
elif test "x$enable_crac_support" = xno ; then
356-
AC_MSG_RESULT([no (explicitly disabled)])
375+
origin_crac="explicitly disabled"
357376
elif test "x$enable_crac_support" = x ; then
358-
case "$OPENJ9_PLATFORM_CODE" in
359-
xa64)
360-
AC_MSG_RESULT([yes (default)])
361-
OPENJ9_ENABLE_CRAC_SUPPORT=true
362-
;;
363-
*)
364-
AC_MSG_RESULT([no (default)])
365-
;;
366-
esac
377+
# Adjust if CRUI is explicitly disabled.
378+
if test "x$enable_criu_support" = xno && test "x$default_crac" = xyes ; then
379+
origin_crac="implicitly disabled"
380+
enable_crac_support=no
381+
else
382+
origin_crac=default
383+
enable_crac_support=$default_crac
384+
fi
367385
else
368386
AC_MSG_ERROR([--enable-crac-support accepts no argument])
369387
fi
370-
AC_SUBST(OPENJ9_ENABLE_CRAC_SUPPORT)
371-
])
372-
373-
AC_DEFUN([OPENJ9_CONFIGURE_CRIU_SUPPORT],
374-
[
375-
AC_MSG_CHECKING([for CRIU support])
376-
AC_ARG_ENABLE([criu-support], [AS_HELP_STRING([--enable-criu-support], [enable CRIU support @<:@platform dependent@:>@])])
377-
OPENJ9_ENABLE_CRIU_SUPPORT=false
378388
379389
if test "x$enable_criu_support" = xyes ; then
380-
AC_MSG_RESULT([yes (explicitly enabled)])
381-
OPENJ9_ENABLE_CRIU_SUPPORT=true
390+
origin_criu="explicitly enabled"
382391
elif test "x$enable_criu_support" = xno ; then
383-
AC_MSG_RESULT([no (explicitly disabled)])
392+
origin_criu="explicitly disabled"
384393
elif test "x$enable_criu_support" = x ; then
385-
case "$OPENJ9_PLATFORM_CODE" in
386-
xa64|xl64|xr64|xz64)
387-
AC_MSG_RESULT([yes (default)])
388-
OPENJ9_ENABLE_CRIU_SUPPORT=true
389-
;;
390-
*)
391-
AC_MSG_RESULT([no (default)])
392-
;;
393-
esac
394+
# Adjust if CRaC is explicitly enabled.
395+
if test "x$enable_crac_support" = xyes && test "x$default_criu" = xno ; then
396+
origin_criu="implicitly enabled"
397+
enable_criu_support=yes
398+
else
399+
origin_criu=default
400+
enable_criu_support=$default_criu
401+
fi
394402
else
395403
AC_MSG_ERROR([--enable-criu-support accepts no argument])
396404
fi
405+
406+
# Report and capture results.
407+
AC_MSG_CHECKING([for CRAC support])
408+
if test "x$enable_crac_support" = xyes ; then
409+
AC_MSG_RESULT([yes ($origin_crac)])
410+
OPENJ9_ENABLE_CRAC_SUPPORT=true
411+
else
412+
AC_MSG_RESULT([no ($origin_crac)])
413+
OPENJ9_ENABLE_CRAC_SUPPORT=false
414+
fi
415+
AC_SUBST(OPENJ9_ENABLE_CRAC_SUPPORT)
416+
417+
AC_MSG_CHECKING([for CRIU support])
418+
if test "x$enable_criu_support" = xyes ; then
419+
AC_MSG_RESULT([yes ($origin_criu)])
420+
OPENJ9_ENABLE_CRIU_SUPPORT=true
421+
else
422+
AC_MSG_RESULT([no ($origin_criu)])
423+
OPENJ9_ENABLE_CRIU_SUPPORT=false
424+
fi
397425
AC_SUBST(OPENJ9_ENABLE_CRIU_SUPPORT)
398426
])
399427

0 commit comments

Comments
 (0)