1
1
openmpi/ompi/mca/btl/openib/configure.stub
Galen Shipman ed1da1a7c8 verbs.h not vapi.h --- doh
This commit was SVN r6444.
2005-07-12 19:07:32 +00:00

153 строки
5.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-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-openib,
AC_HELP_STRING([--with-btl-openib=IBDIR],
[Specify the installation directory of IB (should enable the correct automatic determination of using the 32 or 64 bit library, if both are present under IBDIR/lib and IBDIR/lib64)]))
AC_ARG_WITH(btl-openib-libdir,
AC_HELP_STRING([--with-btl-openib-libdir=IBLIBDIR],
[directory where the IB library can be found, if it is not in $IBDIR/lib or $IBDIR/lib/infiniband]))
# Quick sanity check
if test "$with_btl_openib" = "no"; then
AC_MSG_WARN([*** --without-btl-openib specified -- aborting])
AC_MSG_ERROR([Will not continue])
fi
# Find the right IBDIR
if test "$with_btl_openib" != "" -a "$with_btl_openib" != "yes" ; then
IBDIR="$with_btl_openib"
IBLIBDIR="$with_btl_openib"
fi
if test "$with_btl_openib_libdir" != "" -a "$with_btl_openib_libdir" != "yes" -a \
"$with_btl_openib_libdir" != "no"; then
IBLIBDIR="$with_btl_openib_libdir"
fi
# Add to CPPFLAGS if necessary
EXTRA_CPPFLAGS=
if test "$IBDIR" != ""; then
if test -d "$IBDIR/include"; then
EXTRA_CPPFLAGS="-I$IBDIR/include"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/include])
AC_MSG_WARN([*** Will still try to configure openib btl anyway...])
fi
fi
# See if we can find verbs.h. First try without any additional
# -I's to see if we can find it easily. If we don't find it, then
# try again with the EXTRA_CPPFLAGS. This prevents us from adding
# things like -I/usr/local if we don't need to.
AC_CHECK_HEADERS(infiniband/verbs.h,,
[CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS"
eval "unset ac_cv_header_vapi_h"
AC_CHECK_HEADERS(infiniband/verbs.h,,
AC_MSG_ERROR([*** Cannot find working infiniband/verbs.h]))])
# Many vapi.h's have horrid semantics and don't obey ISOC99
# standards. So we have to turn off flags like -pedantic. Sigh.
# Galen: is this true for Open IB?
#CFLAGS="`echo $CFLAGS | sed 's/-pedantic//g'`"
# Note that it is possible to find the library even if -L is not
# specified, if the LD_LIBRARY_PATH includes the directory where
# the shared ib library is kept. Hence, we unset LD_LIBRARY_PATH
# before running this test.
LD_LIBRARY_PATH_save="$LD_LIBRARY_PATH"
unset LD_LIBRARY_PATH
# Helper function to try to find libvapi (called from below).
mca_btl_openib_try_find_lib() {
func1=[$]1
func2=[$]2
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
vapi_badness=
AC_CHECK_LIB([vapi], [$func1], [], [vapi_badness=true],
[-lmthca -libcm])
if test "$vapi_badness" != ""; then
AC_TRY_LINK([#include <pthread.h>], [pthread_create(0,0,0,0);],
[pthreads="yes"],
[pthreads="no"])
AC_CHECK_LIB(sysfs, sysfs_open_class,
[sysfs=yes LIBS="$LIBS -lsysfs"],
[sysfs=no])
if test "$pthread" = "yes" && test "$sysfs" = "yes"; then
AC_CHECK_LIB([vapi], [$func2], [], [],
[-lmthca -libcm])
fi
fi
}
# Open IB does not appear to make lib64 variants -- just try the
# normal "lib" directory.
LIBS_save="$LIBS"
LDFLAGS_save="$LDFLAGS"
# Galen: Are these the right extra libs?
LIBS="$LIBS -lmthca -libcm"
LIBS_orig="$LIBS"
EXTRA_LDFLAGS=
if test -d "$IBLIBDIR/lib/infiniband"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib/infiniband"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
# Galen: are these the right symbol names?
mca_btl_openib_try_find_lib ibv_get_devices ibv_open_device
if test "$LIBS" != "$LIBS_orig"; then
# Galen: Are we looking for "libvapi"?
echo "--> found libibverbs libs in $IBLIBDIR/lib"
fi
fi
if test "$LIBS" = "$LIBS_orig"; then
# Galen: Are we looking for "libvapi"?
AC_MSG_ERROR([*** Cannot find working libibverbs.])
fi
LD_LIBRARY_PATH="$LD_LIBRARY_PATH_save"
# Galen: Are these the right extra libs?
LIBS="$LIBS -lmthca -libcm"
#
# Save extra compiler/linker flags so that they can be added in
# the wrapper compilers, if necessary
#
WRAPPER_EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
# Galen: Are these the right extra libs?
WRAPPER_EXTRA_LIBS="-libibverbs -lmmthca -libcm"
])dnl