|
| 1 | +# -*- shell-script -*- |
| 2 | +# |
| 3 | +# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. |
| 4 | +# Copyright (c) 2014-2015 Intel, Inc. All rights reserved. |
| 5 | +# Copyright (c) 2015 Research Organization for Information Science |
| 6 | +# and Technology (RIST). All rights reserved. |
| 7 | +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights |
| 8 | +# reserved. |
| 9 | +# |
| 10 | +# $COPYRIGHT$ |
| 11 | +# |
| 12 | +# Additional copyrights may follow |
| 13 | +# |
| 14 | +# $HEADER$ |
| 15 | +# |
| 16 | + |
| 17 | +# |
| 18 | +# Priority |
| 19 | +# |
| 20 | +AC_DEFUN([MCA_opal_hwloc_hwloc1112_PRIORITY], [90]) |
| 21 | + |
| 22 | +# |
| 23 | +# Force this component to compile in static-only mode |
| 24 | +# |
| 25 | +AC_DEFUN([MCA_opal_hwloc_hwloc1112_COMPILE_MODE], [ |
| 26 | + AC_MSG_CHECKING([for MCA component $2:$3 compile mode]) |
| 27 | + $4="static" |
| 28 | + AC_MSG_RESULT([$$4]) |
| 29 | +]) |
| 30 | + |
| 31 | +# Include hwloc m4 files |
| 32 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc.m4) |
| 33 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc_pkg.m4) |
| 34 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc_check_attributes.m4) |
| 35 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc_check_visibility.m4) |
| 36 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc_check_vendor.m4) |
| 37 | +m4_include(opal/mca/hwloc/hwloc1112/hwloc/config/hwloc_components.m4) |
| 38 | + |
| 39 | +# MCA_hwloc_hwloc1112_POST_CONFIG() |
| 40 | +# --------------------------------- |
| 41 | +AC_DEFUN([MCA_opal_hwloc_hwloc1112_POST_CONFIG],[ |
| 42 | + OPAL_VAR_SCOPE_PUSH([opal_hwloc_hwloc1112_basedir]) |
| 43 | + |
| 44 | + # If we won, then do all the rest of the setup |
| 45 | + AS_IF([test "$1" = "1" && test "$opal_hwloc_hwloc1112_support" = "yes"], |
| 46 | + [ |
| 47 | + # Set this variable so that the framework m4 knows what |
| 48 | + # file to include in opal/mca/hwloc/hwloc.h |
| 49 | + opal_hwloc_hwloc1112_basedir=opal/mca/hwloc/hwloc1112 |
| 50 | + opal_hwloc_base_include="$opal_hwloc_hwloc1112_basedir/hwloc1112.h" |
| 51 | + |
| 52 | + # Add some stuff to CPPFLAGS so that the rest of the source |
| 53 | + # tree can be built |
| 54 | + file=$opal_hwloc_hwloc1112_basedir/hwloc |
| 55 | + CPPFLAGS="$CPPFLAGS -I$OPAL_TOP_SRCDIR/$file/include" |
| 56 | + AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"], |
| 57 | + [CPPFLAGS="$CPPFLAGS -I$OPAL_TOP_BUILDDIR/$file/include"]) |
| 58 | + unset file |
| 59 | + ]) |
| 60 | + OPAL_VAR_SCOPE_POP |
| 61 | + |
| 62 | + # This must be run unconditionally |
| 63 | + HWLOC_DO_AM_CONDITIONALS |
| 64 | +])dnl |
| 65 | + |
| 66 | + |
| 67 | +# MCA_hwloc_hwloc1112_CONFIG([action-if-found], [action-if-not-found]) |
| 68 | +# -------------------------------------------------------------------- |
| 69 | +AC_DEFUN([MCA_opal_hwloc_hwloc1112_CONFIG],[ |
| 70 | + # Hwloc needs to know if we have Verbs support |
| 71 | + AC_REQUIRE([OPAL_CHECK_VERBS_DIR]) |
| 72 | + |
| 73 | + AC_CONFIG_FILES([opal/mca/hwloc/hwloc1112/Makefile]) |
| 74 | + |
| 75 | + OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc1112_save_CPPFLAGS opal_hwloc_hwloc1112_save_LDFLAGS opal_hwloc_hwloc1112_save_LIBS opal_hwloc_hwloc1112_save_cairo opal_hwloc_hwloc1112_save_xml opal_hwloc_hwloc1112_basedir opal_hwloc_hwloc1112_file opal_hwloc_hwloc1112_save_cflags CPPFLAGS_save LIBS_save]) |
| 76 | + |
| 77 | + # default to this component not providing support |
| 78 | + opal_hwloc_hwloc1112_basedir=opal/mca/hwloc/hwloc1112 |
| 79 | + opal_hwloc_hwloc1112_support=no |
| 80 | + |
| 81 | + if test "$with_hwloc" = "internal" || test -z "$with_hwloc" || test "$with_hwloc" = "yes"; then |
| 82 | + opal_hwloc_hwloc1112_save_CPPFLAGS=$CPPFLAGS |
| 83 | + opal_hwloc_hwloc1112_save_LDFLAGS=$LDFLAGS |
| 84 | + opal_hwloc_hwloc1112_save_LIBS=$LIBS |
| 85 | + |
| 86 | + # Run the hwloc configuration - set the prefix to minimize |
| 87 | + # the chance that someone will use the internal symbols |
| 88 | + HWLOC_SET_SYMBOL_PREFIX([opal_hwloc1112_]) |
| 89 | + |
| 90 | + # save XML or graphical options |
| 91 | + opal_hwloc_hwloc1112_save_cairo=$enable_cairo |
| 92 | + opal_hwloc_hwloc1112_save_xml=$enable_xml |
| 93 | + opal_hwloc_hwloc1112_save_static=$enable_static |
| 94 | + opal_hwloc_hwloc1112_save_shared=$enable_shared |
| 95 | + opal_hwloc_hwloc1112_save_plugins=$enable_plugins |
| 96 | + |
| 97 | + # never enable hwloc's graphical option |
| 98 | + enable_cairo=no |
| 99 | + |
| 100 | + # never enable hwloc's plugin system |
| 101 | + enable_plugins=no |
| 102 | + enable_static=yes |
| 103 | + enable_shared=no |
| 104 | + |
| 105 | + # Override -- disable hwloc's libxml2 support, but enable the |
| 106 | + # native hwloc XML support |
| 107 | + enable_libxml2=no |
| 108 | + enable_xml=yes |
| 109 | + |
| 110 | + # hwloc checks for compiler visibility, and its needs to do |
| 111 | + # this without "picky" flags. |
| 112 | + opal_hwloc_hwloc1112_save_cflags=$CFLAGS |
| 113 | + CFLAGS=$OPAL_CFLAGS_BEFORE_PICKY |
| 114 | + HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc1112/hwloc], |
| 115 | + [AC_MSG_CHECKING([whether hwloc configure succeeded]) |
| 116 | + AC_MSG_RESULT([yes]) |
| 117 | + HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc1112_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc1112_basedir/hwloc/VERSION`" |
| 118 | + |
| 119 | + # Build flags for our Makefile.am |
| 120 | + opal_hwloc_hwloc1112_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)' |
| 121 | + opal_hwloc_hwloc1112_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_hwloc_hwloc1112_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)' |
| 122 | + opal_hwloc_hwloc1112_support=yes |
| 123 | + |
| 124 | + AC_DEFINE_UNQUOTED([HWLOC_HWLOC1112_HWLOC_VERSION], |
| 125 | + ["$HWLOC_VERSION"], |
| 126 | + [Version of hwloc]) |
| 127 | + |
| 128 | + # Do we have verbs support? |
| 129 | + CPPFLAGS_save=$CPPFLAGS |
| 130 | + AS_IF([test "$opal_want_verbs" = "yes"], |
| 131 | + [CPPFLAGS="-I$opal_verbs_dir/include $CPPFLAGS"]) |
| 132 | + AC_CHECK_HEADERS([infiniband/verbs.h]) |
| 133 | + CPPFLAGS=$CPPFLAGS_save |
| 134 | + ], |
| 135 | + [AC_MSG_CHECKING([whether hwloc configure succeeded]) |
| 136 | + AC_MSG_RESULT([no]) |
| 137 | + opal_hwloc_hwloc1112_support=no]) |
| 138 | + CFLAGS=$opal_hwloc_hwloc1112_save_cflags |
| 139 | + |
| 140 | + # Restore some env variables, if necessary |
| 141 | + AS_IF([test -n "$opal_hwloc_hwloc1112_save_cairo"], |
| 142 | + [enable_cairo=$opal_hwloc_hwloc1112_save_cairo]) |
| 143 | + AS_IF([test -n "$opal_hwloc_hwloc1112_save_xml"], |
| 144 | + [enable_xml=$opal_hwloc_hwloc1112_save_xml]) |
| 145 | + AS_IF([test -n "$opal_hwloc_hwloc1112_save_static"], |
| 146 | + [enable_static=$opal_hwloc_hwloc1112_save_static]) |
| 147 | + AS_IF([test -n "$opal_hwloc_hwloc1112_save_shared"], |
| 148 | + [enable_shared=$opal_hwloc_hwloc1112_save_shared]) |
| 149 | + AS_IF([test -n "$opal_hwloc_hwloc1112_save_plugins"], |
| 150 | + [enable_plugins=$opal_hwloc_hwloc1112_save_shared]) |
| 151 | + |
| 152 | + CPPFLAGS=$opal_hwloc_hwloc1112_save_CPPFLAGS |
| 153 | + LDFLAGS=$opal_hwloc_hwloc1112_save_LDFLAGS |
| 154 | + LIBS=$opal_hwloc_hwloc1112_save_LIBS |
| 155 | + |
| 156 | + AC_SUBST([opal_hwloc_hwloc1112_CFLAGS]) |
| 157 | + AC_SUBST([opal_hwloc_hwloc1112_CPPFLAGS]) |
| 158 | + AC_SUBST([opal_hwloc_hwloc1112_LDFLAGS]) |
| 159 | + AC_SUBST([opal_hwloc_hwloc1112_LIBS]) |
| 160 | + |
| 161 | + # Finally, add some flags to the wrapper compiler so that our |
| 162 | + # headers can be found. |
| 163 | + hwloc_hwloc1112_WRAPPER_EXTRA_LDFLAGS="$HWLOC_EMBEDDED_LDFLAGS" |
| 164 | + hwloc_hwloc1112_WRAPPER_EXTRA_LIBS="$HWLOC_EMBEDDED_LIBS" |
| 165 | + hwloc_hwloc1112_WRAPPER_EXTRA_CPPFLAGS='-I${pkgincludedir}/'"$opal_hwloc_hwloc1112_basedir/hwloc/include" |
| 166 | + fi |
| 167 | + |
| 168 | + # Done! |
| 169 | + AS_IF([test "$opal_hwloc_hwloc1112_support" = "yes"], |
| 170 | + [$1], |
| 171 | + [$2]) |
| 172 | + |
| 173 | + OPAL_VAR_SCOPE_POP |
| 174 | +])dnl |
0 commit comments