From 83590f3e84a23cffcfa0927cf6faa211bda0dbfa Mon Sep 17 00:00:00 2001 From: Phil Sorber Date: Wed, 7 Sep 2016 11:15:59 -0600 Subject: [PATCH 1/3] TS-4821: Make hwloc a required dependency --- cmd/traffic_layout/traffic_layout.cc | 1 - configure.ac | 66 ++++++++---------------- iocore/aio/AIO.cc | 2 - iocore/eventsystem/UnixEventProcessor.cc | 10 ---- lib/ts/ink_config.h.in | 1 - lib/ts/ink_defs.cc | 16 ------ lib/ts/ink_defs.h | 4 -- 7 files changed, 22 insertions(+), 78 deletions(-) diff --git a/cmd/traffic_layout/traffic_layout.cc b/cmd/traffic_layout/traffic_layout.cc index f10fc17b924..da455110e17 100644 --- a/cmd/traffic_layout/traffic_layout.cc +++ b/cmd/traffic_layout/traffic_layout.cc @@ -93,7 +93,6 @@ produce_features(bool json) print_feature("TS_USE_TPROXY", TS_USE_TPROXY, json); print_feature("TS_HAS_SO_MARK", TS_HAS_SO_MARK, json); print_feature("TS_HAS_IP_TOS", TS_HAS_IP_TOS, json); - print_feature("TS_USE_HWLOC", TS_USE_HWLOC, json); print_feature("TS_USE_TLS_NPN", TS_USE_TLS_NPN, json); print_feature("TS_USE_TLS_ALPN", TS_USE_TLS_ALPN, json); print_feature("TS_USE_TLS_SNI", TS_USE_TLS_SNI, json); diff --git a/configure.ac b/configure.ac index f906135fd15..0b49b06da95 100644 --- a/configure.ac +++ b/configure.ac @@ -321,17 +321,6 @@ AC_ARG_ENABLE([posix-cap], ) AC_MSG_RESULT([$enable_posix_cap]) -# -# use hwloc library when possible (can be disabled) -# -AC_MSG_CHECKING([whether to use hwloc library]) -AC_ARG_ENABLE([hwloc], - [AS_HELP_STRING([--disable-hwloc],[Don't use the hwloc library])], - [], - [enable_hwloc="yes"] -) -AC_MSG_RESULT([$enable_hwloc]) - # # Enble ccache explicitly (it's disabled by default, because of build problems in some cases) # @@ -1370,43 +1359,32 @@ AC_MSG_RESULT([$enable_linux_native_aio]) TS_ARG_ENABLE_VAR([use], [linux_native_aio]) # Check for hwloc library. -# If we don't find it, disable checking for header. -use_hwloc=0 -AS_IF([test "x$enable_hwloc" = "xyes"], [ - # Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. - PKG_CHECK_MODULES([HWLOC], [hwloc], [ - SAVE_LIBS="$LIBS" - LIBS="-lhwloc" - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([for hwloc C++ linking]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([#include ],[hwloc_topology_t t; hwloc_topology_init(&t); hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[ - use_hwloc=1 - AC_SUBST([HWLOC_CFLAGS]) - AC_SUBST([HWLOC_LIBS]) - AC_MSG_RESULT([yes]) - # Old versions of libhwloc don't have HWLOC_OBJ_PU. - AC_CHECK_DECL(HWLOC_OBJ_PU, - [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], - [#include ] - ) - ], [ - AC_MSG_RESULT([no]) - AC_MSG_WARN([hwloc not linkable, try --disable-hwloc]) - AC_SUBST([HWLOC_CFLAGS],[""]) - AC_SUBST([HWLOC_LIBS],[""]) - ]) - AC_LANG_POP() - LIBS="$SAVE_LIBS" +# Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. +PKG_CHECK_MODULES([HWLOC], [hwloc], [ + SAVE_LIBS="$LIBS" + LIBS="-lhwloc" + AC_LANG_PUSH([C++]) + AC_MSG_CHECKING([for hwloc C++ linking]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([#include ],[hwloc_topology_t t; hwloc_topology_init(&t); hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[ + AC_SUBST([HWLOC_CFLAGS]) + AC_SUBST([HWLOC_LIBS]) + AC_MSG_RESULT([yes]) + # Old versions of libhwloc don't have HWLOC_OBJ_PU. + AC_CHECK_DECL(HWLOC_OBJ_PU, + [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], + [#include ] + ) ], [ - AC_MSG_WARN([hwloc not found, try --disable-hwloc]) - AC_SUBST([HWLOC_CFLAGS],[""]) - AC_SUBST([HWLOC_LIBS],[""]) + AC_MSG_RESULT([no]) + AC_MSG_ERROR([hwloc not linkable]) ]) + AC_LANG_POP() + LIBS="$SAVE_LIBS" +], [ + AC_MSG_ERROR([hwloc not found]) ]) -AC_SUBST(use_hwloc) - # # Check for Maxmind APIs / includes. TODO: Long term, it might make sense to support # GeoIP as a "helper" plugin, which other plugins can then use. Such a plugin could diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index 46362e2ec8c..4491d975c2f 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -189,10 +189,8 @@ struct AIOThreadInfo : public Continuation { { (void)event; (void)e; -#if TS_USE_HWLOC hwloc_set_membind_nodeset(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()), HWLOC_MEMBIND_INTERLEAVE, HWLOC_MEMBIND_THREAD); -#endif aio_thread_main(this); delete this; return EVENT_DONE; diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 853d347a13b..57caf2293dc 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -23,12 +23,10 @@ #include "P_EventSystem.h" /* MAGIC_EDITING_TAG */ #include -#if TS_USE_HWLOC #if HAVE_ALLOCA_H #include #endif #include -#endif #include "ts/ink_defs.h" #include "ts/hugepages.h" @@ -162,7 +160,6 @@ EventProcessor::start(int n_event_threads, size_t stacksize) } n_threads_for_type[ET_CALL] = n_event_threads; -#if TS_USE_HWLOC int affinity = 1; REC_ReadConfigInteger(affinity, "proxy.config.exec_thread.affinity"); hwloc_obj_t obj; @@ -201,11 +198,8 @@ EventProcessor::start(int n_event_threads, size_t stacksize) obj_count = hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type); Debug("iocore_thread", "Affinity: %d %ss: %d PU: %d", affinity, obj_name, obj_count, ink_number_of_processors()); -#endif for (i = 0; i < n_ethreads; i++) { ink_thread tid; - -#if TS_USE_HWLOC if (obj_count > 0) { // Get our `obj` instance with index based on the thread number we are on. obj = hwloc_get_obj_by_type(ink_get_topology(), obj_type, i % obj_count); @@ -247,10 +241,6 @@ EventProcessor::start(int n_event_threads, size_t stacksize) } else { Warning("hwloc returned an unexpected value -- CPU affinity disabled"); } -#else - // Lets ignore tid if we don't link with HWLOC - (void)tid; -#endif // TS_USE_HWLOC } Debug("iocore_thread", "Created event thread group id %d with %d threads", ET_CALL, n_event_threads); diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in index 9e93687c683..8248eff4b3b 100644 --- a/lib/ts/ink_config.h.in +++ b/lib/ts/ink_config.h.in @@ -69,7 +69,6 @@ #define TS_USE_TPROXY @use_tproxy@ #define TS_HAS_SO_MARK @has_so_mark@ #define TS_HAS_IP_TOS @has_ip_tos@ -#define TS_USE_HWLOC @use_hwloc@ #define TS_USE_TLS_NPN @use_tls_npn@ #define TS_USE_TLS_ALPN @use_tls_alpn@ #define TS_USE_TLS_SNI @use_tls_sni@ diff --git a/lib/ts/ink_defs.cc b/lib/ts/ink_defs.cc index 2dfa331c7c3..bb71f1ce3b4 100644 --- a/lib/ts/ink_defs.cc +++ b/lib/ts/ink_defs.cc @@ -42,8 +42,6 @@ int off = 0; int on = 1; -#if TS_USE_HWLOC - #include // Little helper to initialize the hwloc topology, once. @@ -66,8 +64,6 @@ ink_get_topology() return topology; } -#endif - int ink_sys_name_release(char *name, int namelen, char *release, int releaselen) { @@ -118,23 +114,11 @@ ink_sys_name_release(char *name, int namelen, char *release, int releaselen) int ink_number_of_processors() { -#if TS_USE_HWLOC #if HAVE_HWLOC_OBJ_PU return hwloc_get_nbobjs_by_type(ink_get_topology(), HWLOC_OBJ_PU); #else return hwloc_get_nbobjs_by_type(ink_get_topology(), HWLOC_OBJ_CORE); #endif -#elif defined(freebsd) - int mib[2], n; - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - size_t len = sizeof(n); - if (sysctl(mib, 2, &n, &len, nullptr, 0) == -1) - return 1; - return n; -#else - return sysconf(_SC_NPROCESSORS_ONLN); // number of processing units (includes Hyper Threading) -#endif } int diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h index 0f80a81523d..745039e96bb 100644 --- a/lib/ts/ink_defs.h +++ b/lib/ts/ink_defs.h @@ -128,9 +128,7 @@ max(const T a, const T b) #define unlikely(x) __builtin_expect(!!(x), 0) #endif -#if TS_USE_HWLOC #include -#endif #ifndef ROUNDUP #define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y)) @@ -154,10 +152,8 @@ int ink_sys_name_release(char *name, int namelen, char *release, int releaselen) int ink_number_of_processors(); int ink_login_name_max(); -#if TS_USE_HWLOC // Get the hardware topology hwloc_topology_t ink_get_topology(); -#endif /** Constants. */ From cabefbe631414dea06ff9b124676e338f0d8a411 Mon Sep 17 00:00:00 2001 From: Phil Sorber Date: Wed, 7 Sep 2016 13:59:04 -0600 Subject: [PATCH 2/3] TS-4821: Accept alternate location for hwloc --- build/hwloc.m4 | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 30 ++------------ 2 files changed, 108 insertions(+), 27 deletions(-) create mode 100644 build/hwloc.m4 diff --git a/build/hwloc.m4 b/build/hwloc.m4 new file mode 100644 index 00000000000..323f6e644ff --- /dev/null +++ b/build/hwloc.m4 @@ -0,0 +1,105 @@ +dnl -------------------------------------------------------- -*- autoconf -*- +dnl Licensed to the Apache Software Foundation (ASF) under one or more +dnl contributor license agreements. See the NOTICE file distributed with +dnl this work for additional information regarding copyright ownership. +dnl The ASF licenses this file to You under the Apache License, Version 2.0 +dnl (the "License"); you may not use this file except in compliance with +dnl the License. You may obtain a copy of the License at +dnl +dnl http://www.apache.org/licenses/LICENSE-2.0 +dnl +dnl Unless required by applicable law or agreed to in writing, software +dnl distributed under the License is distributed on an "AS IS" BASIS, +dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +dnl See the License for the specific language governing permissions and +dnl limitations under the License. + +dnl +dnl hwloc.m4: Trafficserver's hwloc autoconf macros +dnl + +dnl +dnl TS_CHECK_HWLOC: look for hwloc libraries and headers +dnl +AC_DEFUN([TS_CHECK_HWLOC], [ +hwloc_path_provided=no +AC_ARG_WITH(hwloc, [AC_HELP_STRING([--with-hwloc=DIR],[use a specific hwloc library])], +[ + if test "x$withval" != "xyes" && test "x$withval" != "x"; then + hwloc_base_dir="$withval" + if test "$withval" != "no"; then + hwloc_path_provided=yes + case "$withval" in + *":"*) + hwloc_include="`echo $withval |sed -e 's/:.*$//'`" + hwloc_ldflags="`echo $withval |sed -e 's/^.*://'`" + AC_MSG_CHECKING(checking for hwloc includes in $hwloc_include libs in $hwloc_ldflags ) + ;; + *) + hwloc_include="$withval/include" + hwloc_ldflags="$withval/lib" + AC_MSG_CHECKING(checking for hwloc includes in $withval) + ;; + esac + fi + fi +]) + +if test "x$hwloc_path_provided" = "xno"; then + # Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. + PKG_CHECK_MODULES([HWLOC], [hwloc], [ + SAVE_LIBS="$LIBS" + LIBS="-lhwloc" + AC_LANG_PUSH([C++]) + AC_MSG_CHECKING([for hwloc C++ linking]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([#include ],[hwloc_topology_t t; hwloc_topology_init(&t); hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[ + AC_SUBST([HWLOC_CFLAGS]) + AC_SUBST([HWLOC_LIBS]) + AC_MSG_RESULT([yes]) + # Old versions of libhwloc don't have HWLOC_OBJ_PU. + AC_CHECK_DECL(HWLOC_OBJ_PU, + [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], + [#include ] + ) + ], [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([hwloc not linkable]) + ]) + AC_LANG_POP() + LIBS="$SAVE_LIBS" + ], [ + AC_MSG_ERROR([hwloc not found]) + ]) +else + if test -d $hwloc_include && test -d $hwloc_ldflags && test -f $hwloc_include/hwloc.h; then + saved_ldflags=$LDFLAGS + saved_cppflags=$CPPFLAGS + hwloc_have_headers=0 + hwloc_have_libs=0 + if test "$hwloc_base_dir" != "/usr"; then + TS_ADDTO(CPPFLAGS, [-I${hwloc_include}]) + TS_ADDTO(LDFLAGS, [-L${hwloc_ldflags}]) + TS_ADDTO_RPATH(${hwloc_ldflags}) + fi + AC_SEARCH_LIBS([hwloc_code], [hwloc], [hwloc_have_libs=1]) + if test "$hwloc_have_libs" != "0"; then + AC_CHECK_HEADERS(hwloc.h, [hwloc_have_headers=1]) + fi + if test "$hwloc_have_headers" != "0"; then + AC_SUBST(HWLOC_LIBS, [-lhwloc]) + AC_CHECK_DECL(HWLOC_OBJ_PU, + [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], + [#include ] + ) + else + AC_MSG_ERROR([hwloc not found]) + CPPFLAGS=$saved_cppflags + LDFLAGS=$saved_ldflags + fi + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([hwloc not found]) + fi +fi +]) diff --git a/configure.ac b/configure.ac index 0b49b06da95..ac277605631 100644 --- a/configure.ac +++ b/configure.ac @@ -1125,6 +1125,9 @@ TS_CHECK_ZLIB # Check for lzma presence and usability TS_CHECK_LZMA +# Check for hwloc presence and usability +TS_CHECK_HWLOC + # # Tcl macros provided by build/tcl.m4 # @@ -1358,33 +1361,6 @@ AS_IF([test "x$enable_linux_native_aio" = "xyes"], [ AC_MSG_RESULT([$enable_linux_native_aio]) TS_ARG_ENABLE_VAR([use], [linux_native_aio]) -# Check for hwloc library. -# Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. -PKG_CHECK_MODULES([HWLOC], [hwloc], [ - SAVE_LIBS="$LIBS" - LIBS="-lhwloc" - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([for hwloc C++ linking]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([#include ],[hwloc_topology_t t; hwloc_topology_init(&t); hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[ - AC_SUBST([HWLOC_CFLAGS]) - AC_SUBST([HWLOC_LIBS]) - AC_MSG_RESULT([yes]) - # Old versions of libhwloc don't have HWLOC_OBJ_PU. - AC_CHECK_DECL(HWLOC_OBJ_PU, - [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], - [#include ] - ) - ], [ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([hwloc not linkable]) - ]) - AC_LANG_POP() - LIBS="$SAVE_LIBS" -], [ - AC_MSG_ERROR([hwloc not found]) -]) - # # Check for Maxmind APIs / includes. TODO: Long term, it might make sense to support # GeoIP as a "helper" plugin, which other plugins can then use. Such a plugin could From 98c41c11fcdc6a62377e72011a5b3c82a51bfb84 Mon Sep 17 00:00:00 2001 From: Phil Sorber Date: Thu, 8 Sep 2016 13:19:14 -0600 Subject: [PATCH 3/3] Checkpoint --- build/hwloc.m4 | 127 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/build/hwloc.m4 b/build/hwloc.m4 index 323f6e644ff..f788d60fcd2 100644 --- a/build/hwloc.m4 +++ b/build/hwloc.m4 @@ -22,84 +22,81 @@ dnl dnl TS_CHECK_HWLOC: look for hwloc libraries and headers dnl AC_DEFUN([TS_CHECK_HWLOC], [ -hwloc_path_provided=no -AC_ARG_WITH(hwloc, [AC_HELP_STRING([--with-hwloc=DIR],[use a specific hwloc library])], -[ - if test "x$withval" != "xyes" && test "x$withval" != "x"; then - hwloc_base_dir="$withval" - if test "$withval" != "no"; then - hwloc_path_provided=yes - case "$withval" in - *":"*) - hwloc_include="`echo $withval |sed -e 's/:.*$//'`" - hwloc_ldflags="`echo $withval |sed -e 's/^.*://'`" - AC_MSG_CHECKING(checking for hwloc includes in $hwloc_include libs in $hwloc_ldflags ) - ;; - *) - hwloc_include="$withval/include" - hwloc_ldflags="$withval/lib" - AC_MSG_CHECKING(checking for hwloc includes in $withval) - ;; - esac + hwloc_path_provided=no + AC_ARG_WITH(hwloc, [AC_HELP_STRING([--with-hwloc=DIR],[use a specific hwloc library])], + [ + if test "x$withval" != "xyes" && test "x$withval" != "x"; then + hwloc_base_dir="$withval" + if test "$withval" != "no"; then + hwloc_path_provided=yes + case "$withval" in + *":"*) + hwloc_include="`echo $withval |sed -e 's/:.*$//'`" + hwloc_ldflags="`echo $withval |sed -e 's/^.*://'`" + AC_MSG_CHECKING(checking for hwloc includes in $hwloc_include libs in $hwloc_ldflags ) + ;; + *) + hwloc_include="$withval/include" + hwloc_ldflags="$withval/lib" + AC_MSG_CHECKING(checking for hwloc includes in $withval) + ;; + esac + fi + fi + ]) + + if test "x$hwloc_path_provided" = "xno"; then + # Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. + PKG_CHECK_MODULES([HWLOC], [hwloc], [], [ + AC_SUBST([HWLOC_CFLAGS],[""]) + AC_SUBST([HWLOC_LIBS],[""]) + AC_MSG_RESULT([no]) + $2 + ]) + else + if test -d $hwloc_include && test -d $hwloc_ldflags && test -f $hwloc_include/hwloc.h; then + saved_ldflags=$LDFLAGS + saved_cppflags=$CPPFLAGS + hwloc_have_headers=0 + hwloc_have_libs=0 + if test "$hwloc_base_dir" != "/usr"; then + TS_ADDTO(CPPFLAGS, [-I${hwloc_include}]) + TS_ADDTO(LDFLAGS, [-L${hwloc_ldflags}]) + TS_ADDTO_RPATH(${hwloc_ldflags}) + fi fi fi -]) -if test "x$hwloc_path_provided" = "xno"; then - # Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places. - PKG_CHECK_MODULES([HWLOC], [hwloc], [ - SAVE_LIBS="$LIBS" - LIBS="-lhwloc" - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([for hwloc C++ linking]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([#include ],[hwloc_topology_t t; hwloc_topology_init(&t); hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[ + SAVE_LIBS="$LIBS" + LIBS="-lhwloc" + AC_LANG_PUSH([C++]) + AC_CHECK_LIBS([hwloc], [hwloc_topology_init], [ + AC_CHECK_HEADERS(hwloc.h, [ AC_SUBST([HWLOC_CFLAGS]) AC_SUBST([HWLOC_LIBS]) AC_MSG_RESULT([yes]) + $1 # Old versions of libhwloc don't have HWLOC_OBJ_PU. AC_CHECK_DECL(HWLOC_OBJ_PU, [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], [#include ] ) ], [ + CPPFLAGS=$saved_cppflags + LDFLAGS=$saved_ldflags + AC_SUBST([HWLOC_CFLAGS],[""]) + AC_SUBST([HWLOC_LIBS],[""]) AC_MSG_RESULT([no]) - AC_MSG_ERROR([hwloc not linkable]) + $2 ]) - AC_LANG_POP() - LIBS="$SAVE_LIBS" ], [ - AC_MSG_ERROR([hwloc not found]) - ]) -else - if test -d $hwloc_include && test -d $hwloc_ldflags && test -f $hwloc_include/hwloc.h; then - saved_ldflags=$LDFLAGS - saved_cppflags=$CPPFLAGS - hwloc_have_headers=0 - hwloc_have_libs=0 - if test "$hwloc_base_dir" != "/usr"; then - TS_ADDTO(CPPFLAGS, [-I${hwloc_include}]) - TS_ADDTO(LDFLAGS, [-L${hwloc_ldflags}]) - TS_ADDTO_RPATH(${hwloc_ldflags}) - fi - AC_SEARCH_LIBS([hwloc_code], [hwloc], [hwloc_have_libs=1]) - if test "$hwloc_have_libs" != "0"; then - AC_CHECK_HEADERS(hwloc.h, [hwloc_have_headers=1]) - fi - if test "$hwloc_have_headers" != "0"; then - AC_SUBST(HWLOC_LIBS, [-lhwloc]) - AC_CHECK_DECL(HWLOC_OBJ_PU, - [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [], - [#include ] - ) - else - AC_MSG_ERROR([hwloc not found]) - CPPFLAGS=$saved_cppflags - LDFLAGS=$saved_ldflags - fi - AC_MSG_RESULT([ok]) - else - AC_MSG_ERROR([hwloc not found]) - fi -fi + CPPFLAGS=$saved_cppflags + LDFLAGS=$saved_ldflags + AC_SUBST([HWLOC_CFLAGS],[""]) + AC_SUBST([HWLOC_LIBS],[""]) + AC_MSG_RESULT([no]) + $2 + ],[]) + AC_LANG_POP() + LIBS="$SAVE_LIBS" ])