Blame src/hwloc/config/hwloc_internal.m4

Packit Service c5cf8c
dnl -*- Autoconf -*-
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Copyright © 2010-2018 Inria.  All rights reserved.
Packit Service c5cf8c
dnl Copyright © 2009, 2011 Université Bordeaux
Packit Service c5cf8c
dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
Packit Service c5cf8c
dnl                         University Research and Technology
Packit Service c5cf8c
dnl                         Corporation.  All rights reserved.
Packit Service c5cf8c
dnl Copyright © 2004-2005 The Regents of the University of California.
Packit Service c5cf8c
dnl                         All rights reserved.
Packit Service c5cf8c
dnl Copyright © 2004-2008 High Performance Computing Center Stuttgart,
Packit Service c5cf8c
dnl                         University of Stuttgart.  All rights reserved.
Packit Service c5cf8c
dnl Copyright © 2006-2014 Cisco Systems, Inc.  All rights reserved.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl See COPYING in top-level directory.
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# Probably only ever invoked by hwloc's configure.ac
Packit Service c5cf8c
AC_DEFUN([HWLOC_BUILD_STANDALONE],[
Packit Service c5cf8c
    hwloc_mode=standalone
Packit Service c5cf8c
])dnl
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# Probably only ever invoked by hwloc's configure.ac
Packit Service c5cf8c
AC_DEFUN([HWLOC_DEFINE_ARGS],[
Packit Service c5cf8c
    # Embedded mode, or standalone?
Packit Service c5cf8c
    AC_ARG_ENABLE([embedded-mode],
Packit Service c5cf8c
                    AC_HELP_STRING([--enable-embedded-mode],
Packit Service c5cf8c
                                   [Using --enable-embedded-mode puts the HWLOC into "embedded" mode.  The default is --disable-embedded-mode, meaning that the HWLOC is in "standalone" mode.]))
Packit Service c5cf8c
Packit Service c5cf8c
    # Change the symbol prefix?
Packit Service c5cf8c
    AC_ARG_WITH([hwloc-symbol-prefix],
Packit Service c5cf8c
                AC_HELP_STRING([--with-hwloc-symbol-prefix=STRING],
Packit Service c5cf8c
                               [STRING can be any valid C symbol name.  It will be prefixed to all public HWLOC symbols.  Default: "hwloc_"]))
Packit Service c5cf8c
Packit Service c5cf8c
    # Debug mode?
Packit Service c5cf8c
    AC_ARG_ENABLE([debug],
Packit Service c5cf8c
                  AC_HELP_STRING([--enable-debug],
Packit Service c5cf8c
                                 [Using --enable-debug enables various hwloc maintainer-level debugging controls.  This option is not recomended for end users.]))
Packit Service c5cf8c
Packit Service c5cf8c
    # Doxygen?
Packit Service c5cf8c
    AC_ARG_ENABLE([doxygen],
Packit Service c5cf8c
        [AC_HELP_STRING([--enable-doxygen],
Packit Service c5cf8c
                        [enable support for building Doxygen documentation (note that this option is ONLY relevant in developer builds; Doxygen documentation is pre-built for tarball builds and this option is therefore ignored)])])
Packit Service c5cf8c
Packit Service c5cf8c
    # Picky?
Packit Service c5cf8c
    AC_ARG_ENABLE(picky,
Packit Service c5cf8c
                  AC_HELP_STRING([--disable-picky],
Packit Service c5cf8c
                                 [When in developer checkouts of hwloc and compiling with gcc, the default is to enable maximum compiler pickyness.  Using --disable-picky or --enable-picky overrides any default setting]))
Packit Service c5cf8c
Packit Service c5cf8c
    # Cairo?
Packit Service c5cf8c
    AC_ARG_ENABLE([cairo],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-cairo],
Packit Service c5cf8c
                                 [Disable the Cairo back-end of hwloc's lstopo command]))
Packit Service c5cf8c
Packit Service c5cf8c
    # CPUID
Packit Service c5cf8c
    AC_ARG_ENABLE([cpuid],
Packit Service c5cf8c
		  AS_HELP_STRING([--disable-cpuid],
Packit Service c5cf8c
				 [Disable the cpuid-based architecture specific support (x86 component)]))
Packit Service c5cf8c
Packit Service c5cf8c
    # XML using libxml2?
Packit Service c5cf8c
    AC_ARG_ENABLE([libxml2],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-libxml2],
Packit Service c5cf8c
		                 [Do not use libxml2 for XML support, use a custom minimalistic support]))
Packit Service c5cf8c
Packit Service c5cf8c
    # I/O?
Packit Service c5cf8c
    AC_ARG_ENABLE([io],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-io],
Packit Service c5cf8c
                                 [Disable I/O discovery entirely (PCI, LinuxIO, CUDA, OpenCL, NVML, GL)]))
Packit Service c5cf8c
Packit Service c5cf8c
    # PCI?
Packit Service c5cf8c
    AC_ARG_ENABLE([pci],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-pci],
Packit Service c5cf8c
                                 [Disable the PCI device discovery]))
Packit Service c5cf8c
Packit Service c5cf8c
    # OpenCL?
Packit Service c5cf8c
    AC_ARG_ENABLE([opencl],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-opencl],
Packit Service c5cf8c
                                 [Disable the OpenCL device discovery]))
Packit Service c5cf8c
Packit Service c5cf8c
    # CUDA?
Packit Service c5cf8c
    AC_ARG_ENABLE([cuda],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-cuda],
Packit Service c5cf8c
                                 [Disable the CUDA device discovery using libcudart]))
Packit Service c5cf8c
Packit Service c5cf8c
    # NVML?
Packit Service c5cf8c
    AC_ARG_ENABLE([nvml],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-nvml],
Packit Service c5cf8c
                                 [Disable the NVML device discovery]))
Packit Service c5cf8c
Packit Service c5cf8c
    # GL/Display
Packit Service c5cf8c
    AC_ARG_ENABLE([gl],
Packit Service c5cf8c
		  AS_HELP_STRING([--disable-gl],
Packit Service c5cf8c
				 [Disable the GL display device discovery]))
Packit Service c5cf8c
Packit Service c5cf8c
    # LibUdev
Packit Service c5cf8c
    AC_ARG_ENABLE([libudev],
Packit Service c5cf8c
                  AS_HELP_STRING([--disable-libudev],
Packit Service c5cf8c
                                 [Disable the Linux libudev]))
Packit Service c5cf8c
Packit Service c5cf8c
    # Plugins
Packit Service c5cf8c
    AC_ARG_ENABLE([plugins],
Packit Service c5cf8c
                  AS_HELP_STRING([--enable-plugins=name,...],
Packit Service c5cf8c
                                 [Build the given components as dynamically-loaded plugins]))
Packit Service c5cf8c
Packit Service c5cf8c
])dnl
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
dnl We only build documentation if this is a developer checkout.
Packit Service c5cf8c
dnl Distribution tarballs just install pre-built docuemntation that was
Packit Service c5cf8c
dnl included in the tarball.
Packit Service c5cf8c
Packit Service c5cf8c
# Probably only ever invoked by hwloc's configure.ac
Packit Service c5cf8c
AC_DEFUN([HWLOC_SETUP_DOCS],[
Packit Service c5cf8c
    cat <
Packit Service c5cf8c
Packit Service c5cf8c
###
Packit Service c5cf8c
### Configuring hwloc documentation
Packit Service c5cf8c
###
Packit Service c5cf8c
EOF
Packit Service c5cf8c
Packit Service c5cf8c
    AC_MSG_CHECKING([if this is a developer build])
Packit Service c5cf8c
    AS_IF([test ! -e "$srcdir/.git"],
Packit Service c5cf8c
          [AC_MSG_RESULT([no (doxygen generation is optional)])
Packit Service c5cf8c
	   test "x$enable_doxygen" = x && enable_doxygen=no],
Packit Service c5cf8c
          [AC_MSG_RESULT([yes])
Packit Service c5cf8c
	   test "x$enable_doxygen" = x && enable_doxygen=yes])
Packit Service c5cf8c
Packit Service c5cf8c
    # Generating the doxygen output requires a few tools.  If we
Packit Service c5cf8c
    # don't have all of them, refuse the build the docs.
Packit Service c5cf8c
    AC_ARG_VAR([DOXYGEN], [Location of the doxygen program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([DOXYGEN], [doxygen])
Packit Service c5cf8c
    HWLOC_DOXYGEN_VERSION=`doxygen --version 2> /dev/null`
Packit Service c5cf8c
Packit Service c5cf8c
    AC_ARG_VAR([PDFLATEX], [Location of the pdflatex program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([PDFLATEX], [pdflatex])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_ARG_VAR([MAKEINDEX], [Location of the makeindex program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([MAKEINDEX], [makeindex])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_ARG_VAR([FIG2DEV], [Location of the fig2dev program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([FIG2DEV], [fig2dev])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_ARG_VAR([GS], [Location of the gs program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([GS], [gs])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_ARG_VAR([EPSTOPDF], [Location of the epstopdf program (required for building the hwloc doxygen documentation)])
Packit Service c5cf8c
    AC_PATH_TOOL([EPSTOPDF], [epstopdf])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_MSG_CHECKING([if can build doxygen docs])
Packit Service c5cf8c
    AS_IF([test "x$DOXYGEN" != "x" -a "x$PDFLATEX" != "x" -a "x$MAKEINDEX" != "x" -a "x$FIG2DEV" != "x" -a "x$GS" != "x" -a "x$EPSTOPDF" != "x"],
Packit Service c5cf8c
                 [hwloc_generate_doxs=yes], [hwloc_generate_doxs=no])
Packit Service c5cf8c
    AC_MSG_RESULT([$hwloc_generate_doxs])
Packit Service c5cf8c
    AS_IF([test "x$hwloc_generate_doxs" = xyes -a "x$HWLOC_DOXYGEN_VERSION" = x1.6.2],
Packit Service c5cf8c
                 [hwloc_generate_doxs="no"; AC_MSG_WARN([doxygen 1.6.2 has broken short name support, disabling])])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_REQUIRE([AC_PROG_SED])
Packit Service c5cf8c
Packit Service c5cf8c
    # Making the top-level README requires w3m or lynx.
Packit Service c5cf8c
    AC_ARG_VAR([W3M], [Location of the w3m program (required to building the top-level hwloc README file)])
Packit Service c5cf8c
    AC_PATH_TOOL([W3M], [w3m])
Packit Service c5cf8c
    AC_ARG_VAR([LYNX], [Location of the lynx program (required to building the top-level hwloc README file)])
Packit Service c5cf8c
    AC_PATH_TOOL([LYNX], [lynx])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_MSG_CHECKING([if can build top-level README])
Packit Service c5cf8c
    AS_IF([test "x$W3M" != "x"],
Packit Service c5cf8c
          [hwloc_generate_readme=yes
Packit Service c5cf8c
           HWLOC_W3_GENERATOR=$W3M],
Packit Service c5cf8c
          [AS_IF([test "x$LYNX" != "x"],
Packit Service c5cf8c
                 [hwloc_generate_readme=yes
Packit Service c5cf8c
                  HWLOC_W3_GENERATOR="$LYNX -dump -nolist"],
Packit Service c5cf8c
                 [hwloc_generate_readme=no])])
Packit Service c5cf8c
    AC_SUBST(HWLOC_W3_GENERATOR)
Packit Service c5cf8c
    AC_MSG_RESULT([$hwloc_generate_readme])
Packit Service c5cf8c
Packit Service c5cf8c
    # If any one of the above tools is missing, we will refuse to make dist.
Packit Service c5cf8c
    AC_MSG_CHECKING([if will build doxygen docs])
Packit Service c5cf8c
    AS_IF([test "x$hwloc_generate_doxs" = "xyes" -a "x$enable_doxygen" != "xno"],
Packit Service c5cf8c
          [], [hwloc_generate_doxs=no])
Packit Service c5cf8c
    AC_MSG_RESULT([$hwloc_generate_doxs])
Packit Service c5cf8c
Packit Service c5cf8c
    # See if we want to install the doxygen docs
Packit Service c5cf8c
    AC_MSG_CHECKING([if will install doxygen docs])
Packit Service c5cf8c
    AS_IF([test "x$hwloc_generate_doxs" = "xyes" -o \
Packit Service c5cf8c
	    -f "$srcdir/doc/doxygen-doc/man/man3/hwloc_distrib.3" -a \
Packit Service c5cf8c
    	    -f "$srcdir/doc/doxygen-doc/hwloc-a4.pdf" -a \
Packit Service c5cf8c
    	    -f "$srcdir/doc/doxygen-doc/hwloc-letter.pdf"],
Packit Service c5cf8c
          [hwloc_install_doxs=yes],
Packit Service c5cf8c
          [hwloc_install_doxs=no])
Packit Service c5cf8c
    AC_MSG_RESULT([$hwloc_install_doxs])
Packit Service c5cf8c
Packit Service c5cf8c
    # For the common developer case, if we're in a developer checkout and
Packit Service c5cf8c
    # using the GNU compilers, turn on maximum warnings unless
Packit Service c5cf8c
    # specifically disabled by the user.
Packit Service c5cf8c
    AC_MSG_CHECKING([whether to enable "picky" compiler mode])
Packit Service c5cf8c
    hwloc_want_picky=0
Packit Service c5cf8c
    AS_IF([test "$hwloc_c_vendor" = "gnu"],
Packit Service c5cf8c
          [AS_IF([test -e "$srcdir/.git"],
Packit Service c5cf8c
                 [hwloc_want_picky=1])])
Packit Service c5cf8c
    if test "$enable_picky" = "yes"; then
Packit Service c5cf8c
        if test "$GCC" = "yes"; then
Packit Service c5cf8c
            AC_MSG_RESULT([yes])
Packit Service c5cf8c
            hwloc_want_picky=1
Packit Service c5cf8c
        else
Packit Service c5cf8c
            AC_MSG_RESULT([no])
Packit Service c5cf8c
            AC_MSG_WARN([Warning: --enable-picky used, but is currently only defined for the GCC compiler set -- automatically disabled])
Packit Service c5cf8c
            hwloc_want_picky=0
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    elif test "$enable_picky" = "no"; then
Packit Service c5cf8c
        AC_MSG_RESULT([no])
Packit Service c5cf8c
        hwloc_want_picky=0
Packit Service c5cf8c
    else
Packit Service c5cf8c
        if test "$hwloc_want_picky" = 1; then
Packit Service c5cf8c
            AC_MSG_RESULT([yes (default)])
Packit Service c5cf8c
        else
Packit Service c5cf8c
            AC_MSG_RESULT([no (default)])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test "$hwloc_want_picky" = 1; then
Packit Service c5cf8c
        add="-Wall -Wunused-parameter -Wundef -Wno-long-long -Wsign-compare"
Packit Service c5cf8c
        add="$add -Wmissing-prototypes -Wstrict-prototypes"
Packit Service c5cf8c
        add="$add -Wcomment -pedantic -Wshadow"
Packit Service c5cf8c
Packit Service c5cf8c
        HWLOC_CFLAGS="$HWLOC_CFLAGS $add"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # Generate some files for the docs
Packit Service c5cf8c
    AC_CONFIG_FILES(
Packit Service c5cf8c
        hwloc_config_prefix[doc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[doc/examples/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[doc/doxygen-config.cfg])
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# Probably only ever invoked by hwloc's configure.ac
Packit Service c5cf8c
AC_DEFUN([HWLOC_SETUP_UTILS],[
Packit Service c5cf8c
    cat <
Packit Service c5cf8c
Packit Service c5cf8c
###
Packit Service c5cf8c
### Configuring hwloc command line utilities
Packit Service c5cf8c
###
Packit Service c5cf8c
EOF
Packit Service c5cf8c
Packit Service c5cf8c
    AC_REQUIRE([AC_PROG_SED])
Packit Service c5cf8c
Packit Service c5cf8c
    # runstatedir only supported in autoconf >= 2.70 and in some backports
Packit Service c5cf8c
    if test "x${runstatedir}" != "x"; then
Packit Service c5cf8c
      HWLOC_runstatedir=${runstatedir}
Packit Service c5cf8c
    else
Packit Service c5cf8c
      HWLOC_runstatedir='${localstatedir}/run'
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    AC_SUBST([HWLOC_runstatedir])
Packit Service c5cf8c
Packit Service c5cf8c
    # Cairo support
Packit Service c5cf8c
    hwloc_cairo_happy=no
Packit Service c5cf8c
    if test "x$enable_cairo" != "xno"; then
Packit Service c5cf8c
      HWLOC_PKG_CHECK_MODULES([CAIRO], [cairo], [cairo_fill], [cairo.h],
Packit Service c5cf8c
                              [hwloc_cairo_happy=yes],
Packit Service c5cf8c
                              [hwloc_cairo_happy=no])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    if test "x$hwloc_cairo_happy" = "xyes"; then
Packit Service c5cf8c
        AC_DEFINE([HWLOC_HAVE_CAIRO], [1], [Define to 1 if you have the `cairo' library.])
Packit Service c5cf8c
    else
Packit Service c5cf8c
        AS_IF([test "$enable_cairo" = "yes"],
Packit Service c5cf8c
              [AC_MSG_WARN([--enable-cairo requested, but Cairo/X11 support was not found])
Packit Service c5cf8c
               AC_MSG_ERROR([Cannot continue])])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_TYPES([wchar_t], [
Packit Service c5cf8c
      AC_CHECK_FUNCS([putwc])
Packit Service c5cf8c
    ], [], [[#include <wchar.h>]])
Packit Service c5cf8c
Packit Service c5cf8c
    HWLOC_XML_LOCALIZED=1
Packit Service c5cf8c
    AC_CHECK_HEADERS([locale.h xlocale.h], [
Packit Service c5cf8c
      AC_CHECK_FUNCS([setlocale])
Packit Service c5cf8c
      AC_CHECK_FUNCS([uselocale], [HWLOC_XML_LOCALIZED=0])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
    AC_SUBST([HWLOC_XML_LOCALIZED])
Packit Service c5cf8c
    AC_CHECK_HEADERS([langinfo.h], [
Packit Service c5cf8c
      AC_CHECK_FUNCS([nl_langinfo])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
    hwloc_old_LIBS="$LIBS"
Packit Service c5cf8c
    chosen_curses=""
Packit Service c5cf8c
    for curses in ncurses curses
Packit Service c5cf8c
    do
Packit Service c5cf8c
      for lib in "" -ltermcap -l${curses}w -l$curses
Packit Service c5cf8c
      do
Packit Service c5cf8c
        AC_MSG_CHECKING(termcap support using $curses and $lib)
Packit Service c5cf8c
        LIBS="$hwloc_old_LIBS $lib"
Packit Service c5cf8c
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Packit Service c5cf8c
#include <$curses.h>
Packit Service c5cf8c
#include <term.h>
Packit Service c5cf8c
]], [[tparm(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0)]])], [
Packit Service c5cf8c
          AC_MSG_RESULT(yes)
Packit Service c5cf8c
          AC_SUBST([HWLOC_TERMCAP_LIBS], ["$LIBS"])
Packit Service c5cf8c
          AC_DEFINE([HWLOC_HAVE_LIBTERMCAP], [1],
Packit Service c5cf8c
                    [Define to 1 if you have a library providing the termcap interface])
Packit Service c5cf8c
          chosen_curses=$curses
Packit Service c5cf8c
        ], [
Packit Service c5cf8c
          AC_MSG_RESULT(no)
Packit Service c5cf8c
        ])
Packit Service c5cf8c
        test "x$chosen_curses" != "x" && break
Packit Service c5cf8c
      done
Packit Service c5cf8c
      test "x$chosen_curses" != "x" && break
Packit Service c5cf8c
    done
Packit Service c5cf8c
    if test "$chosen_curses" = ncurses
Packit Service c5cf8c
    then
Packit Service c5cf8c
      AC_DEFINE([HWLOC_USE_NCURSES], [1], [Define to 1 if ncurses works, preferred over curses])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    LIBS="$hwloc_old_LIBS"
Packit Service c5cf8c
    unset hwloc_old_LIBS
Packit Service c5cf8c
Packit Service c5cf8c
    _HWLOC_CHECK_DIFF_U
Packit Service c5cf8c
    _HWLOC_CHECK_DIFF_W
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_HEADERS([time.h], [
Packit Service c5cf8c
      AC_CHECK_FUNCS([clock_gettime])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
Packit Service c5cf8c
    # Only generate this if we're building the utilities
Packit Service c5cf8c
    # Even the netloc library Makefile is here because
Packit Service c5cf8c
    # we don't embed libnetloc yet, it's useless without tools
Packit Service c5cf8c
    AC_CONFIG_FILES(
Packit Service c5cf8c
        hwloc_config_prefix[utils/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/lstopo/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[hwloc.pc]
Packit Service c5cf8c
Packit Service c5cf8c
        hwloc_config_prefix[netloc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/netloc/infiniband/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/netloc/draw/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/netloc/scotch/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/netloc/mpi/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[netloc.pc]
Packit Service c5cf8c
        hwloc_config_prefix[netlocscotch.pc]
Packit Service c5cf8c
   )
Packit Service c5cf8c
])dnl
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# Probably only ever invoked by hwloc's configure.ac
Packit Service c5cf8c
AC_DEFUN([HWLOC_SETUP_TESTS],[
Packit Service c5cf8c
    cat <
Packit Service c5cf8c
Packit Service c5cf8c
###
Packit Service c5cf8c
### Configuring tests
Packit Service c5cf8c
###
Packit Service c5cf8c
EOF
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
Packit Service c5cf8c
Packit Service c5cf8c
    # linux-libnuma.h testing requires libnuma with numa_bitmask_alloc()
Packit Service c5cf8c
    AC_CHECK_LIB([numa], [numa_available], [
Packit Service c5cf8c
      AC_CHECK_DECL([numa_bitmask_alloc], [hwloc_have_linux_libnuma=yes], [],
Packit Service c5cf8c
    	      [#include <numa.h>])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_HEADERS([stdlib.h], [
Packit Service c5cf8c
      AC_CHECK_FUNCS([mkstemp])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_HEADERS([infiniband/verbs.h], [
Packit Service c5cf8c
      AC_CHECK_LIB([ibverbs], [ibv_open_device],
Packit Service c5cf8c
                   [AC_DEFINE([HAVE_LIBIBVERBS], 1, [Define to 1 if we have -libverbs])
Packit Service c5cf8c
                    hwloc_have_libibverbs=yes])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_PROGS(XMLLINT, [xmllint])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CHECK_PROGS(BUNZIPP, bunzip2, false)
Packit Service c5cf8c
Packit Service c5cf8c
    AC_MSG_CHECKING(if CXX works)
Packit Service c5cf8c
    AC_LANG_PUSH([C++])
Packit Service c5cf8c
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Packit Service c5cf8c
#include <iostream>
Packit Service c5cf8c
using namespace std;
Packit Service c5cf8c
int foo(void) {
Packit Service c5cf8c
  cout << "test" << endl;
Packit Service c5cf8c
  return 0;
Packit Service c5cf8c
}
Packit Service c5cf8c
	]])], [hwloc_have_cxx=yes], [hwloc_have_cxx=no])
Packit Service c5cf8c
    AC_LANG_POP([C++])
Packit Service c5cf8c
    AC_MSG_RESULT([$hwloc_have_cxx])
Packit Service c5cf8c
Packit Service c5cf8c
    _HWLOC_CHECK_DIFF_U
Packit Service c5cf8c
Packit Service c5cf8c
    # Only generate these files if we're making the tests
Packit Service c5cf8c
    AC_CONFIG_FILES(
Packit Service c5cf8c
        hwloc_config_prefix[tests/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/allowed/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/gather/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/x86/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/xml/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/ports/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/rename/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/allowed/test-topology.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/gather/test-gather-topology.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/linux/test-topology.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/x86/test-topology.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/xml/test-topology.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/hwloc/wrapper.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/hwloc-compress-dir]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/hwloc-gather-topology]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-annotate.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-calc.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-compress-dir.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-diffpatch.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-distrib.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-info.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-fake-plugin.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-dump-hwdata/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[utils/hwloc/test-hwloc-dump-hwdata/test-hwloc-dump-hwdata.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/lstopo/test-lstopo.sh]
Packit Service c5cf8c
        hwloc_config_prefix[utils/netloc/infiniband/netloc_ib_gather_raw]
Packit Service c5cf8c
        hwloc_config_prefix[contrib/systemd/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[contrib/misc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[contrib/windows/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[contrib/windows/test-windows-version.sh]
Packit Service c5cf8c
        hwloc_config_prefix[tests/netloc/Makefile]
Packit Service c5cf8c
        hwloc_config_prefix[tests/netloc/tests.sh]
Packit Service c5cf8c
    )
Packit Service c5cf8c
Packit Service c5cf8c
    AC_CONFIG_COMMANDS([chmoding-scripts], [
Packit Service c5cf8c
chmod +x ]hwloc_config_prefix[tests/hwloc/linux/test-topology.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/hwloc/x86/test-topology.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/hwloc/xml/test-topology.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/hwloc/linux/allowed/test-topology.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/hwloc/linux/gather/test-gather-topology.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/hwloc/wrapper.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/hwloc-compress-dir \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/hwloc-gather-topology \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-annotate.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-calc.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-compress-dir.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-diffpatch.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-distrib.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-info.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-fake-plugin.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/hwloc/test-hwloc-dump-hwdata/test-hwloc-dump-hwdata.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/lstopo/test-lstopo.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[utils/netloc/infiniband/netloc_ib_gather_raw \
Packit Service c5cf8c
      ]hwloc_config_prefix[contrib/windows/test-windows-version.sh \
Packit Service c5cf8c
      ]hwloc_config_prefix[tests/netloc/tests.sh])
Packit Service c5cf8c
Packit Service c5cf8c
    # These links are only needed in standalone mode.  It would
Packit Service c5cf8c
    # be nice to m4 foreach this somehow, but whenever I tried
Packit Service c5cf8c
    # it, I got obscure "invalid tag" errors from
Packit Service c5cf8c
    # AC_CONFIG_LINKS.  :-\ Since these tests are only run when
Packit Service c5cf8c
    # built in standalone mode, only generate them in
Packit Service c5cf8c
    # standalone mode.
Packit Service c5cf8c
    AC_CONFIG_LINKS(
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-solaris.c]:hwloc_config_prefix[hwloc/topology-solaris.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-solaris-chiptype.c]:hwloc_config_prefix[hwloc/topology-solaris-chiptype.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-aix.c]:hwloc_config_prefix[hwloc/topology-aix.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-windows.c]:hwloc_config_prefix[hwloc/topology-windows.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-darwin.c]:hwloc_config_prefix[hwloc/topology-darwin.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-freebsd.c]:hwloc_config_prefix[hwloc/topology-freebsd.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-netbsd.c]:hwloc_config_prefix[hwloc/topology-netbsd.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-hpux.c]:hwloc_config_prefix[hwloc/topology-hpux.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-bgq.c]:hwloc_config_prefix[hwloc/topology-bgq.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-opencl.c]:hwloc_config_prefix[hwloc/topology-opencl.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-cuda.c]:hwloc_config_prefix[hwloc/topology-cuda.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-nvml.c]:hwloc_config_prefix[hwloc/topology-nvml.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/topology-gl.c]:hwloc_config_prefix[hwloc/topology-gl.c]
Packit Service c5cf8c
	hwloc_config_prefix[tests/hwloc/ports/lstopo-windows.c]:hwloc_config_prefix[utils/lstopo/lstopo-windows.c])
Packit Service c5cf8c
    ])
Packit Service c5cf8c
])dnl
Packit Service c5cf8c
Packit Service c5cf8c
#-----------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
AC_DEFUN([_HWLOC_PROG_DIFF], [
Packit Service c5cf8c
  AC_ARG_VAR(DIFF, [diff tool])
Packit Service c5cf8c
  AC_PATH_PROG([DIFF], [diff])
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
AC_DEFUN([_HWLOC_CHECK_DIFF_U], [
Packit Service c5cf8c
  AC_REQUIRE([_HWLOC_PROG_DIFF])
Packit Service c5cf8c
  AC_MSG_CHECKING([whether diff accepts -u])
Packit Service c5cf8c
  if $DIFF -u /dev/null /dev/null 2> /dev/null
Packit Service c5cf8c
  then
Packit Service c5cf8c
    AC_MSG_RESULT([yes])
Packit Service c5cf8c
    HWLOC_DIFF_U="-u"
Packit Service c5cf8c
  else
Packit Service c5cf8c
    AC_MSG_RESULT([no])
Packit Service c5cf8c
    HWLOC_DIFF_U=""
Packit Service c5cf8c
  fi
Packit Service c5cf8c
  AC_SUBST([HWLOC_DIFF_U])
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
AC_DEFUN([_HWLOC_CHECK_DIFF_W], [
Packit Service c5cf8c
  AC_REQUIRE([_HWLOC_PROG_DIFF])
Packit Service c5cf8c
  AC_MSG_CHECKING([whether diff accepts -w])
Packit Service c5cf8c
  if $DIFF -w /dev/null /dev/null 2> /dev/null
Packit Service c5cf8c
  then
Packit Service c5cf8c
    AC_MSG_RESULT([yes])
Packit Service c5cf8c
    HWLOC_DIFF_W="-w"
Packit Service c5cf8c
  else
Packit Service c5cf8c
    AC_MSG_RESULT([no])
Packit Service c5cf8c
    HWLOC_DIFF_W=""
Packit Service c5cf8c
  fi
Packit Service c5cf8c
  AC_SUBST([HWLOC_DIFF_W])
Packit Service c5cf8c
])