2011-09-11 23:02:24 +04:00
|
|
|
# -*- shell-script -*-
|
|
|
|
#
|
2015-04-14 05:51:01 +03:00
|
|
|
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
2014-12-22 07:42:38 +03:00
|
|
|
# Copyright (c) 2014 Research Organization for Information Science
|
|
|
|
# and Technology (RIST). All rights reserved.
|
2011-09-11 23:02:24 +04:00
|
|
|
#
|
|
|
|
# $COPYRIGHT$
|
2015-03-13 14:14:01 +03:00
|
|
|
#
|
2011-09-11 23:02:24 +04:00
|
|
|
# Additional copyrights may follow
|
2015-03-13 14:14:01 +03:00
|
|
|
#
|
2011-09-11 23:02:24 +04:00
|
|
|
# $HEADER$
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Priority
|
|
|
|
#
|
2013-01-12 05:48:53 +04:00
|
|
|
AC_DEFUN([MCA_opal_hwloc_external_PRIORITY], [90])
|
2011-09-11 23:02:24 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Force this component to compile in static-only mode
|
|
|
|
#
|
|
|
|
AC_DEFUN([MCA_opal_hwloc_external_COMPILE_MODE], [
|
|
|
|
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
|
|
|
|
$4="static"
|
|
|
|
AC_MSG_RESULT([$$4])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# MCA_hwloc_external_POST_CONFIG()
|
|
|
|
# ---------------------------------
|
|
|
|
AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[
|
2013-01-15 01:44:47 +04:00
|
|
|
OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_basedir])
|
|
|
|
|
|
|
|
# If we won, then do all the rest of the setup
|
2015-03-13 14:14:01 +03:00
|
|
|
AS_IF([test "$1" = "1"],
|
|
|
|
[AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
|
|
|
|
[external],
|
2013-01-15 01:44:47 +04:00
|
|
|
[Version of hwloc])
|
|
|
|
|
|
|
|
# Set this variable so that the framework m4 knows what
|
|
|
|
# file to include in opal/mca/hwloc/hwloc.h
|
|
|
|
opal_hwloc_external_basedir=opal/mca/hwloc/external
|
|
|
|
opal_hwloc_base_include="$opal_hwloc_external_basedir/external.h"
|
|
|
|
|
|
|
|
# Add some stuff to CPPFLAGS so that the rest of the source
|
|
|
|
# tree can be built
|
|
|
|
file=$opal_hwloc_external_basedir/hwloc
|
|
|
|
CPPFLAGS="$CPPFLAGS $opal_hwloc_external_CPPFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS $opal_hwloc_external_LDFLAGS"
|
|
|
|
LIBS="$LIBS $opal_hwloc_external_LIBS"
|
2014-05-08 01:48:53 +04:00
|
|
|
AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"],
|
|
|
|
[CPPFLAGS="$CPPFLAGS -I$OPAL_TOP_BUILDDIR/$file/include"])
|
2013-01-15 01:44:47 +04:00
|
|
|
unset file
|
|
|
|
|
|
|
|
# We have to do some extra indirection to get the
|
|
|
|
# OPAL_HWLOC_WANT_VERBS_HELPER to work. First, the
|
|
|
|
# opal_hwloc_external_include file (set above), points to a
|
|
|
|
# file here in this component. That file will include the
|
|
|
|
# actual external hwloc.h file (via the
|
|
|
|
# MCA_hwloc_external_header define). And if
|
|
|
|
# OPAL_HWLOC_WANT_VERBS_HELPER is set, that file will
|
|
|
|
# include the external hwloc/openfabrics-verbs.h file (via
|
|
|
|
# the MCA_hwloc_external_openfabrics_helper define).
|
|
|
|
AC_DEFINE_UNQUOTED(MCA_hwloc_external_header,
|
|
|
|
["$opal_hwloc_dir/include/hwloc.h"],
|
|
|
|
[Location of external hwloc header])
|
|
|
|
AC_DEFINE_UNQUOTED(MCA_hwloc_external_openfabrics_header,
|
|
|
|
["$opal_hwloc_dir/include/hwloc/openfabrics-verbs.h"],
|
|
|
|
[Location of external hwloc header])
|
|
|
|
|
|
|
|
# These flags need to get passed to the wrapper compilers
|
|
|
|
# (this is unnecessary for the internal/embedded hwloc)
|
|
|
|
|
|
|
|
# Finally, add some flags to the wrapper compiler if we're
|
|
|
|
# building with developer headers so that our headers can
|
|
|
|
# be found.
|
2015-03-13 14:37:17 +03:00
|
|
|
hwloc_external_WRAPPER_EXTRA_CPPFLAGS=$opal_hwloc_external_CPPFLAGS
|
|
|
|
hwloc_external_WRAPPER_EXTRA_LDFLAGS=$opal_hwloc_external_LDFLAGS
|
|
|
|
hwloc_external_WRAPPER_EXTRA_LIBS=$opal_hwloc_external_LIBS
|
2013-01-15 01:44:47 +04:00
|
|
|
])
|
|
|
|
OPAL_VAR_SCOPE_POP
|
2011-09-11 23:02:24 +04:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
# MCA_hwloc_external_CONFIG([action-if-found], [action-if-not-found])
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
|
|
|
|
AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile])
|
|
|
|
|
2011-09-22 03:06:13 +04:00
|
|
|
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])
|
2011-09-11 23:02:24 +04:00
|
|
|
|
|
|
|
AC_ARG_WITH([hwloc-libdir],
|
|
|
|
[AC_HELP_STRING([--with-hwloc-libdir=DIR],
|
|
|
|
[Search for hwloc libraries in DIR. Should only be used if an external copy of hwloc is being used.])])
|
|
|
|
|
|
|
|
# Make sure the user didn't specify --with-hwloc=internal and
|
|
|
|
# --with-hwloc-libdir=whatever.
|
2015-03-13 14:37:17 +03:00
|
|
|
AS_IF([test "$with_hwloc" = "internal" && \
|
|
|
|
test "$with_hwloc_libdir" != ""],
|
2011-09-11 23:02:24 +04:00
|
|
|
[AC_MSG_WARN([Both --with-hwloc=internal and --with-hwloc-libdir=DIR])
|
|
|
|
AC_MSG_WARN([were specified, which does not make sense.])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
|
|
|
|
|
|
|
# Do we want this external component? (slightly redundant logic,
|
|
|
|
# but hopefully slightly more clear...)
|
|
|
|
opal_hwloc_external_want=no
|
|
|
|
AS_IF([test "$with_hwloc_libdir" != ""], [opal_hwloc_external_want=yes])
|
|
|
|
AS_IF([test "$with_hwloc" = "external"], [opal_hwloc_external_want=yes])
|
2015-03-13 14:37:17 +03:00
|
|
|
AS_IF([test "$with_hwloc" != "" && \
|
|
|
|
test "$with_hwloc" != "no" && \
|
|
|
|
test "$with_hwloc" != "internal"], [opal_hwloc_external_want=yes])
|
2011-09-11 23:02:24 +04:00
|
|
|
AS_IF([test "$with_hwloc" = "no"], [opal_hwloc_external_want=no])
|
|
|
|
|
|
|
|
# If we still want external support, try it
|
|
|
|
AS_IF([test "$opal_hwloc_external_want" = "yes"],
|
2015-03-13 14:14:01 +03:00
|
|
|
[OPAL_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir],
|
2011-09-11 23:02:24 +04:00
|
|
|
[libhwloc.*])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([looking for external hwloc in])
|
2015-03-13 14:37:17 +03:00
|
|
|
AS_IF([test "$with_hwloc" != "external" && \
|
|
|
|
test "$with_hwloc" != "yes"],
|
2011-09-11 23:02:24 +04:00
|
|
|
[opal_hwloc_dir=$with_hwloc
|
|
|
|
AC_MSG_RESULT([($opal_hwloc_dir)])],
|
|
|
|
[AC_MSG_RESULT([(default search paths)])])
|
2015-03-13 14:37:17 +03:00
|
|
|
AS_IF([test ! -z "$with_hwloc_libdir" && \
|
|
|
|
test "$with_hwloc_libdir" != "yes"],
|
|
|
|
[opal_hwloc_libdir=$with_hwloc_libdir])
|
2011-09-11 23:02:24 +04:00
|
|
|
|
|
|
|
opal_hwloc_external_CPPFLAGS_save=$CPPFLAGS
|
|
|
|
opal_hwloc_external_CFLAGS_save=$CFLAGS
|
|
|
|
opal_hwloc_external_LDFLAGS_save=$LDFLAGS
|
|
|
|
opal_hwloc_external_LIBS_save=$LIBS
|
|
|
|
|
2014-05-01 18:24:56 +04:00
|
|
|
OPAL_CHECK_PACKAGE([opal_hwloc_external],
|
2011-09-11 23:02:24 +04:00
|
|
|
[hwloc.h],
|
|
|
|
[hwloc],
|
|
|
|
[hwloc_topology_init],
|
|
|
|
[],
|
|
|
|
[$opal_hwloc_dir],
|
|
|
|
[$opal_hwloc_libdir],
|
|
|
|
[opal_hwloc_external_support=yes],
|
|
|
|
[opal_hwloc_external_support=no])
|
|
|
|
|
2013-01-15 01:44:47 +04:00
|
|
|
CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save
|
2011-09-11 23:02:24 +04:00
|
|
|
CFLAGS=$opal_hwloc_external_CFLAGS_save
|
|
|
|
LDFLAGS=$opal_hwloc_external_LDFLAGS_save
|
|
|
|
LIBS=$opal_hwloc_external_LIBS_save
|
|
|
|
])
|
|
|
|
|
|
|
|
# Done!
|
|
|
|
AS_IF([test "$opal_hwloc_external_support" = "yes"],
|
2015-03-13 14:14:01 +03:00
|
|
|
[AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
|
|
|
|
[external],
|
2011-09-11 23:02:24 +04:00
|
|
|
[Version of hwloc])
|
2011-09-22 03:06:13 +04:00
|
|
|
|
|
|
|
# See if the external hwloc supports XML
|
|
|
|
AC_MSG_CHECKING([if external hwloc supports XML])
|
|
|
|
AS_IF([test "$opal_hwloc_dir" != ""],
|
|
|
|
[opal_hwloc_external_lstopo="$opal_hwloc_dir/bin/lstopo"],
|
|
|
|
[OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)])
|
|
|
|
opal_hwloc_external_tmp=`$opal_hwloc_external_lstopo --help | $GREP "Supported output file formats" | grep xml`
|
|
|
|
AS_IF([test "$opal_hwloc_external_tmp" = ""],
|
|
|
|
[opal_hwloc_external_enable_xml=0
|
|
|
|
AC_MSG_RESULT([no])],
|
|
|
|
[opal_hwloc_external_enable_xml=1
|
|
|
|
AC_MSG_RESULT([yes])])
|
|
|
|
|
2012-06-14 23:00:57 +04:00
|
|
|
AC_CHECK_HEADERS([infiniband/verbs.h])
|
|
|
|
|
2014-12-22 07:42:38 +03:00
|
|
|
AC_MSG_CHECKING([if external hwloc version is 1.8 or greater])
|
|
|
|
AS_IF([test "$opal_hwloc_dir" != ""],
|
2015-04-14 05:51:01 +03:00
|
|
|
[opal_hwloc_external_CFLAGS_save=$CFLAGS
|
|
|
|
CFLAGS="-I$opal_hwloc_dir/include $opal_hwloc_external_CFLAGS_save"])
|
2014-12-22 07:42:38 +03:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
|
|
|
|
[[
|
|
|
|
#if HWLOC_API_VERSION < 0x00010800
|
|
|
|
#error "hwloc API version is less than 0x00010800"
|
|
|
|
#endif
|
|
|
|
]])],
|
|
|
|
[AC_MSG_RESULT([yes])],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
|
|
|
AS_IF([test "$opal_hwloc_dir" != ""],
|
2015-04-14 05:51:01 +03:00
|
|
|
[CFLAGS=$opal_hwloc_external_CFLAGS_save])
|
2011-09-11 23:02:24 +04:00
|
|
|
$1],
|
|
|
|
[$2])
|
|
|
|
|
|
|
|
AC_SUBST(opal_hwloc_external_LDFLAGS)
|
|
|
|
AC_SUBST(opal_hwloc_external_LIBS)
|
|
|
|
|
|
|
|
OPAL_VAR_SCOPE_POP
|
|
|
|
])dnl
|