|
20 | 20 | # LDFLAGS, LIBS} as needed and runs action-if-found if there is
|
21 | 21 | # support, otherwise executes action-if-not-found
|
22 | 22 | AC_DEFUN([OMPI_CHECK_UCX],[
|
23 |
| - if test -z "$ompi_check_ucx_happy" ; then |
24 |
| - AC_ARG_WITH([ucx], |
25 |
| - [AC_HELP_STRING([--with-ucx(=DIR)], |
26 |
| - [Build with Unified Communication X library support])]) |
27 |
| - OPAL_CHECK_WITHDIR([ucx], [$with_ucx], [include/ucp/api/ucp.h]) |
28 |
| - AC_ARG_WITH([ucx-libdir], |
29 |
| - [AC_HELP_STRING([--with-ucx-libdir=DIR], |
30 |
| - [Search for Unified Communication X libraries in DIR])]) |
31 |
| - OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*]) |
| 23 | + OPAL_VAR_SCOPE_PUSH([ompi_check_ucx_dir]) |
32 | 24 |
|
33 |
| - AS_IF([test "$with_ucx" != "no"], |
34 |
| - [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "yes"], |
35 |
| - [_x_ac_ucx_dirs="$with_ucx"], |
36 |
| - [ |
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"]) |
40 |
| - ]) |
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 |
| - ])]) |
| 25 | + AS_IF([test -z "$ompi_check_ucx_happy"], |
| 26 | + [AC_ARG_WITH([ucx], |
| 27 | + [AC_HELP_STRING([--with-ucx(=DIR)], |
| 28 | + [Build with Unified Communication X library support])]) |
| 29 | + OPAL_CHECK_WITHDIR([ucx], [$with_ucx], [include/ucp/api/ucp.h]) |
| 30 | + AC_ARG_WITH([ucx-libdir], |
| 31 | + [AC_HELP_STRING([--with-ucx-libdir=DIR], |
| 32 | + [Search for Unified Communication X libraries in DIR])]) |
| 33 | + OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*]) |
52 | 34 |
|
53 |
| - ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS" |
54 |
| - ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS" |
55 |
| - ompi_check_ucx_$1_save_LIBS="$LIBS" |
| 35 | + AS_IF([test "$with_ucx" != "no"], |
| 36 | + [AS_IF([test -n "$with_ucx" && test "$with_ucx" != "yes"], |
| 37 | + [ompi_check_ucx_dir="$with_ucx"], |
| 38 | + [PKG_CHECK_MODULES_STATIC([ucx],[ucx], |
| 39 | + [ompi_check_ucx_dir=`$PKG_CONFIG --variable=prefix ucx` |
| 40 | + AS_IF([test "$ompi_check_ucx_dir" = "/usr"], |
| 41 | + [ompi_check_ucx_dir=])], |
| 42 | + [true])]) |
| 43 | + ompi_check_ucx_happy="no" |
| 44 | + AS_IF([test -z "$ompi_check_ucx_dir"], |
| 45 | + [OPAL_CHECK_PACKAGE([ompi_check_ucx], |
| 46 | + [ucp/api/ucp.h], |
| 47 | + [ucp], |
| 48 | + [ucp_cleanup], |
| 49 | + [], |
| 50 | + [], |
| 51 | + [], |
| 52 | + [ompi_check_ucx_happy="yes"], |
| 53 | + [ompi_check_ucx_happy="no"]) |
| 54 | + AS_IF([test "$ompi_check_ucx_happy" = yes], |
| 55 | + [AC_MSG_CHECKING(for UCX version compatibility) |
| 56 | + AC_REQUIRE_CPP |
| 57 | + AC_COMPILE_IFELSE( |
| 58 | + [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
| 59 | + [ompi_check_ucx_happy="yes"], |
| 60 | + [ompi_check_ucx_happy="no"]) |
56 | 61 |
|
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" |
| 62 | + AC_MSG_RESULT([$ompi_check_ucx_happy])]) |
| 63 | + AS_IF([test "$ompi_check_ucx_happy" = "no"], |
| 64 | + [ompi_check_ucx_dir=/opt/ucx])]) |
| 65 | + AS_IF([test "$ompi_check_ucx_happy" != yes], |
| 66 | + [AS_IF([test -n "$with_ucx_libdir"], |
| 67 | + [ompi_check_ucx_libdir="$with_ucx_libdir"], |
| 68 | + [files=`ls $ompi_check_ucx_dir/lib64/libucp.* 2> /dev/null | wc -l` |
| 69 | + AS_IF([test "$files" -gt 0], |
| 70 | + [ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib64], |
| 71 | + [ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib])]) |
69 | 72 |
|
70 |
| - if test "$ompi_check_ucx_happy" = no; then |
71 |
| - continue |
72 |
| - fi |
| 73 | + ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS" |
| 74 | + ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS" |
| 75 | + ompi_check_ucx_$1_save_LIBS="$LIBS" |
73 | 76 |
|
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"]) |
| 77 | + OPAL_CHECK_PACKAGE([ompi_check_ucx], |
| 78 | + [ucp/api/ucp.h], |
| 79 | + [ucp], |
| 80 | + [ucp_cleanup], |
| 81 | + [], |
| 82 | + [$ompi_check_ucx_dir], |
| 83 | + [$ompi_check_ucx_libdir], |
| 84 | + [ompi_check_ucx_happy="yes"], |
| 85 | + [ompi_check_ucx_happy="no"]) |
| 86 | + CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS" |
| 87 | + LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS" |
| 88 | + LIBS="$ompi_check_ucx_$1_save_LIBS" |
82 | 89 |
|
83 |
| - AC_MSG_RESULT([$ompi_ucx_version_ok]) |
84 |
| - CPPFLAGS=$old_CPPFLAGS |
| 90 | + AS_IF([test "$ompi_check_ucx_happy" = yes], |
| 91 | + [AC_MSG_CHECKING(for UCX version compatibility) |
| 92 | + AC_REQUIRE_CPP |
| 93 | + old_CPPFLAGS="$CPPFLAGS" |
| 94 | + CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include" |
| 95 | + AC_COMPILE_IFELSE( |
| 96 | + [AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])], |
| 97 | + [ompi_check_ucx_happy="yes"], |
| 98 | + [ompi_check_ucx_happy="no"]) |
85 | 99 |
|
86 |
| - AS_IF([test "$ompi_ucx_version_ok" = "no"], [ompi_check_ucx_happy="no"]) |
| 100 | + AC_MSG_RESULT([$ompi_check_ucx_happy]) |
| 101 | + CPPFLAGS=$old_CPPFLAGS])]) |
87 | 102 |
|
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]) |
94 |
| - fi |
| 103 | + OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])])]) |
95 | 104 |
|
96 | 105 | AS_IF([test "$ompi_check_ucx_happy" = "yes"],
|
97 | 106 | [$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS"
|
98 |
| - $1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS" |
99 |
| - $1_LIBS="[$]$1_LIBS $ompi_check_ucx_LIBS" |
100 |
| - $2], |
| 107 | + $1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS" |
| 108 | + $1_LIBS="[$]$1_LIBS $ompi_check_ucx_LIBS" |
| 109 | + $2], |
101 | 110 | [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "no"],
|
102 | 111 | [AC_MSG_ERROR([UCX support requested but not found. Aborting])])
|
103 | 112 | $3])
|
| 113 | + |
| 114 | + OPAL_VAR_SCOPE_POP |
104 | 115 | ])
|
105 | 116 |
|
0 commit comments