11# -*- shell-script -*-
22#
3- # Copyright (C) 2015 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
3+ # Copyright (C) 2015-2017 Mellanox Technologies, Inc.
4+ # All rights reserved.
45# Copyright (c) 2015 Research Organization for Information Science
56# and Technology (RIST). All rights reserved.
67# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
2021# support, otherwise executes action-if-not-found
2122AC_DEFUN([OMPI_CHECK_UCX],[
2223 if test -z " $ompi_check_ucx_happy " ; then
24+ _x_ac_ucx_dirs=" /usr /usr/local /opt/ucx"
2325 AC_ARG_WITH([ucx],
2426 [AC_HELP_STRING([--with-ucx(=DIR)],
2527 [Build with Unified Communication X library support])])
@@ -29,58 +31,64 @@ AC_DEFUN([OMPI_CHECK_UCX],[
2931 [Search for Unified Communication X libraries in DIR])])
3032 OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir ], [libucp.* ])
3133
32- ompi_check_ucx_$1 _save_CPPFLAGS=" $CPPFLAGS "
33- ompi_check_ucx_$1 _save_LDFLAGS=" $LDFLAGS "
34- ompi_check_ucx_$1 _save_LIBS=" $LIBS "
35-
3634 AS_IF([test " $with_ucx " != " no" ],
3735 [AS_IF([test ! -z " $with_ucx " && test " $with_ucx " != " yes" ],
38- [
39- ompi_check_ucx_dir= " $with_ucx "
40- ompi_check_ucx_libdir= " $with_ucx /lib"
41- ])
42- AS_IF([test ! -z " $with_ucx_libdir " && test " $with_ucx_libdir " != " yes" ],
43- [ompi_check_ucx_libdir= " $with_ucx_libdir " ])
44-
45- ompi_check_ucx_extra_libs= " -L$ompi_check_ucx_libdir "
36+ [_x_ac_ucx_dirs= " $with_ucx " ])
37+ for ompi_check_ucx_dir in $_x_ac_ucx_dirs ; do
38+ AS_IF([test ! -z " $with_ucx_libdir " && test " $with_ucx_libdir " != " yes" ],
39+ [
40+ ompi_check_ucx_libdir= " $with_ucx_libdir "
41+ ompi_check_ucx_extra_libs= " -L$ompi_check_ucx_libdir "
42+ ],
43+ [AS_IF([test ! -z " $ompi_check_ucx_dir " ],
44+ [
45+ ompi_check_ucx_libdir= $ompi_check_ucx_dir /lib
46+ ompi_check_ucx_extra_libs= " -L$ompi_check_ucx_libdir "
47+ ])])
4648
47- OPAL_CHECK_PACKAGE([ompi_check_ucx],
48- [ucp/api/ucp.h],
49- [ucp],
50- [ucp_cleanup],
51- [$ompi_check_ucx_extra_libs ],
52- [$ompi_check_ucx_dir ],
53- [$ompi_check_ucx_libdir ],
54- [ompi_check_ucx_happy= " yes" ],
55- [ompi_check_ucx_happy= " no" ])],
56- [ompi_check_ucx_happy= " no" ])
49+ ompi_check_ucx_$1 _save_CPPFLAGS=" $CPPFLAGS "
50+ ompi_check_ucx_$1 _save_LDFLAGS=" $LDFLAGS "
51+ ompi_check_ucx_$1 _save_LIBS=" $LIBS "
5752
53+ OPAL_CHECK_PACKAGE([ompi_check_ucx],
54+ [ucp/api/ucp.h],
55+ [ucp],
56+ [ucp_cleanup],
57+ [$ompi_check_ucx_extra_libs ],
58+ [$ompi_check_ucx_dir ],
59+ [$ompi_check_ucx_libdir ],
60+ [ompi_check_ucx_happy= " yes" ],
61+ [ompi_check_ucx_happy= " no" ])
62+ CPPFLAGS=" $ompi_check_ucx_ $1 _save_CPPFLAGS"
63+ LDFLAGS=" $ompi_check_ucx_ $1 _save_LDFLAGS"
64+ LIBS=" $ompi_check_ucx_ $1 _save_LIBS"
5865
66+ if test " $ompi_check_ucx_happy " = no; then
67+ continue
68+ fi
5969
60- CPPFLAGS=" $ompi_check_ucx_ $1 _save_CPPFLAGS"
61- LDFLAGS=" $ompi_check_ucx_ $1 _save_LDFLAGS"
62- LIBS=" $ompi_check_ucx_ $1 _save_LIBS"
70+ AC_MSG_CHECKING(for UCX version compatibility)
71+ AC_REQUIRE_CPP
72+ old_CPPFLAGS=" $CPPFLAGS "
73+ CPPFLAGS=" $CPPFLAGS -I$ompi_check_ucx_dir /include"
74+ AC_COMPILE_IFELSE(
75+ [AC_LANG_PROGRAM([[# include <uct/api/version.h>]],[[]])],
76+ [ompi_ucx_version_ok= " yes" ],
77+ [ompi_ucx_version_ok= " no" ])
6378
64- AC_MSG_CHECKING(for UCX version compatibility)
65- AC_REQUIRE_CPP
66- old_CPPFLAGS=" $CPPFLAGS "
67- CPPFLAGS=" $CPPFLAGS -I$ompi_check_ucx_dir /include"
68- AC_COMPILE_IFELSE(
69- [AC_LANG_PROGRAM([[# include <uct/api/version.h>]],
70- [[
71- ]])],
72- [ompi_ucx_version_ok= " yes" ],
73- [ompi_ucx_version_ok= " no" ])
79+ AC_MSG_RESULT([$ompi_ucx_version_ok ])
80+ CPPFLAGS= $old_CPPFLAGS
7481
75- AC_MSG_RESULT([$ompi_ucx_version_ok ])
76- CPPFLAGS= $old_CPPFLAGS
82+ AS_IF([test " $ompi_ucx_version_ok " = " no" ], [ompi_check_ucx_happy= " no" ])
7783
78- AS_IF([test " $ompi_ucx_version_ok " = " no" ], [ompi_check_ucx_happy= " no" ])
79-
80- OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1 ],[$ompi_check_ucx_happy ])
84+ if test " $ompi_check_ucx_happy " = yes; then
85+ break
86+ fi
87+ done],
88+ [ompi_check_ucx_happy= " no" ])
89+ OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1 ],[$ompi_check_ucx_happy ])
8190 fi
8291
83-
8492 AS_IF([test " $ompi_check_ucx_happy " = " yes" ],
8593 [$1 _CPPFLAGS= " [$]$1 _CPPFLAGS $ompi_check_ucx_CPPFLAGS "
8694 $1 _LDFLAGS= " [$]$1 _LDFLAGS $ompi_check_ucx_LDFLAGS "
0 commit comments