forked from open-mpi/hwloc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetloc.m4
111 lines (96 loc) · 3.67 KB
/
netloc.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
dnl -*- Autoconf -*-
dnl
dnl Copyright © 2014 Cisco Systems, Inc. All rights reserved.
dnl
dnl Copyright © 2014-2017 Inria. All rights reserved.
dnl See COPYING in top-level directory.
# Main hwloc m4 macro, to be invoked by the user
#
# Expects:
# 1. Configuration prefix
# 2. What to do upon success
# 3. What to do upon failure
# 4. If non-empty, print the announcement banner
#
AC_DEFUN([NETLOC_SETUP_CORE],[
AC_REQUIRE([HWLOC_SETUP_CORE])
AC_REQUIRE([AC_PROG_CC])
AS_IF([test "x$4" != "x"],
[cat <<EOF
###
### Configuring netloc core
###
EOF])
# If no prefix was defined, set a good value
m4_ifval([$1],
[m4_define([netloc_config_prefix],[$1/])],
[m4_define([netloc_config_prefix], [])])
# These flags are specific to netloc, and should not be redundant
# with hwloc. I.e., if the flag already exists in hwloc, there's
# no need to put it here.
NETLOC_CFLAGS=$HWLOC_CFLAGS
NETLOC_CPPFLAGS=$HWLOC_CPPFLAGS
NETLOC_LDFLAGS=$HWLOC_LDFLAGS
NETLOC_LIBS=
NETLOC_LIBS_PRIVATE=
# Setup the individual parts of Netloc
netloc_happy=yes
AS_IF([test "$netloc_happy" = "yes"],
[NETLOC_CHECK_PLATFORM([netloc_happy])])
AC_SUBST(NETLOC_CFLAGS)
AC_SUBST(NETLOC_CPPFLAGS)
AC_SUBST(NETLOC_LDFLAGS)
AC_SUBST(NETLOC_LIBS)
AC_SUBST(NETLOC_LIBS_PRIVATE)
# Set these values explicitly for embedded builds. Exporting
# these values through *_EMBEDDED_* values gives us the freedom to
# do something different someday if we ever need to. There's no
# need to fill these values in unless we're in embedded mode.
# Indeed, if we're building in embedded mode, we want NETLOC_LIBS
# to be empty so that nothing is linked into libnetloc_embedded.la
# itself -- only the upper-layer will link in anything required.
AS_IF([test "$hwloc_mode" = "embedded"],
[NETLOC_EMBEDDED_CFLAGS=$NETLOC_CFLAGS
NETLOC_EMBEDDED_CPPFLAGS=$NETLOC_CPPFLAGS
NETLOC_EMBEDDED_LDADD='$(HWLOC_top_builddir)/netloc/libnetloc_embedded.la'
NETLOC_EMBEDDED_LIBS=$NETLOC_LIBS
NETLOC_LIBS=],
[AC_CONFIG_FILES(netloc_config_prefix[utils/netloc/infiniband/netloc_ib_gather_raw])
AC_CONFIG_COMMANDS([chmoding-netloc-scripts], [
chmod +x ]hwloc_config_prefix[utils/netloc/infiniband/netloc_ib_gather_raw
])
])
AC_SUBST(NETLOC_EMBEDDED_CFLAGS)
AC_SUBST(NETLOC_EMBEDDED_CPPFLAGS)
AC_SUBST(NETLOC_EMBEDDED_LDADD)
AC_SUBST(NETLOC_EMBEDDED_LIBS)
AC_CONFIG_FILES(
netloc_config_prefix[netloc/Makefile]
)
AS_IF([test "$netloc_happy" = "yes"],
[$2],
[$3])
])dnl
AC_DEFUN([NETLOC_CHECK_PLATFORM], [
AC_CHECK_FUNC([asprintf])
AC_MSG_CHECKING([if netloc supports this platform])
AS_IF([test "$ac_cv_func_asprintf" != "yes"],
[$1=no netloc_missing_reason=" (asprintf missing)"])
AS_IF([test "$hwloc_windows" = "yes"],
[$1=no netloc_missing_reason=" (Windows platform)"])
AC_MSG_RESULT([$$1$netloc_missing_reason])
AC_CHECK_LIB(scotch, SCOTCH_archSub,
[scotch_found_headers=yes;
AC_DEFINE([NETLOC_SCOTCH], [1],
[Define to 1 if scotch is netlocscotch is enabled])
], [], -lscotcherr)
AC_CHECK_HEADERS([mpi.h],
[mpi_found_headers=yes; break;])
AC_CHECK_PROG([xz],[xz],[yes],[no])
])dnl
AC_DEFUN([NETLOC_DO_AM_CONDITIONALS], [
AM_CONDITIONAL([BUILD_NETLOC], [test "$netloc_happy" = "yes"])
AM_CONDITIONAL([BUILD_NETLOCSCOTCH], [test "x$scotch_found_headers" = "xyes"])
AM_CONDITIONAL([BUILD_MPITOOLS], [test "x$mpi_found_headers" = "xyes"])
AM_CONDITIONAL([FOUND_XZ], [test "x$xz" = xyes])
])dnl