|
1 | 1 | # -*- shell-script -*- |
2 | 2 | # |
3 | | -# Copyright (C) 2015 Mellanox Technologies Ltd. ALL RIGHTS RESERVED. |
| 3 | +# Copyright (C) 2015-2017 Mellanox Technologies, Inc. |
| 4 | +# All rights reserved. |
4 | 5 | # Copyright (c) 2015 Research Organization for Information Science |
5 | 6 | # and Technology (RIST). All rights reserved. |
6 | 7 | # Copyright (c) 2016 Los Alamos National Security, LLC. All rights |
@@ -29,58 +30,69 @@ AC_DEFUN([OMPI_CHECK_UCX],[ |
29 | 30 | [Search for Unified Communication X libraries in DIR])]) |
30 | 31 | OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*]) |
31 | 32 |
|
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 | | - |
36 | 33 | AS_IF([test "$with_ucx" != "no"], |
37 | 34 | [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "yes"], |
| 35 | + [_x_ac_ucx_dirs="$with_ucx"], |
38 | 36 | [ |
39 | | - ompi_check_ucx_dir="$with_ucx" |
40 | | - ompi_check_ucx_libdir="$with_ucx/lib" |
| 37 | + PKG_CHECK_MODULES_STATIC([ucx],[ucx], |
| 38 | + [_x_ac_ucx_dirs=`$PKG_CONFIG --variable=prefix ucx`], |
| 39 | + [_x_ac_ucx_dirs="/usr /usr/local /opt/ucx"]) |
41 | 40 | ]) |
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" |
| 41 | + for ompi_check_ucx_dir in $_x_ac_ucx_dirs; do |
| 42 | + AS_IF([test ! -z "$with_ucx_libdir" && test "$with_ucx_libdir" != "yes"], |
| 43 | + [ |
| 44 | + ompi_check_ucx_libdir="$with_ucx_libdir" |
| 45 | + ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir" |
| 46 | + ], |
| 47 | + [AS_IF([test ! -z "$ompi_check_ucx_dir"], |
| 48 | + [ |
| 49 | + ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib |
| 50 | + ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir" |
| 51 | + ])]) |
46 | 52 |
|
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"]) |
| 53 | + ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS" |
| 54 | + ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS" |
| 55 | + ompi_check_ucx_$1_save_LIBS="$LIBS" |
57 | 56 |
|
| 57 | + OPAL_CHECK_PACKAGE([ompi_check_ucx], |
| 58 | + [ucp/api/ucp.h], |
| 59 | + [ucp], |
| 60 | + [ucp_cleanup], |
| 61 | + [$ompi_check_ucx_extra_libs], |
| 62 | + [$ompi_check_ucx_dir], |
| 63 | + [$ompi_check_ucx_libdir], |
| 64 | + [ompi_check_ucx_happy="yes"], |
| 65 | + [ompi_check_ucx_happy="no"]) |
| 66 | + CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS" |
| 67 | + LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS" |
| 68 | + LIBS="$ompi_check_ucx_$1_save_LIBS" |
58 | 69 |
|
| 70 | + if test "$ompi_check_ucx_happy" = no; then |
| 71 | + continue |
| 72 | + fi |
59 | 73 |
|
60 | | - CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS" |
61 | | - LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS" |
62 | | - LIBS="$ompi_check_ucx_$1_save_LIBS" |
| 74 | + AC_MSG_CHECKING(for UCX version compatibility) |
| 75 | + AC_REQUIRE_CPP |
| 76 | + old_CPPFLAGS="$CPPFLAGS" |
| 77 | + CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include" |
| 78 | + AC_COMPILE_IFELSE( |
| 79 | + [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
| 80 | + [ompi_ucx_version_ok="yes"], |
| 81 | + [ompi_ucx_version_ok="no"]) |
63 | 82 |
|
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"]) |
| 83 | + AC_MSG_RESULT([$ompi_ucx_version_ok]) |
| 84 | + CPPFLAGS=$old_CPPFLAGS |
74 | 85 |
|
75 | | - AC_MSG_RESULT([$ompi_ucx_version_ok]) |
76 | | - CPPFLAGS=$old_CPPFLAGS |
| 86 | + AS_IF([test "$ompi_ucx_version_ok" = "no"], [ompi_check_ucx_happy="no"]) |
77 | 87 |
|
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]) |
| 88 | + if test "$ompi_check_ucx_happy" = yes; then |
| 89 | + break |
| 90 | + fi |
| 91 | + done], |
| 92 | + [ompi_check_ucx_happy="no"]) |
| 93 | + OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy]) |
81 | 94 | fi |
82 | 95 |
|
83 | | - |
84 | 96 | AS_IF([test "$ompi_check_ucx_happy" = "yes"], |
85 | 97 | [$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS" |
86 | 98 | $1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS" |
|
0 commit comments