33dnl Copyright (c) 2001-2011 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
44dnl Copyright (c) 2015 Research Organization for Information Science
55dnl and Technology (RIST). All rights reserved.
6+ dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
7+ dnl reserved.
68dnl $COPYRIGHT $
79dnl
810dnl Additional copyrights may follow
1618# LDFLAGS, LIBS} as needed and runs action-if-found if there is
1719# support, otherwise executes action-if-not-found
1820AC_DEFUN([OMPI_CHECK_MXM],[
19- AC_ARG_WITH([mxm],
20- [AC_HELP_STRING([--with-mxm(=DIR)],
21- [Build Mellanox Messaging support, optionally adding
22- DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
23- AC_ARG_WITH([mxm-libdir],
24- [AC_HELP_STRING([--with-mxm-libdir= DIR],
25- [Search for Mellanox MXM libraries in DIR])])
26- OPAL_CHECK_WITHDIR([mxm-libdir], [$with_mxm_libdir ], [libmxm.* ])
21+ if test -z " $ompi_check_mxm_happy " ; then
22+ AC_ARG_WITH([mxm],
23+ [AC_HELP_STRING([--with-mxm(=DIR)],
24+ [Build Mellanox Messaging support, optionally adding
25+ DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
26+ AC_ARG_WITH([mxm-libdir],
27+ [AC_HELP_STRING([--with-mxm-libdir= DIR],
28+ [Search for Mellanox MXM libraries in DIR])])
29+ OPAL_CHECK_WITHDIR([mxm-libdir], [$with_mxm_libdir ], [libmxm.* ])
2730
28- ompi_check_mxm_$1 _save_CPPFLAGS=" $CPPFLAGS "
29- ompi_check_mxm_$1 _save_LDFLAGS=" $LDFLAGS "
30- ompi_check_mxm_$1 _save_LIBS=" $LIBS "
31+ ompi_check_mxm_$1 _save_CPPFLAGS=" $CPPFLAGS "
32+ ompi_check_mxm_$1 _save_LDFLAGS=" $LDFLAGS "
33+ ompi_check_mxm_$1 _save_LIBS=" $LIBS "
3134
32- AS_IF([test " $with_mxm " != " no" ],
33- [AS_IF([test ! -z " $with_mxm " && test " $with_mxm " != " yes" ],
34- [
35+ AS_IF([test " $with_mxm " != " no" ],
36+ [AS_IF([test ! -z " $with_mxm " && test " $with_mxm " != " yes" ],
37+ [
3538 ompi_check_mxm_dir= " $with_mxm "
36- ])
37- AS_IF([test ! -z " $with_mxm_libdir " && test " $with_mxm_libdir " != " yes" ],
38- [ompi_check_mxm_libdir= " $with_mxm_libdir " ])
39+ ])
40+ AS_IF([test ! -z " $with_mxm_libdir " && test " $with_mxm_libdir " != " yes" ],
41+ [ompi_check_mxm_libdir= " $with_mxm_libdir " ])
3942
40- OPAL_CHECK_PACKAGE([$1 ],
41- [mxm/api/mxm_api.h],
42- [mxm],
43- [mxm_cleanup],
44- [],
45- [$ompi_check_mxm_dir ],
46- [$ompi_check_mxm_libdir ],
47- [ompi_check_mxm_happy= " yes" ],
48- [ompi_check_mxm_happy= " no" ])],
49- [ompi_check_mxm_happy= " no" ])
43+ OPAL_CHECK_PACKAGE([ompi_check_mxm ],
44+ [mxm/api/mxm_api.h],
45+ [mxm],
46+ [mxm_cleanup],
47+ [],
48+ [$ompi_check_mxm_dir ],
49+ [$ompi_check_mxm_libdir ],
50+ [ompi_check_mxm_happy= " yes" ],
51+ [ompi_check_mxm_happy= " no" ])],
52+ [ompi_check_mxm_happy= " no" ])
5053
54+ CPPFLAGS=" $ompi_check_mxm_ $1 _save_CPPFLAGS"
55+ LDFLAGS=" $ompi_check_mxm_ $1 _save_LDFLAGS"
56+ LIBS=" $ompi_check_mxm_ $1 _save_LIBS"
5157
52-
53- CPPFLAGS=" $ompi_check_mxm_ $1 _save_CPPFLAGS"
54- LDFLAGS=" $ompi_check_mxm_ $1 _save_LDFLAGS"
55- LIBS=" $ompi_check_mxm_ $1 _save_LIBS"
56-
57- AC_MSG_CHECKING(for MXM version compatibility)
58- AC_REQUIRE_CPP
59- old_CFLAGS=" $CFLAGS "
60- CFLAGS=" $CFLAGS -I$ompi_check_mxm_dir /include"
61- AC_COMPILE_IFELSE(
58+ AC_MSG_CHECKING(for MXM version compatibility)
59+ AC_REQUIRE_CPP
60+ old_CFLAGS=" $CFLAGS "
61+ CFLAGS=" $CFLAGS -I$ompi_check_mxm_dir /include"
62+ AC_COMPILE_IFELSE(
6263 [AC_LANG_PROGRAM([[# include <mxm/api/mxm_version.h>]],
63- [[
64+ [[
6465# ifndef MXM_VERSION
6566# error "MXM Version is less than 2.1, please upgrade"
6667# endif
@@ -72,13 +73,19 @@ AC_DEFUN([OMPI_CHECK_MXM],[
7273 [ompi_mxm_version_ok= " yes" ],
7374 [ompi_mxm_version_ok= " no" ])
7475
75- AC_MSG_RESULT([$ompi_mxm_version_ok ])
76- CFLAGS= $old_CFLAGS
76+ AC_MSG_RESULT([$ompi_mxm_version_ok ])
77+ CFLAGS= $old_CFLAGS
78+
79+ AS_IF([test " $ompi_mxm_version_ok " = " no" ], [ompi_check_mxm_happy= " no" ])
7780
78- AS_IF([test " $ompi_mxm_version_ok " = " no" ], [ompi_check_mxm_happy= " no" ])
81+ OMPI_SUMMARY_ADD([[Transports]],[[Mellanox MXM]],[$1 ],[$ompi_check_mxm_happy ])
82+ fi
7983
8084 AS_IF([test " $ompi_check_mxm_happy " = " yes" ],
81- [$2 ],
85+ [$1 _LDFLAGS= " [$]$_LDFLAGS $ompi_check_mxm_LDFLAGS "
86+ $1 _LIBS= " [$]$1 _LIBS $ompi_check_mxm_LIBS "
87+ $1 _CPPFLAGS= " [$]$1 _CPPFLAGS $ompi_check_mxm_CPPFLAGS "
88+ $2 ],
8289 [AS_IF([test ! -z " $with_mxm " && test " $with_mxm " != " no" ],
8390 [AC_MSG_ERROR([MXM support requested but not found. Aborting])])
8491 $3 ])
0 commit comments