Skip to content

Commit 4a37981

Browse files
committed
build/knem: Update to not use internal macros
Clean up the knem check, primarily to avoid the use of the internal OPAL_CHECK_PACKAGE macro. Since we're here, also use AC_CACHE_CHECK around checks instead of the silent check at the start of the macro. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 33ec92e commit 4a37981

File tree

1 file changed

+25
-33
lines changed

1 file changed

+25
-33
lines changed

config/opal_check_knem.m4

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,45 @@ dnl
2323
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
2424
# support, otherwise executes action-if-not-found
2525
AC_DEFUN([OPAL_CHECK_KNEM],[
26-
if test -z "$opal_check_knem_happy" ; then
27-
OPAL_VAR_SCOPE_PUSH([opal_check_knem_$1_save_CPPFLAGS opal_check_knem_dir])
28-
AC_ARG_WITH([knem],
29-
[AS_HELP_STRING([--with-knem(=DIR)],
30-
[Build knem Linux kernel module support, searching for headers in DIR/include])])
26+
OPAL_VAR_SCOPE_PUSH([opal_check_knem_happy opal_check_knem_CPPFLAGS_save])
3127

32-
OPAL_CHECK_WITHDIR([knem], [$with_knem], [include/knem_io.h])
33-
opal_check_knem_$1_save_CPPFLAGS="$CPPFLAGS"
28+
AC_ARG_WITH([knem],
29+
[AS_HELP_STRING([--with-knem(=DIR)],
30+
[Build knem Linux kernel module support, searching for headers in DIR/include])])
3431

35-
opal_check_knem_happy=no
32+
opal_check_knem_CPPFLAGS_save="${CPPFLAGS}"
3633

37-
AS_IF([test "$with_knem" != "no"],
38-
[AS_IF([test ! -z "$with_knem" && test "$with_knem" != "yes"],
39-
[opal_check_knem_dir="$with_knem"])
34+
AS_IF([test -n "${with_knem}" -a "${with_knem}" != "yes" -a "${with_knem}" != "no"],
35+
[$1_CPPFLAGS="-I${with_knem}/include"
36+
CPPFLAGS="$CPPFLAGS ${$1_CPPFLAGS}"])
4037

41-
_OPAL_CHECK_PACKAGE_HEADER([ompi_check_knem],
42-
[knem_io.h],
43-
[$opal_check_knem_dir],
44-
[opal_check_knem_happy="yes"],
45-
[])],
46-
[])
38+
AC_CHECK_HEADER([knem_io.h], [opal_check_knem_happy="yes"], [opal_check_knem_happy="no"])
4739

48-
CPPFLAGS="$CPPFLAGS $ompi_check_knem_CPPFLAGS"
49-
50-
# need at least version 0x0000000b
51-
if test "$opal_check_knem_happy" = "yes" ; then
52-
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
40+
# need at least version 0x0000000b
41+
AS_IF([test "$opal_check_knem_happy" = "yes"],
42+
[AC_CACHE_CHECK([for recent vesion of knem ABI],
43+
[opal_check_knem_cv_abi_version],
44+
[AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5345
#include <knem_io.h>
54-
],[
46+
]], [[
5547
#if KNEM_ABI_VERSION < 0xc
5648
#error "Version less than 0xc"
5749
#endif
58-
])],
59-
[opal_check_knem_happy=yes],
60-
[opal_check_knem_happy=no])
61-
fi
50+
]])],
51+
[opal_check_knem_cv_abi_version=yes],
52+
[opal_check_knem_cv_abi_version=no])])
53+
AS_IF([test "${opal_check_knem_cv_abi_version}" = "no"],
54+
[opal_check_knem_happy=no])])
6255

63-
CPPFLAGS="$opal_check_knem_$1_save_CPPFLAGS"
56+
CPPFLAGS="${opal_check_knem_CPPFLAGS_save}"
6457

65-
OPAL_SUMMARY_ADD([Transports], [Shared memory/Linux KNEM], [], [$opal_check_knem_happy])
66-
OPAL_VAR_SCOPE_POP
67-
fi
58+
OPAL_SUMMARY_ADD([Transports], [Shared memory/Linux KNEM], [], [$opal_check_knem_happy])
6859

6960
AS_IF([test "$opal_check_knem_happy" = "yes"],
70-
[$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_knem_CPPFLAGS"
71-
$2],
61+
[$2],
7262
[AS_IF([test ! -z "$with_knem" && test "$with_knem" != "no"],
7363
[AC_MSG_ERROR([KNEM support requested but not found. Aborting])])
7464
$3])
65+
66+
OPAL_VAR_SCOPE_POP
7567
])dnl

0 commit comments

Comments
 (0)