Skip to content

Commit 6767309

Browse files
committed
build: Swap CHECK_PACKAGE macros
Swap usage of OPAL_CHECK_PACKAGE for OAC_CHECK_PACKAGE across the code base. This is the bulk "easy" swap, which is mostly just removing the now unnecessary preflight checks before calling CHECK_PACKAGE. In a couple of situations, there were some indenting changes because of the conditional check cleanups. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent e373e54 commit 6767309

File tree

14 files changed

+239
-368
lines changed

14 files changed

+239
-368
lines changed

config/ompi_check_gpfs.m4

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,29 @@ dnl
2424
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
2525
# support, otherwise executes action-if-not-found
2626
AC_DEFUN([OMPI_CHECK_GPFS],[
27-
28-
check_gpfs_CPPFLAGS=
29-
check_gpfs_LDFLAGS=
30-
check_gpfs_LIBS=
31-
32-
check_gpfs_save_LIBS="$LIBS"
33-
check_gpfs_save_LDFLAGS="$LDFLAGS"
34-
check_gpfs_save_CPPFLAGS="$CPPFLAGS"
35-
36-
check_gpfs_configuration="none"
37-
ompi_check_gpfs_happy="yes"
27+
OPAL_VAR_SCOPE_PUSH([ompi_check_gpfs_happy])
3828

3929
# Get some configuration information
4030
AC_ARG_WITH([gpfs],
4131
[AS_HELP_STRING([--with-gpfs(=DIR)],
4232
[Build Gpfs support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
43-
OPAL_CHECK_WITHDIR([gpfs], [$with_gpfs], [include/gpfs.h])
4433

45-
AS_IF([test "$with_gpfs" = "no"],
46-
[ompi_check_gpfs_happy="no"],
47-
[AS_IF([test -z "$with_gpfs" || test "$with_gpfs" = "yes"],
48-
[ompi_check_gpfs_dir="/usr"],
49-
[ompi_check_gpfs_dir=$with_gpfs])
50-
51-
if test -e "$ompi_check_gpfs_dir/lib64" ; then
52-
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib64"
53-
else
54-
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib"
55-
fi
56-
57-
# Add correct -I and -L flags
58-
OPAL_CHECK_PACKAGE([$1], [gpfs.h], [gpfs], [gpfs_lib_init],
59-
[], [$ompi_check_gpfs_dir], [$ompi_check_gpfs_libdir],
60-
[ompi_check_gpfs_happy="yes"],
61-
[ompi_check_gpfs_happy="no"])
62-
])
34+
# Add correct -I and -L flags
35+
OAC_CHECK_PACKAGE([gpfs],
36+
[$1],
37+
[gpfs.h],
38+
[gpfs],
39+
[gpfs_lib_init],
40+
[ompi_check_gpfs_happy="yes"],
41+
[ompi_check_gpfs_happy="no"])
42+
43+
OPAL_SUMMARY_ADD([OMPIO File Systems], [IBM Spectrum Scale/GPFS], [], [${$1_SUMMARY}])
6344

6445
AS_IF([test "$ompi_check_gpfs_happy" = "yes"],
6546
[$2],
6647
[AS_IF([test ! -z "$with_gpfs" && test "$with_gpfs" != "no"],
6748
[AC_MSG_ERROR([GPFS support requested but not found. Aborting])])
6849
$3])
50+
51+
OPAL_VAR_SCOPE_POP
6952
])

config/ompi_check_ime.m4

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,20 @@ dnl
1616
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
1717
# support, otherwise executes action-if-not-found
1818
AC_DEFUN([OMPI_CHECK_IME],[
19-
20-
OPAL_VAR_SCOPE_PUSH([ompi_check_ime_happy ompi_check_ime_dir])
19+
OPAL_VAR_SCOPE_PUSH([ompi_check_ime_happy])
2120

2221
# Get some configuration information
2322
AC_ARG_WITH([ime],
2423
[AS_HELP_STRING([--with-ime(=DIR)],
2524
[Build IME support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
26-
OPAL_CHECK_WITHDIR([ime], [$with_ime], [include/ime_native.h])
27-
28-
AS_IF([test "$with_ime" = "no"],
29-
[ompi_check_ime_happy="no"],
30-
[AS_IF([test -n "$with_ime" && test "$with_ime" != "yes"],
31-
[ompi_check_ime_dir=$with_ime])
3225

33-
OPAL_CHECK_PACKAGE([$1], [ime_native.h], [im_client], [ime_client_native2_init],
34-
[], [$ompi_check_ime_dir], [],
35-
[ompi_check_ime_happy="yes"],
36-
[ompi_check_ime_happy="no"])])
26+
OAC_CHECK_PACKAGE([ime],
27+
[$1],
28+
[ime_native.h],
29+
[im_client],
30+
[ime_client_native2_init],
31+
[ompi_check_ime_happy="yes"],
32+
[ompi_check_ime_happy="no"])
3733

3834
AS_IF([test "$ompi_check_ime_happy" = "yes"],
3935
[$2],

config/ompi_check_libhcoll.m4

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,35 @@ dnl
1717
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
1818
# support, otherwise executes action-if-not-found
1919
AC_DEFUN([OMPI_CHECK_HCOLL],[
20-
OPAL_VAR_SCOPE_PUSH([ompi_check_hcoll_dir ompi_check_hcoll_libs ompi_check_hcoll_happy CPPFLAGS_save LDFLAGS_save LIBS_save])
20+
OPAL_VAR_SCOPE_PUSH([ompi_check_hcoll_happy CPPFLAGS_save LDFLAGS_save LIBS_save])
2121

2222
AC_ARG_WITH([hcoll],
2323
[AS_HELP_STRING([--with-hcoll(=DIR)],
2424
[Build hcoll (Mellanox Hierarchical Collectives) support, optionally adding
2525
DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
2626

27-
AS_IF([test "$with_hcoll" != "no"],
28-
[ompi_check_hcoll_libs=hcoll
29-
AS_IF([test ! -z "$with_hcoll" && test "$with_hcoll" != "yes"],
30-
[ompi_check_hcoll_dir=$with_hcoll])
27+
OAC_CHECK_PACKAGE([libhcoll],
28+
[$1],
29+
[hcoll/api/hcoll_api.h],
30+
[hcoll],
31+
[hcoll_get_version],
32+
[ompi_check_hcoll_happy="yes"],
33+
[ompi_check_hcoll_happy="no"])
3134

32-
CPPFLAGS_save=$CPPFLAGS
35+
AS_IF([test "$ompi_check_hcoll_happy" = "yes"],
36+
[CPPFLAGS_save=$CPPFLAGS
3337
LDFLAGS_save=$LDFLAGS
3438
LIBS_save=$LIBS
3539

36-
OPAL_LOG_MSG([$1_CPPFLAGS : $$1_CPPFLAGS], 1)
37-
OPAL_LOG_MSG([$1_LDFLAGS : $$1_LDFLAGS], 1)
38-
OPAL_LOG_MSG([$1_LIBS : $$1_LIBS], 1)
39-
40-
OPAL_CHECK_PACKAGE([$1],
41-
[hcoll/api/hcoll_api.h],
42-
[$ompi_check_hcoll_libs],
43-
[hcoll_get_version],
44-
[],
45-
[$ompi_check_hcoll_dir],
46-
[],
47-
[ompi_check_hcoll_happy="yes"],
48-
[ompi_check_hcoll_happy="no"])
40+
CPPFLAGS="${$1_CPPFLAGS} ${CPPFLAGS}"
41+
LDFLAGS="${$1_LDFLAGS} ${LDFLAGS}"
42+
LIBS="${$1_LIBS} ${LIBS}"
4943

50-
AS_IF([test "$ompi_check_hcoll_happy" = "yes"],
51-
[
52-
CPPFLAGS=$coll_hcoll_CPPFLAGS
53-
LDFLAGS=$coll_hcoll_LDFLAGS
54-
LIBS=$coll_hcoll_LIBS
55-
AC_CHECK_FUNCS(hcoll_context_free, [], [])
56-
],
57-
[])
44+
AC_CHECK_FUNCS(hcoll_context_free, [], [])
5845

5946
CPPFLAGS=$CPPFLAGS_save
6047
LDFLAGS=$LDFLAGS_save
61-
LIBS=$LIBS_save],
62-
[ompi_check_hcoll_happy=no])
48+
LIBS=$LIBS_save])
6349

6450
AS_IF([test "$ompi_check_hcoll_happy" = "yes" && test "$enable_progress_threads" = "yes"],
6551
[AC_MSG_WARN([hcoll driver does not currently support progress threads. Disabling HCOLL.])

config/ompi_check_lustre.m4

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,26 @@ dnl
2929
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
3030
# support, otherwise executes action-if-not-found
3131
AC_DEFUN([OMPI_CHECK_LUSTRE],[
32-
33-
OPAL_VAR_SCOPE_PUSH([ompi_check_lustre_happy ompi_check_lustre_dir])
32+
OPAL_VAR_SCOPE_PUSH([ompi_check_lustre_happy])
3433

3534
# Get some configuration information
3635
AC_ARG_WITH([lustre],
3736
[AS_HELP_STRING([--with-lustre(=DIR)],
3837
[Build Lustre support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
39-
OPAL_CHECK_WITHDIR([lustre], [$with_lustre], [include/lustre/lustreapi.h])
40-
41-
AS_IF([test "$with_lustre" = "no"],
42-
[ompi_check_lustre_happy="no"],
43-
[AS_IF([test -n "$with_lustre" && test "$with_lustre" != "yes"],
44-
[ompi_check_lustre_dir=$with_lustre])
4538

46-
OPAL_CHECK_PACKAGE([$1], [lustre/lustreapi.h], [lustreapi], [llapi_file_create],
47-
[], [$ompi_check_lustre_dir], [],
48-
[ompi_check_lustre_happy="yes"],
49-
[ompi_check_lustre_happy="no"])])
39+
OAC_CHECK_PACKAGE([lustre],
40+
[$1],
41+
[lustre/lustreapi.h],
42+
[lustreapi],
43+
[llapi_file_create],
44+
[ompi_check_lustre_happy="yes"],
45+
[ompi_check_lustre_happy="no"])
5046

5147
AS_IF([test "$ompi_check_lustre_happy" = "yes"],
52-
[AC_MSG_CHECKING([for required lustre data structures])
53-
cat > conftest.c <<EOF
48+
[AC_CACHE_CHECK([for required lustre data structures],
49+
[ompi_check_lustre_cv_ost_data_v1],
50+
[ompi_check_lustre_cv_ost_data_v1=yes
51+
cat > conftest.c <<EOF
5452
#include "lustre/lustreapi.h"
5553
void alloc_lum()
5654
{
@@ -61,12 +59,15 @@ void alloc_lum()
6159
LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
6260
}
6361
EOF
62+
# Try the compile
63+
OPAL_LOG_COMMAND([$CC $CFLAGS ${$1_CPPFLAGS} -c conftest.c],
64+
[], [ompi_check_lustre_cv_ost_data_v1=no])
65+
rm -f conftest.c conftest.o])
66+
AS_IF([test "${ompi_check_lustre_cv_ost_data_v1}" = "no"],
67+
[ompi_check_lustre_happy=no
68+
fs_lustre_SUMMARY="no"])])
6469

65-
# Try the compile
66-
OPAL_LOG_COMMAND([$CC $CFLAGS $$1_CPPFLAGS -c conftest.c],
67-
[], [ompi_check_lustre_happy="no"])
68-
rm -f conftest.c conftest.o
69-
AC_MSG_RESULT([$ompi_check_lustre_happy])])
70+
OPAL_SUMMARY_ADD([OMPIO File Systems], [Lustre], [], [${$1_SUMMARY}])
7071

7172
AS_IF([test "$ompi_check_lustre_happy" = "yes"],
7273
[$2],

config/ompi_check_psm2.m4

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -33,77 +33,58 @@
3333
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
3434
# support, otherwise executes action-if-not-found
3535
AC_DEFUN([OMPI_CHECK_PSM2],[
36-
if test -z "$ompi_check_psm2_happy" ; then
37-
AC_ARG_WITH([psm2],
38-
[AS_HELP_STRING([--with-psm2(=DIR)],
39-
[Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
40-
OPAL_CHECK_WITHDIR([psm2], [$with_psm2], [include/psm2.h])
41-
AC_ARG_WITH([psm2-libdir],
42-
[AS_HELP_STRING([--with-psm2-libdir=DIR],
43-
[Search for PSM (Intel PSM2) libraries in DIR])])
44-
OPAL_CHECK_WITHDIR([psm2-libdir], [$with_psm2_libdir], [libpsm2.*])
36+
OPAL_VAR_SCOPE_PUSH([opal_psm2_CPPFLAGS_save opal_psm2_LDFLAGS_save opal_psm2_LIBS_save])
4537

46-
AC_ARG_ENABLE([psm2-version-check],
47-
[AS_HELP_STRING([--disable-psm2-version-check],
48-
[Disable PSM2 version checking. Not recommended to disable. (default: enabled)])])
38+
AC_ARG_WITH([psm2],
39+
[AS_HELP_STRING([--with-psm2(=DIR)],
40+
[Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
41+
AC_ARG_WITH([psm2-libdir],
42+
[AS_HELP_STRING([--with-psm2-libdir=DIR],
43+
[Search for PSM (Intel PSM2) libraries in DIR])])
4944

50-
ompi_check_psm2_$1_save_CPPFLAGS="$CPPFLAGS"
51-
ompi_check_psm2_$1_save_LDFLAGS="$LDFLAGS"
52-
ompi_check_psm2_$1_save_LIBS="$LIBS"
45+
AC_ARG_ENABLE([psm2-version-check],
46+
[AS_HELP_STRING([--disable-psm2-version-check],
47+
[Disable PSM2 version checking. Not recommended to disable. (default: enabled)])])
5348

54-
AS_IF([test "$with_psm2" != "no"],
55-
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "yes"],
56-
[ompi_check_psm2_dir="$with_psm2"])
57-
AS_IF([test ! -z "$with_psm2_libdir" && test "$with_psm2_libdir" != "yes"],
58-
[ompi_check_psm2_libdir="$with_psm2_libdir"])
49+
OAC_CHECK_PACKAGE([psm2],
50+
[$1],
51+
[psm2.h],
52+
[psm2],
53+
[psm2_mq_irecv2],
54+
[ompi_check_psm2_happy="yes"],
55+
[ompi_check_psm2_happy="no"])
5956

60-
OPAL_CHECK_PACKAGE([ompi_check_psm2],
61-
[psm2.h],
62-
[psm2],
63-
[psm2_mq_irecv2],
64-
[],
65-
[$ompi_check_psm2_dir],
66-
[$ompi_check_psm2_libdir],
67-
[ompi_check_psm2_happy="yes"],
68-
[ompi_check_psm2_happy="no"])],
69-
[ompi_check_psm2_happy="no"])
57+
AS_IF([test "$ompi_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"],
58+
[AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.])
59+
$1_SUMMARY="no (progress threads not supported)"
60+
ompi_check_psm2_happy="no"])
7061

71-
AS_IF([test "$ompi_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"],
72-
[AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.])
73-
ompi_check_psm2_happy="no"])
62+
opal_psm2_CPPFLAGS_save="$CPPFLAGS"
63+
CPPFLAGS="${$1_CPPFLAGS} ${CPPFLAGS}"
7464

75-
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
76-
[AC_CHECK_HEADERS(
77-
glob.h,
78-
[],
65+
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
66+
[AC_CHECK_HEADERS([glob.h], []
7967
[AC_MSG_WARN([glob.h not found. Can not build component.])
80-
ompi_check_psm2_happy="no"])])
68+
$1_SUMMARY="no (glob.h not found))"
69+
ompi_check_psm2_happy="no"])])
8170

82-
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
83-
[AS_IF([ test ! -z "$ompi_check_psm2_dir"],
84-
[CPPFLAGS="-I $ompi_check_psm2_dir/include $CPPFLAGS"])
85-
AC_CHECK_DECL([PSM2_LIB_REFCOUNT_CAP],
86-
[AC_DEFINE([HAVE_PSM2_LIB_REFCOUNT_CAP], [1],
87-
[have PSM2_LIB_REFCOUNT_CAP in psm2.h])],
88-
[AS_IF([test "x$enable_psm2_version_check" != "xno"],
89-
[ompi_check_psm2_happy="no"
90-
AC_MSG_WARN([PSM2 needs to be version 11.2.173 or later. Disabling MTL.])]
91-
)],
92-
[#include <psm2.h>])]
93-
)
71+
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
72+
[AC_CHECK_DECL([PSM2_LIB_REFCOUNT_CAP],
73+
[AC_DEFINE([HAVE_PSM2_LIB_REFCOUNT_CAP], [1],
74+
[have PSM2_LIB_REFCOUNT_CAP in psm2.h])],
75+
[AS_IF([test "x$enable_psm2_version_check" != "xno"],
76+
[ompi_check_psm2_happy="no"
77+
$1_SUMMARY="no (version too old)"
78+
AC_MSG_WARN([PSM2 needs to be version 11.2.173 or later. Disabling MTL.])]
79+
)],
80+
[#include <psm2.h>])])
9481

95-
CPPFLAGS="$ompi_check_psm2_$1_save_CPPFLAGS"
96-
LDFLAGS="$ompi_check_psm2_$1_save_LDFLAGS"
97-
LIBS="$ompi_check_psm2_$1_save_LIBS"
82+
CPPFLAGS="${opal_psm2_CPPFLAGS_save}"
9883

99-
OPAL_SUMMARY_ADD([Transports], [Intel Omnipath (PSM2)], [], [$ompi_check_psm2_happy])
100-
fi
84+
OPAL_SUMMARY_ADD([Transports], [Intel Omnipath (PSM2)], [], [${$1_SUMMARY}])
10185

10286
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
103-
[$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_psm2_LDFLAGS"
104-
$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_psm2_CPPFLAGS"
105-
$1_LIBS="[$]$1_LIBS $ompi_check_psm2_LIBS"
106-
$2],
87+
[$2],
10788
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "no"],
10889
[AC_MSG_ERROR([PSM2 support requested but not found. Aborting])])
10990
$3])

config/ompi_check_pvfs2.m4

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,20 @@ dnl
2727
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
2828
# support, otherwise executes action-if-not-found
2929
AC_DEFUN([OMPI_CHECK_PVFS2],[
30-
31-
OPAL_VAR_SCOPE_PUSH([ompi_check_pvfs2_happy ompi_check_pvfs2_dir])
30+
OPAL_VAR_SCOPE_PUSH([ompi_check_pvfs2_happy])
3231

3332
# Get some configuration information
3433
AC_ARG_WITH([pvfs2],
3534
[AS_HELP_STRING([--with-pvfs2(=DIR)],
3635
[Build Pvfs2 support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
37-
OPAL_CHECK_WITHDIR([pvfs2], [$with_pvfs2], [include/pvfs2.h])
3836

39-
AS_IF([test "$with_pvfs2" = "no"],
40-
[ompi_check_pvfs2_happy="no"],
41-
[AS_IF([test -n "$with_pvfs2" && test "$with_pvfs2" != "yes"],
42-
[ompi_check_pvfs2_dir=$with_pvfs2])
43-
OPAL_CHECK_PACKAGE([$1], [pvfs2.h], [pvfs2], [PVFS_util_resolve],
44-
[], [$ompi_check_pvfs2_dir], [],
45-
[ompi_check_pvfs2_happy="yes"],
46-
[ompi_check_pvfs2_happy="no"])
47-
])
37+
OAC_CHECK_PACKAGE([pvfs2],
38+
[$1],
39+
[pvfs2.h],
40+
[pvfs2],
41+
[PVFS_util_resolve],
42+
[ompi_check_pvfs2_happy="yes"],
43+
[ompi_check_pvfs2_happy="no"])
4844

4945
AS_IF([test "$ompi_check_pvfs2_happy" = "yes"],
5046
[$2],

0 commit comments

Comments
 (0)