diff --git a/src/mca/ptl/gm/configure.stub b/src/mca/ptl/gm/configure.stub index 16823e331a..fb09c72835 100644 --- a/src/mca/ptl/gm/configure.stub +++ b/src/mca/ptl/gm/configure.stub @@ -8,40 +8,128 @@ # configure script. # AC_DEFUN([MCA_CONFIGURE_STUB],[ -# -# gm ptl configure.stub -# -# -# ...do whatever you need to do here, like look for the Elan4 -# libraries and header files. Built-in tests such as AC_CHECK_LIBS -# and AC_CHECK_HEADERS may be useful here. See the Autoconf docs ... -# -echo "Hello from gm configure.stub:MCA-CONFIGURE-STUB!" + # Additional --with flags that can be specified -# -# done with gm ptl configure.stub -# -])dnl - - -# -# Since MCA_CONFIGURE_STUB is not invoked when we are configured with -# --enable dist, we provide this alternate macro is that invoked -# instead. Not all modules will need this -- probably only modules -# thaty use AM_CONDITIONALS will require doing anything here. If you -# don't need it, you can remove this whole AC_DEFUN. -# -AC_DEFUN([MCA_CONFIGURE_DIST_STUB],[ -# -# gm ptl configure-dist.stub -# - -# ...probably only need this if have AM_CONDITIONALs in the -# MCA_CONFIGURE_STUB. -echo "Hello from gm configure.stub:MCA-CONFIGURE-DIST-STUB!" - -# -# done with gm ptl configure-dist.stub -# + AC_ARG_WITH(ptl-gm, + AC_HELP_STRING([--with-ptl-gm=DIR], + [Specify the installation directory of GM])) + AC_ARG_WITH(ptl-gm-libdir, + AC_HELP_STRING([--with-ptl-gm-libdir=DIR], + [directory where the GM library can be found, if it is not in \$GMDIR/lib or \$GMDIR/binary/lib])) + + # Add to CPPFLAGS if necessary + + EXTRA_CPPFLAGS= + if test -n "$with_ptl_gm"; then + if test -d "$with_ptl_gm/include"; then + EXTRA_CPPFLAGS="-I$with_ptl_gm/include" + else + AC_MSG_WARN([*** Warning: cannot find $with_ptl_gm/include]) + AC_MSG_WARN([*** Will still try to configure gm ptl 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_ptl_gm_libdir"; then + if test -d "$with_ptl_gm_libdir/lib"; then + EXTRA_LDFLAGS="-L$with_ptl_gm_libdir/lib" + elif test -d "$with_ptl_bm_libdir/binary/lib"; then + EXTRA_LDFLAGS="-L$with_ptl_gm_libdir/binary/lib" + else + AC_MSG_WARN([*** Warning: cannot find $with_ptl_gm_libdir/lib]) + AC_MSG_WARN([*** or $with_ptl_gm_libdir/binary/lib]) + AC_MSG_WARN([*** Will still try to configure gm ptl anyway...]) + fi + elif test -n "$with_ptl_gm"; then + if test -d "$with_ptl_gm/lib"; then + EXTRA_LDFLAGS="-L$with_ptl_gm/lib" + elif test -d "$with_ptl_bm/binary/lib"; then + EXTRA_LDFLAGS="-L$with_ptl_gm/binary/lib" + else + AC_MSG_WARN([*** Warning: cannot find $with_ptl_gm/lib]) + AC_MSG_WARN([*** or $with_ptl_gm/binary/lib]) + AC_MSG_WARN([*** Will still try to configure gm ptl 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], + [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], + [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_PTL_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_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_PTL_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_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_PTL_GM_HAVE_RDMA_GET, $HAVE_RDMA_GET, + [Whether we have get_get() or not]) + AC_MSG_RESULT([$MSG]) ])dnl