Skip to content

Commit 602f5e2

Browse files
authored
Merge pull request #10169 from bwbarrett/cleanup/treematch
Treematch cleanups
2 parents e64faae + a7c6084 commit 602f5e2

File tree

2 files changed

+37
-82
lines changed

2 files changed

+37
-82
lines changed

3rd-party/treematch/Makefile.am

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#
2+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
110
sources = tm_bucket.h \
211
tm_mapping.h \
312
tm_timings.h tm_tree.h \
@@ -21,7 +30,7 @@ EXTRA_DIST = COPYING LICENSE
2130

2231
noinst_LTLIBRARIES = libtreematch.la
2332
libtreematch_la_SOURCES = $(sources)
24-
libtreematch_la_LDFLAGS = -static
33+
libtreematch_la_LDFLAGS =
2534

2635
distclean-local:
2736
rm config.h

config/opal_config_treematch.m4

Lines changed: 27 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
# Copyright (c) 2015 Intel, Inc. All rights reserved.
1010
# Copyright (c) 2019 Research Organization for Information Science
1111
# and Technology (RIST). All rights reserved.
12-
# Copyright (c) 2020 Amazon.com, Inc. or its affiliates.
13-
# All Rights reserved.
12+
# Copyright (c) 2020-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1413
# Copyright (c) 2021 Google, LLC. All rights reserved.
1514
# $COPYRIGHT$
1615
#
@@ -20,73 +19,23 @@
2019
#
2120

2221
AC_DEFUN([OPAL_CONFIG_TREEMATCH], [
23-
OPAL_VAR_SCOPE_PUSH(treematch_files_local)
22+
OPAL_VAR_SCOPE_PUSH(treematch_builddir)
2423
25-
OPAL_3RDPARTY_WITH([treematch], [treematch], [package_treematch])
26-
27-
if test -z "$opal_config_treematch_happy" ; then
28-
AC_ARG_WITH([treematch],
29-
[AS_HELP_STRING([--with-treematch(=DIR)],
30-
[Build TreeMatch topology support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])],
24+
AC_ARG_WITH([treematch],
25+
[AS_HELP_STRING([--with-treematch],
26+
[Build TreeMatch topology support. Building against an external TreeMatch is no longer supported, so valid values are "yes" or "no".])],
3127
[], [with_treematch=yes])
32-
AC_ARG_WITH([treematch-include],
33-
[AS_HELP_STRING([--with-treematch-include(=DIR)],
34-
["Search for TreeMatch headers in DIR"])])
35-
AC_ARG_WITH([treematch-libdir],
36-
[AS_HELP_STRING([--with-treematch-libdir(=DIR)],
37-
["Search for TreeMatch libraries in DIR"])])
38-
39-
treematch_files_local=no
40-
opal_config_treematch_happy=0
4128
42-
if test "$with_treematch" != no ; then
43-
# Argument sanity checks.
44-
if (test -z "$with_treematch_include" && test -n "$with_treematch_libdir") ||
45-
(test -n "$with_treematch_include" && test -z "$with_treematch_libdir") ; then
46-
AC_MSG_ERROR([specified only one of --with-treematch-include or --with-treematch-libdir. Both (or neither) should be specified])
47-
fi
48-
if test -n "$with_treematch_include" && test "$with_treematch" != yes ; then
49-
AC_MSG_ERROR([specified both --with-treematch-include and either --with-treematch=path or --without-treematch])
50-
fi
29+
AS_IF([test "$with_treematch" != "yes" -a "$with_treematch" != "no"],
30+
[AC_MSG_ERROR([Valid values for --with-treematch are yes or no.])])
5131
52-
AC_MSG_CHECKING([TreeMatch source])
53-
if test -n "$with_treematch_include" || test "$with_treematch" != yes ; then
54-
if test -z "$with_treematch_include" ; then
55-
with_treematch_include="$with_treematch/include"
56-
with_treematch_libdir="$with_treematch/lib"
57-
fi
58-
AC_MSG_RESULT([user provided])
59-
else
60-
treematch_files_local=yes
61-
with_treematch_include="$OMPI_TOP_SRCDIR/3rd-party/treematch"
62-
with_treematch_libdir="$OMPI_TOP_BUILDDIR/3rd-party/treematch"
63-
AC_MSG_RESULT([in tree (3rd-party)])
64-
fi
32+
treematch_builddir="${OMPI_TOP_BUILDDIR}/3rd-party/treematch"
6533
66-
OPAL_CHECK_WITHDIR([treematch],
67-
[$with_treematch_include],
68-
[tm_tree.h])
69-
if test $treematch_files_local == no ; then
70-
OPAL_CHECK_WITHDIR([treematch-libdir], [$with_treematch_libdir], [libtreematch.*])
71-
OPAL_CHECK_PACKAGE([topo_treematch],
72-
[treematch.h],
73-
[treematch],
74-
[tm_build_synthetic_topology],
75-
[],
76-
[${with_treematch_include%include}],
77-
[$with_treematch_libdir],
78-
[opal_config_treematch_happy=1],
79-
[AC_MSG_ERROR([TreeMatch support requested but not found. Aborting])])
80-
else
81-
opal_config_treematch_happy=1
82-
fi
83-
fi
34+
AS_IF([test "${opal_config_treematch_run_once}" != "yes"],
35+
[AS_IF([! test -d ${treematch_builddir}],
36+
[mkdir -p ${treematch_builddir}])
8437
85-
if test $opal_config_treematch_happy -eq 1 && test $treematch_files_local = yes ; then
86-
AS_IF([! test -d $OMPI_TOP_BUILDDIR/3rd-party/treematch],
87-
[mkdir -p $OMPI_TOP_BUILDDIR/3rd-party/treematch])
88-
AC_CONFIG_FILES([3rd-party/treematch/Makefile])
89-
cat > $OMPI_TOP_BUILDDIR/3rd-party/treematch/config.h << EOF
38+
cat > ${treematch_builddir}/config.h << EOF
9039
/*
9140
* This file is automatically generated by configure. Edits will be lost
9241
*
@@ -96,25 +45,22 @@ AC_DEFUN([OPAL_CONFIG_TREEMATCH], [
9645
* see https://github.com/open-mpi/ompi/pull/6185#issuecomment-458807930
9746
*/
9847
EOF
99-
opal_config_treematch_LIBS=$OMPI_TOP_BUILDDIR/3rd-party/treematch/libtreematch.la
100-
opal_config_treematch_LDFLAGS=
101-
else
102-
opal_config_treematch_LIBS="-ltreematch"
103-
opal_config_treematch_LDFLAGS="-L$with_treematch_libdir"
104-
fi
105-
fi
10648
107-
if test $opal_config_treematch_happy -eq 1 ; then
108-
$1_CPPFLAGS="[$]$1_CPPFLAGS -I$with_treematch_include"
109-
$1_LDFLAGS="[$]$1_LDFLAGS $opal_config_treematch_LDFLAGS"
110-
$1_LIBS="[$]$1_LIBS $opal_config_treematch_LIBS"
111-
fi
49+
AC_CONFIG_FILES([3rd-party/treematch/Makefile])
50+
OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS treematch"
51+
52+
AS_IF([test "${with_treematch}" = "yes"],
53+
[OPAL_3RDPARTY_SUBDIRS="$OPAL_3RDPARTY_SUBDIRS treematch"])
54+
55+
opal_config_treematch_run_once=yes])
56+
57+
$1_CPPFLAGS="-I$OMPI_TOP_SRCDIR/3rd-party/treematch"
58+
$1_LIBS="${OMPI_TOP_BUILDDIR}/3rd-party/treematch/libtreematch.la"
59+
60+
AS_IF([test "${with_treematch}" = "yes"],
61+
[$2],
62+
[AC_MSG_NOTICE([Treematch explicitly disabled via --with-treematch=no])
63+
$3])
11264
113-
OPAL_3RDPARTY_SUBDIRS="$OPAL_3RDPARTY_SUBDIRS treematch"
114-
OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS treematch"
115-
116-
AS_IF([test $opal_config_treematch_happy -eq 1], [$2], [$3])
11765
OPAL_VAR_SCOPE_POP
11866
])
119-
120-

0 commit comments

Comments
 (0)