2005-08-03 00:25:42 +04:00
# -*- shell-script -*-
2005-07-27 07:38:25 +04:00
#
2005-11-05 22:57:48 +03:00
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
2005-07-27 07:38:25 +04:00
# 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.
2007-04-21 04:15:05 +04:00
# Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
2007-02-15 21:03:20 +03:00
# Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
2005-07-27 07:38:25 +04:00
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI_CHECK_OPENIB(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if OPENIB support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_OPENIB],[
AC_ARG_WITH([openib],
2005-12-20 03:47:36 +03:00
[AC_HELP_STRING([--with-openib(=DIR)],
2007-04-21 04:15:05 +04:00
[Build OpenFabrics support, searching for libraries in DIR])])
2005-07-27 07:38:25 +04:00
AC_ARG_WITH([openib-libdir],
2005-12-20 03:47:36 +03:00
[AC_HELP_STRING([--with-openib-libdir=DIR],
2007-04-21 04:15:05 +04:00
[Search for OpenFabrics libraries in DIR])])
2005-07-27 07:38:25 +04:00
2005-11-28 23:44:53 +03:00
AS_IF([test ! -z "$with_openib" -a "$with_openib" != "yes"],
[ompi_check_openib_dir="$with_openib"])
AS_IF([test ! -z "$with_openib_libdir" -a "$with_openib_libdir" != "yes"],
[ompi_check_openib_libdir="$with_openib_libdir"])
2007-05-01 08:40:31 +04:00
AS_IF([test "$with_openib" = "no"],
[ompi_check_openib_happy="no"],
[ompi_check_openib_happy="yes"])
2005-07-27 07:38:25 +04:00
2007-05-01 08:40:31 +04:00
ompi_check_openib_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_openib_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_openib_$1_save_LIBS="$LIBS"
2007-04-21 04:15:05 +04:00
2007-05-01 08:40:31 +04:00
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AS_IF([test "$THREAD_TYPE" != "posix" -a "$memory_ptmalloc2_happy" = "yes"],
[AC_MSG_WARN([POSIX Threads disabled but PTMalloc2 enabled.])
AC_MSG_WARN([This will cause memory corruption with OpenFabrics.])
AC_MSG_WARN([Not building component.])
ompi_check_openib_happy="no"])])
2005-08-03 00:25:42 +04:00
2007-05-01 08:40:31 +04:00
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[OMPI_CHECK_PACKAGE([$1],
[infiniband/verbs.h],
[ibverbs],
[ibv_open_device],
[],
[$ompi_check_openib_dir],
[$ompi_check_openib_libdir],
[ompi_check_openib_happy="yes"],
[ompi_check_openib_happy="no"])])
2005-09-29 17:35:57 +04:00
2007-05-01 08:40:31 +04:00
CPPFLAGS="$CPPFLAGS $$1_CPPFLAGS"
LDFLAGS="$LDFLAGS $$1_LDFLAGS"
LIBS="$LIBS $$1_LIBS"
2005-09-29 17:35:57 +04:00
2007-05-01 08:40:31 +04:00
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AC_CACHE_CHECK(
2005-12-20 03:47:36 +03:00
[number of arguments to ibv_create_cq],
[ompi_cv_func_ibv_create_cq_args],
[AC_LINK_IFELSE(
2007-05-01 08:40:31 +04:00
[AC_LANG_PROGRAM(
[[#include <infiniband/verbs.h> ]],
[[ibv_create_cq(NULL, 0, NULL, NULL, 0);]])],
[ompi_cv_func_ibv_create_cq_args=5],
[AC_LINK_IFELSE(
2005-12-20 03:47:36 +03:00
[AC_LANG_PROGRAM(
[[#include <infiniband/verbs.h> ]],
[[ibv_create_cq(NULL, 0, NULL);]])],
2007-05-01 08:40:31 +04:00
[ompi_cv_func_ibv_create_cq_args=3],
[ompi_cv_func_ibv_create_cq_args="unknown"])])])
AS_IF([test "$ompi_cv_func_ibv_create_cq_args" = "unknown"],
[AC_MSG_WARN([Can not determine number of args to ibv_create_cq.])
AC_MSG_WARN([Not building component.])
ompi_check_openib_happy="no"],
2007-06-05 05:49:26 +04:00
[AC_DEFINE_UNQUOTED([OMPI_IBV_CREATE_CQ_ARGS],
2007-05-01 08:40:31 +04:00
[$ompi_cv_func_ibv_create_cq_args],
[Number of arguments to ibv_create_cq])])])
AS_IF([test "$ompi_check_openib_happy" = "yes"],
2007-05-15 17:53:49 +04:00
[AC_CHECK_DECLS([IBV_EVENT_CLIENT_REREGISTER], [], [],
[#include <infiniband/verbs.h>])
2007-06-05 05:49:26 +04:00
AC_CHECK_FUNCS([ibv_get_device_list ibv_resize_cq])])
2006-01-14 02:20:49 +03:00
2007-05-01 08:40:31 +04:00
CPPFLAGS="$ompi_check_openib_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_openib_$1_save_LDFLAGS"
LIBS="$ompi_check_openib_$1_save_LIBS"
2005-07-27 07:38:25 +04:00
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[$2],
2005-11-28 23:44:53 +03:00
[AS_IF([test ! -z "$with_openib" -a "$with_openib" != "no"],
Fixes trac:1045.
libsysfs headers are required for libibverbs v1.0 (i.e., OFED 1.0 and
OFED 1.1), meaning that <infiniband/verbs.h> would #include
<sysfs/libsysfs.h>. Hence, if the libsysfs headers did not exist on a
system, including <verbs.h> would fail.
With older versions of Autoconf, we would simply test for the
''presence'' of the <infinband/verbs.h> and not actually try to
''use'' it. This could leave OMPI in a weird situation on systems
that did not have the sysfs headers installed: configure would
complete successfully, but the build of the openib btl would fail.
Some users complained, thinking that there was a real compile error in
the OMPI code base.
Hence, we decided that it would be better to AC_CHECK_HEADER for the
sysfs header files in configure. If the sysfs header files were not
found, configure would abort. Users generally understand when
configure aborts, and know how to read the output and fix the
underlying problem; it was ''much'' more obvious than having the OMPI
build fail for nebulous reasons much later.
Note that we also checked for / added -lsysfs, but that wasn't
necessary because libibverbs already run-time linked to it (i.e.,
libibverbs couldn't have been installed if the sysfs libraries weren't
installed).
However, there are now two reasons why the check for sysfs's header
files is no longer necessary:
* Newer versions of Autoconf are now used for OMPI tarballs that
check for both the presence '''and''' usability of header files.
Hence, AC_CHECK_HEADER for <infiniband/verbs.h> will actually try
to ''use'' it, so if the sysfs header files are not installed,
AC_CHECK_HEADER will (rightfully) fail.
* libibverbs v1.1 (i.e., OFED 1.2 and beyond) does not require
libsysfs at all (headers or libraries).
When checking for the sysfs header files, OMPI's configure ''forces''
you to have sysfs installed, even though it may not be needed (e.g.,
libibverbs v1.1 and beyond). Clearly, this is not good (especially
since the sysfs software package is now deprecated, and some Linux
distros no longer install it by default).
So this commit simply removes the check for the sysfs header files and
libraries, allowing OMPI to be build on systems with libibverbs >=1.1 that
do not have sysfs installed.
For systems with libibverbs 1.0, if they do not have the sysfs headers
installed, we'll still fail AC_CHECK_HEADER and therefore still fail
configure properly. I expanded the warning message to say that if
libibverbs 1.0 is being used, check to ensure that sysfs is installed,
yadda yadda yadda.
This commit was SVN r14971.
The following Trac tickets were found above:
Ticket 1045 --> https://svn.open-mpi.org/trac/ompi/ticket/1045
2007-06-09 03:34:05 +04:00
[AC_MSG_WARN([OpenFabrics support requested (via --with-openib) but not found.])
AC_MSG_WARN([If you are using libibverbs v1.0 (i.e., OFED v1.0 or v1.1), you *MUST* have both the libsysfs headers and libraries installed. Later versions of libibverbs do not require libsysfs.])
AC_MSG_ERROR([Aborting.])])
2005-07-27 07:38:25 +04:00
$3])
])