|
1 | 1 | dnl -*- shell-script -*- |
2 | 2 | dnl |
3 | | -dnl Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved. |
4 | | -dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights |
| 3 | +dnl Copyright (c) 2015-2019 Cisco Systems, Inc. All rights reserved. |
| 4 | +dnl Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights |
5 | 5 | dnl reserved. |
6 | 6 | dnl $COPYRIGHT$ |
7 | 7 | dnl |
|
10 | 10 | dnl $HEADER$ |
11 | 11 | dnl |
12 | 12 |
|
| 13 | +dnl |
| 14 | +dnl _OPAL_CHECK_OFI |
| 15 | +dnl -------------------------------------------------------- |
| 16 | +dnl Do the real work of checking for OFI libfabric. |
| 17 | +dnl Upon return: |
| 18 | +dnl |
| 19 | +dnl - opal_ofi_happy: will be "yes" or "no" |
| 20 | +dnl - opal_ofi_{CPPFLAGS|LDFLAGS|LIBS} will be loaded (if relevant) |
| 21 | +dnl |
| 22 | +AC_DEFUN([_OPAL_CHECK_OFI],[ |
| 23 | + # Add --with options |
| 24 | + AC_ARG_WITH([libfabric], |
| 25 | + [AC_HELP_STRING([--with-libfabric=DIR], |
| 26 | + [Deprecated synonym for --with-ofi])]) |
| 27 | + AC_ARG_WITH([libfabric-libdir], |
| 28 | + [AC_HELP_STRING([--with-libfabric-libdir=DIR], |
| 29 | + [Deprecated synonym for --with-ofi-libdir])]) |
13 | 30 |
|
14 | | -# OPAL_CHECK_LIBFABRIC(prefix, [action-if-found], [action-if-not-found] |
15 | | -# -------------------------------------------------------- |
16 | | -# Check if libfabric support can be found. |
17 | | -# |
18 | | -# Sets prefix_{CPPFLAGS, LDFLAGs, LIBS} as needed and runs |
19 | | -# action-if-found if there is support; otherwise executes |
20 | | -# action-if-not-found. |
21 | | -# |
22 | | -AC_DEFUN([OPAL_CHECK_LIBFABRIC],[ |
23 | | - if test -z "$opal_check_libfabric_happy" ; then |
24 | | - OPAL_VAR_SCOPE_PUSH([opal_check_libfabric_$1_save_CPPFLAGS opal_check_libfabric_$1_save_LDFLAGS opal_check_libfabric_$1_save_LIBS]) |
25 | | - |
26 | | - # Add --with options |
27 | | - AC_ARG_WITH([libfabric], |
28 | | - [AC_HELP_STRING([--with-libfabric=DIR], |
29 | | - [Specify location of libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])]) |
30 | | - AC_ARG_WITH([libfabric-libdir], |
31 | | - [AC_HELP_STRING([--with-libfabric-libdir=DIR], |
32 | | - [Search for libfabric libraries in DIR])]) |
33 | | - |
34 | | - # Sanity check the --with values |
35 | | - OPAL_CHECK_WITHDIR([libfabric], [$with_libfabric], |
36 | | - [include/rdma/fabric.h]) |
37 | | - OPAL_CHECK_WITHDIR([libfabric-libdir], [$with_libfabric_libdir], |
38 | | - [libfabric.*]) |
39 | | - |
40 | | - opal_check_libfabric_$1_save_CPPFLAGS=$CPPFLAGS |
41 | | - opal_check_libfabric_$1_save_LDFLAGS=$LDFLAGS |
42 | | - opal_check_libfabric_$1_save_LIBS=$LIBS |
43 | | - |
44 | | - opal_check_libfabric_happy=yes |
45 | | - AS_IF([test "$with_libfabric" = "no"], |
46 | | - [opal_check_libfabric_happy=no]) |
47 | | - |
48 | | - AS_IF([test $opal_check_libfabric_happy = yes], |
49 | | - [AC_MSG_CHECKING([looking for libfabric in]) |
50 | | - AS_IF([test "$with_libfabric" != "yes"], |
51 | | - [opal_libfabric_dir=$with_libfabric |
52 | | - AC_MSG_RESULT([($opal_libfabric_dir)])], |
53 | | - [AC_MSG_RESULT([(default search paths)])]) |
54 | | - AS_IF([test ! -z "$with_libfabric_libdir" && \ |
55 | | - test "$with_libfabric_libdir" != "yes"], |
56 | | - [opal_libfabric_libdir=$with_libfabric_libdir]) |
57 | | - ]) |
58 | | - |
59 | | - AS_IF([test $opal_check_libfabric_happy = yes], |
60 | | - [OPAL_CHECK_PACKAGE([opal_check_libfabric], |
61 | | - [rdma/fabric.h], |
62 | | - [fabric], |
63 | | - [fi_getinfo], |
64 | | - [], |
65 | | - [$opal_libfabric_dir], |
66 | | - [$opal_libfabric_libdir], |
67 | | - [], |
68 | | - [opal_check_libfabric_happy=no])]) |
69 | | - |
70 | | - CPPFLAGS=$opal_check_libfabric_$1_save_CPPFLAGS |
71 | | - LDFLAGS=$opal_check_libfabric_$1_save_LDFLAGS |
72 | | - LIBS=$opal_check_libfabric_$1_save_LIBS |
73 | | - |
74 | | - OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics Libfabric]],[$1],[$opal_check_libfabric_happy]) |
75 | | - |
76 | | - OPAL_VAR_SCOPE_POP |
77 | | - fi |
| 31 | + AC_ARG_WITH([ofi], |
| 32 | + [AC_HELP_STRING([--with-ofi=DIR], |
| 33 | + [Specify location of OFI libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])]) |
| 34 | + |
| 35 | + AC_ARG_WITH([ofi-libdir], |
| 36 | + [AC_HELP_STRING([--with-ofi-libdir=DIR], |
| 37 | + [Search for OFI libfabric libraries in DIR])]) |
78 | 38 |
|
79 | | - if test $opal_check_libfabric_happy = yes ; then |
80 | | - $1_CPPFLAGS="[$]$1_CPPFLAGS $opal_check_libfabric_CPPFLAGS" |
81 | | - $1_LIBS="[$]$1_LIBS $opal_check_libfabric_LIBS" |
82 | | - $1_LDFLAGS="[$]$1_LDFLAGS $opal_check_libfabric_LDFLAGS" |
| 39 | + if test "$with_ofi" = ""; then |
| 40 | + with_ofi=$with_libfabric |
| 41 | + fi |
83 | 42 |
|
84 | | - AC_SUBST($1_CPPFLAGS) |
85 | | - AC_SUBST($1_LDFLAGS) |
86 | | - AC_SUBST($1_LIBS) |
| 43 | + if test "$with_ofi_libdir" = ""; then |
| 44 | + with_ofi_libdir=$with_libfabric_libdir |
87 | 45 | fi |
88 | 46 |
|
89 | | - AS_IF([test $opal_check_libfabric_happy = yes], |
90 | | - [$2], |
91 | | - [AS_IF([test -n "$with_libfabric" && test "$with_libfabric" != "no"], |
92 | | - [AC_MSG_WARN([libfabric support requested (via --with-libfabric), but not found.]) |
| 47 | + # Sanity check the --with values |
| 48 | + OPAL_CHECK_WITHDIR([ofi], [$with_ofi], |
| 49 | + [include/rdma/fabric.h]) |
| 50 | + OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir], |
| 51 | + [libfabric.*]) |
| 52 | + |
| 53 | + OPAL_VAR_SCOPE_PUSH([opal_check_ofi_save_CPPFLAGS opal_check_ofi_save_LDFLAGS opal_check_ofi_save_LIBS]) |
| 54 | + opal_check_ofi_save_CPPFLAGS=$CPPFLAGS |
| 55 | + opal_check_ofi_save_LDFLAGS=$LDFLAGS |
| 56 | + opal_check_ofi_save_LIBS=$LIBS |
| 57 | + |
| 58 | + opal_ofi_happy=yes |
| 59 | + AS_IF([test "$with_ofi" = "no"], |
| 60 | + [opal_ofi_happy=no]) |
| 61 | + |
| 62 | + AS_IF([test $opal_ofi_happy = yes], |
| 63 | + [AC_MSG_CHECKING([looking for OFI libfabric in]) |
| 64 | + AS_IF([test "$with_ofi" != "yes"], |
| 65 | + [opal_ofi_dir=$with_ofi |
| 66 | + AC_MSG_RESULT([($opal_ofi_dir)])], |
| 67 | + [AC_MSG_RESULT([(default search paths)])]) |
| 68 | + AS_IF([test ! -z "$with_ofi_libdir" && \ |
| 69 | + test "$with_ofi_libdir" != "yes"], |
| 70 | + [opal_ofi_libdir=$with_ofi_libdir]) |
| 71 | + ]) |
| 72 | + |
| 73 | + AS_IF([test $opal_ofi_happy = yes], |
| 74 | + [OPAL_CHECK_PACKAGE([opal_ofi], |
| 75 | + [rdma/fabric.h], |
| 76 | + [fabric], |
| 77 | + [fi_getinfo], |
| 78 | + [], |
| 79 | + [$opal_ofi_dir], |
| 80 | + [$opal_ofi_libdir], |
| 81 | + [], |
| 82 | + [opal_ofi_happy=no])]) |
| 83 | + |
| 84 | + CPPFLAGS=$opal_check_ofi_save_CPPFLAGS |
| 85 | + LDFLAGS=$opal_check_ofi_save_LDFLAGS |
| 86 | + LIBS=$opal_check_ofi_save_LIBS |
| 87 | + |
| 88 | + AC_SUBST([opal_ofi_CPPFLAGS]) |
| 89 | + AC_SUBST([opal_ofi_LDFLAGS]) |
| 90 | + AC_SUBST([opal_ofi_LIBS]) |
| 91 | + |
| 92 | + OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics OFI Libfabric]],[],[$opal_ofi_happy]) |
| 93 | + |
| 94 | + OPAL_VAR_SCOPE_POP |
| 95 | + |
| 96 | + AS_IF([test $opal_ofi_happy = no], |
| 97 | + [AS_IF([test -n "$with_ofi" && test "$with_ofi" != "no"], |
| 98 | + [AC_MSG_WARN([OFI libfabric support requested (via --with-ofi or --with-libfabric), but not found.]) |
93 | 99 | AC_MSG_ERROR([Cannot continue.])]) |
94 | | - $3]) |
| 100 | + ]) |
95 | 101 | ])dnl |
| 102 | + |
| 103 | + |
| 104 | +dnl |
| 105 | +dnl OPAL_CHECK_OFI |
| 106 | +dnl -------------------------------------------------------- |
| 107 | +dnl Check to see if OFI libfabric is available. |
| 108 | +dnl |
| 109 | +dnl This is a simple wrapper around _OPAL_CHECK_OFI that just |
| 110 | +dnl ensures to only run the checks once. We do not use AC_REQUIRE |
| 111 | +dnl because that re-orders the texts and makes ordering in stdout |
| 112 | +dnl quite confusing / difficult to grok. |
| 113 | +dnl |
| 114 | +AC_DEFUN([OPAL_CHECK_OFI],[ |
| 115 | + # Check for OFI libfabric. Note that $opal_ofi_happy is used in |
| 116 | + # other configure.m4's to know if OFI/libfabric configured |
| 117 | + # successfully. We only need to run the back-end checks once, but |
| 118 | + # at least emit a "checking..." statement each subsequent time |
| 119 | + # this macro is invoked so that configure's stdout has |
| 120 | + # sensible/logical output. |
| 121 | + AS_IF([test -z "$opal_ofi_happy"], |
| 122 | + [_OPAL_CHECK_OFI], |
| 123 | + [AC_MSG_CHECKING([if OFI libfabric is available]) |
| 124 | + AC_MSG_RESULT([$opal_ofi_happy])]) |
| 125 | +]) |
0 commit comments