11# -*- shell-script -*-
22#
33# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
4- # Copyright (c) 2014-2017 Research Organization for Information Science
4+ # Copyright (c) 2014-2018 Research Organization for Information Science
55# and Technology (RIST). All rights reserved.
66#
77# Copyright (c) 2018 Intel, Inc. All rights reserved.
@@ -84,7 +84,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[
8484AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
8585 AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile])
8686
87- OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want opal_hwloc_external_tmp opal_hwloc_external_lstopo])
87+ OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_tmp opal_hwloc_external_lstopo opal_hwloc_summary_msg ])
8888
8989 AC_ARG_WITH([hwloc-libdir],
9090 [AC_HELP_STRING([--with-hwloc-libdir= DIR],
@@ -98,19 +98,9 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
9898 AC_MSG_WARN([were specified, which does not make sense.])
9999 AC_MSG_ERROR([Cannot continue])])
100100
101- # Do we want this external component? (slightly redundant logic,
102- # but hopefully slightly more clear...)
103- opal_hwloc_external_want=no
104- AS_IF([test " $with_hwloc_libdir " != " " ], [opal_hwloc_external_want= yes])
105- AS_IF([test " $with_hwloc " = " external" ], [opal_hwloc_external_want= yes])
106- AS_IF([test " $with_hwloc " != " " && \
107- test " $with_hwloc " != " no" && \
108- test " $with_hwloc " != " internal" && \
109- test " $with_hwloc " != " future" ], [opal_hwloc_external_want= yes])
110- AS_IF([test " $with_hwloc " = " no" ], [opal_hwloc_external_want= no])
111-
112- # If we still want external support, try it
113- AS_IF([test " $opal_hwloc_external_want " = " yes" ],
101+ opal_hwloc_summary_msg=" internal"
102+ # Try external support if needed
103+ AS_IF([test " $with_hwloc " != " internal" ],
114104 [OPAL_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir ],
115105 [libhwloc.* ])
116106
@@ -144,64 +134,86 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
144134 LDFLAGS= " $LDFLAGS $opal_hwloc_external_LDFLAGS "
145135 LIBS= " $LIBS $opal_hwloc_external_LIBS "
146136 AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [# include <hwloc.h>])
147- AC_CHECK_FUNCS([hwloc_topology_dup])])
137+ AC_CHECK_FUNCS([hwloc_topology_dup])
148138
149- CPPFLAGS= $opal_hwloc_external_CPPFLAGS_save
150- CFLAGS= $opal_hwloc_external_CFLAGS_save
151- LDFLAGS= $opal_hwloc_external_LDFLAGS_save
152- LIBS= $opal_hwloc_external_LIBS_save
153- ])
154-
155- # Done!
156- AS_IF([test " $opal_hwloc_external_support " = " yes" ],
157- [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
158- [external],
159- [Version of hwloc])
160-
161- # See if the external hwloc supports XML
162- AC_MSG_CHECKING([if external hwloc supports XML])
163- AS_IF([test " $opal_hwloc_dir " != " " ],
164- [opal_hwloc_external_lstopo= " $opal_hwloc_dir /bin/lstopo" ],
165- [OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)])
166- opal_hwloc_external_tmp= ` $opal_hwloc_external_lstopo --help | $GREP " Supported output file formats" | grep xml`
167- AS_IF([test " $opal_hwloc_external_tmp " = " " ],
168- [opal_hwloc_external_enable_xml= 0
169- AC_MSG_RESULT([no])],
170- [opal_hwloc_external_enable_xml= 1
171- AC_MSG_RESULT([yes])])
172-
173- AC_CHECK_HEADERS([infiniband/verbs.h])
174-
175- AC_MSG_CHECKING([if external hwloc version is 1.5 or greater])
176- AS_IF([test " $opal_hwloc_dir " != " " ],
177- [opal_hwloc_external_CFLAGS_save= $CFLAGS
178- CFLAGS= " -I$opal_hwloc_dir /include $opal_hwloc_external_CFLAGS_save " ])
179- AC_COMPILE_IFELSE(
180- [AC_LANG_PROGRAM([[# include <hwloc.h>]],
181- [[
139+ AC_MSG_CHECKING([if external hwloc version is 1.5 or greater])
140+ AC_COMPILE_IFELSE(
141+ [AC_LANG_PROGRAM([[# include <hwloc.h>]],
142+ [[
182143# if HWLOC_API_VERSION < 0x00010500
183144# error "hwloc API version is less than 0x00010500"
184145# endif
185- ]])],
186- [AC_MSG_RESULT([yes])],
187- [AC_MSG_RESULT([no])
188- AC_MSG_ERROR([Cannot continue])])
189-
190- AS_IF([test " $opal_hwloc_dir " != " " ],
191- [CFLAGS= $opal_hwloc_external_CFLAGS_save ])
146+ ]])],
147+ [AC_MSG_RESULT([yes])],
148+ [AC_MSG_RESULT([no])
149+ opal_hwloc_external_support= no])])
192150
193- # These flags need to get passed to the wrapper compilers
194- # (this is unnecessary for the internal/embedded hwloc)
151+ # If external hwloc is not explicitly requested, check external version
152+ # is not lower than the internal one
153+ AS_IF([test " $opal_hwloc_external_support " = " yes" ],
154+ [AS_IF([test -z " $with_hwloc " || test " $with_hwloc " = " yes" ],
155+ [AC_MSG_CHECKING([if external hwloc version is 2.0 or greater])
156+ AC_COMPILE_IFELSE(
157+ [AC_LANG_PROGRAM([[# include <hwloc.h>]],
158+ [[
159+ # if HWLOC_API_VERSION < 0x00020000
160+ # error "hwloc API version is less than 0x00020000"
161+ # endif
162+ ]])],
163+ [AC_MSG_RESULT([yes])],
164+ [AC_MSG_RESULT([no])
165+ opal_hwloc_summary_msg= " internal (external hlwoc version is less than internal version 2.0)"
166+ AC_MSG_WARN([external hwloc version is less than internal version 2.0])
167+ AC_MSG_WARN([using internal hwloc])
168+ opal_hwloc_external_support= no])])])
195169
196- # Finally, add some flags to the wrapper compiler if we're
197- # building with developer headers so that our headers can
198- # be found.
199- hwloc_external_WRAPPER_EXTRA_CPPFLAGS= $opal_hwloc_external_CPPFLAGS
200- hwloc_external_WRAPPER_EXTRA_LDFLAGS= $opal_hwloc_external_LDFLAGS
201- hwloc_external_WRAPPER_EXTRA_LIBS= $opal_hwloc_external_LIBS
170+ AS_IF([test " $opal_hwloc_external_support " = " yes" ],
171+ [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
172+ [external],
173+ [Version of hwloc])
174+
175+ # See if the external hwloc supports XML
176+ AC_MSG_CHECKING([if external hwloc supports XML])
177+ AS_IF([test " $opal_hwloc_dir " != " " ],
178+ [opal_hwloc_external_lstopo= " $opal_hwloc_dir /bin/lstopo" ],
179+ [OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)])
180+ opal_hwloc_external_tmp= ` $opal_hwloc_external_lstopo --help | $GREP " Supported output file formats" | grep xml`
181+ AS_IF([test " $opal_hwloc_external_tmp " = " " ],
182+ [opal_hwloc_external_enable_xml= 0
183+ AC_MSG_RESULT([no])],
184+ [opal_hwloc_external_enable_xml= 1
185+ AC_MSG_RESULT([yes])])
186+
187+ AC_CHECK_HEADERS([infiniband/verbs.h])
188+
189+ # These flags need to get passed to the wrapper compilers
190+ # (this is unnecessary for the internal/embedded hwloc)
191+
192+ # Finally, add some flags to the wrapper compiler if we're
193+ # building with developer headers so that our headers can
194+ # be found.
195+ hwloc_external_WRAPPER_EXTRA_CPPFLAGS= $opal_hwloc_external_CPPFLAGS
196+ hwloc_external_WRAPPER_EXTRA_LDFLAGS= $opal_hwloc_external_LDFLAGS
197+ hwloc_external_WRAPPER_EXTRA_LIBS= $opal_hwloc_external_LIBS ])
198+
199+ CPPFLAGS= $opal_hwloc_external_CPPFLAGS_save
200+ CFLAGS= $opal_hwloc_external_CFLAGS_save
201+ LDFLAGS= $opal_hwloc_external_LDFLAGS_save
202+ LIBS= $opal_hwloc_external_LIBS_save
203+ ])
202204
205+ # Done!
206+ AS_IF([test " $opal_hwloc_external_support " = " yes" ],
207+ [opal_hwloc_summary_msg= " external"
203208 $1 ],
204- [$2 ])
209+ [# Abort is external hwloc was explicitly requested but cannot be built
210+ AS_IF([test " $with_hwloc " != internal &&
211+ test -n " $with_hwloc " ],
212+ [AC_MSG_WARN([external hwloc cannot be built])
213+ AC_MSG_ERROR([Cannot continue.])])
214+ $2 ])
215+
216+ OPAL_SUMMARY_ADD([[Miscellaneous]],[[HWLOC support]], [], [$opal_hwloc_summary_msg ])
205217
206218 AC_SUBST(opal_hwloc_external_LDFLAGS)
207219 AC_SUBST(opal_hwloc_external_LIBS)
0 commit comments