1
1
openmpi/ompi/mca/mpool/gm/configure.stub
Tim Woodall e0c8991a6e checkpoint
This commit was SVN r6367.
2005-07-07 16:56:58 +00:00

197 строки
7.0 KiB
Bash

# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004 The Ohio State University.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Main function. This will be invoked in the middle of the templated
# configure script.
#
AC_DEFUN([MCA_CONFIGURE_STUB],[
# Additional --with flags that can be specified
AC_ARG_WITH(btl-gm,
AC_HELP_STRING([--with-btl-gm=DIR],
[Specify the installation directory of GM]))
AC_ARG_WITH(btl-gm-libdir,
AC_HELP_STRING([--with-btl-gm-libdir=DIR],
[directory where the GM library can be found, if it is not in \$GMDIR/lib or \$GMDIR/binary/lib]))
AC_ARG_ENABLE(gm-btl-cache,
AC_HELP_STRING([--enable-gm-btl-cache],[Enable/disable the internal registered memory cache (default=no)]),
[enable_gm_cache=$(enable_gm_btl_cache)],
[enable_gm_cache="no"])
if test "$enable_gm_cache" = "yes"; then
AC_DEFINE_UNQUOTED( OMPI_MCA_MPOOL_GM_CACHE_ENABLE, 1,
[Enable GM MPOOL internal cache for registered memory])
else
AC_DEFINE_UNQUOTED( OMPI_MCA_MPOOL_GM_CACHE_ENABLE, 0,
[Disable GM MPOOL internal cache for registered memory])
fi
AM_CONDITIONAL( OMPI_ENABLE_GM_CACHE, test "$enable_gm_cache" = "yes" )
# Add to CPPFLAGS if necessary
EXTRA_CPPFLAGS=
if test -n "$with_btl_gm"; then
if test -d "$with_btl_gm/include"; then
EXTRA_CPPFLAGS="-I$with_btl_gm/include"
else
AC_MSG_WARN([*** Warning: cannot find $with_btl_gm/include])
AC_MSG_WARN([*** Will still try to configure gm btl anyway...])
fi
fi
# See if we can find gm.h
CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS"
AC_CHECK_HEADERS(gm.h,,
AC_MSG_ERROR([*** Cannot find working gm.h.]))
# Add to LDFLAGS if necessary
EXTRA_LDFLAGS=
if test -n "$with_btl_gm_libdir"; then
if test -d "$with_btl_gm_libdir"; then
EXTRA_LDFLAGS="-L$with_btl_gm_libdir"
else
AC_MSG_WARN([*** Warning: cannot find $with_btl_gm_libdir])
AC_MSG_WARN([*** Will still try to configure gm btl anyway...])
fi
elif test -n "$with_btl_gm"; then
if test -d "$with_btl_gm/lib"; then
EXTRA_LDFLAGS="-L$with_btl_gm/lib"
elif test -d "$with_btl_gm/binary/lib"; then
EXTRA_LDFLAGS="-L$with_btl_gm/binary/lib"
else
AC_MSG_WARN([*** Warning: cannot find $with_btl_gm/lib])
AC_MSG_WARN([*** or $with_btl_gm/binary/lib])
AC_MSG_WARN([*** Will still try to configure gm btl anyway...])
fi
fi
# Try to find libgm
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
AC_CHECK_LIB([gm], [main], [],
AC_MSG_ERROR([*** Cannot find libgm]))
#
# See if we have GM_API_VERSION. If we do, use it. If not, find the
# highest one available. It seems that GM_API_VERSION was introduced
# somewhere after 1.3 but before 1.6. :-\
#
AC_MSG_CHECKING(for GM_API_VERSION)
AC_TRY_COMPILE([#include<gm.h>],
[int foo = GM_API_VERSION;],
have_gm_api_ver_msg=yes gm_api_ver=GM_API_VERSION,
have_gm_api_ver_msg=no gm_api_ver="")
AC_MSG_RESULT([$have_gm_api_ver_msg])
if test "$gm_api_ver" = ""; then
found=0
for val in 5 4 3; do
if test "$found" = "0"; then
var="GM_API_VERSION_1_$val"
AC_MSG_CHECKING(for $var)
AC_TRY_COMPILE([#include<gm.h>],
[int foo = $var;],
msg=yes found=1 gm_api_ver=$var,
msg=no found=0 gm_api_ver="")
AC_MSG_RESULT($msg)
fi
done
fi
if test "$gm_api_ver" = ""; then
AC_MSG_WARN([*** Could not find a supported GM_API_VERSION])
AC_MSG_ERROR([*** Cannot continue])
fi
AC_DEFINE_UNQUOTED(OMPI_MCA_MPOOL_GM_API_VERSION, $gm_api_ver,
[Version of the GM API to use])
unset gm_api_ver have_gm_api_ver_msg found val msg
#
# Do we have gm_put()?
# gm_put() was introduced in gm 2.0, and is exactly identical to gm
# 1.6's gm_directed_send_with_callback(). The name was simply changed
# for consistency/symmtery with gm_get().
#
AC_MSG_CHECKING([for gm_put()])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include<gm.h>
]],
[[gm_put(0, 0, 0, 0, 0, 0, 0, 0, 0);]])],
[HAVE_RDMA_PUT=1 MSG=yes],
[HAVE_RDMA_PUT=0 MSG="no, use gm_directed_send_with_callback()"])
AC_DEFINE_UNQUOTED(OMPI_MCA_MPOOL_GM_HAVE_RDMA_PUT, $HAVE_RDMA_PUT,
[Whether we have gm_put() or gm_directed_send_with_callback()])
AC_MSG_RESULT([$MSG])
#
# Do we have gm_get()?
# gm_get() was introduced in gm 2.0.
#
AC_MSG_CHECKING([for gm_get()])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include<gm.h>
]],
[[gm_get(0, 0, 0, 0, 0, 0, 0, 0, 0);]])],
[HAVE_RDMA_GET=1 MSG=yes],
[HAVE_RDMA_GET=0 MSG=no])
AC_DEFINE_UNQUOTED(OMPI_MCA_MPOOL_GM_HAVE_RDMA_GET, $HAVE_RDMA_GET,
[Whether we have get_get() or not])
AC_MSG_RESULT([$MSG])
# Now test to see if the targetted GM is a broken one broken gm builds
AC_MSG_CHECKING([for broken GM 2.x RDMA gets build])
AC_TRY_COMPILE([
#include <gm.h>
], [
#if GM_API_VERSION_2_0 && \
((GM_API_VERSION_2_1_0 && GM_API_VERSION < 0x20102) || \
GM_API_VERSION < 0x2000c)
#error GM build is broken
#endif ],
[ mca_btl_gm_broken=0 gm_build_broken=no ],
[ mca_btl_gm_broken=1 gm_build_broken=yes ])
AC_MSG_RESULT( [$gm_build_broken] )
AC_DEFINE_UNQUOTED( OMPI_MCA_MPOOL_GM_GET_BROKEN, $mca_btl_gm_broken,
[The GM build has or not a broker gm_get function] )
unset gm_build_broken mca_btl_gm_broken
AC_DEFINE_UNQUOTED( OMPI_MCA_MPOOL_GM_SUPPORT_REGISTERING, 1,
[The OS support or not the virtal page registration] )
#
# Save extra compiler/linker flags so that they can be added in
# the wrapper compilers, if necessary
#
WRAPPER_EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
WRAPPER_EXTRA_LIBS="-lgm"
])dnl
#
# For dist
#
AC_DEFUN([MCA_CONFIGURE_DIST_STUB],[
AM_CONDITIONAL( OMPI_ENABLE_GM_CACHE, test "yes" = "yes" )
])