Skip to content
Snippets Groups Projects
Select Git revision
  • cecac0b83fa990770bccbc2ef87f1f3a5e8290a2
  • devel default
  • 107-compilation-error-when-building-maestro-core-on-m1-apple-processors
  • 108-implement-cpu-id-query-for-apple-m1-hardware
  • 58-scripting-interface-to-maestro-core
  • 101-need-ci-test-using-installed-maestro
  • 57-sphinx-documentation
  • 105-memory-leak-in-pm-message-envelope-handling
  • 104-permit-disabling-memory-pool
  • 103-liberl-installation-issue-on-devel
  • 94-maestro-rdma-transport-ignores-max_msg_size-2
  • main protected
  • 102-possible-race-in-check_pm_redundant_interlock-test
  • 97-check-if-shm-provider-can-be-enabled-after-libfabric-1-14-is-in-our-tree-2
  • 100-include-maestro-attributes-h-cannot-include-mamba-header-from-deps-path
  • 97-check-if-shm-provider-can-be-enabled-after-libfabric-1-14-is-in-our-tree
  • 17-job-failed-282354-needs-update-of-mio-interface-and-build-rules
  • 96-test-libfabric-update-to-1-13-or-1-14
  • feature/stop-telemetry-after-all-left
  • 94-maestro-rdma-transport-ignores-max_msg_size
  • 93-improve-performance-of-mstro_attribute_val_cmp_str
  • v0.3_rc1
  • maestro_d65
  • d65_experiments_20211113
  • v0.2
  • v0.2_rc1
  • d3.3
  • d3.3-review
  • d5.5
  • d5.5-review
  • v0.1
  • d3.2
  • d3.2-draft
  • v0.0
34 results

configure.ac

Blame
  • configure.ac 25.05 KiB
    # Copyright (C) 2018-19 Cray Computer GmbH
    # Copyright (C) 2020 HPE, HP Schweiz GmbH
    #
    # Redistribution and use in source and binary forms, with or without
    # modification, are permitted provided that the following conditions are
    # met:
    #
    # 1. Redistributions of source code must retain the above copyright
    #    notice, this list of conditions and the following disclaimer.
    #
    # 2. Redistributions in binary form must reproduce the above copyright
    #    notice, this list of conditions and the following disclaimer in the
    #    documentation and/or other materials provided with the distribution.
    #
    # 3. Neither the name of the copyright holder nor the names of its
    #    contributors may be used to endorse or promote products derived from
    #    this software without specific prior written permission.
    #
    # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    #
    
    AC_INIT([maestro],[m4_esyscmd(build-aux/git-version-gen .tarball-version)],[emearesearchlab@hpe.com])
    
    AC_CONFIG_MACRO_DIR([m4])
    AC_CONFIG_AUX_DIR([build-aux])
    
    dnl for hwloc later we need:
    AC_CANONICAL_TARGET
    AC_USE_SYSTEM_EXTENSIONS
    
    dnl If your default tar version does not support big UID not big GID, please
    dnl uncomment the following line  and comment out the line after it in order to be
    dnl able to run the 'make dist' command.
    # AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])
    AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-ustar])
    
    dnl If the tar fails to be good enough (stock macOS tar which does not do ustar nicely) we try again:
    AS_IF([test "x$am__tar" = "xfalse"],[
     AC_MSG_NOTICE([Your tar command is insufficient to run `make dist', trying `pax'])
     _AM_PROG_TAR([pax])
    ])
    
    
    
    dnl silent automake requires version 1.11
    m4_ifdef([AM_SILENT_RULES],
    	 [AM_SILENT_RULES([yes])])
    
    AC_ARG_ENABLE([developer],
                  [AS_HELP_STRING([--enable-developer],
    	                      [Enable developer build (more logging, address santizer, ... (default: no))])],
    	      [enable_devel=$enabkeval],
    	      [enable_devel=no])
    AS_IF([test "x$enable_devel" != "xno"],
    	    [ dnl enable ASAN for developers
                  enable_asan=yes
                  dnl include NOISE level debugging ability, but default to DEBUG
    	      CPPFLAGS="-DMSTRO_DEFAULT_LOG_LEVEL=3 -DMSTRO_MAX_DEBUG_LEVEL=4 $CPPFLAGS"
    
                ],
                [ dnl set logging to ERR, and limit logging to DEBUG
    	      CPPFLAGS="-DMSTRO_DEFAULT_LOG_LEVEL=0 -DMSTRO_MAX_DEBUG_LEVEL=3 $CPPFLAGS"
                ])
    
    dnl ... make the number of max cq poll entries configurable
    AC_ARG_WITH([maxcq], [AS_HELP_STRING([--with-maxcq], [...])])
    AS_IF([test "x$with_maxcq" != "x"],
        [AC_DEFINE_UNQUOTED([MAX_ENTRIES_PER_POLL], [$with_maxcq],[...])]
    )
    
    AC_ARG_ENABLE([numa],
                  [AS_HELP_STRING([--enable-numa],[Enable libnuma usage (default: use if detected)])],
    	      [enable_numa=$enableval],[enable_numa=yes])
    AS_IF([test "x$enable_numa" = xyes],
          [AC_CHECK_HEADERS([numa.h numaif.h],
    			[AC_CHECK_LIB([numa],[numa_available],
    				      AC_DEFINE([HAVE_NUMA])
    				      LIBS="-lnuma $LIBS")
    				      have_numa=yes],
    			[have_numa=no])])
    AM_CONDITIONAL([NUMA_ENABLED], [test "x$have_numa" = "xyes"])
    AC_SUBST([NUMA_ENABLED], [$have_numa])
    
    AC_CONFIG_SRCDIR([maestro/version.c])
    AX_CHECK_ENABLE_DEBUG()
    
    AC_PROG_EGREP
    
    dnl ... and check for C11 flags needed
    AC_PROG_CC
    AM_PROG_CC_C_O
    AM_PROG_AR
    
    AC_PROG_RANLIB
    
    dnl give up if stdatomic.h is not there
    AC_CACHE_CHECK([whether compiler provides stdatomic.h], ac_cv_has_stdatomic,
      [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdatomic.h>]])],
    		     ac_cv_has_stdatomic=yes, 
    		AC_MSG_FAILURE([cannot find stdatomic.h]))])
    
    AC_SEARCH_LIBS([floor], [m])
    
    dnl things suggested by autoscan
    dnl clock_gettime is subtle. Old glibc for instance needs -lrt, others need posix4
    AC_SEARCH_LIBS([clock_gettime],[rt posix4])
    
    AC_CHECK_FUNCS([atexit bzero dup2 ftruncate gethostname getpagesize memmove memset mkdir munmap putenv regcomp select strcasecmp strchr strdup strerror strncasecmp strspn strtol strtoul strtoull strtoumax gettimeofday setenv strstr],[],
    		[AC_MSG_ERROR([Missing essential system library function])])
    AC_CHECK_HEADERS([fcntl.h float.h limits.h netdb.h netinet/in.h stddef.h sys/param.h sys/socket.h sys/time.h],[],
    		[AC_MSG_ERROR([Missing essential system header function])])
    AC_CHECK_HEADERS([arpa/inet.h],[],[AC_MSG_ERROR([Missing arpa/inet.h header -- FIXME: work around this in protocol serialization])])
    AC_CHECK_HEADER_STDBOOL
    AC_CHECK_TYPES([ptrdiff_t])
    AC_C_INLINE
    AC_C_RESTRICT
    AC_FUNC_ALLOCA
    AC_FUNC_FORK
    AC_FUNC_MALLOC
    AC_FUNC_MMAP
    AC_FUNC_REALLOC
    AC_FUNC_STRNLEN
    AC_FUNC_STRTOD
    AC_TYPE_INT8_T
    AC_TYPE_INT16_T
    AC_TYPE_INT32_T
    AC_TYPE_INT64_T
    AC_TYPE_PID_T
    AC_TYPE_SSIZE_T
    AC_TYPE_UID_T
    AC_TYPE_UINT8_T
    AC_TYPE_UINT16_T
    AC_TYPE_UINT32_T
    AC_TYPE_UINT64_T
    AC_FUNC_ERROR_AT_LINE
    dnl end of autoscan suggestions
    
    AC_COMPILE_IFELSE(
     dnl inspired by the code in attributes/maestro-schema.c: check that global constants can be used to initialized other global constants
     [AC_LANG_PROGRAM([[
    	const unsigned int len = 1859;
    	const struct { unsigned int schema_size; }
    	 builtin_schema_texts[1] =
    	 { [0] = { .schema_size = len}};]],
     [;])],
     [AC_MSG_NOTICE([C compiler understands C11 well])],
     [AC_MSG_ERROR([C compiler does not handle constant initializers to structures, not fully C11 compatible])])
    
    dnl check for code-coverage option. This needs to stay at the start of checks
    AC_ARG_ENABLE([code-coverage],
    	  AS_HELP_STRING([--enable-code-coverage],
    	  [Whether to enable code coverage support]),,
    	  [enable_code_coverage=no])
    AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test "x$enable_code_coverage" = xyes])
    	AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
    	AC_MSG_RESULT($enable_code_coverage)
    
    if test "x$enable_code_coverage" = "xyes"; then
            BUILD_COV=yes
            AX_CHECK_COMPILE_FLAG([-g --coverage],
           		[CPPFLAGS="-DNDEBUG"
                     CFLAGS="-O0 -g --coverage"
                     LIBS="-g --coverage -static "],
    		AC_MSG_ERROR([compiler does not support -ftest-coverage]))
    	AC_CHECK_TOOL([GCOV], [gcov], [gcov])
    	AS_IF([test "X$GCOV" = "X:"],
    	      [AC_MSG_ERROR([gcov is needed to do coverage])])
    
    	AC_CHECK_PROG([LCOV], [lcov], [lcov])
    	AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
    	AS_IF([ test x"$LCOV" = x ], [
    		AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
    	      ])
    	AS_IF([ test x"$GENHTML" = x ], [
    		AC_MSG_ERROR([Could not find genhtml from the lcov package])
    	])
    else
            BUILD_COV=no
    fi
    
    AC_ARG_ENABLE([asan],
                  AS_HELP_STRING([--enable-asan],
    			     [Enable Address Sanitizer support]))
    if test "x$enable_asan" = "xyes"; then
            BUILD_ASAN=yes
            AX_CHECK_COMPILE_FLAG([-fsanitize=address -fno-omit-frame-pointer -Wpedantic -Wextra ],
           		[CFLAGS="${CFLAGS} -O1 -g -fsanitize=address -fno-omit-frame-pointer -Wpedantic -Wextra "
                     LDFLAGS="${LDFLAGS} -fsanitize=address"],
    		AC_MSG_ERROR([compiler does not support -fsanitize=address flag]))
    else
            BUILD_ASAN=no
    fi
    
    AC_ARG_ENABLE([tsan],
                  AS_HELP_STRING([--enable-tsan],[Enable Thread Sanitizer support]))
    if test "x$enable_tsan" = "xyes"; then
            BUILD_TSAN=yes
            AX_CHECK_COMPILE_FLAG([-fsanitize=thread -fno-omit-frame-pointer],
           		[CFLAGS="${CFLAGS} -O1 -g -fsanitize=thread -fno-omit-frame-pointer"
    				LDFLAGS="${LDFLAGS} -fsanitize=thread"],
    		AC_MSG_ERROR([compiler does not support -fsanitize=thread flag]))
    else
            BUILD_TSAN=no
    fi
    
    
    dnl xxx dnl ensure we have protobuf-c -- needs protobuf to build
    dnl xxx dnl FIXME: this likely has issues on cross-compiles
    dnl xxx
    dnl xxx AC_MSG_NOTICE([Configuring private protobuf and protobuf-c builds])
    dnl xxx AS_IF([test ! -f $srcdir/deps/protobuf/configure],
    dnl xxx       [(cd $srcdir/deps/protobuf; ./autogen.sh)])
    dnl xxx
    dnl xxx AX_SUBDIRS_CONFIGURE([deps/protobuf],
    dnl xxx 		[], [], [], [],
    dnl xxx                 [$ac_abs_top_builddir/deps/protobuf/dst])
    dnl xxx
    dnl xxx AS_IF([test ! -f $srcdir/deps/protobuf-c/configure],
    dnl xxx       [(cd $srcdir/deps/protobuf-c; ./autogen.sh)])
    dnl xxx dnl FIXME: on CRAY need to extend LDFLAGS by "-fuse-ld=bfd" or "-fuse-ld=$(which ld.bfd)"
    dnl xxx
    dnl xxx AC_MSG_WARN([On CRAY we are missing LDFLAGS setting "-fuse-ld=bfd" or "-fuse-ld=$(which ld.bfd)"])
    dnl xxx dnl This is a bit tricky. since protoc is not built/installed yet we need to
    dnl xxx provide all things that configure would like to find
    dnl xxx AX_SUBDIRS_CONFIGURE([deps/protobuf-c],
    dnl xxx 		[[protobuf_CFLAGS="-I$ac_top_srcdir/deps/protobuf/src"],
    dnl xxx 		 [protobuf_LIBS=["-L$ac_top_builddir/deps/protobuf/dst/lib -lprotobuf"]],
    dnl xxx 		 [PROTOC="$ac_abs_top_builddir/deps/protobuf/dst/bin/protoc"]],
    dnl xxx 		[],[],[],
    dnl xxx 		[$ac_abs_top_builddir/deps/protobuf/dst])
    dnl xxx
    dnl xxx
    dnl xxx AC_SUBST([PROTOC_C],[$ac_top_builddir/deps/protobuf/bin/protoc-c])
    dnl xxx
    dnl xxx prefix="$saved_prefix"
    
    PKG_PROG_PKG_CONFIG
    AC_ARG_VAR([PROTOC_C], [protobuf-c compiler command])
    dnl protoc-c will be installed into the source tree if the user builds it
    dnl using the deps/build_protobuf_c.sh script, so abs_confdir is ok
    PKG_CONFIG_PATH="$ac_abs_confdir/deps/util/lib/pkgconfig:$PKG_CONFIG_PATH"
    export PKG_CONFIG_PATH
    AC_PATH_PROG([PROTOC_C], [protoc-c], [],
    	[`$PKG_CONFIG --variable=exec_prefix protobuf`/bin:$PATH])
    if test -z "$PROTOC_C"; then
        AC_MSG_WARN([protobuf-c compiler not found. Consider building it (in deps)])
    fi
    
    dnl AC_SUBST([PROTOC_C],[$ac_top_builddir/deps/util/bin/protoc-c])
    
    dnl pthread checks on Cray CC need this to have _REENTRANT defined
    CPPFLAGS+=" -D_REENTRANT"
    AX_PTHREAD([
    LIBS="$PTHREAD_LIBS $LIBS"
    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    CC="$PTHREAD_CC"
    ],[AC_MSG_FAILURE([Need pthread library])])
    
    dnl check for pthread_np (to get some of the nonportable functions if possible)
    AC_CHECK_HEADERS([pthread_np.h],,,
        [#include <pthread_np.h>
        ])
    
    dnl check for thread-id
    AC_MSG_CHECKING([for pthread_threadid_np])
    AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
            [
    	 [#include <pthread.h>
    	  #ifdef HAVE_PTHREAD_NP_H
    	  #include <pthread_np.h>
    	  #endif
    	  #include <stdint.h>
    	 ]
    	],
            [[int (*fptr)(pthread_t, uint64_t*);]
             [fptr = pthread_threadid_np;]])
        ],[
            AC_MSG_RESULT([yes])
            AC_DEFINE(HAVE_PTHREAD_THREADID_NP, [], [Does pthread have pthread_threadid_np with expected prototype?])
        ],[
            AC_MSG_RESULT([no])
        ])
    
    AC_CHECK_HEADERS([syslog.h],
     [AC_CHECK_FUNCS([syslog])
         if test $ac_cv_func_syslog = no; then
           # syslog is not in the default libraries.  See if it's in some other.
           for lib in bsd socket inet; do
             AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG])
               LIBS="-l$lib $LIBS"; break])
           done
         fi])
    
    LT_INIT
    
    link_all_deplibs=yes
    link_all_deplibs_CXX=yes
    dnl If you like TAGS and tags regenerated on every run use this
    AC_ARG_ENABLE([frequent-tag-generation],
    	[AS_HELP_STRING([--enable-frequent-tag-generation],
    			[enable TAGS and tags regeneration with every make run @<:@default=disabled@:>@])],
    	[enable_frequent_tag_generation=yes],
    	[enable_frequent_tag_generation=no])
    AM_CONDITIONAL([WITH_FREQUENT_TAGS], [test x$enable_frequent_tag_generation != xno])
    
    dnl Check if doxygen is available
    AC_CHECK_PROGS([DOXYGEN], [doxygen], [no])
    AS_IF([ test "x$DOXYGEN" = x ],
        [AC_MSG_WARN([Doxygen not found - continue without Doxygen support])],
        [AM_CONDITIONAL([HAVE_DOXYGEN], [ test "x$DOXYGEN" != xno ])
        dnl If you like to see verbose doxygen traces use this
        AC_ARG_ENABLE([verbose-doxygen],
        	[AS_HELP_STRING([--enable-verbose-doxygen],
        			[enable verbose doxygen output @<:@default=disabled@:>@])],
        	[enable_verbose_doxygen=yes],
        	[enable_verbose_doxygen=no])
        AM_CONDITIONAL([WITH_VERBOSE_DOXYGEN], [ test x$enable_verbose_doxygen != xno ])
        dnl propagate the doxygen verbose level to distribution
        AS_IF([ test x$enable_verbose_doxygen = xyes ],
              [AC_SUBST([MSTRO_CONF_DOXY_VERBOSE], [--enable-verbose-doxygen])])
        AC_CHECK_PROGS([DOT], [dot], [no])
        AS_IF([ test "x$DOT" = xno ],
              [AC_MSG_WARN([Doxygen needs dot to generate graphs. Your documentation may be incomplete.])
              AC_SUBST([HAVE_DOT], [NO])],
              [AC_SUBST([HAVE_DOT], [YES])])
        AC_CHECK_PROGS([PDFLATEX], [pdflatex], [no])
        AS_IF([ test "x$PDFLATEX" = xno ],
              [AC_MSG_WARN([Doxygen needs pdflatex program for a better build, it is part of TeX http://www.tug.org/texlive/acquire-netinstall.html])
              AC_SUBST([HAVE_PDFLATEX], [NO])],
              [AC_SUBST([HAVE_PDFLATEX], [YES])])
    ])
    
    dnl Check if Sphinx is available
    AC_CHECK_PROGS([SPHINX], [sphinx-build], [no])
    AS_IF([ test "x$SPHINX" == x ],
        [AC_MSG_WARN([Sphinx not found - continue without Sphinx support])],
        AM_CONDITIONAL([HAVE_SPHINX], [ test "x$SPHINX" != xno ])
        )
    
    dnl Check if Breathe is available
    AC_CHECK_PROGS([BREATHE], [breathe-apidoc], [no])
    AS_IF([ test "x$BREATHE" == x ],
        [AC_MSG_WARN([Breathe not found - continue without Breathe support])],
        AM_CONDITIONAL([HAVE_BREATHE], [ test "x$BREATHE" != xno ])
        )
    
    
    dnl libyaml for configuration purposes
    dnl AC_CHECK_HEADER([yaml.h],[],AC_MSG_ERROR([yaml.h header not found]))
    dnl AC_CHECK_LIB([yaml],[yaml_document_initialize],[],[AC_MSG_ERROR([libyaml not found])])
    
    dnl *****************************************************************************
    dnl Checks and defines needed to make the libyaml build we do in deps happy
    m4_define([YAML_MAJOR], 0)
    m4_define([YAML_MINOR], 2)
    m4_define([YAML_PATCH], 2)
    m4_define([YAML_BUGS], [https://github.com/yaml/libyaml/issues/new])
    
    # Define the libtool version numbers; check the Autobook, Section 11.4.
    # Bump the libtool version numbers using the following algorithm:
    #   if (the current interface has not been changed):
    #       YAML_REVISION += 1
    #   else:
    #       YAML_REVISION = 0
    #       YAML_CURRENT += 1
    #       if (this release is backward compatible with the previous release):
    #           YAML_AGE += 1
    #       else:
    #           YAML_AGE = 0
    m4_define([YAML_RELEASE], 0)
    m4_define([YAML_CURRENT], 2)
    m4_define([YAML_REVISION], 6)
    m4_define([YAML_AGE], 0)
    
    AC_DEFINE(YAML_VERSION_MAJOR, YAML_MAJOR, [Define the major version number.])
    AC_DEFINE(YAML_VERSION_MINOR, YAML_MINOR, [Define the minor version number.])
    AC_DEFINE(YAML_VERSION_PATCH, YAML_PATCH, [Define the patch version number.])
    AC_DEFINE(YAML_VERSION_STRING, "YAML_MAJOR.YAML_MINOR.YAML_PATCH", [Define the version string.])
    
    # Define substitutions for the libtool version numbers.
    YAML_LT_RELEASE=YAML_RELEASE
    YAML_LT_CURRENT=YAML_CURRENT
    YAML_LT_REVISION=YAML_REVISION
    YAML_LT_AGE=YAML_AGE
    AC_SUBST(YAML_LT_RELEASE)
    AC_SUBST(YAML_LT_CURRENT)
    AC_SUBST(YAML_LT_REVISION)
    AC_SUBST(YAML_LT_AGE)
    
    
    # Checks for header files.
    AC_CHECK_HEADERS([stdlib.h])
    # Checks for typedefs, structures, and compiler characteristics.
    AC_C_CONST
    AC_TYPE_SIZE_T
    
    AC_ARG_ENABLE([mempool],
     AS_HELP_STRING([--enable-mempool], [Enable memory pool implementation @<:@default=enabled@:>@]),
     [if   test "x$enableval" = "xyes" ; then
         use_mempool=yes
       elif test "x$enableval" = "xno" ; then
         use_mempool=no
         AC_DEFINE(DISABLE_MEMPOOL,[1],[Disable mempool (for debugging, mostly)])
       else
         AC_MSG_ERROR([--enable-mempool must be used with 'yes' or 'no' argument])
       fi],
     [use_mempool=yes])
    
    
    dnl end of libyaml-introduced checks
    dnl *****************************************************************************
    
    dnl Check for pool manager style
    dnl We will support (at some point) OFI, MPI, and SMP
    
    dnl An SMP pool manager is built if neither OFI or MPI are enabled
    AC_ARG_ENABLE([ofi-pool-manager],
     AS_HELP_STRING([--enable-ofi-pool-manager], [Enable OpenFabric based pool manager @<:@default=enabled@:>@]]),[],[enable_ofi_pool_manager=yes])
    AC_ARG_ENABLE([mpi-pool-manager],
     AS_HELP_STRING([--enable-mpi-pool-manager], [Enable MPI based pool manager @<:@default=disabled@:>@]]))
    
    dnl OFI pool manager?
    AS_IF([test "x$enable_ofi_pool_manager" = "xyes"], [
      AS_IF([test "x$enable_mpi_pool_manager" = "xyes"], [
        AC_MSG_ERROR([Both OFI and MPI pool manager, can only include one])])
      AC_MSG_NOTICE([Building with OFI pool manager])
    
      dnl Do fabric check
      dnl Allow an alternate libfabric installation to be easily specified via the
      dnl 'ax_use_library' macro from this package. This will add the library and
      dnl include paths to LDFLAGS and CPPFLAGS via the 'ax_append_flag' macro from
      dnl the 'Autoconf Archive'. Additionally, an alternative library name for
      dnl libfabric can also be specified. Subsequent configure tests should use
      dnl the variable '$fabric_library_name', instead of directly using the static
      dnl name 'fabric', to honor this configure option result.
    
      dnl in case we build out own libfabric in the end:
      SAVED_CPPFLAGS="$CPPFLAGS"
      SAVED_LDFLAGS="$LDFLAGS"
      SAVED_LIBS="$LIBS"
    
      dnl If libfabric is installed in a nonstandard place but can be found by pkg-config, add whatever that tells us before trying to find it
      dnl (notable example: Cray Shasta systems)
      if pkg-config libfabric; then
         AC_MSG_NOTICE([found libfabric via pkg-config])
         CPPFLAGS="`pkg-config --cflags      libfabric` $CFLAGS"
         LDFLAGS=" `pkg-config --libs-only-L libfabric` $LDFLAGS"
         LIBS="    `pkg-config --libs-only-l libfabric` $LIBS"
      else
         AC_MSG_NOTICE([pkg-config does not know about a libfabric installation, fine])
      fi
    
      AX_USE_LIBRARY([fabric])
    
      dnl Sanity check for libfabric library
      AC_SEARCH_LIBS(fi_getinfo, $fabric_library_name,
        [
        dnl check version of libfabric
        AC_PREPROC_IFELSE(
    	    [AC_LANG_PROGRAM(
    		    [[#include <rdma/fabric.h>
    #if !(FI_VERSION_GE(FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION), FI_VERSION(1,14)))
    #error libfabric 1.14 or better required
    #endif]],
    		    [[return 0;]])],
    	    [AC_MSG_NOTICE([libfabric is recent enough, great])],
    	    [AC_MSG_WARN([libfabric is not recent enough, we require version 1.14 or better; will build our own])
    	    build_private_ofi=yes])],
        [AC_MSG_WARN([building our own libfabric])
         build_private_ofi=yes])
    
      AS_IF([test "x$build_private_ofi" = xyes],
      [
       # reset flags to what they were before trying system libfabric; the respective Makefile.am
       # will add explicit reference to our self-built one in libtool archive form
       CPPFLAGS="$SAVED_CPPFLAGS"
       LDFLAGS="$SAVED_LDFLAGS"
       LIBS="$SAVED_LIBS"
       AC_MSG_NOTICE([================== Pre-configuring private libfabric library build])
       # check whether we're in a dist tree or in a git repo
       AS_IF([test ! -f $srcdir/deps/libfabric/configure],
             [(cd $srcdir/deps/libfabric; ./autogen.sh)])
       #AX_SUBDIRS_CONFIGURE([deps/libfabric],[[--enable-embedded],[--disable-rxm],[--disable-rxd],[--disable-psm]],[],[],[])
       dnl Configuring without kdreg to fix issue https://gitlab.com/cerl/maestro/maestro-core/-/issues/117 which relates to https://github.com/ofiwg/libfabric/issues/5313
       dnl Whether doing so creates a performance problem or not is still to be determined
       AX_SUBDIRS_CONFIGURE([deps/libfabric],[[--enable-embedded],[--disable-rxd],[--disable-tcp],[--with-kdreg=no],[--enable-debug]],[],[],[])
       AC_MSG_NOTICE([================== done preconfiguring private libfabric library build])
       AC_DEFINE([LOCAL_LIBFABRIC],[1],[Define if using our own libfabric build])
      ])
    
    
      dnl struct sockaddr_ib needs a header
      AC_CHECK_HEADER([infiniband/ib.h],
              [AC_DEFINE_UNQUOTED([HAVE_IB], 1, [Define if Infiniband support is included])],
              [])
    
      dnl IP sanity check
      AC_CHECK_HEADER([netinet/in.h],
              [],
              [AC_MSG_ERROR("Failed to find netinet/in.h -- how am I supposed to talk IP?")])
      	  ])
    
    dnl MPI pool manager?
    AS_IF([test "x$enable_mpi_pool_manager" = "xyes"], [
      dnl we already checked that OFI is off
      AC_MSG_NOTICE([Building with MPI pool manager])
    
      AC_MSG_ERROR([MPI pool manager not supported yet])])
    
    AS_IF([test ! "x$enable_ofi_pool_manager" = "xyes" -a ! "x$enable_mpi_pool_manager" = "xyes"],
      AC_MSG_NOTICE([Building with SMP pool manager]))
    
    
    
    dnl libdrc on cray?
    dnl PKG_CHECK_MODULES is not robust, so we do it directly
    
    AC_ARG_ENABLE([cray-drc],
     AS_HELP_STRING([--enable-cray-drc], [Enable support for Cray RDMA Credentials (DRC) @<:@default=enabled@:>@]]),[],[enable_cray_drc=yes])
    
    AS_IF([test "x$enable_cray_drc" = "xyes"],
     [AC_MSG_CHECKING([for DRC on Cray])
      AS_IF([test -d /opt/cray/pe ],
       [if pkg-config cray-drc; then
         AC_MSG_NOTICE([found cray-drc])
         AC_DEFINE_UNQUOTED([HAVE_DRC], 1, [Define if DRC support is included])
         DRC_CFLAGS=`pkg-config --cflags cray-drc`
         DRC_LIBS=`pkg-config --libs cray-drc`
         AC_MSG_RESULT([DRC support found])
        else
         AC_MSG_NOTICE([no libdrc support])
         AC_MSG_WARN([You seem to be running on a Cray system; consider loading module rdma-credentials if running on an XC 30/40/50 system])
        fi
       ],
       [AC_MSG_RESULT([Not a Cray system, or no Cray PE installed])])],
     [AC_MSG_NOTICE([Cray DRC support disabled])])
    
    AC_SUBST(DRC_CFLAGS)
    AC_SUBST(DRC_LIBS)
    
    dnl libERL
    AS_IF([test ! -f $srcdir/deps/liberl/configure],
    		[(cd $srcdir/deps/liberl; autoreconf -ifv)])
    AX_SUBDIRS_CONFIGURE([deps/liberl],
                         [[--enable-embedded]])
    
    dnl Mamba
    AS_IF([test ! -f $srcdir/deps/mamba/configure],
    		[(cd $srcdir/deps/mamba; autoreconf -ifv)])
    dnl we force our logging into mamba build
    AX_SUBDIRS_CONFIGURE([deps/mamba],
                         [[--with-loop-analysis=no],
                          [--disable-discovery],
    		      [--enable-embedded]])
    
    LIBS="$DRC_LIBS $LIBS"
    CFLAGS="$CFLAGS $DRC_CFLAGS"
    
    dnl always ensure MIO gets some autoconf infrastructure
    AS_IF([test ! -f $srcdir/deps/mio/configure],
    		[(cd $srcdir/deps/mio; ./autogen.sh)])
    dnl check whether to include MIO
    AC_ARG_WITH([mio],
    		[AS_HELP_STRING([--with-mio],
    			[Include MIO/Mero transport library @<:@default=no@:>@])],
    		[],
    		[with_mio=no])
    
    AS_IF([test "x$with_mio" != xno],
                    [AX_CHECK_OPENSSL([CFLAGS="$OPENSSL_INCLUDES $CFLAGS"
                                       LDFLAGS="$OPENSSL_LDFLAGS $LDFLAGS"
                                       LIBS="$OPENSSL_LIBS $LIBS"
                                      ], [AC_MSG_FAILURE([MIO requires openssl which cannot be found])])
    		 AC_CHECK_LIB([mero], [m0_init],
    			 [AC_DEFINE([HAVE_MERO], [1],
    				 [Define if you have libmero])
    			 AC_DEFINE([HAVE_MIO], [1],
    				 [Define if you have MIO])
    			 AX_SUBDIRS_CONFIGURE([deps/mio],[--enable-embedded],[],[],[])
    			 ],
    			 [AC_MSG_FAILURE(
    				 [--with-mio was given, but test for libmero failed])],
    			 [])]
                     CPPFLAGS="-I/usr/include/mero $CPPFLAGS -DM0_INTERNAL= -DM0_EXTERN=extern -D_REENTRANT -D_GNU_SOURCE "
                     AC_CHECK_HEADERS([clovis/clovis.h],
                                     [],
                                     [AC_MSG_ERROR("Failed to find clovis/clovis.h -- no support for nonstandard mero install dir FIXME")],
    				 [])
    		 )
    
    dnl this needs modification when we have MIO/non-mero at some point too
    AM_CONDITIONAL([WITH_MERO], [test "x$with_mio" != "xno"])
    AM_CONDITIONAL([WITH_MIO],  [test "x$with_mio" != "xno"])
    
    AS_IF([test ! -f $srcdir/deps/packcc/configure],
    		[(cd $srcdir/deps/packcc; autoreconf -ifv)])
    AX_SUBDIRS_CONFIGURE([deps/packcc])
    
    AC_CONFIG_FILES([
      Makefile
      include/Makefile
      protocols/Makefile
      transport/Makefile
      transformation/Makefile
      maestro/Makefile
      attributes/Makefile
      tests/Makefile
      docs/Makefile
      docs/doxygen/Makefile
      docs/sphinx/Makefile
      deps/Makefile
      deps/libyaml/Makefile
      deps/libyaml/include/Makefile
      deps/libyaml/src/Makefile
      deps/libcyaml/Makefile
      deps/c-timestamp/Makefile
      MaestroConfig.cmake
    ])
    
    dnl AC_SUBST does not preserve executable bit on scripts, so do
    dnl substitution and chmod in 2 phases
    m4_define([TESTSCRIPTS],
      [tests/check_pm_declare.sh \
       tests/check_pm_declare_group.sh \
       tests/check_pm_interlock.sh \
       tests/check_pm_collision.sh \
       tests/check_pm_reentrant_client.sh \
       tests/check_pm_redundant_interlock.sh \
       tests/check_pm_interlock_async.sh \
       tests/check_pm_dist_cdo.sh \
       tests/check_subscribe.sh \
       tests/check_ecmwf_events.sh \
       tests/check_ecmwf_handle.sh \
       tests/check_ecmwf_attr.sh \
       tests/check_decode_pminfo.sh
      ])
    
    m4_foreach_w([TESTSCRIPT],
    	TESTSCRIPTS,
    	[AC_CONFIG_FILES(TESTSCRIPT, [chmod +x] TESTSCRIPT)])dnl
    
    AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/doxygen/Doxyfile])])
    
    AM_CONDITIONAL([WITH_OFI_POOL_MANAGER], [test "x$enable_ofi_pool_manager" = "xyes"])
    AM_CONDITIONAL([WITH_MPI_POOL_MANAGER], [test "x$enable_mpi_pool_manager" = "xyes"])
    AM_CONDITIONAL([WITH_SMP_POOL_MANAGER],
      [test    ! "x$enable_ofi_pool_manager" = "xyes" -a ! "x$enable_mpi_pool_manager" = "xyes"])
    AM_CONDITIONAL([WITH_LOCAL_LIBFABRIC], [test "x$enable_ofi_pool_manager" = "xyes" -a "x$build_private_ofi" = "xyes"])
    
    
    
    AC_OUTPUT