22#
33# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
44# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
5- # Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
5+ # Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
66# $COPYRIGHT$
77#
88# Additional copyrights may follow
1313# MCA_hwloc_CONFIG([action-if-found], [action-if-not-found])
1414# --------------------------------------------------------------------
1515AC_DEFUN([PMIX_HWLOC_CONFIG],[
16+ AC_ARG_WITH([hwloc-header],
17+ [AC_HELP_STRING([--with-hwloc-header= HEADER],
18+ [The value that should be included in C files to include hwloc.h])])
19+
20+ AC_ARG_ENABLE([embedded-hwloc],
21+ [AC_HELP_STRING([--enable-embedded-hwloc],
22+ [Enable use of locally embedded hwloc])])
23+
24+ AS_IF([test " $enable_embedded_hwloc " = " yes" ],
25+ [_PMIX_HWLOC_EMBEDDED_MODE],
26+ [_PMIX_HWLOC_EXTERNAL])
27+
28+ AC_MSG_CHECKING([hwloc header])
29+ AC_DEFINE_UNQUOTED([PMIX_HWLOC_HEADER], [$PMIX_HWLOC_HEADER ],
30+ [Location of hwloc.h])
31+ AC_MSG_RESULT([$PMIX_HWLOC_HEADER ])
32+
33+ AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support ],
34+ [Whether or not we have hwloc support])
35+
36+ PMIX_SUMMARY_ADD([[External Packages]],[[HWLOC]], [pmix_hwloc], [$pmix_hwloc_support_will_build ($pmix_hwloc_source )])
37+ ])
38+
39+ AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[
40+ AC_MSG_CHECKING([for hwloc])
41+ AC_MSG_RESULT([assumed available (embedded mode)])
42+
43+ AS_IF([test -z " $with_hwloc_header " || test " $with_hwloc_header " = " yes" ],
44+ [PMIX_HWLOC_HEADER= " <hwloc.h>" ],
45+ [PMIX_HWLOC_HEADER= " $with_hwloc_header " ])
46+
47+ pmix_hwloc_support= 1
48+ pmix_hwloc_source= embedded
49+ pmix_hwloc_support_will_build= yes
50+ ])
51+
52+ AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[
1653 PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_hwloc_standard_lib_location pmix_hwloc_standard_header_location])
1754
1855 AC_ARG_WITH([hwloc],
@@ -62,18 +99,13 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
6299 [$pmix_hwloc_libdir ],
63100 [pmix_hwloc_support= 1],
64101 [pmix_hwloc_support= 0])
65- if test $pmix_hwloc_support = " 1" ; then
66- LIBS=" $LIBS -lhwloc"
67- PMIX_EMBEDDED_LIBS=" $PMIX_EMBEDDED_LIBS -lhwloc"
68- if test " $pmix_hwloc_standard_header_location " ! = " yes" ; then
69- PMIX_EMBEDDED_CPPFLAGS=" $PMIX_EMBEDDED_CPPFLAGS $pmix_hwloc_CPPFLAGS "
70- CPPFLAGS=" $CPPFLAGS $pmix_hwloc_CPPFLAGS "
71- fi
72- if test " $pmix_hwloc_standard_lib_location " ! = " yes" ; then
73- PMIX_EMBEDDED_LDFLAGS=" $PMIX_EMBEDDED_LDFLAGS $pmix_hwloc_LDFLAGS "
74- LDFLAGS=" $LDFLAGS $pmix_hwloc_LDFLAGS "
75- fi
76- fi
102+
103+ AS_IF([test " $pmix_hwloc_standard_header_location " != " yes" ],
104+ [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_hwloc_CPPFLAGS )])
105+
106+ AS_IF([test " $pmix_hwloc_standard_lib_location " != " yes" ],
107+ [PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_hwloc_LIBS )
108+ PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_hwloc_LDFLAGS )])
77109 fi
78110
79111 if test ! -z " $with_hwloc " && test " $with_hwloc " ! = " no" && test " $pmix_hwloc_support " ! = " 1" ; then
@@ -98,11 +130,16 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
98130 AC_MSG_CHECKING([will hwloc support be built])
99131 if test " $pmix_hwloc_support " ! = " 1" ; then
100132 AC_MSG_RESULT([no])
133+ pmix_hwloc_source=none
134+ pmix_hwloc_support_will_build=no
101135 else
102136 AC_MSG_RESULT([yes])
137+ pmix_hwloc_source=$pmix_hwloc_dir
138+ pmix_hwloc_support_will_build=yes
103139 fi
104140
105- AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support ],
106- [Whether or not we have hwloc support])
141+ # Set output variables
142+ PMIX_HWLOC_HEADER= " <hwloc.h>"
143+
107144 PMIX_VAR_SCOPE_POP
108145])dnl
0 commit comments