1
1

opal_check_cma: make consistent with rest of configury

Split the CMA test into two parts so that the back-end test only has
to be run once.  Fail with --with-cma is specified and cannot be
provided.  Remove a few useless quotes.  Change
$ompi_check_cma_need_defs and $ompi_check_cma_happy to be numeric
values.  Finally, remove a bunch of tabs.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
Jeff Squyres 2016-08-23 07:26:47 -07:00
родитель 065b93600d
Коммит 997431696a

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

@ -18,23 +18,45 @@
# -------------------------------------------------------- # --------------------------------------------------------
# check if cma support is wanted. # check if cma support is wanted.
AC_DEFUN([OPAL_CHECK_CMA],[ AC_DEFUN([OPAL_CHECK_CMA],[
if test -z "$ompi_check_cma_happy" ; then AC_ARG_WITH([cma],
OPAL_VAR_SCOPE_PUSH([ompi_check_cma_need_defs ompi_check_cma_kernel_version ompi_check_cma_CFLAGS]) [AC_HELP_STRING([--with-cma],
[Build Cross Memory Attach support (default: autodetect)])])
AC_ARG_WITH([cma], # We only need to do the back-end test once
[AC_HELP_STRING([--with-cma], if test -z "$opal_check_cma_happy" ; then
[Build Cross Memory Attach support (default: autodetect)])]) OPAL_CHECK_CMA_BACKEND
fi
# Enable CMA support by default if process_vm_readv is defined in glibc AS_IF([test $opal_check_cma_happy -eq 1],
AC_CHECK_FUNC(process_vm_readv, [ompi_check_cma_need_defs=0], [$2],
[ompi_check_cma_need_defs=1]) [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 AC_DEFUN([OPAL_CHECK_CMA_BACKEND],
ompi_check_cma_CFLAGS="$CFLAGS" [
# Need some extra include paths to locate the appropriate headers OPAL_VAR_SCOPE_PUSH([opal_check_cma_need_defs opal_check_cma_kernel_version opal_check_cma_CFLAGS opal_check_cma_msg])
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/opal/include"
AC_MSG_CHECKING([if internal syscall numbers for Linux CMA work]) # Some systems have process_cm_readv() in libc, which means CMA is
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ # 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 <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -88,31 +110,23 @@ static void do_check (pid_t pid, int *in, int *out)
/* all good */ /* all good */
return 0; return 0;
]])], ]])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
ompi_check_cma_happy="yes"], opal_check_cma_happy=1],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
ompi_check_cma_happy="no"], opal_check_cma_happy=0],
[AC_MSG_RESULT([no (cross-compiling)]) [AC_MSG_RESULT([no (cross-compiling)])
ompi_check_cma_happy="no"]) opal_check_cma_happy=0])
CFLAGS="$ompi_check_cma_CFLAGS" CFLAGS=$opal_check_cma_CFLAGS
else else
ompi_check_cma_happy="yes" # If we didn't need the defs, then we have process_vm_readv(),
fi # and CMA is happy.
opal_check_cma_happy=1
# 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])
fi 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])
]) ])