1
1

Merge pull request #1997 from jsquyres/pr/make-cma-configury-better

opal_check_cma: make consistent with rest of configury
Этот коммит содержится в:
Jeff Squyres 2016-08-31 09:50:24 -04:00 коммит произвёл GitHub
родитель ba0ed2401a 997431696a
Коммит c33aaa5604

Просмотреть файл

@ -18,23 +18,45 @@
# --------------------------------------------------------
# check if cma support is wanted.
AC_DEFUN([OPAL_CHECK_CMA],[
if test -z "$ompi_check_cma_happy" ; then
OPAL_VAR_SCOPE_PUSH([ompi_check_cma_need_defs ompi_check_cma_kernel_version ompi_check_cma_CFLAGS])
AC_ARG_WITH([cma],
[AC_HELP_STRING([--with-cma],
[Build Cross Memory Attach support (default: autodetect)])])
AC_ARG_WITH([cma],
[AC_HELP_STRING([--with-cma],
[Build Cross Memory Attach support (default: autodetect)])])
# We only need to do the back-end test once
if test -z "$opal_check_cma_happy" ; then
OPAL_CHECK_CMA_BACKEND
fi
# Enable CMA support by default if process_vm_readv is defined in glibc
AC_CHECK_FUNC(process_vm_readv, [ompi_check_cma_need_defs=0],
[ompi_check_cma_need_defs=1])
AS_IF([test $opal_check_cma_happy -eq 1],
[$2],
[if test "$with_cma" = "yes"; then
AC_MSG_WARN([--with-cma support requested, but not available])
AC_MSG_ERROR([Cannot continue])
fi
$3])
])
if test $ompi_check_cma_need_defs = 1 ; then
ompi_check_cma_CFLAGS="$CFLAGS"
# Need some extra include paths to locate the appropriate headers
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/opal/include"
AC_MSG_CHECKING([if internal syscall numbers for Linux CMA work])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
AC_DEFUN([OPAL_CHECK_CMA_BACKEND],
[
OPAL_VAR_SCOPE_PUSH([opal_check_cma_need_defs opal_check_cma_kernel_version opal_check_cma_CFLAGS opal_check_cma_msg])
# Some systems have process_cm_readv() in libc, which means CMA is
# supported. Other systems do not have process_cm_readv() in
# libc, but have support for it in the kernel if we invoke it
# directly. Check for both.
AC_CHECK_HEADERS([sys/prctl.h])
AC_CHECK_FUNC([process_vm_readv], [opal_check_cma_need_defs=0],
[opal_check_cma_need_defs=1])
AC_DEFINE_UNQUOTED([OPAL_CMA_NEED_SYSCALL_DEFS],
[$opal_check_cma_need_defs],
[Need CMA syscalls defined])
if test $opal_check_cma_need_defs -eq 1 ; then
opal_check_cma_CFLAGS=$CFLAGS
# Need some extra include paths to locate the appropriate headers
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/opal/include"
AC_MSG_CHECKING([if internal syscall numbers for Linux CMA work])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
@ -88,31 +110,23 @@ static void do_check (pid_t pid, int *in, int *out)
/* all good */
return 0;
]])],
[AC_MSG_RESULT([yes])
ompi_check_cma_happy="yes"],
[AC_MSG_RESULT([no])
ompi_check_cma_happy="no"],
[AC_MSG_RESULT([no (cross-compiling)])
ompi_check_cma_happy="no"])
CFLAGS="$ompi_check_cma_CFLAGS"
else
ompi_check_cma_happy="yes"
fi
# If the user specifically requests CMA go ahead and enable it even
# if the glibc version does not support process_vm_readv
if test "x$with_cma" = "xyes" || test "$ompi_check_cma_happy" = "yes" ; then
ompi_check_cma_happy="yes"
AC_DEFINE_UNQUOTED([OPAL_CMA_NEED_SYSCALL_DEFS],
[$ompi_check_cma_need_defs],
[Need CMA syscalls defined])
AC_CHECK_HEADERS([sys/prctl.h])
fi
OPAL_VAR_SCOPE_POP
OPAL_SUMMARY_ADD([[Transports]],[[Shared memory/Linux CMA]],[$1],[$ompi_check_cma_happy])
[AC_MSG_RESULT([yes])
opal_check_cma_happy=1],
[AC_MSG_RESULT([no])
opal_check_cma_happy=0],
[AC_MSG_RESULT([no (cross-compiling)])
opal_check_cma_happy=0])
CFLAGS=$opal_check_cma_CFLAGS
else
# If we didn't need the defs, then we have process_vm_readv(),
# and CMA is happy.
opal_check_cma_happy=1
fi
AS_IF([test "$ompi_check_cma_happy" = "yes"], [$2], [$3])
OPAL_VAR_SCOPE_POP
AS_IF([test $opal_check_cma_happy -eq 1],
[opal_check_cma_msg=yes],
[opal_check_cma_msg=no])
OPAL_SUMMARY_ADD([[Transports]],[[Shared memory/Linux CMA]],[$1],[$opal_check_cma_msg])
])