dnl -*- m4 -*- # $Source: bitbucket.org:berkeleylab/gasnet.git/configure.in $ # Description: GASNet configure script # Copyright 2002, Dan Bonachea # Copyright (c) 2014-2015 Intel Corporation. All rights reserved. # Based in part on the Titanium project configure script # Terms of use are as specified in license.txt define([cv_prefix],[gasnet_cv_]) dnl Public release version packaging identifier: define([GASNET_RELEASE_VERSION_MAJOR_D],[2023]) define([GASNET_RELEASE_VERSION_MINOR_D],[9]) define([GASNET_RELEASE_VERSION_PATCH_D],[0]) dnl GASNet-EX spec version: define([GASNETEX_SPEC_VERSION_MAJOR_D],[0]) define([GASNETEX_SPEC_VERSION_MINOR_D],[17]) dnl GASNet-1 spec version: define([GASNET_SPEC_VERSION_MAJOR_D],[1]) define([GASNET_SPEC_VERSION_MINOR_D],[8]) dnl GASNet tools spec version: define([GASNETT_SPEC_VERSION_MAJOR_D],[1]) define([GASNETT_SPEC_VERSION_MINOR_D],[20]) define([GASNET_RELEASE_VERSION_D], [GASNET_RELEASE_VERSION_MAJOR_D.GASNET_RELEASE_VERSION_MINOR_D.GASNET_RELEASE_VERSION_PATCH_D]) dnl Note that dist-hook rewrites AC_REVISION in the generated configure dnl GASNET_TOOLSONLY_FALSE_BEGIN AC_REVISION("no-version-control-info") define([AC_PACKAGE_NAME],[GASNet]) dnl GASNET_TOOLSONLY_FALSE_END dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl AC_REVISION("no-version-control-info (tools only)") dnl define([AC_PACKAGE_NAME],[GASNet_Tools]) dnl GASNET_TOOLSONLY_TRUE_END define([AC_PACKAGE_BUGREPORT],[https://gasnet-bugs.lbl.gov]) define([AC_PACKAGE_URL],[https://gasnet.lbl.gov]) define([AC_PACKAGE_VERSION],[GASNET_RELEASE_VERSION_D]) ifdef([GASNET_TRIM_ACHELP], dnl must precede AC_INIT [GASNET_TRIM_ACHELP(sbindir,libexecdir,sysconfdir,datadir,sharedstatedir,localstatedir,oldincludedir,infodir,localedir,mandir,htmldir,dvidir,pdfdir,psdir)]) dnl the "new" init incantation dnl AC_INIT(AC_PACKAGE_NAME, AC_PACKAGE_VERSION, AC_PACKAGE_BUGREPORT, AC_PACKAGE_NAME, AC_PACKAGE_URL) dnl AC_CONFIG_SRCDIR(gasnet_tools.h) dnl AM_INIT_AUTOMAKE([no-define]) dnl the "old" init incantation AC_INIT(gasnet_tools.h) AC_PREREQ(2.13) ifdef([GASNET_NO_CHECK_OPTS],[GASNET_NO_CHECK_OPTS]) dnl Don't warn about unknown configure options (which probably belong to client), must precede AC_PRESERVE_HELP_ORDER ifdef([AC_PRESERVE_HELP_ORDER],[AC_PRESERVE_HELP_ORDER]) dnl select merged enable/with --help output GASNET_FIX_SHELL AC_CONFIG_AUX_DIR(config-aux) AC_CANONICAL_SYSTEM AC_VALIDATE_CACHED_SYSTEM_TUPLE dnl GASNET_TOOLSONLY_FALSE_BEGIN AM_INIT_AUTOMAKE(GASNet, GASNET_RELEASE_VERSION_D, no-define) dnl GASNET_TOOLSONLY_FALSE_END dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl AM_INIT_AUTOMAKE(GASNet_Tools, GASNET_RELEASE_VERSION_D, no-define) dnl GASNET_TOOLSONLY_TRUE_END AC_PREFIX_DEFAULT(/usr/local/gasnet) AM_CONFIG_HEADER(gasnet_config.h) GASNET_START_CONFIGURE([],[CXX CXXCPP CXXFLAGS]) GASNET_DEFINE_CONFIGURE_VARS([GASNETI]) GASNET_SPLIT_LINKER_OPTS(LDFLAGS,LIBS) dnl early split to handle direct user input AM_CONDITIONAL(ALWAYS_TRUECOND, test -z "") AM_CONDITIONAL(ALWAYS_FALSECOND, test -n "") # Wish to define docdir in Makefiles if-and-only-if autoconf does not. # If/when we raise the mimumin required version of autoconf to 2.60, # then we can remove this and all uses of NEED_DOCDIR. AM_CONDITIONAL(NEED_DOCDIR, test -z "$docdir") # Set gasnet_toolsonly_mode based on how we Bootstrapped gasnet_toolsonly_mode=no dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl gasnet_toolsonly_mode=yes dnl GASNET_TOOLSONLY_TRUE_END dnl define version identifiers AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_MAJOR,GASNET_RELEASE_VERSION_MAJOR_D) AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_MINOR,GASNET_RELEASE_VERSION_MINOR_D) AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_PATCH,GASNET_RELEASE_VERSION_PATCH_D) AC_DEFINE_UNQUOTED(GASNETI_EX_SPEC_VERSION_MAJOR,GASNETEX_SPEC_VERSION_MAJOR_D) AC_DEFINE_UNQUOTED(GASNETI_EX_SPEC_VERSION_MINOR,GASNETEX_SPEC_VERSION_MINOR_D) AC_DEFINE_UNQUOTED(GASNETI_SPEC_VERSION_MAJOR,GASNET_SPEC_VERSION_MAJOR_D) AC_DEFINE_UNQUOTED(GASNETI_SPEC_VERSION_MINOR,GASNET_SPEC_VERSION_MINOR_D) AC_DEFINE_UNQUOTED(GASNETI_TOOLS_SPEC_VERSION_MAJOR,GASNETT_SPEC_VERSION_MAJOR_D) AC_DEFINE_UNQUOTED(GASNETI_TOOLS_SPEC_VERSION_MINOR,GASNETT_SPEC_VERSION_MINOR_D) dnl legacy defines: AC_DEFINE_UNQUOTED(GASNETI_RELEASE_VERSION,GASNET_RELEASE_VERSION_D) AC_PROG_AWK ######################################################################## ## ## Misc configure option processing ## # default: support pthreads if library found # --enable-pthreads: fail if pthreads lib not found # --disable-pthreads: don't even look for pthreads library GASNET_IF_ENABLED_WITH_AUTO(pthreads, [enable use of pthreads (required to support pthreaded GASNet clients)], [use_pthreads="yes"], [use_pthreads="no"], [use_pthreads="try"]) GASNET_FORBID_PROGRAM_TRANSFORM # This is to support a very conservative implementation of # GASNETE_FAST_ALIGNED_MEMCPY and other type-punning operations. # It is to be enabled only to test if a given problem is related # to our type-punning issues (see bug 1389) GASNET_IF_ENABLED(conservative-local-copy, [enable use of conservative (slower) mechanism for local data movement (default is no)],[ AC_DEFINE(GASNETI_BUG1389_WORKAROUND) GASNET_MSG_WARN([ ----------------------------------------------------------------------- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING You passed --enable-conservative-local-copy This usually has a SERIOUS impact on performance, so you should NOT trust any performance numbers obtained from programs built using this GASNet installation!!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -----------------------------------------------------------------------])]) ######################################################################## ## ## Perl ## ## We do this early so we can use "$PERL -e" for complex configure tests. GASNET_PROG_PERL AC_SUBST(PERL) PERLSTART=$TOP_BUILDDIR/other/perlstart AC_SUBST_FILE(PERLSTART) ######################################################################## ## ## Supporting Command-Line Tools ## dnl Store full paths, so we find right ones even if users have dnl some other version in their path GASNET_PATH_PROGS(GMAKE, gmake make $MAKE, GNU make) AC_MSG_CHECKING(for GNU make) GMAKE_VERSTR=`$GMAKE --version | grep GNU 2> /dev/null` if test "$GMAKE_VERSTR" = "" ; then AC_MSG_RESULT(no) AC_MSG_ERROR(cannot find a version of GNU make - please install GNU make and/or set \$GMAKE to indicate where it's located) else GMAKE_VER=`echo "$GMAKE_VERSTR" | $PERL -n -e 'if (/([[0-9]]+)\.([[0-9]]+)(\.[[0-9]]+)?/) { $maj=$1; $min=$2; $pat=$3; printf "%i%03i%03i",($maj,$min,($pat?$pat=~s/\.//:0)) }'` # Currently require 3.79 or newer if test $GMAKE_VER -lt 3079000 ; then AC_MSG_RESULT(no) AC_MSG_ERROR([This software requires GNU make version 3.79 or newer, and you appear to be running: "$GMAKE_VERSTR" - please install GNU make and/or set \$GMAKE to indicate where it's located]) else AC_MSG_RESULT($GMAKE_VERSTR) fi fi AC_SUBST(GMAKE) dnl Other tools checked later, after PROG_CC check sets cross_compiling ######################################################################## ## ## C/C++ Compilers ## GASNET_PROG_CC if test -n "$CFLAGS"; then # embed user-provided CFLAGS into CC for safe-keeping CC="$CC $CFLAGS" CFLAGS="" fi AC_PROG_LN_S GASNET_BIGENDIAN AC_CHECK_PROG(have_mpcc_r,mpcc_r,yes,no) ## specific compiler families GASNET_FAMILY_CACHE_CHECK(C, CC, gasnet_cv_cc_family) ## compiler family early initialization gcc_flag_prefix='' case "$CC_FAMILY" in GNU) GASNET_GCC_VERSION_CHECK(CC) gcc_flag_delim=' ' case "$CC_SUBFAMILY" in GCCFSS) AC_DEFINE(GASNETI_GCC_GCCFSS) ;; APPLE) AC_DEFINE(GASNETI_GCC_APPLE) ;; NVIDIA) gcc_flag_prefix='-Xcompiler ' gcc_flag_delim=',' ;; esac ;; PGI) GASNET_PGI_VERSION_CHECK(CC);; Pathscale) GASNET_PATHSCALE_VERSION_CHECK(CC);; esac if test "$cross_compiling" = "yes" ; then AC_DEFINE(GASNETI_CROSS_COMPILING) fi ## discover bit width dnl Use the results of CHECK_SIZEOF(void *) to select 64-bit mode for some tools dnl NOTE: CHECK_SIZEOF may only be safely called after AC_PROG_CC/AC_PROG_CPP dnl Store full paths, so we find right ones even if users have dnl some other version in their path GASNET_CHECK_SIZEOF(void *) GASNETI_PTR_BITS=`expr $SIZEOF_VOID_P \* 8` AC_SUBST(GASNETI_PTR_BITS) ### # Allow user forced ARCH and/or ISA settings w/o the corresponding probes # XXX: Incomplete... GASNET_IF_ENABLED_NOHELP(force-arch, [ case "$enable_force_arch" in generic|ibmpe|wsl|crayex) : # OK ;; yes|'') AC_MSG_ERROR([Missing required argument to --enable-force-arch]) ;; *) AC_MSG_ERROR([Unknown --enable-force-arch argument '$enable_force_arch']) ;; esac ]) ## # Look for a Cray-provided header allowing for the possibility we are not using Cray's wrapper compiler # There are two distinct "success" cases: # 1) The header is found w/o any extra CPPFLAGS # 2) The system is a Cray and the header is found only when the env var named by the 2nd arg is appended to CPPFLAGS # The includes_var passed is intended for use with CRAY_* variables defined only by Cray-provided standard modules, # and hence does NOT use GASNET_ENV_DEFAULT or generate --help output : these variables should NEVER be manually set # by an end-user, although they might be implicitly changed by switching loaded modules. # GASNET_CHECK_CRAY_HEADER(header, includes_var [, action-on-success-1] [, action-on-success-2] [, action-on-failure]) AC_DEFUN([GASNET_CHECK_CRAY_HEADER],[ pushdef([cvname],ac_cv_header_[]translit($1,'.-','__')) dnl Any others? AC_CHECK_HEADERS([$1], [$3], [ if expr "$target" : ".*-cnl-" >/dev/null; then AC_MSG_CHECKING([for [\$]$2 in the environment]) if test "${$2+set}" = set; then AC_MSG_RESULT([yes (rechecking there for $1)]) unset cvname GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS ${$2}") AC_CHECK_HEADERS([$1]) dnl Any action passed here could not set CPPFLAGS GASNET_POPVAR(CPPFLAGS) if test $cvname = yes; then : $4 fi else AC_MSG_RESULT(no) fi fi if test $cvname = no; then : $5 fi cvname=no dnl Otherwise recheck makes wrong choice ]) popdef([cvname]) ]) dnl GASNET_TRY_WNO_FLAG(type,flag,action-on-success,action-on-failure) type=C or CXX dnl As per bug 2718 gcc might silently ignore -Wno-such-flag, but not -Wsuch-flag dnl XXX: Probably sufficient to just probe for -Wsuch-flag (but lie in AC_MSG_CHECKING) AC_DEFUN([GASNET_TRY_WNO_FLAG],[ ]GASNET_TRY_[$1]FLAG[([$2], ]GASNET_TRY_[$1]FLAG[(patsubst([$2],[Wno-],[W]),[$3],[$4]),[$4])]) dnl GASNET_GET_GNUWARNINGFLAGS(type, family, flagprefix) type=C or CXX AC_DEFUN([GASNET_GET_GNUWARNINGFLAGS],[ if test "$enabled_dev_warnings" = "yes" ; then # enable additional supported warnings for warnflag in dnl Traditional GASNet devwarn: -Wall \ -Wpointer-arith \ -Wnested-externs \ -Wwrite-strings \ -Wmissing-format-attribute \ dnl Selected warnings: -Winit-self \ -Wvla \ -Wexpansion-to-defined \ -Woverlength-strings \ dnl -Wextra subset: -Wclobbered \ -Wcast-function-type \ -Wempty-body \ -Wignored-qualifiers \ -Wimplicit-fallthrough \ -Wmissing-parameter-type \ -Wold-style-declaration \ -Wuninitialized \ -Wshift-negative-value \ ; do if test "$2" = "Open64" && ( test "x$warnflag" = "x-Wempty-body" || test "x$warnflag" = "x-Wexpansion-to-defined" ) ; then : # Bug 3711: Open64 botches some warnings at link time, which is not probed here else ]GASNET_TRY_[$1]FLAG[([$3$warnflag], [DEVWARN_[$1]FLAGS="$DEVWARN_[$1]FLAGS $3$warnflag"]) fi done # Disable DEVWARN flags from -Wall that we don't support in our library code GASNET_TRY_WNO_FLAG([$1],[$3-Wno-format-overflow], [DEVWARN_[$1]FLAGS="$DEVWARN_[$1]FLAGS $3-Wno-format-overflow"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-format-truncation], [DEVWARN_[$1]FLAGS="$DEVWARN_[$1]FLAGS $3-Wno-format-truncation"]) # Disable DEVWARN flag(s) from -Wcast-function-type that we don't support in our library code GASNET_TRY_WNO_FLAG([$1],[$3-Wno-cast-function-type-strict], [DEVWARN_[$1]FLAGS="$DEVWARN_[$1]FLAGS $3-Wno-cast-function-type-strict"]) ifelse(GASNETI_C_OR_CXX([$1]),[C],[ # CC and MPI_CC only. Not desired for CXX GASNET_TRY_WNO_FLAG([$1],[$3-Wno-strict-prototypes], [DEVWARN_[$1]FLAGS="$DEVWARN_[$1]FLAGS $3-Wno-strict-prototypes"]) ]) fi # compiler-specific global warning disables case "$2" in Pathscale) # pathcc default enables -Wformat-security which we don't want GASNET_TRY_WNO_FLAG([$1],[$3-Wno-format-security], [[$1]FLAGS="$[$1]FLAGS $3-Wno-format-security"]) ;; Open64) # Open64's maybe-uninitialized analysis is too broken to be usable GASNET_TRY_WNO_FLAG([$1],[$3-Wno-uninitialized], [[$1]FLAGS="$[$1]FLAGS $3-Wno-uninitialized"]) # Open64 strict aliasing complains about (void **)/(T **) aliasing, which we use in places GASNET_TRY_WNO_FLAG([$1],[$3-Wno-strict-aliasing], [[$1]FLAGS="$[$1]FLAGS $3-Wno-strict-aliasing"]) ;; GNU) # GCC 11 appears to have analysis problems which yield bogus warnings (bugs 4228,4231,4232) dnl We do not use AC_CACHE_CHECK() here since doing so w/o additional changes dnl would conflate CC and MPI_CC (and this is not a terribly expensive check). AC_MSG_CHECKING(whether ifelse([$1],[CXX],[C++ compiler is g++],[C compiler is gcc]) 11 or higher) GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") GASNET_TRY_COMPILE_WITHWARN(GASNETI_C_OR_CXX([$1]),[ #include "gasnet_portable_platform.h" #if PLATFORM_COMPILER_VERSION_LT(11,0,0) #error #endif ],[],[ is_gcc11_or_higher=yes ],[ is_gcc11_or_higher=yes ],[ is_gcc11_or_higher=no ]) GASNET_POPVAR(CPPFLAGS) AC_MSG_RESULT($is_gcc11_or_higher) if test "$is_gcc11_or_higher" = yes; then GASNET_TRY_WNO_FLAG([$1],[$3-Wno-array-bounds], [[$1]FLAGS="$[$1]FLAGS $3-Wno-array-bounds"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-stringop-overflow], [[$1]FLAGS="$[$1]FLAGS $3-Wno-stringop-overflow"]) # These warnings were immediately problematic when introduced in 12.1 (bugs 4450,4451) # earlier versions silently ignore the unrecognized option GASNET_TRY_WNO_FLAG([$1],[$3-Wno-dangling-pointer], [[$1]FLAGS="$[$1]FLAGS $3-Wno-dangling-pointer"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-use-after-free], [[$1]FLAGS="$[$1]FLAGS $3-Wno-use-after-free"]) fi ;; esac # disable -Wformat if unsure we can support it for the printf implementation in use if test -z "$have_c99_format" ; then AC_MSG_ERROR([Internal configure error - Wformat check missing]) elif test "$have_c99_format" = 0 ; then # avoid false warnings GASNET_TRY_WNO_FLAG([$1],[$3-Wno-format], [[$1]FLAGS="$[$1]FLAGS $3-Wno-format"]) fi # disable warnings that should always be off (not supported by our headers) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused], [ [$1]FLAGS="$[$1]FLAGS $3-Wno-unused" # -Wno-unused unfortunately disables unused-result, which we want to preserve if test "$2" != "Open64" ; then # Open64 accepts the illegal option and botches it GASNET_TRY_[$1]FLAG([$3-Wunused-result], [[$1]FLAGS="$[$1]FLAGS $3-Wunused-result"]) fi ], [ # -Wno-unused meta disable failed, try to disable the problematic sub-options individually GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-function], [[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-function"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-value], [[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-value"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-variable], [[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-variable"]) ]) # -Wno-unused is not enough to ignore unused params on clang -Wall -Wextra (clang 3.8.1) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-parameter], [[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-parameter"]) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-address], [[$1]FLAGS="$[$1]FLAGS $3-Wno-address"]) if test "$use_pthreads" != "no" ; then # some crappy pthread mutex implementations generate warnings without -Wno-missing-braces AC_MSG_CHECKING(for buggy pthread.h mutex initializers) old[$1]FLAGS="$[$1]FLAGS" [$1]FLAGS="$DEVWARN_[$1]FLAGS $[$1]FLAGS" # FREEBSD requires the -pthread compiler flag when including pthread.h case "$target_os" in freebsd*) [$1]FLAGS="-pthread $[$1]FLAGS" ;; esac ]GASNET_TRY_[$1]COMPILE_WITHWARN[([#include ], [pthread_mutex_t fastmutex = PTHREAD_MUTEX_INITIALIZER;], [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(buggy) GASNET_TRY_WNO_FLAG([$1],[$3-Wno-missing-braces], [old[$1]FLAGS="$old[$1]FLAGS $3-Wno-missing-braces"])], [#bug611: ignore failures here, which may be due to broken/missing pthreads support #AC_MSG_ERROR(failure while checking for buggy pthread.h mutexes) AC_MSG_RESULT(failure - ignored) ] ) [$1]FLAGS="$old[$1]FLAGS" fi case "$target_os" in solaris*) # hide pragma warnings in system header files included by absolute path GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unknown-pragmas],[[$1]FLAGS="$[$1]FLAGS $3-Wno-unknown-pragmas"]) esac #]GASNET_TRY_[$1]FLAG[([-ansi -U__STRICT_ANSI__],[[$1]FLAGS="$[$1]FLAGS -ansi -U__STRICT_ANSI__"]) ]) ### # # choose the default CC flags # NOTE: we intentionally *overwrite* CFLAGS with reasonable, well-tested values, # to avoid picking up bad default flags from AC_PROG_CC or the default user environment # Users who want to insert a specific compiler flag for all builds should append it to $CC DEVWARN_CFLAGS_OPT= case "$CC_FAMILY" in GNU) GASNET_PUSHVAR(CFLAGS,"-O3") # prefer the --param inliner option(s), which give us finer control GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns-single=35000], [CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns-single=35000" GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns=100000], [CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns=100000"])], GASNET_TRY_CFLAG([${gcc_flag_prefix}-finline-limit=10000], [CFLAGS="$CFLAGS ${gcc_flag_prefix}-finline-limit=10000"]) ) # gcc 3.4+ require new flags to enable full inlining GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}inline-unit-growth=10000], [CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}inline-unit-growth=10000"]) GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}large-function-growth=200000], [CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}large-function-growth=200000"]) # We'd like to use -Winline to detect call sites where the optimizer # ignores our inline function modifier (usually due to technical limitations) # However, some versions of gcc issue spurious warnings with -Winline # for inlining operations which the user did not request. # Detect that gcc bug and avoid -Winline for those versions GASNET_TRY_CFLAG([${gcc_flag_prefix}-Winline],[ DEVWARN_CFLAGS_OPT="${gcc_flag_prefix}-Winline" AC_MSG_CHECKING(for buggy -Winline) GASNET_PUSHVAR(CFLAGS,"$CFLAGS $DEVWARN_CFLAGS_OPT") GASNET_TRY_CCOMPILE_WITHWARN([ int foo() { return 0; } int bar() { return foo() + bar(); } ], [ int x = bar(); ], [ AC_MSG_RESULT(ok) # keep -Winline ], [ AC_MSG_RESULT(buggy) DEVWARN_CFLAGS_OPT="" # remove -Winline ], [ GASNET_MSG_ERROR(failure when detecting buggy -Winline)]) GASNET_POPVAR(CFLAGS) ]) CCOPTFLAGS="$CFLAGS" GASNET_POPVAR(CFLAGS) ;; Pathscale) GASNET_PUSHVAR(CFLAGS,"-O3") # We'd like to use -Winline (for the same reasons as with gcc). # However, some installations have been observed to complain # on every inline keyword, due to -fno-inline being inserted # by the compiler driver. Avoid using -Winline in such a case. GASNET_TRY_CFLAG([-Winline],[ DEVWARN_CFLAGS_OPT="-Winline" AC_MSG_CHECKING(for -Winline flags conflict) GASNET_PUSHVAR(CFLAGS,"$CFLAGS $DEVWARN_CFLAGS_OPT") GASNET_TRY_CCOMPILE_WITHWARN([ inline int foo() { return 0; } ], [ int x = foo(); ], [ AC_MSG_RESULT(ok) # keep -Winline ], [ AC_MSG_RESULT(conflict) DEVWARN_CFLAGS_OPT="" # remove -Winline ], [ GASNET_MSG_ERROR(failure when detecting -Winline conflict)]) GASNET_POPVAR(CFLAGS) ]) CCOPTFLAGS="$CFLAGS" GASNET_POPVAR(CFLAGS) ;; Sun) if test "$GASNETI_PTR_BITS" = 64; then # -fast => -xarch=v8 which clobbers user's 64-bit choice SUN_ARCH_FLAG=`echo "$CC $CFLAGS" | $PERL -ne 'foreach(split(/ /,$_)) { print "$_" if (m/^-xarch/);}'` else SUN_ARCH_FLAG= fi CCOPTFLAGS="-fast $SUN_ARCH_FLAG -xO5" # bug 3662: try to workaround warnings generated by -fast when the target system cannot be autodetected GASNET_TRY_CFLAG([$CCOPTFLAGS],[],[ SUN_FALLBACK_FLAG=`echo "$_GASNET_TRY_CFLAG_TMP" | $PERL -ne 'print " $1" if (m/falling back to (.*)$/);'` GASNET_TRY_CFLAG([$CCOPTFLAGS$SUN_FALLBACK_FLAG],[ CCOPTFLAGS="$CCOPTFLAGS$SUN_FALLBACK_FLAG" ]) ]) ;; Cray) CCOPTFLAGS="-O2" ;; # DOB: -O3 is unstable on Cray cc XLC) case "$target_os" in darwin*) # enabling ipa (-O4 or higher) breaks linking to MPI (and thus ibv). case `/usr/sbin/sysctl hw.cpusubtype | cut '-d ' -f2` in # bug926: on G5 (cpusubtype 100) -qarch={ppc970,auto} causes corruption of 64-bit integer arithmetic 100) CCOPTFLAGS="-O3 -qhot -qarch=g5 -qtune=auto -qthreaded -qmaxmem=-1" ;; *) CCOPTFLAGS="-O3 -qhot -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1" ;; esac ;; linux*) CCOPTFLAGS="-O3 -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1";; *) #CCOPTFLAGS="-O5 -qthreaded -qmaxmem=-1" ;; # -O5 == -O3 w/ intra-procedural analysis, maxmem=-1 is default for -O3 or higher CCOPTFLAGS="-O3 -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1" ;; # -O5 causes linker to hang on Titanium esac GASNET_TRY_CFLAG([-qnosmp], [CCOPTFLAGS="$CCOPTFLAGS -qnosmp"]) # If $CC sets -q, then remove conflicting options from CCOPTFLAGS for flag in arch tune hot threaded smp; do if echo "$CC" | grep "q\(no\)\?${flag}" >/dev/null; then CCOPTFLAGS=`echo "$CCOPTFLAGS" | sed -e "s/-q\(no\)\?${flag}\(=[[a-z0-9_]]*\)\?//"` fi done ;; Intel) CCOPTFLAGS="-O3" ;; NVHPC) CCOPTFLAGS="-O1" ;; # TODO: restore -O2 if/when bugs are resolved? (see bug 4158) PGI) CCOPTFLAGS="-O2" # Default # Work-aroung bug 2842: bad code gen by pgcc 10.5-0 through 10.7-0 at -O2 # XXX: Need an ending version here when known GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") GASNET_TRY_CACHE_CHECK([if PGI compiler misoptimizes assignment to (const char *)], bug2842, [ #include "gasnet_portable_platform.h" #if PLATFORM_COMPILER_VERSION_LT(10,5,0) || PLATFORM_COMPILER_VERSION_GT(10,7,0) #error "GOOD pgcc version should FAIL this test" #endif ],[(void)0],[CCOPTFLAGS="-O1"]) GASNET_POPVAR(CPPFLAGS) ;; TINY) CCOPTFLAGS="" # optimization not supported SEPARATE_CC=1 # force separate compilation - multiple -c compilation not supported ;; Open64) if test "$GASNETI_PTR_BITS" = 32; then # See bug 2725 for info on test failures at -O3 # Also see "opencc -m32 -O2" crashing when building libupcr CCOPTFLAGS="-O1" else # See bug 2724 for info on "-OPT:wrap_around_unsafe=off" CCOPTFLAGS="-O3 -OPT:wrap_around_unsafe=off" fi ;; Clang) CCOPTFLAGS="-O3" ;; *) CCOPTFLAGS="-O" ;; esac AC_SUBST(SEPARATE_CC) case "$CC_FAMILY" in GNU) GASNET_PUSHVAR(CFLAGS,"${gcc_flag_prefix}-g3") case "$target_os" in darwin*) # Want -gstabs+ instead of -g3, if supported GASNET_TRY_CFLAG([${gcc_flag_prefix}-gstabs+], [CFLAGS="${gcc_flag_prefix}-gstabs+"]) ;; esac CCDEBUGFLAGS="$CFLAGS" GASNET_POPVAR(CFLAGS) ;; Pathscale) CCDEBUGFLAGS="-g3 -O0" ;; # need to explicitly disable optimization Open64) CCDEBUGFLAGS="-g3" ;; Clang) CCDEBUGFLAGS="-g -O0" ;; Cray) CCDEBUGFLAGS="-g -O0" ;; *) CCDEBUGFLAGS="-g" ;; esac dnl GASNET_GET_ULTRASPARC_FLAGS(type,flags) type=C or CXX # attempt to enable the ultrasparc ISA in MISC_C(XX)FLAGS, and test for related capabilities # flags is compiler options which enable ultrasparc instructions for 32-bit ABI GASNET_IF_DISABLED([ultrasparc-probe],[Disable probe for UltraSPARC compiler options],[DISABLE_ULTRASPARC=1]) AC_DEFUN([GASNET_GET_ULTRASPARC_FLAGS],[ pushdef([ultrasparc3code],[ void foo(void) { #ifdef __GNUC__ register void * addr = 0; register int oldval = 0; register int newval = 1; __asm__ __volatile__ ("cas [[%2]], %0, %1" : "=&r"(oldval), "=&r"(newval) : "r" (addr) : "memory"); #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) __asm("cas [[%i0]], %i1, %i2"); #else #error unknown sparc compiler #endif } ]) if test "$GASNETI_PTR_BITS" = 32 -a "$DISABLE_ULTRASPARC" != 1; then for flag in $2 ; do ]GASNET_TRY_[$1]FLAG[([$flag],[ultrasparc_flag_worked=1],[ultrasparc_flag_worked=0]) if test "$ultrasparc_flag_worked" = 1; then GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS $flag") AC_MSG_CHECKING(for working flag $flag) AC_TRY_RUN(ultrasparc3code [ int main(void) { return 0; } ], [ultrasparc_flag_worked=1], [ultrasparc_flag_worked=0], [ultrasparc_flag_worked=1]) GASNET_POPVAR([$1]FLAGS) if test "$ultrasparc_flag_worked" = 1; then AC_MSG_RESULT(yes) MISC_[$1]FLAGS="$flag" break else AC_MSG_RESULT(no) fi fi done fi AC_MSG_CHECKING(for UltraSPARC instruction support) GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS") ]GASNET_TRY_[$1]COMPILE_WITHWARN[( [ ultrasparc3code ] , [ ], [ AC_MSG_RESULT(yes) AC_DEFINE(GASNETI_ARCH_ULTRASPARC) ], [ AC_MSG_RESULT(no/warning) ], [ AC_MSG_RESULT(no/error) ]) GASNET_POPVAR([$1]FLAGS) popdef([ultrasparc3code]) ]) dnl GASNET_GET_PPC64_FLAGS(type,flags) type=C or CXX # attempt to enable 64-bit inline asm in MISC_C(XX)FLAGS, and test for related capabilities # flags is compiler options which enable ppc64 instructions for 32-bit ABI GASNET_IF_DISABLED([ppc64-probe],[Disable probe for PPC64 compiler options],[DISABLE_PPC64=1]) AC_DEFUN([GASNET_GET_PPC64_FLAGS],[ pushdef([ppc64code],[[ #include #if (defined(__xlC__) || defined(__ibmxl__)) && !defined(__clang__) static int testme(double *p); #pragma mc_func testme { \\ /* ARGS: r3 = p LOCAL: r4, r5 */ \\ "38a00001" /* li r5,1 */ \\ "38800000" /* li r4,0 */ \\ "f8830000" /* std r4,0(r3) */ \\ "e8a30000" /* ld r5,0(r3) */ \\ "7ca32b78" /* mr r3,r5 */ \\ } #pragma reg_killed_by testme cr0, gr4, gr5 #else static int testme(double *p) { int tmp, result; __asm__ __volatile__ ( "li %2,1 \n\t" "li %1,0 \n\t" "std %1,0(%3) \n\t" "ld %2,0(%3) \n\t" : "=m" (*p), "=&b" (tmp), "=&r" (result) : "b" (p) ); return result; } #endif ]]) if test "$GASNETI_PTR_BITS" = 32 -a "$DISABLE_PPC64" != 1 -a "$cross_compiling" != "yes"; then dnl Bug 1587: "for flag in ; do" chokes the shell on Solaris - so use ifelse ifelse([$2],[],[:],[ for flag in $2 ; do ]GASNET_TRY_[$1]FLAG[([$flag],[ppc64_flag_worked=1],[ppc64_flag_worked=0]) if test "$ppc64_flag_worked" = 1; then GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS $flag") AC_MSG_CHECKING(for working flag $flag) AC_TRY_RUN(ppc64code [ int main(void) { double x; return testme(&x); } ], [ppc64_flag_worked=1], [ppc64_flag_worked=0], [ppc64_flag_worked=1]) GASNET_POPVAR([$1]FLAGS) if test "$ppc64_flag_worked" = 1; then AC_MSG_RESULT(yes) MISC_[$1]FLAGS="$flag" break else AC_MSG_RESULT(no) fi fi done ]) fi AC_MSG_CHECKING(for PPC64 instruction support) GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS") ]GASNET_TRY_[$1]COMPILE_WITHWARN[( [ ppc64code ] , [ ], AC_TRY_RUN(ppc64code [ int main(void) { double x; return testme(&x); } ], [AC_MSG_RESULT(yes) AC_DEFINE(GASNETI_ARCH_PPC64)], [AC_MSG_RESULT(no/failure)], [ # Cross compiling. For now just trust PTR_BITS. if test "$GASNETI_PTR_BITS" = 64; then AC_MSG_RESULT([yes (cross-compiling w/ 64-bit pointers)]) AC_DEFINE(GASNETI_ARCH_PPC64) else AC_MSG_RESULT([no (cross-compiling w/ 32-bit pointers)]) fi ]), [ AC_MSG_RESULT(no/warning) ], [ AC_MSG_RESULT(no/error) ]) GASNET_POPVAR([$1]FLAGS) popdef([ppc64code]) ]) # Detect features that affect MISCFLAGS if test "$cross_compiling" = "yes" && test -z "$gasnet_cv_c99_format" ; then gasnet_cv_c99_format=no # conservatively assume it's unavailable if we can't check fi GASNET_TRY_CACHE_RUN([for working C99 printf specifiers],c99_format, [ #include /* snprintf */ #include /* strcmp */ #include /* types */ #include /* reporting */ char test[[100]]; char expect[[100]]; int check(void) { ptrdiff_t pd, pdneg; size_t sz = 0xAAAABBBB; strcat(expect, "AAAABBBB"); if (sizeof(size_t) >= 8) { sz <<= 16; sz <<= 16; sz += 0xCCCCDDDD; strcat(expect,"CCCCDDDD"); } strcat(expect, " 987654321"); pd = 987654321; if (sizeof(ptrdiff_t) >= 8) { pd *= 1000000000; pd += 987654321; strcat(expect, "987654321"); } strcat(expect, " -123456789"); pdneg = -123456789; int ret = snprintf(test,sizeof(test),"%zX %ti %ti",sz,pd,pdneg); if (ret <= 0) return ret; if (strcmp(test,expect)) return 666; return 0; } int main(void) { int ret = check(); if (ret) { printf("got %i(%s): \t'%s'\n",ret,strerror(errno),test); /* for debugging */ printf("expected: \t'%s'\n", expect); } return ret; } ],[ have_c99_format=1 ],[ have_c99_format=0 ]) AC_DEFINE_UNQUOTED(HAVE_C99_FORMAT_SPECIFIERS,[$have_c99_format]) dnl GASNET_SET_MISCFLAGS(CC|MPI_CC, compliancecode) AC_DEFUN([GASNET_SET_MISCFLAGS],[ # Set MISC_CFLAGS: flags to be used by all C compilations, regardless of optimization/debugging level # This should include architectural/CPU flags, warning flags, and anything required for C99 conformance # We do not currently allow a user override of MISC_C(PP)FLAGS MISC_CFLAGS="" misc_flag_prefix='' misc_flag_delim=' ' case "$CC_FAMILY" in GNU) case "$CC_SUBFAMILY" in NVIDIA) misc_flag_prefix='-Xcompiler ' misc_flag_delim=',' ;; esac case "$target_cpu" in sparc) GASNET_GET_ULTRASPARC_FLAGS(C,["-mcpu=ultrasparc3 -mtune=ultrasparc3" "-mcpu=ultrasparc -mtune=ultrasparc"]);; rs6000|powerpc*) GASNET_GET_PPC64_FLAGS(C,["-force_cpusubtype_ALL" "-Wa,-mppc64"]);; esac case "$target_os" in darwin*) GASNET_TRY_WNO_FLAG([C],[${misc_flag_prefix}-Wno-long-double], [MISC_CFLAGS="$MISC_CFLAGS ${misc_flag_prefix}-Wno-long-double"]) ;; esac ;; Cray) AC_MSG_CHECKING([for Cray C warning flags]) crayc_warn_flags="236:3185" # 3185 = bug 3306 GASNET_PUSHVAR(CFLAGS,"$CFLAGS -g") # bug 3309 is specific to -g GASNET_TRY_CCOMPILE_WITHWARN( [ typedef struct { int f1; } S; S foo(void) { S s; s.f1 = 1; return s; } ], [], [], [ crayc_warn_flags="${crayc_warn_flags}:7212" ], # bug 3309, Cray C 8.5+ [GASNET_MSG_ERROR(failure building struct warning test)]) GASNET_POPVAR(CFLAGS) case "$target_cpu" in x86_64) MISC_CFLAGS="-hnomessage=$crayc_warn_flags" ;; # XT, XE, XK, XC, etc. *) AC_MSG_ERROR(Cray C compiler for unknown target CPU) ;; esac AC_MSG_RESULT([$MISC_CFLAGS]) ;; Intel) # Note we need to support both older -wd and newer -diag-disable # Setting (CC|MPI_CC)_WDFLAG simplifes doing so in later tests pushdef([wdflag],$1[]_WDFLAG) GASNET_TRY_CFLAG([-diag-disable=177], [wdflag='-diag-disable='], [wdflag='-wd']) MISC_CFLAGS="${wdflag}177 ${wdflag}279" GASNET_TRY_CFLAG([${wdflag}1572], [MISC_CFLAGS="$MISC_CFLAGS ${wdflag}1572"]) popdef([wdflag]) ;; NVHPC) # TODO: are either `-M` options, inherited from PGI, still required? # suppress large number of useless default warnings # get inline assembly and sign-extended widening MISC_CFLAGS="-w -Masmkeyword -Msignextend" ;; PGI) MISC_CFLAGS="-Masmkeyword -Msignextend" # get inline assembly and sign-extended widening # The following looks backwards, but is not. # PGI 20.1 introduced fine-grained warning control at the same time as # default-enabling a large number of useless warnings (on the level of # -Wextra in other compilers). GASNET_TRY_CFLAG([[-Wc,--diag_suppress=177]], [MISC_CFLAGS="-w $MISC_CFLAGS"]) ;; Sun) if test "$target_cpu" = "sparc"; then GASNET_GET_ULTRASPARC_FLAGS(C,["-xarch=v8plusb" "-xarch=v8plusa" "-xarch=v8plus" "-xarch=sparcvis2" "-xarch=sparcvis" "-xarch=sparc"]) fi # Try to suppress warnings about __attribute__(__common__): GASNET_TRY_CFLAG([-erroff=E_ATTRIBUTE_NOT_FUNC], [MISC_CFLAGS="$MISC_CFLAGS -erroff=E_ATTRIBUTE_NOT_FUNC"]) MISC_CFLAGS="$MISC_CFLAGS -errtags" ;; # show warning tag ids in warnings XLC) GASNET_GET_PPC64_FLAGS(C) # Try to suppress certain warnings: # 1500-010 = infinite loop (such as in our tests) # 1500-029 = could not inline (e.g. varargs, alloc, etc.) # 1506-229 = empty source file (some linux headers) GASNET_TRY_CFLAG([-qsuppress=1500-010:1500-029:1506-229], [MISC_CFLAGS="$MISC_CFLAGS -qsuppress=1500-010:1500-029:1506-229"]) ;; *) ;; esac # Add warning enable/suppression flags to MISC_CFLAGS case "$CC_FAMILY" in GNU | Pathscale | Open64 | Clang) GASNET_PUSHVAR(CFLAGS,"$MISC_CFLAGS") GASNET_GET_GNUWARNINGFLAGS(C,$CC_FAMILY,[${misc_flag_prefix}]) MISC_CFLAGS="$CFLAGS" GASNET_POPVAR(CFLAGS) ;; *) ;; esac # Set MISC_CPPFLAGS: flags to be used by all C preprocesses and compilations # Note this is ALSO used for C++ compilation, so only generic language-independent options should go in here # We do not currently allow a user override of MISC_C(PP)FLAGS # but this is where we embed the user's CPPFLAGS input to configure MISC_CPPFLAGS="$CPPFLAGS" case "$CC_FAMILY" in GNU) case "$target_os" in darwin*) # add some options which are specific to the Apple Inc version of gcc GASNET_TRY_CFLAG([${misc_flag_prefix}-no-cpp-precomp], [MISC_CPPFLAGS="$MISC_CPPFLAGS ${misc_flag_prefix}-no-cpp-precomp"]) ;; esac ;; *) ;; esac # Determine the minimal CFLAGS we need to add for C99 compliance # This is done incrementally to avoid passing options on newer compiler versions where the # required compliance is provided by default, making the flag redundant (and potentially detrimental) # This also allows the user to pass a specific compliance flag in $CC without conflict case "$CC_FAMILY" in # Some known oddball cases: XLC) gasnet_c99_flags="-qlanglvl=extc99 -qlanglvl=stdc99";; Sun) gasnet_c99_flags="-xc99=all";; Cray) gasnet_c99_flags="'-h c99'";; PGI) gasnet_c99_flags="-c99 -c9x" ;; NVHPC) gasnet_c99_flags="-c99" ;; # One of these should work for the rest: # std=c99 requests strict C99 conformance from gcc and look-alikes, whereas # std=gnu99 additionally requests GNU-specific language extensions. # All GASNet code should adhere to the subset of strict C99 in the README coding standards, # (a subset of std=c99), however these flags are also used to compile network API headers # and client code that may require more general support. Therefore std=gnu99 is default. *) gasnet_c99_flags="${misc_flag_prefix}-std=gnu99 ${misc_flag_prefix}-c99 ${misc_flag_prefix}-std=c99";; esac # NOTE: We do not currently cache this check because it is expanded in multiple contexts GASNET_C99_FLAG=unknown eval set - $gasnet_c99_flags for flag in "" "[$]@"; do GASNET_PUSHVAR(CFLAGS, "$CFLAGS $MISC_CFLAGS $MISC_CPPFLAGS") # first see if the flag generates warnings GASNET_TRY_CFLAG([$flag],[ # now see if it gives us the support we want GASNET_PUSHVAR(CFLAGS, "$CFLAGS $flag") AC_TRY_COMPILE($2,[],[GASNET_C99_FLAG="$flag"]) GASNET_POPVAR(CFLAGS) ]) GASNET_POPVAR(CFLAGS) if test "$GASNET_C99_FLAG" != "unknown"; then break; fi done AC_MSG_CHECKING([for flags required for C99 subset compliance]) if test "$GASNET_C99_FLAG" = "unknown"; then AC_MSG_ERROR([Could not determine \$$1 flag to accept ISO C99 input. You may need to append flags in \$$1 to enable C99 support]) elif test "$GASNET_C99_FLAG" = ""; then AC_MSG_RESULT([none required]) else AC_MSG_RESULT([$GASNET_C99_FLAG]) MISC_CFLAGS="$MISC_CFLAGS $GASNET_C99_FLAG" fi ]) dnl GASNET_SET_MISCFLAGS dnl Test code for compliance to the C99 subset required to compile gasnet.h dnl The following should ONLY include C99 features we officially adopt in the GASNet/README coding standards AC_DEFUN([GASNET_C99_TEST], [ void foo(void) { int a = 1; // C99 comment for (int i=0; i < 100; i++) a += i; // Conditional expression declaration int i = a; // mid-block decl int x = (int)(0x1234567812345678LL + 0x8765432187654321ULL + i); // (U)LL-suffix 64-bit integer literals } ]) dnl The following is required for $CC (when compiling libgasnet) and optional for clients compiling gasnet.h AC_DEFUN([GASNET_VA_ARGS_TEST],[ #define GASNETI_AMNUMARGS(...) GASNETI_AMNUMARGS_(__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0) #define GASNETI_AMNUMARGS_(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,N,...) N int b[[GASNETI_AMNUMARGS(1)+1]]; int c[[GASNETI_AMNUMARGS(1,2)+1]]; int d[[GASNETI_AMNUMARGS(1,2,3)+1]]; ]) DEVWARN_CFLAGS= GASNET_IF_ENABLED(debug, Build GASNet in a debugging mode, [ if test -z "$GASNET_SUPPRESS_DEBUG_WARNING" ; then GASNET_MSG_WARN([ ----------------------------------------------------------------------- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING Configuring the system for global, forced debugging mode. This usually has a SERIOUS impact on performance, so you should NOT trust any performance numbers obtained from programs built using this GASNet installation!!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -----------------------------------------------------------------------]) fi GASNET_OPT_CFLAGS="$CCDEBUGFLAGS" AC_DEFINE(GASNET_DEBUG) BUILDCONFIG="debug" enabled_debug=yes], [ GASNET_OPT_CFLAGS="$CCOPTFLAGS" DEVWARN_CFLAGS="$DEVWARN_CFLAGS $DEVWARN_CFLAGS_OPT" AC_DEFINE(GASNET_NDEBUG) BUILDCONFIG="optimize" enabled_debug=no]) AM_CONDITIONAL(BUILDCONFIG_DEBUG, test "$enabled_debug" = yes) GASNET_IF_ENABLED(valgrind, [Build a valgrind-friendly library, disabling some optimizations. Implies --disable-debug-malloc], [ if test -z "$GASNET_SUPPRESS_DEBUG_WARNING" ; then GASNET_MSG_WARN([Enabling valgrind-friendly codegen, disabling some optimizations.]) fi AC_DEFINE(GASNETI_VALGRIND) enable_debug_malloc=no # debug mallocator obfuscates heap activity and confuses valgrind if test x"$enable_pshm_xpmem" = xyes && test x"$enable_pshm" != xno; then # valgrind fundamentally incompatible with XPMEM, issuing errors on every access case "$target" in *-cnl-*) GASNET_MSG_WARN([Valgrind (--enable-valgrind) does not interoperate with XPMEM (--enable-pshm-xpmem). This appears to be a Cray, so converting to --enable-pshm-hugetlbfs instead]) enable_pshm_xpmem=no enable_pshm_hugetlbfs=yes ;; *) GASNET_MSG_ERROR([Valgrind (--enable-valgrind) does not interoperate with XPMEM (--enable-pshm-xpmem). Please select a different PSHM protocol (e.g. --disable-pshm-xpmem --enable-pshm-posix) or disable PSHM (--disable-pshm) ]) ;; esac fi enabled_valgrind=yes ], [ enabled_valgrind=no ]) AM_CONDITIONAL(VALGRIND, test "$enabled_valgrind" = yes) GASNET_IF_ENABLED_WITH_AUTO(dev-warnings, Build GASNet with developer compiler warnings for the library and tests (default: yes), enabled_dev_warnings=yes, enabled_dev_warnings=no, enabled_dev_warnings=yes) GASNET_SET_MISCFLAGS(CC,[ GASNET_VA_ARGS_TEST GASNET_C99_TEST ]) if test "$enabled_dev_warnings" = "no" ; then DEVWARN_CFLAGS= fi AC_SUBST(DEVWARN_CFLAGS) # Some C compilers disable OS POSIX entry points when strict c99 conformance is selected # _GNU_SOURCE implies _XOPEN_SOURCE and enables other features we probe for, like "adaptive" mutex_t and pthread_rwlock_t # Known to work on Linux, cygwin, and expected to be safe or at worst ignored on other OS's GASNET_EXTRA_DEFINES="-D_GNU_SOURCE=1" AC_SUBST(GASNET_EXTRA_DEFINES) # MISC_C(PP)FLAGS are added to C(PP)FLAGS here to ensure they are used for the remaining configure tests, # but they retain a separate identity post-configure CFLAGS="$GASNET_OPT_CFLAGS $MISC_CFLAGS" CPPFLAGS="$GASNET_EXTRA_DEFINES $MISC_CPPFLAGS" AC_SUBST(MISC_CFLAGS) # warning suppression and other misc C flags AC_SUBST(MISC_CPPFLAGS) # misc preprocessor flags AC_SUBST(GASNET_OPT_CFLAGS) # Final check to ensure everything works together -- in case some combination of flags broke something GASNET_TRY_CACHE_CHECK(for working GASNet-required ISO C99 subset, gasnet_c99_subset, [ GASNET_VA_ARGS_TEST GASNET_C99_TEST ], [], [], [ AC_MSG_ERROR(Unable to find sufficient C99 support features in $CC to build GASNet. You may need to append flags in \$CC to enable C99 support) ]) GASNET_IF_ENABLED(gasnet-verbose, Build GASNet lib with debugging status messages, [ enabled_debug_verbose=yes ], [ enabled_debug_verbose=no ]) if test "$enabled_debug_verbose" = yes; then AC_DEFINE(GASNET_DEBUG_VERBOSE) fi AM_CONDITIONAL(BUILDCONFIG_DEBUG_VERBOSE, test "$enabled_debug_verbose" = yes) dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_IF_ENABLED_WITH_AUTO(trace, Build GASNet with tracing enabled (enabled by default with --enable-debug), enabled_trace=yes, enabled_trace=no, enabled_trace=$enabled_debug) if test "$enabled_trace" = yes; then AC_DEFINE(GASNET_TRACE) fi AM_CONDITIONAL(BUILDCONFIG_TRACE, test "$enabled_trace" = yes) GASNET_IF_ENABLED_WITH_AUTO(stats, Build GASNet with statistical collection enabled (enabled by default with --enable-debug), enabled_stats=yes, enabled_stats=no, enabled_stats=$enabled_debug) if test "$enabled_stats" = yes; then AC_DEFINE(GASNET_STATS) fi AM_CONDITIONAL(BUILDCONFIG_STATS, test "$enabled_stats" = yes) GASNET_IF_ENABLED(srclines, Build GASNet with srclines support (enabled by default with --enable-trace), [ enabled_srclines=yes ]) if test "$enabled_srclines" = yes; then AC_DEFINE(GASNET_SRCLINES) fi AM_CONDITIONAL(BUILDCONFIG_SRCLINES, test "$enabled_srclines" = yes) dnl GASNET_TOOLSONLY_FALSE_END GASNET_IF_ENABLED_WITH_AUTO(debug-malloc, Build GASNet with debugging malloc implementation enabled (enabled by default with --enable-debug), enabled_debug_malloc=yes, enabled_debug_malloc=no, enabled_debug_malloc=$enabled_debug) if test "$enabled_debug_malloc" = yes; then AC_DEFINE(GASNET_DEBUGMALLOC) fi AM_CONDITIONAL(BUILDCONFIG_DEBUGMALLOC, test "$enabled_debug_malloc" = yes) GASNET_CORRECT_OPTIMIZEDDEBUG(CC,CFLAGS,CC,[$CPPFLAGS],[]) case "$CC_FAMILY" in GNU) KEEPTMP_CFLAGS="-save-temps" ;; Clang) KEEPTMP_CFLAGS="-save-temps" ;; Pathscale) KEEPTMP_CFLAGS="-keep" ;; Open64) KEEPTMP_CFLAGS="-keep" ;; XLC) KEEPTMP_CFLAGS="-qlist" ;; # XXX: generates .lst w/ asm. Can't find a way to preserve .i PGI|NVHPC) KEEPTMP_CFLAGS="-Mkeepasm" ;; # XXX: only keeps .s. Can't find a way to preserve .i Intel) KEEPTMP_CFLAGS="-save-temps" ;; # XXX: only keeps .s. Can't find a way to preserve .i Sun) KEEPTMP_CFLAGS="-keeptmp" ;; Cray) KEEPTMP_CFLAGS="-hkeepfiles" ;; # XXX: only keeps .s. Can't find a way to preserve .i *) KEEPTMP_CFLAGS="" ;; esac AC_SUBST(KEEPTMP_CFLAGS) # flags to preserve intermediate file (,i, .s, etc.) # Global opt-in to (semi-)automatic RPATH support GASNET_IF_ENABLED(rpath, [Build GASNet libraries using RPATH for dependent libraries (disabled by default)], enabled_rpath=yes, enabled_rpath=no) warn_missing_rpath='' # Probe(s) of compiler/linker support for RPATH # # TODO: warning-sensitive linker probe prior to making this ON-by-default # The logic below current uses `AC_TRY_LINK()` to test for support for # linker flags. However, this is not capable of rejecting flags which # induce warnings rather than failure. The most straight-forward approach # to checking for warnings is susceptible to persistent warnings (such as # for impending license expiration). Therefore, before RPATH support can be # ON by default, this probe should use `GASNET_TRY_LDFLAG()`, which does not # *yet* exist, but would be analogous to `GASNET_TRY_CFLAG()`. # Example scenarios where this would improve our behavior: # + Compilers/linkers which don't recognize flags we attempt, but only warn. # This would fail the probe, possibly allowing a later flag to be chosen. # + Conflicts (such as hypothetically with `-static`) which generate # warnings that an otherwise supported behavior is unavailable. # This would probably fail *all* the probes, resulting in disabling a # "non-feature" that only generates warnings. # + Might check if multiple instances of the same directory generates a warning. # However, we don't have a good solution in mind if this is ever the case. # pushdef([cache_var],cv_prefix[]cc_rpath_option) AC_MSG_CHECKING([for rpath option to \$CC]) AC_CACHE_VAL(cache_var, [ cache_var='unknown' if test "$CC_FAMILY$CC_SUBFAMILY" = 'GNUNVIDIA'; then wl='-Xlinker ' else wl='-Wl,' fi for opt in "${wl}-rpath," "${wl}-rpath=" "${wl}-rpath ${wl}"; do GASNET_PUSHVAR(LDFLAGS,"$opt${TMPDIR:-/tmp}") AC_TRY_LINK([ #include ], [ puts("hello"); ], [ cache_var="$opt" ], ) GASNET_POPVAR(LDFLAGS) if test x"$cache_var" != xunknown; then break fi done unset wl ]) if test x"$cache_var" = 'xunknown'; then AC_MSG_RESULT(unknown) unset cc_rpath_option else AC_MSG_RESULT("${cache_var}DIR") # explicit (visible) quotes are intentional cc_rpath_option="$cache_var" fi popdef([cache_var]) dnl GASNET_TOOLSONLY_FALSE_BEGIN segconfig="" GASNET_IF_ENABLED(segment-fast, Build GASNet in the FAST shared segment configuration, segconfig="fast$segconfig", ) GASNET_IF_ENABLED(segment-large, Build GASNet in the LARGE shared segment configuration, segconfig="large$segconfig", ) GASNET_IF_ENABLED(segment-everything, Build GASNet in the EVERYTHING shared segment configuration, segconfig="everything$segconfig", ) case "$segconfig" in "") segconfig=fast; #for AM_CONDITIONAL, below AC_DEFINE(GASNET_SEGMENT_FAST) ;; # default is fast fast) AC_DEFINE(GASNET_SEGMENT_FAST) ;; large) AC_DEFINE(GASNET_SEGMENT_LARGE) ;; everything) AC_DEFINE(GASNET_SEGMENT_EVERYTHING) ;; *) AC_MSG_ERROR(Conflicting shared segment configurations specified) ;; esac # Do it all again because AM_CONDITIONAL()s can't go inside if or case. # Groan. AM_CONDITIONAL(GASNET_SEGMENT_FAST, test "$segconfig" = fast) AM_CONDITIONAL(GASNET_SEGMENT_LARGE, test "$segconfig" = large) AM_CONDITIONAL(GASNET_SEGMENT_EVERYTHING, test "$segconfig" = everything) dnl GASNET_TOOLSONLY_FALSE_END dnl GASNET_GET_PLATFORM_ID(CCVAR, opt compiler-desc) dnl probe a compiler for version information AC_DEFUN([GASNET_GET_PLATFORM_COMPILER], [ GASNET_TRY_CACHE_EXTRACT_$4($2 for PLATFORM_COMPILER_$3, PLATFORM_$1_$3, [ #include "gasnet_portable_platform.h" ], [ PLATFORM_COMPILER_$3 ], GASNETI_PLATFORM_$1_$3) AC_DEFINE_UNQUOTED(GASNETI_PLATFORM_$1_$3, ifelse([$4],[STR],["$GASNETI_PLATFORM_$1_$3"],[$GASNETI_PLATFORM_$1_$3])) ]) AC_DEFUN([GASNET_GET_PLATFORM_ID], [ GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") GASNET_GET_PLATFORM_COMPILER([$1],[$2],[IDSTR],[STR]) GASNET_GET_PLATFORM_COMPILER([$1],[$2],[FAMILYID],[EXPR]) GASNET_GET_PLATFORM_COMPILER([$1],[$2],[ID],[EXPR]) GASNET_GET_PLATFORM_COMPILER([$1],[$2],[VERSION],[EXPR]) GASNET_GET_PLATFORM_COMPILER([$1],[$2],GASNETI_C_OR_CXX([$1])[_LANGLVL],[EXPR]) GASNET_POPVAR(CPPFLAGS) ]) dnl Try to discover the C compiler's inline modifier dnl GASNET_INLINE_MODIFIER(compiler-display-name, compiler-type) dnl Where compiler-type is CC|MPI_CC AC_DEFUN([GASNET_TRY_INLINE],[ dnl INTERNAL USE BY GASNET_INLINE_MODIFIER ONLY if test -z "$inlinemod"; then GASNET_TRY_CACHE_CHECK([$1 for $3 modifier], $2[]mod$3, [$3 int dummy(void) { return 1; }], [], [inlinemod="$3"]) fi ]) AC_DEFUN([GASNET_INLINE_MODIFIER],[ pushdef([lowername],translit($2,'A-Z','a-z')) pushdef([uppername],translit($2,'a-z','A-Z')) inlinemod="" case "$[]uppername[]_FAMILY" in XLC) # force __inline on XLC, to avoid warnings inlinemod=__inline ;; esac GASNET_TRY_INLINE($1,lowername,[inline]) GASNET_TRY_INLINE($1,lowername,[__inline__]) GASNET_TRY_INLINE($1,lowername,[__inline]) GASNET_TRY_INLINE($1,lowername,[_inline]) GASNET_TRY_INLINE($1,lowername,[_Inline]) if test -n "$inlinemod"; then GASNET_TRY_CACHE_CHECK($1 for working 'static $inlinemod', lowername[_static_inline], [static $inlinemod int dummy() { return 1; }], [], [inlinemod="static $inlinemod"]) fi AC_DEFINE_UNQUOTED(GASNETI_[]uppername[]_INLINE_MODIFIER, $inlinemod) popdef([uppername]) popdef([lowername]) ]) dnl Check GCC-style inline asm support dnl GASNET_CHECK_GCC_ASM(compiler-display-name, compiler-type) dnl Where compiler-type is CC|CXX|MPI_CC AC_DEFUN([GASNET_CHECK_GCC_ASM],[ GASNET_FUN_BEGIN([$0($1,$2)]) pushdef([lowername],translit($2,'A-Z','a-z')) pushdef([uppername],translit($2,'a-z','A-Z')) case "$target_cpu" in # TODO: expand as this becomes reachable on other CPUs rs6000|powerpc*) gcc_asm_string='"sync"';; *) AC_MSG_ERROR([Internal error - GASNET_CHECK[]_GCC_ASM called for unknown architecture]) ;; esac GASNET_TRY_CACHE_LINK([$1 for GCC inline asm support], lowername[]_gcc_asm, [], [ __asm__ __volatile__ ($gcc_asm_string); ], [ AC_DEFINE(GASNETI_HAVE_[]uppername[]_GCC_ASM) ]) popdef([uppername]) popdef([lowername]) ]) dnl Check for compilers with varying support for inline asm and atomics dnl GASNET_CHECK_ASM_SUPPORT(compiler-display-name, compiler-type) dnl Where compiler-type is CC|CXX|MPI_CC dnl dnl NOTE TO IMPLEMENTERS: dnl Changes made here that enable ASM support on additional platforms, dnl which do not require any compile/link/run test, should also be dnl applied in gasnet_asm.h. dnl AC_DEFUN([GASNET_CHECK_ASM_SUPPORT],[ GASNET_FUN_BEGIN([$0($1,$2)]) pushdef([lowername],translit($2,'A-Z','a-z')) pushdef([uppername],translit($2,'a-z','A-Z')) pushdef([flagsvar],ifelse(index([$2],[CXX]),[-1],[C],[CXX])[]FLAGS) GASNET_PUSHVAR(flagsvar,"$flagsvar -I$TOP_SRCDIR/other") case "$[]uppername[]_FAMILY" in Sun) GASNET_TRY_CACHE_LINK([$1 for simple inline asm() support], lowername[]_simple_asm, [], [ asm("nop"); ], [ AC_DEFINE(GASNETI_HAVE_[]uppername[]_SIMPLE_ASM) ]) # We lack a reliable configure probe to diagnose broken GCC inline asm support on Sun C # We only know 5.12 and newer on x86/x86-64 are reliable (see bug 2941) GASNET_TRY_CACHE_LINK([$1 for GCC inline asm support], lowername[]_gcc_asm, [ #include "gasnet_portable_platform.h" ],[ #if (PLATFORM_ARCH_X86 || PLATFORM_ARCH_X86_64) && PLATFORM_COMPILER_VERSION_GE(5,12,0) __asm__ __volatile__ ("lock; addl \$[]0,0(%%esp)" : : : "memory", "cc"); #else #error Support has not been verified #endif ],[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_GCC_ASM) ]) ;; XLC) GASNET_CHECK_GCC_ASM($1, $2) ;; GNU|Intel|Pathscale|Open64|Clang|NVHPC|PGI|TINY) # Currently believe all of these support GCC-style inline ASM on all CPUs # where we use it. If that is ever *not* the case then one should split # off the case for the relevant compiler and apply banlists or probes. # NOTE: be sure to keep gasnet_asm.h in-sync with any changes made here. AC_DEFINE(GASNETI_HAVE_[]uppername[]_GCC_ASM) ;; esac dnl TODO: factor this and loop over "32" and "64" ? GASNET_TRY_CACHE_LINK([$1 for 32-bit __sync atomics support], lowername[]_sync_atomics_32, [ #include "portable_inttypes.h" ],[ struct { volatile uint32_t ctr; } x = { 2 }; uint32_t op = 1; uint32_t oval = 2; uint32_t nval = 3; volatile uint32_t result; result = __sync_bool_compare_and_swap(&(x.ctr), oval, nval) + __sync_val_compare_and_swap(&(x.ctr), nval, oval) + __sync_fetch_and_add(&(x.ctr), op); ],[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_SYNC_ATOMICS_32) ]) GASNET_TRY_CACHE_LINK([$1 for 64-bit __sync atomics support], lowername[]_sync_atomics_64, [ #include "portable_inttypes.h" ],[ struct { volatile uint64_t ctr; } x = { 2 }; uint64_t op = 1; uint64_t oval = 2; uint64_t nval = 3; volatile uint64_t result; result = __sync_bool_compare_and_swap(&(x.ctr), oval, nval) + __sync_val_compare_and_swap(&(x.ctr), nval, oval) + __sync_fetch_and_add(&(x.ctr), op); ],[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_SYNC_ATOMICS_64) ]) GASNET_POPVAR(flagsvar) popdef([flagsvar]) popdef([uppername]) popdef([lowername]) GASNET_FUN_END([$0]) ]) GASNET_LIBGCC GASNET_CHECK_RESTRICT([GASNETI_CC]) GASNET_CHECK_ASM_SUPPORT([C compiler],[CC]) GASNET_INLINE_MODIFIER([C compiler],[CC]) GASNET_GET_GNU_ATTRIBUTES([GASNETI_HAVE_CC]) GASNET_CHECK_BUILTINS([GASNETI_HAVE_CC]) GASNET_GET_PLATFORM_ID([COMPILER]) GASNET_IFDEF([__PIC__],[AC_DEFINE(GASNETI_CONFIGURED_PIC)]) dnl Check for the historically behavior with respect to tentative dnl definitions, and seek means to restore this behavior when it dnl is lacking. dnl dnl This is only probing CC, this is only applicable to GASNet dnl library builds, not clients. dnl CHECK_TENTATIVE_BASE=gasnet_conftest_tent CHECK_TENTATIVE_SRC=$CHECK_TENTATIVE_BASE.c CHECK_TENTATIVE_OBJ=$CHECK_TENTATIVE_BASE.o dnl helper: GASNET_CHECK_TENTATIVE_TRY_RUN(msg,cv_var,extra,on_success) AC_DEFUN([GASNET_CHECK_TENTATIVE_TRY_RUN],[ GASNET_PUSHVAR(LIBS,"$CHECK_TENTATIVE_OBJ $LIBS") GASNET_TRY_CACHE_RUN_WITHCC($1, $2, [ $3 int tentative; extern void increment(void); ], [ tentative = 1; increment(); return (tentative != 2); ],[ $4 ]) GASNET_POPVAR(LIBS) ]) AC_MSG_CHECKING([building tentative definition helper object]) cat >$CHECK_TENTATIVE_SRC <<_GASNET_EOF int tentative; void increment(void) { tentative += 1; } _GASNET_EOF compile="$CC $CFLAGS $CPPFLAGS -c $CHECK_TENTATIVE_SRC -o $CHECK_TENTATIVE_OBJ" eval echo "$compile" >&5 if eval $compile 2>&5 && test -s $CHECK_TENTATIVE_OBJ ; then AC_MSG_RESULT(ok) else GASNET_MSG_ERROR(failed while building tentative definition helper object) fi unset GASNETI_COMMON GASNET_CHECK_TENTATIVE_TRY_RUN( [for tentative definition support], have_tentative_normal, [], [GASNETI_COMMON='']) if test "${GASNETI_COMMON+set}" != set; then GASNET_CHECK_TENTATIVE_TRY_RUN( [for tentative definition support via "common" attribute], have_tentative_common_attribute, [__attribute__((__common__))], [GASNETI_COMMON='__attribute__((__common__))']) fi rm -f $CHECK_TENTATIVE_OBJ if test "${GASNETI_COMMON+set}" = set; then AC_DEFINE_UNQUOTED(GASNETI_COMMON,$GASNETI_COMMON) else AC_MSG_ERROR(could not determine how to use tentative definitions) fi rm -f $CHECK_TENTATIVE_SRC $CHECK_TENTATIVE_OBJ ######################################################################## # hunt for 16-, 32-, and 64-bit integer types GASNET_SETUP_INTTYPES() ######################################################################## # get sizes of additional types for the "anytype" unions GASNET_CHECK_SIZEOF(float) GASNET_CHECK_SIZEOF(double) dnl Grumble! Can't use AC_CHECK_TYPE or AC_CHECK_TYPES in autoconf 2.13 dnl Additionally, this duplicates a check in recent AC_SIZEOF() just dnl for the sake of avoiding the error abort in GASNET_CHECK_SIZEOF. AC_DEFUN([GASNET_CHECK_SIZEOF_OPTIONAL], [ pushdef([uppername],translit($1,'a-z ','A-Z_')) pushdef([lowername],translit($1,'A-Z ','a-z_')) GASNET_TRY_CACHE_CHECK([for type $1],[type_]lowername,[], [ if (($1 *) 0) return 0; if (sizeof ($1)) return 0; ], [GASNET_CHECK_SIZEOF($1)], [dnl see GASNET_CHECK_SIZEOF for a desciption of this little gem: ac_cv_SIZEOF_[]uppername[]_indirect=SIZEOF_[]uppername AC_DEFINE_UNQUOTED($ac_cv_SIZEOF_[]uppername[]_indirect,0) ]) popdef([lowername]) popdef([uppername]) ]) GASNET_CHECK_SIZEOF_OPTIONAL(_Bool) GASNET_CHECK_SIZEOF_OPTIONAL(long double) GASNET_CHECK_SIZEOF_OPTIONAL(float _Complex) dnl NOT YET - GASNET_CHECK_SIZEOF_OPTIONAL(double _Complex) dnl NOT YET - GASNET_CHECK_SIZEOF_OPTIONAL(long double _Complex) ######################################################################## ## ## Page size ## GASNET_CROSS_VAR(GASNETI_PAGESIZE,PAGESIZE) if test "$GASNETI_PAGESIZE" = ""; then GASNET_TRY_CACHE_RUN_EXPR(PAGESIZE, PAGESIZE, [ #include ], [ val = PAGESIZE; if (val<=0) exit(1); ], GASNETI_PAGESIZE) fi if test "$GASNETI_PAGESIZE" = ""; then GASNET_TRY_CACHE_RUN_EXPR(PAGE_SIZE, PAGE_SIZE, [ #include ], [ val = PAGE_SIZE; if (val<=0) exit(1); ], GASNETI_PAGESIZE) fi if test "$GASNETI_PAGESIZE" = ""; then GASNET_TRY_CACHE_RUN_EXPR([sysconf(_SC_PAGESIZE)], _SC_PAGESIZE, [ #include ], [ val = sysconf(_SC_PAGESIZE); if (val<=0) exit(1); ], GASNETI_PAGESIZE) fi if test "$GASNETI_PAGESIZE" = ""; then GASNET_TRY_CACHE_RUN_EXPR([sysconf(_SC_PAGE_SIZE)], _SC_PAGE_SIZE, [ #include ], [ val = sysconf(_SC_PAGE_SIZE); if (val<=0) exit(1); ], GASNETI_PAGESIZE) fi if test "$GASNETI_PAGESIZE" = ""; then GASNET_TRY_CACHE_RUN_EXPR([getpagesize()], getpagesize, [ #include ], [ val = getpagesize(); if (val<=0) exit(1); ], GASNETI_PAGESIZE) fi if test "$GASNETI_PAGESIZE" != ""; then AC_DEFINE_UNQUOTED(GASNETI_PAGESIZE,$GASNETI_PAGESIZE) case "$GASNETI_PAGESIZE" in 1024) GASNETI_PAGESHIFT=10 ;; 2048) GASNETI_PAGESHIFT=11 ;; 4096) GASNETI_PAGESHIFT=12 ;; 8192) GASNETI_PAGESHIFT=13 ;; 16384) GASNETI_PAGESHIFT=14 ;; 32768) GASNETI_PAGESHIFT=15 ;; 65536) GASNETI_PAGESHIFT=16 ;; 131072) GASNETI_PAGESHIFT=17 ;; 262144) GASNETI_PAGESHIFT=18 ;; 524288) GASNETI_PAGESHIFT=19 ;; 1048576) GASNETI_PAGESHIFT=20 ;; 2097152) GASNETI_PAGESHIFT=21 ;; 4194304) GASNETI_PAGESHIFT=22 ;; 8388608) GASNETI_PAGESHIFT=23 ;; 16777216) GASNETI_PAGESHIFT=24 ;; *) AC_MSG_ERROR(unknown GASNETI_PAGESIZE=$GASNETI_PAGESIZE) ;; esac AC_DEFINE_UNQUOTED(GASNETI_PAGESHIFT,$GASNETI_PAGESHIFT) fi # -lm should only live in LIBM, and only if we have it (not in LIBS) GASNET_LIBM() #--------------------------------------------------------------------------------------------------------------- # Machine defs GASNET_PLATFORM=generic GASNET_THREAD_DEFINES="" GASNET_THREAD_LIBS="" case "$target_os" in solaris*) GASNET_THREAD_DEFINES="-D_REENTRANT" # on some systems static linking fails with -lpthread, # but need it or pthread_create will fail at runtime GASNET_THREAD_LIBS="-lpthread" ;; linux*) if test "x$enable_force_arch" = xgeneric; then : # no action elif test "x$enable_force_arch" = xibmpe || # Check for IBM PE by presence of POE ( env PAGER=cat poe -h | grep 'Parallel Operating Environment' ) >/dev/null 2>&1; then GASNETI_ARCH_IBMPE=1 GASNET_PLATFORM=ibmpe AC_DEFINE(GASNETI_ARCH_IBMPE) elif test "x$enable_force_arch" = xwsl || # Check for Microsoft Windows Subsystem for Linux (WSL) ( test -f /proc/sys/kernel/osrelease && grep 'Microsoft' /proc/sys/kernel/osrelease ) >/dev/null 2>&1; then GASNETI_ARCH_WSL=1 GASNET_PLATFORM=wsl AC_DEFINE(GASNETI_ARCH_WSL) elif test "x$enable_force_arch" = xcrayex || # Check for HPE Cray EX (aka Shasta) using kernel version or CRAYPE_NETWORK_TARGET ( uname -r | grep cray_shasta ) >/dev/null 2>&1 || test "x$CRAYPE_NETWORK_TARGET" = xofi -o "x$CRAYPE_NETWORK_TARGET" = xucx ; then GASNETI_ARCH_CRAYEX=1 GASNET_PLATFORM=crayex AC_DEFINE(GASNETI_ARCH_CRAYEX) # some defaults: if test "${enable_ofi-unset}" = unset; then enable_ofi=yes; fi if test "${enable_ibv-unset}" = unset; then enable_ibv=no; fi if test "${enable_udp-unset}" = unset; then enable_udp=no; fi if test "${with_ofi_spawner-unset}" = unset; then with_ofi_spawner=pmi; fi if test "${with_ucx_spawner-unset}" = unset; then with_ucx_spawner=pmi; fi fi AC_MSG_CHECKING(for Linux flavor) AC_MSG_RESULT($GASNET_PLATFORM${enable_force_arch:+ (forced)}) GASNET_THREAD_DEFINES="-D_REENTRANT" GASNET_THREAD_LIBS="-lpthread" ;; freebsd*) # bug 1781: FreeBSD requires version-dependent magic to get a working pthread library OS_RELDATE="`/sbin/sysctl -n kern.osreldate 2>/dev/null`" if test "$OS_RELDATE" -lt "500016"; then GASNET_THREAD_DEFINES="-D_THREAD_SAFE" GASNET_THREAD_LIBS="-pthread" elif test "$OS_RELDATE" -lt "502102"; then GASNET_THREAD_DEFINES="-D_THREAD_SAFE" GASNET_THREAD_LIBS="-lc_r" else GASNET_THREAD_DEFINES="-D_THREAD_SAFE" # optional? GASNET_THREAD_LIBS="-pthread" fi ;; netbsd*) # The -pthread argument is effectively part of the standard compiler interface on *BSD # It's a frontend macro argument that expands to appropriate compiler-independent -D and -l # options in the right context, so we allow it to live in GASNET_DEFINES and GASNET_LIBS GASNET_THREAD_DEFINES="-pthread -D_REENTRANT" # _REENTRANT probably redundant GASNET_THREAD_LIBS="-pthread" # bug 1205: do not explicitly select threading lib ;; openbsd*) # Probe because at some point clang didn't accept -pthread as it does on the other BSDs # Otherwise same as netbsd, above, including the comments. GASNET_TRY_CFLAG([-pthread], [GASNET_THREAD_DEFINES="-pthread -D_REENTRANT" GASNET_THREAD_LIBS="-pthread"], [GASNET_THREAD_DEFINES="-D_POSIX_THREADS -D_REENTRANT" GASNET_THREAD_LIBS="-lpthread"]) ;; cygwin*) GASNET_THREAD_DEFINES="-D_REENTRANT" GASNET_THREAD_LIBS="" GASNET_TRY_CACHE_CHECK( [for Cygwin version 2.0 or newer],cygwin2, [#include ],[ #if CYGWIN_VERSION_DLL_MAJOR < 2000 #error #endif ],[have_cygwin2='yes'],[have_cygwin2='no']) ;; darwin*) GASNET_THREAD_DEFINES="-D_REENTRANT" GASNET_THREAD_LIBS="" ;; *) GASNET_MSG_WARN(unknown OS - you may need to update the configure script) ;; esac AC_SUBST(GASNET_THREAD_DEFINES) AC_SUBST(GASNET_THREAD_LIBS) AC_SUBST(GASNET_PLATFORM) # Find the appropriate OS suffix for executables if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then EXESUFFIX=$ac_cv_exeext else case "$target_os" in cygwin*) EXESUFFIX='.exe' ;; *) EXESUFFIX='' ;; esac fi AC_SUBST(EXESUFFIX) AM_CONDITIONAL(HAVE_EXESUFFIX, test -n "$EXESUFFIX") ######################################################################## ## ## Utilities for locating external packages ## dnl GASNET_PACKAGE_HOME(PREFIX, DESC, PROG, DIRS, FILE) dnl sets [PREFIX]_HOME to the first found in the following dnl User-provided [PREFIX]_HOME dnl The grandparent of "PROG", if non-emppty dnl Example: /usr/local/bin/PROG -> /usr/local) dnl If the located PROG is a symlink, it may be followed dnl The first directory in [DIRS /usr] to contain FILE dnl The first directory in [DIRS /usr] to be readable dnl Last resort: /usr dnl FILE is used to help validate the [PREFIX]_HOME AC_DEFUN([GASNET_PACKAGE_HOME],[ GASNET_FUN_BEGIN([$0($1,$2,$3,$4,$5)]) pushdef([the_var],$1[]_HOME) pushdef([the_prog],$1[]_guess_prog) pushdef([the_guess],$1[]_guess) the_guess= ifelse(len([$3]),[0],[],[ AC_PATH_PROGS(the_prog, $3) if test -n "$the_prog"; then the_guess=`dirname \`dirname $the_prog\`` fi ]) if test -z "$the_guess" ; then dnl Look for first dir w/ the marker FILE, and then just first dir that exists for the_guess[]_file in "$5" "."; do for the_guess in $4 /usr; do if test -r "$the_guess/$the_guess[]_file" ; then break 2 fi done done unset the_guess[]_file fi GASNET_ENV_DEFAULT(the_var, $the_guess, [Install prefix of $2]ifelse(len([$3]),[0],[],[ (auto-detected from PATH)])) AC_MSG_CHECKING(if $the_var is the $2 install prefix) the_var[]_good=no if test -r "$the_var/$5"; then the_var[]_good=yes AC_MSG_RESULT([yes]) fi ifelse(len([$3]),[0],[],[ if test $the_var[]_good = no && test -n "$the_prog"; then GASNET_FOLLOWLINKS(the_prog) the_var[]_tmp=`dirname \`dirname $the_prog\`` if test -r "$the_var[]_tmp/$5"; then the_var[]_good=yes the_var="$the_var[]_tmp" AC_MSG_RESULT([no - followed symlink to $the_var]) fi unset the_var[]_tmp fi ]) if test $the_var[]_good = no; then AC_MSG_RESULT([probably not - missing $5]) fi unset the_var[]_good unset the_guess popdef([the_guess]) popdef([the_prog]) popdef([the_var]) GASNET_FUN_END([$0]) ]) dnl GASNET_PACKAGE_CFLAGS(PREFIX, [extra flags], [noenv]) dnl Construct [PREFIX]_CFLAGS to contain "-I$[PREFIX]_HOME/include" plus [extra flags] dnl Special cases $[PREFIX]_HOME = "/usr" or "/" to omit the "-I..." dnl If the optional [noenv] argument is non-empty then GASNET_ENV_DEFAULT in NOT used AC_DEFUN([GASNET_PACKAGE_CFLAGS],[ GASNET_FUN_BEGIN([$0($@)]) pushdef([the_home],$1[]_HOME) pushdef([the_var],$1[]_CFLAGS) pushdef([the_guess],$1[]_cflags_guess) pushdef([extra_flags],ifelse(len([$2]),[0],[],[ $2])) dnl prepends space only if non-empty dnl TODO - strengthen this if we can determine compiler's default search path: case "$the_home" in /usr|/) the_guess='$2';; *) if test -d "$the_home/include/."; then the_guess="-I$the_home/include[]extra_flags" else the_guess='$2' fi;; esac ifelse(len([$3]),[0],[GASNET_ENV_DEFAULT(the_var, $the_guess)],[the_var=$the_guess]) unset the_guess popdef([extra_flags]) popdef([the_guess]) popdef([the_var]) popdef([the_home]) GASNET_FUN_END([$0]) ]) dnl GASNET_PACKAGE_LDFLAGS(PREFIX, libnames, [extra flags], [noenv]) dnl Construct [PREFIX]_LDFLAGS to contain the proper "-L$[PREFIX]_HOME/lib{,32,64}" plus [extra flags] dnl Optionally includes an RPATH option, based on --enable-rpath and --(en|dis)able-[PREFIX]-rpath. dnl Special cases $[PREFIX]_HOME = "/usr" or "/" to omit the "-L..." and rpath dnl The libnames arg is like AC_CHECK_LIB: just "foo" and "bar", not libfoo.a or libbar.so dnl If the optional [noenv] argument is non-empty then GASNET_ENV_DEFAULT in NOT used AC_DEFUN([GASNET_PACKAGE_LDFLAGS],[ GASNET_FUN_BEGIN([$0($@)]) pushdef([the_home],$1[]_HOME) pushdef([the_var],$1[]_LDFLAGS) pushdef([the_guess],$1[]_ldflags_guess) pushdef([extra_flags],ifelse(len([$3]),[0],[],[ $3])) dnl prepends space only if non-empty pushdef([rpath_opt],translit($1,'A-Z_','a-z-')-rpath) pushdef([rpath_var],enabled_[]translit($1,'A-Z-','a-z_')_rpath) dnl TODO - strengthen this if we can determine linker's default search path: case "$the_home" in /usr|/) the_guess='$3';; *) for the_guess[]_dir in "$the_home/lib${GASNETI_PTR_BITS}" "$the_home/lib" ''; do test -z "$the_guess[]_dir[]" && break for the_guess[]_lib in $2; do for the_guess[]_suff in a so sl dylib la dll; do if test -r "$the_guess[]_dir/lib$the_guess[]_lib.$the_guess[]_suff"; then break 3; fi done done done if test -n "$the_guess[]_dir[]"; then the_guess="-L$the_guess[]_dir[]" pushdef([GASNET_SUPPRESSHELP],1) # deferred to appear after help for [PREFIX]_LDFLAGS GASNET_IF_ENABLED_WITH_AUTO(rpath_opt, [N/A], [rpath_var="$the_guess[]_dir"], [rpath_var=''], [if test -z "$rpath_var"; then if test "x$enabled_rpath" = xyes; then rpath_var="$the_guess[]_dir" else rpath_var='' fi fi]) popdef([GASNET_SUPPRESSHELP]) if test -n "$rpath_var"; then if test "${cc_rpath_option:+set}" = set; then the_guess="$the_guess $cc_rpath_option$rpath_var" else warn_missing_rpath="$warn_missing_rpath translit($1,'A-Z-','a-z_')" fi fi the_guess="${the_guess}extra_flags" else the_guess='$3' fi ;; esac dnl show_rpath_help captures whether with_expanded_[PKG]_LDFLAGS is defined dnl prior to us (optionally) calling GASNET_ENV_DEFAULT, which *will* set it. dnl This allows us to display the help for --enable-[pkg]-rpath immediately dnl following the help (if any) for [PKG]_LDFLAGS, while ensuring that dnl with_expanded_[PKG]_LDFLAGS will suppress both. pushdef([show_rpath_help],ifdef(with_expanded_[]the_var,no,yes)) ifelse(len([$4]),[0],[GASNET_ENV_DEFAULT(the_var, $the_guess)],[the_var=$the_guess]) ifelse(show_rpath_help,[yes],[ AC_ARG_ENABLE(rpath_opt,GASNET_OPTION_HELP((en|dis)able-rpath_opt, [Use RPATH in default the_var if appropriate (enabled by default with --enable-rpath)]))]) popdef([show_rpath_help]) unset the_guess unset the_guess[]_dir unset the_guess[]_lib unset the_guess[]_suff popdef([rpath_var]) popdef([rpath_opt]) popdef([extra_flags]) popdef([the_guess]) popdef([the_var]) popdef([the_home]) GASNET_FUN_END([$0]) ]) ######################################################################## ## ## GASNET_CRAY_FIX_LINK_OPTS(lib [, envvar]) ## ## Modify CRAY_[LIB]_POST_LINK_OPTS envvars to reference the 'default' ## rather than the versioned directory normally set by environment modules ## lib: short name ('foo', not 'libfoo') ## envvar: defaults to CRAY_[upcase(lib)]_POST_LINK_OPTS ## AC_DEFUN([GASNET_CRAY_FIX_LINK_OPTS],[ GASNET_FUN_BEGIN([$0($@)]) pushdef([varname],ifelse(len([$2]),[0],[CRAY_[]translit($1,'a-z','A-Z')[]_POST_LINK_OPTS],[$2])) if test -n x"$varname"; then cplo_tmp=`$PERL -e "\\\$_='$varname'; s,/$1/[[^/]]*/lib,/$1/default/lib,g; print;"` cplo_dir=`$PERL -e "\\\$_='$cplo_tmp'; m,-L([[^ ]]*/$1/[[^ ]]*),; print \\\$[]1;"` if test -d "$cplo_dir/."; then varname="$cplo_tmp" else GASNET_MSG_WARN([Directory $cplo_dir missing - disabling rewrite of varname]) fi fi popdef([varname]) GASNET_FUN_END([$0]) ]) # Fix the POST_LINK_OPTS for libs required by aries-conduit GASNET_IF_DISABLED_NOHELP(cray-post-link-rewrite,[],[ GASNET_CRAY_FIX_LINK_OPTS([pmi]) GASNET_CRAY_FIX_LINK_OPTS([udreg]) GASNET_CRAY_FIX_LINK_OPTS([ugni]) GASNET_CRAY_FIX_LINK_OPTS([xpmem]) ]) ######################################################################## ## ## Multithreading Libraries ## ## POSIX threads # have_pthread=no if test "$use_pthreads" != "no"; then GASNET_PUSHVAR(CFLAGS,"$CFLAGS $GASNET_THREAD_DEFINES") GASNET_PUSHVAR(LIBS,"$LIBS $GASNET_THREAD_LIBS") GASNET_TRY_CACHE_LINK([for working pthreads support], pthreads_works, [ #include ], [ pthread_create(0,0,0,0); ], [have_pthread=yes]) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LIBS) else pthread_reason="was disabled" fi if test "$use_pthreads$have_pthread" = "yesno" ; then AC_MSG_ERROR([--enable-pthreads passed but no working pthreads support found]) fi if test "$use_pthreads$have_pthread" = "tryno" ; then GASNET_MSG_WARN([No working pthreads support found - disabling pthreads support]) pthread_reason="appear to be missing or broken" fi GASNET_IF_ENABLED_WITH_AUTO(seq, [support SEQ-mode single-threaded GASNet clients], [build_seq_libs="yes"], [build_seq_libs="no"], [build_seq_libs="yes"]) GASNET_IF_ENABLED_WITH_AUTO(par, [support PAR-mode pthreaded GASNet clients], [build_par_libs="yes"], [build_par_libs="no"], [build_par_libs="$have_pthread"]) build_parsync_libs="no" dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_IF_ENABLED_WITH_AUTO(parsync, [support PARSYNC-mode pthreaded GASNet clients], [build_parsync_libs="yes"], [build_parsync_libs="no"], [build_parsync_libs="$have_pthread"]) dnl GASNET_TOOLSONLY_FALSE_END if test "$build_par_libs$have_pthread" = "yesno" ; then AC_MSG_ERROR([--enable-par passed but no working pthreads support found]) fi if test "$build_parsync_libs$have_pthread" = "yesno" ; then AC_MSG_ERROR([--enable-parsync passed but no working pthreads support found]) fi if test "$build_seq_libs$build_par_libs$build_parsync_libs" = "nonono" ; then AC_MSG_ERROR([all libraries disabled by configure options!]) fi AM_CONDITIONAL(BUILD_SEQ_LIBS, test "$build_seq_libs" = "yes") AM_CONDITIONAL(BUILD_PAR_LIBS, test "$build_par_libs" = "yes") AM_CONDITIONAL(BUILD_PARSYNC_LIBS, test "$build_parsync_libs" = "yes") GASNET_WITH(max-pthreads-per-node, [Set max pthreads supported per GASNet node], [AC_DEFINE_UNQUOTED(GASNETI_MAX_THREADS_CONFIGURE, $withval)] ) if test "$have_pthread" = no ; then GASNET_THREAD_DEFINES="" GASNET_THREAD_LIBS="" else GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS $GASNET_THREAD_DEFINES -I$TOP_SRCDIR/other") GASNET_PUSHVAR(LIBS,"$GASNET_THREAD_LIBS") # define HAVE_PTHREAD_H AC_CHECK_HEADERS(pthread.h) # libraries that may be required for some POSIX thread features opt_pthread_libs="pthread pthreads c_r" # look for optional pthreads entry points and features AC_SEARCH_LIBS(pthread_setconcurrency, $opt_pthread_libs, AC_DEFINE(HAVE_PTHREAD_SETCONCURRENCY)) AC_SEARCH_LIBS(pthread_kill, $opt_pthread_libs, AC_DEFINE(HAVE_PTHREAD_KILL)) AC_SEARCH_LIBS(pthread_kill_other_threads_np, $opt_pthread_libs, AC_DEFINE(HAVE_PTHREAD_KILL_OTHER_THREADS_NP)) AC_SEARCH_LIBS(pthread_sigmask, $opt_pthread_libs, AC_DEFINE(HAVE_PTHREAD_SIGMASK)) GASNET_IF_ENABLED_WITH_AUTO(rwlock, Enable/disable use of pthread_rwlock_t (auto-detected), enabled_rwlock=yes, enabled_rwlock=no, enabled_rwlock=probe) if test "$enabled_rwlock" != "no" ; then have_rwlock="yes" AC_SEARCH_LIBS(pthread_rwlock_tryrdlock, $opt_pthread_libs, [], have_rwlock=no) AC_SEARCH_LIBS(pthread_rwlock_wrlock, $opt_pthread_libs, [], have_rwlock=no) if test "$have_rwlock" = "yes" ; then AC_DEFINE(GASNETI_HAVE_PTHREAD_RWLOCK) fi if test "$enabled_rwlock$have_rwlock" = "yesno"; then GASNET_MSG_ERROR([--enable-rwlock passed but no working pthread_rwlock_t support found]) fi fi GASNET_IF_ENABLED_WITH_AUTO(tls, Enable/disable use of thread-local storage extensions (ie __thread) (auto-detected), enabled_tls=yes, enabled_tls=no, enabled_tls=probe) if test "$enabled_tls" != "no" ; then GASNET_CHECK_TLS_SUPPORT([ AC_DEFINE(GASNETI_HAVE_TLS_SUPPORT, 1) have_tls=yes ],[ have_tls=no ]) fi if test "$enabled_tls$have_tls" = "yesno"; then GASNET_MSG_ERROR([--enable-tls passed but no working tls support found]) fi GASNET_IF_ENABLED_WITH_AUTO(threadinfo-opt, [Enable/disable threadinfo passing optimization (default is system dependent)], [AC_DEFINE_UNQUOTED(GASNETI_THREADINFO_OPT_CONFIGURE, 1)], [AC_DEFINE_UNQUOTED(GASNETI_THREADINFO_OPT_CONFIGURE, 0)]) case "$target_os" in freebsd*) ;; # bug 1205: intentionally avoid -lpthread on BSD, where it causes problems netbsd*) ;; openbsd*) ;; *) GASNET_THREAD_LIBS="$LIBS" ;; esac GASNET_POPVAR(CPPFLAGS) GASNET_POPVAR(LIBS) fi # Determine the cache line size we should use for padding to avoid false sharing cache traffic AC_MSG_CHECKING(for shared data cache line size) # initial guess based on architecture case "$target_cpu" in # when chip revs differ, we should err on the larger size i*86) cache_line_guess=64 ;; x86_64) cache_line_guess=64 ;; arm*) cache_line_guess=64 ;; aarch64) cache_line_guess=64 ;; rs6000) cache_line_guess=32 ;; # https://www.csee.umbc.edu/portal/help/architecture/rs6000_arch.ps powerpc*) cache_line_guess=128 ;; # https://www.7-cpu.com/cpu/Power8.html sparc) cache_line_guess=128 ;; # https://en.wikipedia.org/wiki/SPARC64_V *) cache_line_guess=128 ;; # the default when we have no other info esac # allow the OS to refine our guess if test "$cross_compiling" = "no"; then cache_line_guess_os= case "$target_os" in darwin*) # could also use `sysctl machdep.cpu.cache.linesize` cache_line_guess_os=`(/usr/sbin/sysctl hw.cachelinesize | cut '-d ' -f2) 2>/dev/null` ;; linux*) # `getconf LEVEL1_DCACHE_LINESIZE` and cache_alignment in /proc/cpuinfo seem less reliable cache_line_guess_os=`(cat /sys/devices/system/cpu/cpu0/cache/index{0,1,2,3}/coherency_line_size | tail -1) 2>/dev/null` ;; *) ;; esac if test -n "$cache_line_guess_os" ; then cache_line_guess=$cache_line_guess_os fi fi AC_MSG_RESULT($cache_line_guess) GASNET_ENV_DEFAULT(CACHE_LINE_BYTES, $cache_line_guess, [shared data cache line width, in bytes (default is platform-dependent)]) AC_DEFINE_UNQUOTED(GASNETI_CACHE_LINE_BYTES,$CACHE_LINE_BYTES) case "$CACHE_LINE_BYTES" in 8) GASNETI_CACHE_LINE_SHIFT=3 ;; 16) GASNETI_CACHE_LINE_SHIFT=4 ;; 32) GASNETI_CACHE_LINE_SHIFT=5 ;; 64) GASNETI_CACHE_LINE_SHIFT=6 ;; 128) GASNETI_CACHE_LINE_SHIFT=7 ;; 256) GASNETI_CACHE_LINE_SHIFT=8 ;; 512) GASNETI_CACHE_LINE_SHIFT=9 ;; 1024) GASNETI_CACHE_LINE_SHIFT=10 ;; *) AC_MSG_ERROR(unsupported CACHE_LINE_BYTES=$CACHE_LINE_BYTES) ;; esac AC_DEFINE_UNQUOTED(GASNETI_CACHE_LINE_SHIFT,$GASNETI_CACHE_LINE_SHIFT) if test x"$enabled_valgrind" = x"yes" ; then GASNETI_TM0_ALIGN=0 # team disalignment optimization leads to "possible leak" reports for every non-primordial gex_TM_t elif test $CACHE_LINE_BYTES -lt 8; then GASNETI_TM0_ALIGN=16 else GASNETI_TM0_ALIGN=`expr 2 \* $CACHE_LINE_BYTES` fi AC_DEFINE_UNQUOTED(GASNETI_TM0_ALIGN,$GASNETI_TM0_ALIGN) AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = yes) PTHREADS="$have_pthread" AC_SUBST(PTHREADS) ######################################################################## ## Process-shared memory (pshm) dnl GASNET_TOOLSONLY_FALSE_BEGIN have_hugetlbfs=no GASNET_IF_ENABLED_WITH_AUTO(hugetlbfs, [Enable/disable huegtlbfs support (default is system dependent)], [enabled_hugetlbfs=yes], [enabled_hugetlbfs=no], [enabled_hugetlbfs=probe]) if test "$enabled_hugetlbfs" != 'no'; then AC_CHECK_HEADERS(hugetlbfs.h, [ GASNET_PUSHVAR(LIBS,"$LIBS -lhugetlbfs") AC_CHECK_FUNCS([hugetlbfs_unlinked_fd], [have_hugetlbfs=yes AC_DEFINE(HAVE_HUGETLBFS)]) GASNET_POPVAR(LIBS) ]) if test "$enabled_hugetlbfs$have_hugetlbfs" = 'yesno'; then GASNET_MSG_ERROR([User requested --enable-hugetlbfs but the header and/or library could not be found]) fi if test "$have_hugetlbfs" = 'yes'; then GASNET_IF_ENABLED(hugetlbfs-whole-archive, [Use --whole-archive with libhugetlbfs], [HUGETLBFS_LIBS='-Wl,--whole-archive,-lhugetlbfs,--no-whole-archive'], [HUGETLBFS_LIBS='-lhugetlbfs']) fi fi with_pshm=no GASNET_PSHM_CFLAGS= GASNET_PSHM_LDFLAGS= GASNET_PSHM_LIBS= GASNET_PSHM_ENABLED=no GASNET_IF_ENABLED_WITH_AUTO(pshm, [Enable/disable inter-process shared memory support (default is system dependent)], [enabled_pshm=yes], [enabled_pshm=no], [ if test "$segconfig" = everything; then enabled_pshm=no elif test "$cross_compiling" = yes; then enabled_pshm=no else # Current default is 'probe' unless overridden in case statment below enabled_pshm=probe case "$target_os" in cygwin*) if test "$have_cygwin2" = 'no'; then enabled_pshm=no; fi ;; esac fi ]) if test "$segconfig$enabled_pshm" = everythingyes; then GASNET_MSG_ERROR([User requested --enable-segment-everything and --enable-pshm but PSHM support does not include GASNET_SEGMENT_EVERYTHING.]) fi if test "$enabled_pshm" != no; then # First check for POSIX (shm_open) support GASNET_IF_ENABLED_WITH_AUTO(pshm-posix, [Enable/disable use of POSIX shm_open() for inter-process shared memory support (default is system dependent)], [enabled_pshm_posix=yes], [enabled_pshm_posix=no], [ # Default is YES except: # + on Solaris due to incompatibility w/ ibv and the "robustness" of SysV # + on HPE Cray EX where we prefer hugetlbfs if available enabled_pshm_posix=yes case "$target_os" in solaris*) enabled_pshm_posix=no ;; esac if test "$GASNET_PLATFORM$have_hugetlbfs" = crayexyes; then enabled_pshm_posix=no fi ]) if test "$enabled_pshm_posix$with_pshm" = yesno; then # shm_open() might be in libc (e.g. AIX, Darwin) or librt (e.g. Linux, Solaris) GASNET_PUSHVAR(LIBS,"$LIBS") have_shm_open=probe AC_SEARCH_LIBS(shm_open, [rt posix4], [ if test "$cross_compiling" = "yes" ; then # To the best of my knowledge CNL, and BG/L all lack # working shm_open() support, though at least CNL finds the symbol. # So, we default to NO shm_open() when cross-compiling. -PHH # Update: CNL on Cray XE *does* have working shm_open(). -PHH # One can set CROSS_HAVE_SHM_OPEN=1 to force building PSHM for POSIX. GASNET_CROSS_VAR(GASNETI_HAVE_SHM_OPEN, HAVE_SHM_OPEN, 0) if test "$CROSS_HAVE_SHM_OPEN" != 1; then have_shm_open=no fi fi if test "$have_shm_open" = probe; then GASNET_TRY_CACHE_RUN_WITHCC([for working shm_open()], have_shm_open, [ #include #include #include #include #include #include #define SHM_NAME "/GASNETconftst" ],[ int size = GASNETI_PAGESIZE; int fd; void * addr; fd = shm_open(SHM_NAME, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR); (void)shm_unlink(SHM_NAME); if (fd < 0) return 1; if (ftruncate(fd, size) < 0) return 1; addr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); (void)close(fd); if (!addr || (addr == MAP_FAILED)) return 1; (void)munmap(addr, size); return 0; ],[ have_shm_open=yes ], [ have_shm_open=no ]) fi if test "$have_shm_open" = yes; then AC_DEFINE(GASNETI_PSHM_POSIX) GASNET_PSHM_LIBS="$LIBS" with_pshm=posix fi ], [ have_shm_open=no ]) GASNET_POPVAR(LIBS) fi # Second check is for SysV (shmget) support enabled_pshm_sysv=no GASNET_IF_ENABLED_WITH_AUTO(pshm-sysv, [Enable use of SysV shmat() for inter-process shared memory support (default is system dependent)], [enabled_pshm_sysv=yes], [enabled_pshm_sysv=no], [ # Default is NO except: # + on Solaris due to "robust" defaults and compatibility with ibv-conduit enabled_pshm_sysv=no case "$target_os" in solaris*) enabled_pshm_sysv=yes ;; esac ]) if test "$enabled_pshm_sysv$with_pshm" = yesno; then dnl XXX Stronger probe? AC_CHECK_FUNC(shmget, [ AC_DEFINE(GASNETI_PSHM_SYSV) with_pshm=sysv ]) fi # Third check is for XPMEM+hugetlbfs support enabled_pshm_xpmem=no GASNET_IF_ENABLED(pshm-xpmem, [Enable use of XPMEM for inter-process shared memory support (default disabled)], [enabled_pshm_xpmem=yes]) if test "$enabled_pshm_xpmem$with_pshm" = yesno; then GASNET_PUSHVAR(LIBS,"") GASNET_PUSHVAR(LDFLAGS,"") GASNET_PUSHVAR(CPPFLAGS,"") GASNET_CHECK_CRAY_HEADER([xpmem.h], [CRAY_XPMEM_INCLUDE_OPTS], [ found_xpmem_h=yes ],[ found_xpmem_h=yes CPPFLAGS="$CRAY_XPMEM_INCLUDE_OPTS" ],[ AC_CHECK_HEADERS([sn/xpmem.h], [found_xpmem_h=yes], [found_xpmem_h=no]) ]) LDFLAGS="$CRAY_XPMEM_POST_LINK_OPTS" LIBS="-lxpmem" if test $found_xpmem_h = yes; then AC_SEARCH_LIBS(xpmem_get, xpmem, [ if test $have_hugetlbfs = yes; then LIBS="$LIBS $HUGETLBFS_LIBS" AC_DEFINE(GASNETI_USE_HUGETLBFS) fi GASNET_PSHM_CFLAGS="$CPPFLAGS" GASNET_PSHM_LDFLAGS="$LDFLAGS" GASNET_PSHM_LIBS="$LIBS" AC_CHECK_FUNCS([xpmem_make_2]) AC_DEFINE(GASNETI_PSHM_XPMEM) with_pshm=xpmem ]) fi GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(CPPFLAGS) fi # Next check is for mmap()ed file support on hugetlbfs enabled_pshm_hugetlbfs=no pshm_hugetlbfs_why='User requested' GASNET_IF_ENABLED_WITH_AUTO(pshm-hugetlbfs, [Enable use of hugetlbfs for inter-process shared memory support (default is system dependent)], [enabled_pshm_hugetlbfs=yes], [enabled_pshm_hugetlbfs=no], [ # Default is NO except: # + on HPE Cray EX if available if test "$GASNET_PLATFORM$have_hugetlbfs" = crayexyes; then enabled_pshm_hugetlbfs=yes pshm_hugetlbfs_why='System defaults to' fi ] ) if test "$enabled_pshm_hugetlbfs$with_pshm" = yesno; then if test $enabled_hugetlbfs = no; then GASNET_MSG_ERROR([User requested --enable-pshm-hugetlbfs, but hugetlbfs support was disabled.]) elif test $have_hugetlbfs = no; then GASNET_MSG_ERROR([$pshm_hugetlbfs_why --enable-pshm-hugetlbfs but hugetlbfs support was not found.]) fi AC_DEFINE(GASNETI_PSHM_FILE) AC_DEFINE(GASNETI_USE_HUGETLBFS) GASNET_PSHM_LIBS="$HUGETLBFS_LIBS" with_pshm=hugetlbfs fi # Final check is for mmap()ed file support enabled_pshm_file=no GASNET_IF_ENABLED(pshm-file, [Enable use of mmap()ed temporary files for inter-process shared memory support (default disabled)], [enabled_pshm_file=yes]) if test "$enabled_pshm_file$with_pshm" = yesno; then dnl Currently if requested, this will get used. AC_DEFINE(GASNETI_PSHM_FILE) with_pshm=file fi fi if test "$with_pshm" != no; then AC_DEFINE(GASNETI_PSHM_ENABLED) GASNET_PSHM_ENABLED=yes case "$target_os" in netbsd*) # XXX: We know this is required for decent performance, but WHY?!? # What magic does libpthread perform at library init time? GASNET_PSHM_LIBS="$GASNET_PSHM_LIBS -pthread" # Even if --disable-pthreads ;; esac GASNET_IF_ENABLED([large-pshm], [Enable PSHM support for upto 45k cores per node (default is 255 cores)], [gasnet_pshm_max_nodes=46655], [gasnet_pshm_max_nodes=255]) AC_DEFINE_UNQUOTED(GASNETI_CONFIG_PSHM_MAX_NODES, $gasnet_pshm_max_nodes) elif test "$enabled_pshm" = yes; then GASNET_MSG_ERROR([User requested --enable-pshm but no supported implementation was found]) elif test "$have_hugetlbfs" = yes && \ ( test "$enable_aries" = yes || test "$GASNET_PLATFORM" = crayex ); then # If PSHM is disabled or not found, but hugetlbfs is present on a supported # system, then ensure use of hugetlfs for segment allocation. # To do so, we (ab)use GASNET_PSHM_LIBS which would otherwise be empty. # Currently the supported systems are the Cray XC and HPE Cray EX AC_DEFINE(GASNETI_USE_HUGETLBFS) GASNET_PSHM_LIBS="$HUGETLBFS_LIBS" fi GASNET_SPLIT_LINKER_OPTS(GASNET_PSHM_LDFLAGS,GASNET_PSHM_LIBS) AC_SUBST(GASNET_PSHM_ENABLED) AC_SUBST(GASNET_PSHM_CFLAGS) AC_SUBST(GASNET_PSHM_LDFLAGS) AC_SUBST(GASNET_PSHM_LIBS) # Note that --enable-pshm disables aligned segments ONLY for conduits that USE it GASNETI_DISABLE_ALIGNED_SEGMENTS=0 GASNET_IF_ENABLED([aligned-segments], [Force alignment for GASNet-allocated segment base address. Incompatible with PSHM, heterogeneous clusters and OS address randomization], [RVMFILE="/proc/sys/kernel/randomize_va_space" if test "$segconfig" = everything ; then : # Alignment not applicable to segment-everything elif test -f $RVMFILE && test "`cat $RVMFILE`" != "0" ; then WMSG="$RVMFILE on this node indicates the Linux VM space randomization \ security feature is enabled. If this feature is also enabled on the compute \ nodes, you need to re-run configure without --enable-aligned-segments" GASNET_MSG_WARN([$WMSG]) fi if test "$with_pshm" != no; then AC_MSG_ERROR([--enable-aligned-segments is incompatible with PSHM support. To force aligned segments, add --disable-pshm]) fi ],[ GASNETI_DISABLE_ALIGNED_SEGMENTS=1 AC_DEFINE(GASNETI_DISABLE_ALIGNED_SEGMENTS) ]) AC_CHECK_HEADER([sys/statvfs.h],[AC_CHECK_FUNCS([fstatvfs])]) dnl GASNET_TOOLSONLY_FALSE_END AM_CONDITIONAL(USE_PSHM, test "$with_pshm" != no) ######################################################################## ## CPU feature checks ## Look for potentially buggy MIPS R10k systems # There is a processor erratum to work-around in our atomics :-( # The only SGI products w/ the bad cpus are the "IP27" platforms (Origin 200, Origin 2000, and Onyx 2) # XXX: We could refine this to check the reported cpu revision GASNET_IF_ENABLED_WITH_AUTO(arch-sgi-ip27, Enable/disable work-around for buggy SGI IP27 platforms (Onyx2, Origin200 and Origin2000) (disabled), enabled_sgi_ip27=yes, enabled_sgi_ip27=no, enabled_sgi_ip27=no) if test "$enabled_sgi_ip27" = yes; then AC_DEFINE(GASNETI_ARCH_SGI_IP27) fi # Check how to reference MIPS assembler temporary register ("$1" or "$at") if expr "$target_cpu" : "mips" >/dev/null; then AC_CHECK_HEADERS(sgidefs.h) GASNET_TRY_CACHE_CHECK(for MIPS register '\$[]1', mips_reg_1, [ #define GASNETI_ASM(mnemonic) __asm__ __volatile__ (mnemonic : : : "memory") ], [ GASNETI_ASM(".set noat\n\t" "move \$1,\$0\n\t" ".set at"); ], [AC_DEFINE(GASNETI_HAVE_MIPS_REG_1)]) GASNET_TRY_CACHE_CHECK(for MIPS register '\$at', mips_reg_at, [ #define GASNETI_ASM(mnemonic) __asm__ __volatile__ (mnemonic : : : "memory") ], [ GASNETI_ASM(".set noat\n\t" "move \$at,\$0\n\t" ".set at"); ], [AC_DEFINE(GASNETI_HAVE_MIPS_REG_AT)]) fi ## ARM-specific checks for "kernel helpers" if expr "$target_cpu" : "arm" >/dev/null; then GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") dnl for gasnet_arch_arm.h ## Does ARM kernel have cmpxchg support? if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(GASNETI_HAVE_ARM_CMPXCHG, HAVE_ARM_CMPXCHG) else GASNET_TRY_CACHE_RUN([for ARM cmpxchg kernel support], have_arm_cmpxchg, [ #define GASNETI_IN_CONFIGURE 1 #define CHECK_ARM_CMPXCHG 1 #include "gasnet_arch_arm.h" int main(void) { return gasneti_arm_cmpxchg_check(); } ], [GASNETI_HAVE_ARM_CMPXCHG=1] , [GASNETI_HAVE_ARM_CMPXCHG=0]) fi if test $GASNETI_HAVE_ARM_CMPXCHG = 1; then AC_DEFINE(GASNETI_HAVE_ARM_CMPXCHG) fi ## Does ARM kernel have membar support? if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(GASNETI_HAVE_ARM_MEMBAR, HAVE_ARM_MEMBAR) else GASNET_TRY_CACHE_RUN([for ARM membar kernel support], have_arm_membar, [ #define GASNETI_IN_CONFIGURE 1 #define CHECK_ARM_MEMBAR 1 #include "gasnet_arch_arm.h" int main(void) { return gasneti_arm_membar_check(); } ], [GASNETI_HAVE_ARM_MEMBAR=1] , [GASNETI_HAVE_ARM_MEMBAR=0]) fi if test $GASNETI_HAVE_ARM_MEMBAR = 1; then AC_DEFINE(GASNETI_HAVE_ARM_MEMBAR) fi GASNET_POPVAR(CPPFLAGS) fi ## Check support for AARCH64 real time counter if test "$target_cpu" = "aarch64" ; then GASNET_TRY_CACHE_CHECK(for aarch64 virtual timer count register, aarch64_cntvct_el0, [ #include #include ], [ uint64_t tick, freq; __asm__ __volatile__ ("isb\n\t" "mrs %0,CNTVCT_EL0" : "=r" (tick) : /* no inputs */ : "memory"); __asm__ __volatile__ ("mrs %0,CNTFRQ_EL0" : "=r" (freq)); return !tick || !freq; /* Fail if either register is zero */ ], [AC_DEFINE(GASNETI_HAVE_AARCH64_CNTVCT_EL0)]) fi ## Do CC/gas and CPU support "cmpxchg16b"? if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(GASNETI_HAVE_X86_CMPXCHG16B,HAVE_X86_CMPXCHG16B,[probe]) if test "$GASNETI_HAVE_X86_CMPXCHG16B" = '1'; then AC_DEFINE(GASNETI_HAVE_X86_CMPXCHG16B) fi fi if test "$cross_compiling" = 'no' -o "$GASNETI_HAVE_X86_CMPXCHG16B" = 'probe' ; then GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") dnl for gasnet_portable_platform.h GASNET_TRY_CACHE_RUN_WITHCC([for x86-64 cmpxchg16b support],[x86_64_cmpxchg16b],[ #include "gasnet_portable_platform.h" ],[[ #if PLATFORM_ARCH_X86_64 #if PLATFORM_COMPILER_GNU || PLATFORM_COMPILER_INTEL || \ PLATFORM_COMPILER_PATHSCALE || PLATFORM_COMPILER_PGI || \ PLATFORM_COMPILER_OPEN64 || PLATFORM_COMPILER_CLANG || \ PLATFORM_COMPILER_NVHPC unsigned long *array[3]; volatile unsigned long *p = (void *)(((unsigned long)array + 15) & ~(unsigned long)15); /* Note oldhi selected to detect bug 2408 (anything in upper 32bits) */ register unsigned long oldlo = 0; register unsigned long oldhi = 0x1234llu << 32; register unsigned long newlo = 1234; register unsigned long newhi = 5678; register unsigned char result; p[0] = oldlo; p[1] = oldhi; __asm__ __volatile__ ( "lock; " "cmpxchg16b %1 \n\t" "sete %0 " : "=q" (result), "=m" (*p), "+&a" (oldlo), "+&d" (oldhi) : "b" (newlo), "c" (newhi) : "cc", "memory"); /* Want SUCCESS and changed values */ return (!result || (p[0] != 1234) || (p[1] != 5678)); #else /* Don't know, but also don't currently care */ return 1; #endif #else #error wrong CPU architecture #endif ]], [AC_DEFINE(GASNETI_HAVE_X86_CMPXCHG16B)]) GASNET_POPVAR(CPPFLAGS) fi ## x86 -fPIC which steals the B register ## XXX: Test currently only correctly identifies PIC mode with using a ## compiler which accepts GNU-style asm - but that is the only ## case where we *currently* care. Test may need some additional ## cases for other compilers in the future. GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") dnl for gasnet_portable_platform.h GASNET_TRY_CACHE_CHECK(for x86 EBX register, x86_ebx, [ #include "gasnet_portable_platform.h" /* For PLATFORM_COMPILER_* */ ], [ #if PLATFORM_ARCH_X86_64 || PLATFORM_ARCH_X86 #if PLATFORM_COMPILER_GNU || PLATFORM_COMPILER_INTEL || \ PLATFORM_COMPILER_PATHSCALE || PLATFORM_COMPILER_PGI || \ PLATFORM_COMPILER_OPEN64 || \ PLATFORM_COMPILER_NVHPC || \ PLATFORM_COMPILER_CLANG __asm__ __volatile__ ("push %0" : : "b" (0)); #else /* Don't know, but fortunately don't currently care */ #endif #else #error wrong CPU architecture #endif ], [AC_DEFINE(GASNETI_HAVE_X86_EBX)]) GASNET_POPVAR(CPPFLAGS) ## Does 32-bit SPARC compiler understand "U" and "h" register classes? if expr "$GASNETI_PTR_BITS$target_cpu" : "32sparc" >/dev/null; then GASNET_TRY_CACHE_CHECK([for 64-bit SPARC asm support], have_sparc32_64bit_asm, [] ,[ unsigned long long u, v; volatile unsigned long long *p = &u; register int retval; register int tmp = 0; __asm__ __volatile__ ( "std %1, %0" : "=m"(*p) : "U"(v) ); __asm__ __volatile__ ( "clr %0 \n\tmovrz %1,1,%0" : "=&h"(retval), "+h"(tmp) ); ], [AC_DEFINE(GASNETI_HAVE_SPARC32_64BIT_ASM)]) fi ## Spinloop hints GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other") dnl for gasnet_portable_platform.h # need to run here because some OS's (Solaris/x86) forbid the pause instruction GASNET_TRY_CACHE_RUN_WITHCC(for x86 pause instruction,x86_pause_instruction, [ #include "gasnet_portable_platform.h" #if PLATFORM_COMPILER_SUN #define GASNETI_ASM(mnemonic) __asm(mnemonic) #else /* All remaining x86/x86-64 compilers support GNU-style ASM or none at all */ #define GASNETI_ASM(mnemonic) __asm__ __volatile__ (mnemonic : : : "memory") #endif ], [ #if PLATFORM_ARCH_X86_64 || PLATFORM_ARCH_X86 GASNETI_ASM("pause"); #else #error wrong CPU architecture #endif ], [AC_DEFINE(GASNETI_PAUSE_INSTRUCTION, "pause")]) GASNET_POPVAR(CPPFLAGS) ## Misc. builtins (e.g. for bit manipilation) GASNET_TRY_CACHE_LINK(for __builtin_clz, cc_has_builtin_clz, [unsigned int x;], [__builtin_clz(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CLZ)) GASNET_TRY_CACHE_LINK(for __builtin_clzl, cc_has_builtin_clzl, [unsigned long int x;], [__builtin_clzl(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CLZL)) GASNET_TRY_CACHE_LINK(for __builtin_clzll, cc_has_builtin_clzll, [unsigned long long int x;], [__builtin_clzll(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CLZLL)) GASNET_TRY_CACHE_LINK(for __builtin_ctz, cc_has_builtin_ctz, [unsigned int x;], [__builtin_ctz(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CTZ)) GASNET_TRY_CACHE_LINK(for __builtin_ctzl, cc_has_builtin_ctzl, [unsigned long x;], [__builtin_ctzl(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CTZL)) GASNET_TRY_CACHE_LINK(for __builtin_ctzll, cc_has_builtin_ctzll, [unsigned long long int x;], [__builtin_ctzll(x);], AC_DEFINE(GASNETI_HAVE_CC_BUILTIN_CTZLL)) #--------------------------------------------------------------------------------------------------------------- # Linux's PR_SET_PDEATHSIG of interest to both smp-conduit and ssh-spawer # Linux's PR_SET_PTRACER of interest for backtracing if expr "$target_os" : "linux" >/dev/null; then GASNET_IF_DISABLED(pdeathsig, [Support use of Linux-specific prctl(PR_SET_PDEATHSIG) (default is to probe)], [:], [ GASNET_TRY_CACHE_LINK([for PR_SET_PDEATHSIG], pr_set_pdeathsig, [ #include /* to look for unsafe 2.4.x kernels */ #include ],[ struct utsname u; int rc1 = uname(&u); int rc2 = prctl(PR_SET_PDEATHSIG, 0); ],[ AC_DEFINE(HAVE_PR_SET_PDEATHSIG) ]) ]) GASNET_TRY_CACHE_LINK([for PR_SET_PTRACER], pr_set_ptracer, [ #include #ifndef PR_SET_PTRACER #define PR_SET_PTRACER 0x59616d61 /* 'Yama' */ #endif #ifndef PR_SET_PTRACER_ANY #define PR_SET_PTRACER_ANY ((unsigned long)(-1)) #endif ],[ int rc = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); ],[ AC_DEFINE(HAVE_PR_SET_PTRACER) ]) fi #--------------------------------------------------------------------------------------------------------------- # Global disable of fork() (and related calls) on "special" systems. # Conduits may also set GASNETI_NO_FORK individually have_fork=yes GASNET_IF_ENABLED_WITH_AUTO(fork, Allow internal use of fork() and related calls (default is to probe at configure time), [ : ], [ have_fork=no fork_reason="was disabled" ], [ AC_CHECK_FUNCS(fork popen system, [ : ], [ have_fork=no fork_reason="appears to be missing or broken" break])]) if test $have_fork = no; then AC_DEFINE(GASNETI_NO_FORK) fi #--------------------------------------------------------------------------------------------------------------- # Check for overrides of compile-time checks for SMPs # Enable build of SMP-safe libraries (default is off) GASNET_IF_DISABLED_NOHELP(smp-safe, [ GASNET_MSG_WARN([configure --disable-smp-safe is deprecated and may be unsafe. You should only use this option if you really know what you are doing.]) AC_DEFINE(GASNETI_UNI_BUILD) ]) dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_IF_ENABLED(loopback-memsync, Force memory barriers for GASNet local (loopback) puts and gets, [AC_DEFINE(GASNETI_MEMSYNC_ON_LOOPBACK)]) GASNET_IF_ENABLED(throttle-poll, throttle polling threads in multi-threaded configurations to reduce contention (experimental, only implemented in some conduits), [AC_DEFINE(GASNETI_THROTTLE_FEATURE_ENABLED)]) GASNET_WITH(maxeps, [Maximum number of endpoints per-process, subject to per-conduit limits (default is conduit-dependent)], [if expr "${withval}" : "[[1-9]][[0-9]]*" >/dev/null; then AC_DEFINE_UNQUOTED(GASNETI_MAXEPS_CONFIGURE, $withval) else AC_MSG_ERROR([--with-maxeps requires a positive integer argument]) fi], [AC_MSG_ERROR([--with-maxeps requires a positive integer argument])]) dnl GASNET_TOOLSONLY_FALSE_END # FORCED non-default implementations - used mainly for debugging # # NOTE: If adding an "--enable-forced-*" option here, please: # 1) Set enabled_force=yes to trigger the warning below # 2) Add to the "don't trust performance" warning in tests/test.h # 3) If applicable, the corresponding portion of the GASNet config string should # distinguish forced behaviors from default ones. # 4) You probably want a "LINKCONFIG_IDIOTCHECK" as well (might be covered by #3) GASNET_IF_ENABLED(force-generic-atomicops, [Force mutex-based atomic ops (default is platform specific)], [enabled_force=yes; enabled_generic_atomicops=yes]) GASNET_IF_ENABLED(force-os-atomicops, [Force os-provided atomic ops (default is platform specific)], [enabled_force=yes; enabled_os_atomicops=yes]) GASNET_IF_ENABLED(force-compiler-atomicops, [Force compiler-provided atomic ops (default is platform specific)], [enabled_force=yes; enabled_compiler_atomicops=yes]) if test -z "$enabled_generic_atomicops$enabled_os_atomicops$enabled_compiler_atomicops"; then : # Nothing to do elif test "$enabled_generic_atomicops$enabled_os_atomicops$enabled_compiler_atomicops" != yes; then AC_MSG_ERROR([You may request at most one of --enable-force-generic-atomicops, --enable-force-os-atomicops, --enable-force-compiler-atomicops]) elif test -n "$enabled_generic_atomicops" ; then AC_DEFINE(GASNETI_FORCE_GENERIC_ATOMICOPS) elif test -n "$enabled_os_atomicops"; then AC_DEFINE(GASNETI_FORCE_OS_ATOMICOPS) elif test -n "$enabled_compiler_atomicops"; then AC_DEFINE(GASNETI_FORCE_COMPILER_ATOMICOPS) fi # Check for clock_gettime GASNET_TRY_CACHE_CHECK(for clock_gettime(), cc_has_clock_gettime, [ #include ], [ struct timespec tm; int rc = clock_gettime(CLOCK_REALTIME,&tm); ], AC_SEARCH_LIBS(clock_gettime, [rt posix4], [ AC_DEFINE(HAVE_CLOCK_GETTIME) have_clock_gettime=yes ], AC_MSG_RESULT(entry point not found - disabled))) # Timer configuration use_timers=native if test x"$enabled_valgrind" = x"yes" ; then # valgrind emulation degrades timer calibration and reliability, default to posixrt use_timers=posixrt fi AC_DEFUN([GASNET_CHECK_TIMER_OPTION],[ if test -n "$force_timers" ; then AC_MSG_ERROR([You may request at most one of: --enable-force-gettimeofday --enable-force-posix-realtime --enable-force-native-timers]) fi force_timers=1 ]) GASNET_IF_ENABLED(force-native-timers, [Force use of "native" timers (default is platform-specific)], [# don't enabled_force here because the warning makes no sense for this case use_timers=native GASNET_CHECK_TIMER_OPTION]) GASNET_IF_ENABLED(force-gettimeofday, [Force use of gettimeofday() for timers (default is platform-specific)], [if test "$use_timers" != gettimeofday; then enabled_force=yes; use_timers=gettimeofday fi GASNET_CHECK_TIMER_OPTION]) GASNET_IF_ENABLED(force-posix-realtime, [Force use of clock_gettime() for timers (default is platform-specific)], [if test "$use_timers" != posixrt; then enabled_force=yes; use_timers=posixrt fi GASNET_CHECK_TIMER_OPTION]) case "$use_timers" in native) : ;; gettimeofday) AC_DEFINE(GASNETI_FORCE_GETTIMEOFDAY) ;; posixrt) if test x$have_clock_gettime != xyes; then AC_MSG_ERROR([No support found for posix-realtime timers. Try --enable-force-gettimeofday or --enable-force-native-timers]) fi AC_DEFINE(GASNETI_FORCE_POSIX_REALTIME) ;; *) AC_MSG_ERROR([Internal error in timer configuration]) ;; esac GASNET_IF_ENABLED(force-yield-membars, [Force a sched_yield() call in memory barriers (disabled by default)], [enabled_force=yes; enabled_yield_membars=yes]) GASNET_IF_ENABLED(force-slow-membars, [Force function call based (non-inline) memory barriers (disabled by default)], [enabled_force=yes; enabled_slow_membars=yes]) if test "$enabled_yield_membars$enabled_slow_membars" = yesyes; then AC_MSG_ERROR([You cannot request both --enable-force-yield-membars and --enable-force-slow-membars]) elif test -n "$enabled_yield_membars" ; then AC_DEFINE(GASNETI_FORCE_YIELD_MEMBARS) elif test -n "$enabled_slow_membars" ; then AC_DEFINE(GASNETI_FORCE_SLOW_MEMBARS) fi GASNET_IF_ENABLED(force-true-weakatomics, [Force use of real atomic operations in sequential code (disabled by default)], [enabled_force=yes; AC_DEFINE(GASNETI_FORCE_TRUE_WEAKATOMICS)] ) GASNET_IF_ENABLED(force-generic-semaphores, [Force mutex-based semaphores (default is platform specific)], [enabled_force=yes; AC_DEFINE(GASNETI_FORCE_GENERIC_SEMAPHORES)] ) if test "$enabled_force" = yes; then GASNET_MSG_WARN([ ----------------------------------------------------------------------- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING You have configured with one or more --enable-force-* options This usually has a SERIOUS impact on performance, so you should NOT trust any performance numbers obtained from programs built using this GASNet installation!!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -----------------------------------------------------------------------]) fi #--------------------------------------------------------------------------------------------------------------- ## Determine our atomics "family" ## Must follow all potentially relevant probes of asm support and "force" option AC_DEFUN([GASNET_GET_ATOMIC_IMPL],[ pushdef([uppername],translit($1,'a-z','A-Z')) GASNET_TRY_CACHE_EXTRACT_EXPR([$1 implementation family (binary probe)], uppername[]_IMPL, [#include "gasnet_portable_platform.h" #define GASNETI_IN_CONFIGURE 1 #include "gasnet_atomic_fwd.h"], GASNETI_[]uppername[]_IMPL, GASNETI_[]uppername[]_IMPL_CONFIGURE) AC_DEFINE_UNQUOTED(GASNETI_[]uppername[]_IMPL_CONFIGURE, $GASNETI_[]uppername[]_IMPL_CONFIGURE) # Must keep the following consistent with gasnet_atomic_fwd.h case $GASNETI_[]uppername[]_IMPL_CONFIGURE in 0) GASNETI_[]uppername[]_IMPL_STR=generic;; 1) GASNETI_[]uppername[]_IMPL_STR=native;; 2) GASNETI_[]uppername[]_IMPL_STR=os;; 3) GASNETI_[]uppername[]_IMPL_STR=compiler;; 4) GASNETI_[]uppername[]_IMPL_STR=hybrid;; 5) GASNETI_[]uppername[]_IMPL_STR=native;; # 5="special" is native but not inline *) GASNET_MSG_ERROR([Invalid GASNETI_[]uppername[]_IMPL detected]) ;; esac popdef([uppername]) ]) GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR -I$TOP_SRCDIR/other") GASNET_GET_ATOMIC_IMPL(atomic) GASNET_GET_ATOMIC_IMPL(atomic32) GASNET_GET_ATOMIC_IMPL(atomic64) GASNET_POPVAR(CPPFLAGS) if test "$GASNETI_ATOMIC_IMPL_STR" = "$GASNETI_ATOMIC32_IMPL_STR" && test "$GASNETI_ATOMIC_IMPL_STR" = "$GASNETI_ATOMIC64_IMPL_STR"; then atomics_config="$GASNETI_ATOMIC_IMPL_STR" else atomics_config="$GASNETI_ATOMIC_IMPL_STR,${GASNETI_ATOMIC32_IMPL_STR}32,${GASNETI_ATOMIC64_IMPL_STR}64" fi dnl Logic to check for certain atomics implementation(s) dnl dnl CHECK_ATOMICS(match-list, action-on-match, action-on-no-match) dnl Note: action-on-no-match runs with $check_atomics_msg set AC_DEFUN([CHECK_ATOMICS],[ check_atomics_match='' for check_atomics_val in [$1]; do if test $GASNETI_ATOMIC_IMPL_STR = $check_atomics_val; then check_atomics_match=1 break fi done if test -n "$check_atomics_match"; then : $2 else if test -n "$enabled_generic_atomicops" ; then check_atomics_msg='user passed --enable-force-generic-atomicops' elif test -n "$enabled_os_atomicops"; then check_atomics_msg='user passed --enable-force-os-atomicops' else check_atomics_msg="this platform has defaulted to '$GASNETI_ATOMIC_IMPL_STR' atomicops" fi $3 unset check_atomics_msg fi unset check_atomics_match ]) #--------------------------------------------------------------------------------------------------------------- # PSHM uses atomics in shared memory for IPC. # So we assume that Generic and O/S atomics are insufficient. # If that is ever not the case, one can add exceptions as needed. dnl GASNET_TOOLSONLY_FALSE_BEGIN if test "$with_pshm" != no; then case "$enabled_pshm" in yes) pshm_how='enabled explicitly by --enable-pshm';; *) pshm_how='auto-enabled';; esac # For all platforms of interest, compiler is equivalent to native CHECK_ATOMICS([native compiler],[],[ GASNET_MSG_ERROR([PSHM support ($pshm_how) requires native atomicops, but $check_atomics_msg]) ]) fi dnl GASNET_TOOLSONLY_FALSE_END #--------------------------------------------------------------------------------------------------------------- # CONDUIT CONFIGURATION UTILITIES #--------------------------------------------------------------------------------------------------------------- # Hack-around to prevent a bogus autoconf 2.58 bug when AC_PROG_CXX is called conditionally below am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_IF_DISABLED(auto-conduit-detect, [Enable/disable automatic detection of supported network conduits (enabled by default)], [enabled_auto_detect=no;_conduit_auto_reason=disabled], [enabled_auto_detect=yes;_conduit_auto_reason=auto]) dnl GASNET_TOOLSONLY_FALSE_END dnl CONDUIT_BEGIN(lowername, conduit_allow, desc) dnl conduit_allow should be a literal [yes|exp|g1|no] to control use of this conduit: dnl yes = normal EX conduit dnl exp = experimental EX conduit (don't auto-detect, warns and requires --enable-conduit or --enable-conduit=probe) dnl g1 = force-disabled: warns directing users to GASNet-1 version of conduit dnl no = completely disabled and hidden dnl sets enabled_ to yes or no for whether conduit should be enabled AC_DEFUN([CONDUIT_BEGIN],[ pushdef([CONDUIT_NAME],[$1]) pushdef([CONDUIT_UPPERNAME],translit($1,'a-z','A-Z')) pushdef([CONDUIT_DESC],[$3]) # bug 1946: prevent confusing cross-conduit error messages GASNET_ERR_CLEANUP pushdef([CONDUIT_IMPLEMENTED],$2) pushdef([CONDUIT_HELP_TAG],[]) ifelse(CONDUIT_IMPLEMENTED,[yes],[ _conduit_list_[]CONDUIT_NAME=yes pushdef([CONDUIT_IMPLEMENTED_HELP],yes) ],CONDUIT_IMPLEMENTED,[exp],[ _conduit_list_[]CONDUIT_NAME=yes pushdef([CONDUIT_IMPLEMENTED_HELP],yes) popdef([CONDUIT_HELP_TAG]) pushdef([CONDUIT_HELP_TAG],[**EXPERIMENTAL**]) ],CONDUIT_IMPLEMENTED,[g1],[ _conduit_list_[]CONDUIT_NAME=no pushdef([CONDUIT_IMPLEMENTED_HELP],no) ],CONDUIT_IMPLEMENTED,[no],[ _conduit_list_[]CONDUIT_NAME=no pushdef([CONDUIT_IMPLEMENTED_HELP],no) ],[m4_fatal([Internal error on CONDUIT_BEGIN($1,conduit_allow=$2)])]) ifelse(CONDUIT_IMPLEMENTED_HELP,[yes],[ GASNET_HELP_OUTPUT([ CONDUIT_NAME[]-conduit options: (CONDUIT_DESC) CONDUIT_HELP_TAG]) ],[ dnl unimplemented conduit help disabled pushdef([GASNET_SUPPRESSHELP],[set]) ]) popdef([CONDUIT_HELP_TAG]) dnl GASNET_TOOLSONLY_FALSE_BEGIN ifelse(CONDUIT_IMPLEMENTED,[no],[ enabled_[]$1=no ],[ GASNET_IF_ENABLED_WITH_AUTO($1, Enable/disable the CONDUIT_DESC ifelse(CONDUIT_IMPLEMENTED,[yes],[(auto-detected)],[]), [enabled_[]$1=yes;force_[]$1=yes; _conduit_reason_[]$1=enabled], [enabled_[]$1=no; _conduit_reason_[]$1=disabled], [ if test "$enable_$1" = "probe" ; then # --enable-conduit=probe overrides --disable-auto-conduit-detect enabled_[]$1=yes; _conduit_reason_[]$1=auto else # default enabled_[]$1=$enabled_auto_detect;_conduit_reason_[]$1=$_conduit_auto_reason fi ]) ]) dnl GASNET_TOOLSONLY_FALSE_END dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl enabled_[]$1=no dnl GASNET_TOOLSONLY_TRUE_END ]) dnl CONDUIT_DISALLOW_SEGMENT(segment_type) AC_DEFUN([CONDUIT_DISALLOW_SEGMENT],[ pushdef([upperseg],translit($1,'a-z','A-Z')) if test "$enabled_[]CONDUIT_NAME" = "yes" && expr "$segconfig" : $1 >/dev/null; then msg="CONDUIT_NAME[]-conduit does not support the upperseg shared segment configuration" if test "$force_[]CONDUIT_NAME" = yes ; then GASNET_MSG_ERROR([User requested --enable-CONDUIT_NAME but $msg]) fi GASNET_MSG_WARN([$msg - disabling CONDUIT_NAME]) enabled_[]CONDUIT_NAME=no fi popdef([upperseg]) ]) dnl CONDUIT_HOME(DESC, PROG, DIRS, FILE) dnl Wrapper around GASNET_PACKAGE_HOME() to pass the implicit conduit name AC_DEFUN([CONDUIT_HOME],[ GASNET_FUN_BEGIN([$0($@)]) GASNET_PACKAGE_HOME(CONDUIT_UPPERNAME,$@) GASNET_FUN_END([$0]) ]) dnl CONDUIT_CFLAGS([extra flags]) dnl Wrapper around GASNET_PACKAGE_CFLAGS() to pass the implicit conduit name AC_DEFUN([CONDUIT_CFLAGS],[ GASNET_FUN_BEGIN([$0($@)]) GASNET_PACKAGE_CFLAGS(CONDUIT_UPPERNAME,$@) GASNET_FUN_END([$0]) ]) dnl CONDUIT_LDFLAGS(libnames, [extra flags]) dnl Wrapper around GASNET_PACKAGE_LDFLAGS() to pass the implicit conduit name AC_DEFUN([CONDUIT_LDFLAGS],[ GASNET_FUN_BEGIN([$0($@)]) GASNET_PACKAGE_LDFLAGS(CONDUIT_UPPERNAME,$@) GASNET_FUN_END([$0]) ]) dnl CONDUIT_SPAWNER dnl sets and substitutes GASNET_[CONDUIT_NAME]_SPAWNER_CONF dnl defines GASNETC_[CONDUIT_NAME]_SPAWNER_CONF AC_DEFUN([CONDUIT_SPAWNER],[ pushdef([the_option],--with-[]CONDUIT_NAME[]-spawner) pushdef([the_variable],GASNET_[]CONDUIT_UPPERNAME[]_SPAWNER_CONF) GASNET_WITH(CONDUIT_NAME[]-spawner, [CONDUIT_NAME job spawner ("ssh", "mpi" or "pmi", default is mpi when available)], [case "$withval" in ssh|mpi|pmi) gasnet_spawner_conf=$withval ;; yes) AC_MSG_ERROR([the_option requires an argument ("ssh", "mpi" or "pmi")]) ;; *) AC_MSG_ERROR([the_option argument must be "ssh", "mpi" or "pmi"]) ;; esac], [AC_MSG_ERROR([the_option argument must be "ssh", "mpi" or "pmi"])], [if test "$have_mpi_compat" = yes; then gasnet_spawner_conf=mpi else gasnet_spawner_conf=ssh fi]) if test "$gasnet_spawner_conf$have_mpi_compat" = mpino; then AC_MSG_ERROR([the_option=mpi requires MPI compatibility support which $mpi_compat_reason]) elif test "$gasnet_spawner_conf$have_fork" = sshno; then AC_MSG_ERROR([the_option=ssh requires fork() support which $fork_reason]) elif test "$gasnet_spawner_conf" = pmi; then force_pmi=yes fi AC_DEFINE_UNQUOTED(GASNETC_[]CONDUIT_UPPERNAME[]_SPAWNER_CONF, "$gasnet_spawner_conf") the_variable=$gasnet_spawner_conf AC_SUBST(the_variable) unset gasnet_spawner_conf popdef([the_variable]) popdef([the_option]) ]) dnl CONDUIT_PHYSMEM(default) dnl defines GASNETC_[CONDUIT_NAME]_PHYSMEM_{MAX,PROBE}_CONFIGURE AC_DEFUN([CONDUIT_PHYSMEM],[ pushdef([the_option],--with-[]CONDUIT_NAME[]-physmem-max) GASNET_WITH(CONDUIT_NAME[]-physmem-max, [Maximum physical memory CONDUIT_UPPERNAME may pin: less than 1.0 is fraction of apparent physical memory, larger than 1 is absolute size with optional M, G and T suffix (default is $1)], [if expr "${withval}" : "[[0-9]]" >/dev/null; then : # TODO: stronger validation? AC_DEFINE_UNQUOTED(GASNETC_[]CONDUIT_UPPERNAME[]_PHYSMEM_MAX_CONFIGURE, "$withval") else AC_MSG_ERROR([the_option requires a positive argument]) fi], [AC_MSG_ERROR([the_option requires a positive argument])], [:]) popdef([the_option]) GASNET_IF_ENABLED_WITH_AUTO(CONDUIT_NAME[]-physmem-probe, [Force default enable/disable of GASNET_PHYSMEM_PROBE in CONDUIT_NAME[]-conduit], force_physmem_probe=1, force_physmem_probe=0, force_physmem_probe='') if test -n "$force_physmem_probe"; then AC_DEFINE_UNQUOTED(GASNETC_[]CONDUIT_UPPERNAME[]_PHYSMEM_PROBE_CONFIGURE, $force_physmem_probe) fi ]) dnl CONDUIT_END(test_conduit_enabled) dnl note this may also change enabled_ for (conduit_allow != yes) AC_DEFUN([CONDUIT_END],[ _conduit_enabled_[]CONDUIT_NAME=no if test "$gasnet_toolsonly_mode" = "no" ; then if $1; then case "CONDUIT_IMPLEMENTED" in no) ;; g1) pushdef([EX_UNIMPL_MESSAGE],[It appears your system has the required support for CONDUIT_NAME[]-conduit, however CONDUIT_NAME[]-conduit is not yet fully implemented in this GASNet-EX distribution, If you want to use this conduit, please download the GASNet v1.x distribution from https://gasnet.lbl.gov. Otherwise, you can disable this message with --disable-[]CONDUIT_NAME ]) if test "$force_[]CONDUIT_NAME" = yes ; then GASNET_MSG_ERROR([EX_UNIMPL_MESSAGE]) else # warn and disable enabled_[]CONDUIT_NAME=no GASNET_MSG_WARN([EX_UNIMPL_MESSAGE]) fi popdef([EX_UNIMPL_MESSAGE]) ;; exp) pushdef([EXP_MESSAGE],[CONDUIT_NAME[]-conduit is still experimental, and may have performance and correctness bugs.]) if test "$force_[]CONDUIT_NAME" = yes || test "$enable_[]CONDUIT_NAME" = "probe" ; then GASNET_MSG_WARN([EXP_MESSAGE]) _conduit_enabled_[]CONDUIT_NAME=yes else # warn and disable enabled_[]CONDUIT_NAME=no GASNET_MSG_WARN([It appears your system has the required support for CONDUIT_NAME[]-conduit. However, EXP_MESSAGE You can enable experimental support with --enable-[]CONDUIT_NAME. Otherwise, you can disable this message with --disable-[]CONDUIT_NAME ]) fi popdef([EXP_MESSAGE]) ;; yes) _conduit_enabled_[]CONDUIT_NAME=yes ;; esac else if test "$force_[]CONDUIT_NAME" = yes ; then GASNET_MSG_ERROR([User requested --enable-CONDUIT_NAME but I don't know how to build CONDUIT_NAME programs for your system]) fi if test "$_conduit_reason_[]CONDUIT_NAME" = "auto" ; then _conduit_reason_[]CONDUIT_NAME="not found" fi fi if test "$_conduit_enabled_[]CONDUIT_NAME" = "yes" ; then _conduit_flagstr="ON ($_conduit_reason_[]CONDUIT_NAME)" else _conduit_flagstr="OFF ($_conduit_reason_[]CONDUIT_NAME)" fi _conduit_desc_[]CONDUIT_NAME=" CONDUIT_DESC m4_substr([ ],len(CONDUIT_DESC))$_conduit_flagstr" fi ifelse(CONDUIT_IMPLEMENTED_HELP,[no],[ popdef([GASNET_SUPPRESSHELP]) ]) popdef([CONDUIT_IMPLEMENTED]) popdef([CONDUIT_IMPLEMENTED_HELP]) popdef([CONDUIT_NAME]) popdef([CONDUIT_UPPERNAME]) popdef([CONDUIT_DESC]) ]) dnl CONDUIT_OUTPUT(lowername) AC_DEFUN([CONDUIT_OUTPUT],[ if test "$_conduit_enabled_[]$1" = "yes" ; then CONDUITS="$CONDUITS $1" fi if test "$_conduit_list_[]$1" = "yes" ; then echo "$_conduit_desc_[]$1" >> $CONDUIT_LIST fi ]) AM_CONDITIONAL(TOOLSONLY_MODE, test "$gasnet_toolsonly_mode" = "yes") AM_CONDITIONAL(CONDUIT_MODE, test "$gasnet_toolsonly_mode" = "no") dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl define([GASNET_SUPPRESSHELP],[set]) dnl GASNET_TOOLSONLY_TRUE_END #--------------------------------------------------------------------------------------------------------------- # CODE COMMON TO MULTIPLE CONDUITS #--------------------------------------------------------------------------------------------------------------- dnl find proper CFLAGS for compiling firehose library AC_DEFUN([GASNET_FH_CFLAGS],[ fh_cflags_default="" case "$CC_FAMILY" in GNU) fh_cflags_default="${gcc_flag_prefix}-fno-strict-aliasing";; Pathscale) fh_cflags_default="-fno-strict-aliasing";; Open64) fh_cflags_default="-fno-strict-aliasing";; Clang) fh_cflags_default="-fno-strict-aliasing";; XLC) GASNET_TRY_CFLAG([-qnoansialias -qalias=addr], [fh_cflags_default="-qnoansialias -qalias=addr"]) GASNET_TRY_CFLAG([-qalias=noansi -qalias=addr], [fh_cflags_default="-qalias=noansi -qalias=addr"]) ;; Intel) fh_cflags_default="-no-ansi-alias";; Sun) fh_cflags_default="-xalias_level=any";; NVHPC|PGI) fh_cflags_default="-alias=traditional";; esac GASNET_ENV_DEFAULT(FH_CFLAGS, [$fh_cflags_default], [C flags for building the Firehose memory registration library]) AC_SUBST(FH_CFLAGS) ]) dnl GASNET_ID_OTHER_COMPILER_FAMILY(CCVAR, lang-decr) dnl CCVAR is CXX|MPI_CC AC_DEFUN([GASNET_ID_OTHER_COMPILER_FAMILY],[ pushdef([lowername],translit($1,'A-Z','a-z')) GASNET_FAMILY_CACHE_CHECK([$2], [$1], gasnet_cv_[]lowername[]_family) popdef([lowername]) ]) dnl GASNET_ID_OTHER_COMPILER_PLATFORM(CCVAR, lang-decr) dnl CCVAR is CXX|MPI_CC AC_DEFUN([GASNET_ID_OTHER_COMPILER_PLATFORM],[ GASNET_GET_PLATFORM_ID([$1],[$2 compiler]) mismatch="" if test -z "$[$1]_FAMILY" || test -z "$CC_FAMILY"; then AC_MSG_ERROR([Internal error in ID_OTHER_COMPILER_PLATFORM($1)]) elif test x"$[$1]_FAMILY" != x"$CC_FAMILY"; then mismatch="families" elif test x"$gasnet_cv_PLATFORM_[$1]_VERSION" != x"$gasnet_cv_PLATFORM_COMPILER_VERSION"; then mismatch="version codes" fi if test -n "$mismatch"; then pushdef([outfmt],[$AWK -F'|' '{ printf("%-22s\t%s",[$]2,[$]3); }']) idstr1=`echo "$gasnet_cv_PLATFORM_COMPILER_IDSTR" | outfmt` idstr2=`echo "$gasnet_cv_PLATFORM_[$1]_IDSTR" | outfmt` popdef([outfmt]) GASNET_MSG_WARN([dnl The compiler $mismatch of \$CC and \$[$1] do not match: CC: $idstr1 m4_substr([ ],len([$1]))$1: $idstr2 If this is not what you intended, then set \$[$1] to select a different $2 compiler.]) fi ]) dnl GASNET_LINKHELPER-*: dnl GASNET_LINKHELPER_SETUP(lang-decr) dnl GASNET_LINKHELPER_TRY_{RUN,LINK}(msg,cv_var,includes,body,on_success,on_failure) dnl GASNET_LINKHELPER_CLEANUP() LINKHELPER_BASE=gasnet_conftest_cfunc LINKHELPER_SRC=$LINKHELPER_BASE.c LINKHELPER_OBJ=$LINKHELPER_BASE.o LINKHELPER_LIBS="$LINKHELPER_OBJ $LIBM" LINKHELPER_DECL="extern int linkhelper_cint; extern void linkhelper_cfunc(int val);" LINKHELPER_CODE="linkhelper_cfunc(linkhelper_cint);" if test x"$have_tls" = xyes; then LINKHELPER_TLS_DECL='__thread long tlocal;' LINKHELPER_TLS_CODE='tlocal = 4;' fi AC_DEFUN([GASNET_LINKHELPER_SETUP],[ AC_MSG_CHECKING([building $1 helper object]) cat >$LINKHELPER_SRC <<_GASNET_EOF #include #include #include #include int linkhelper_cint = 0xFFFF; $LINKHELPER_TLS_DECL extern void linkhelper_cfunc(int val) { char s[[255]], s2[[255]]; int a[[40]] = {1}; /* trigger Intel C issue */ assert(val == linkhelper_cint); s[[4]] = '\0'; s[[5]] = (char)(sin((double)val)+cos((double)val))+sqrt((double)val)+log((double)val); strcpy(s2, s); memcpy(s2, s, strlen(s)); memmove(s2, s, strlen(s)); memcpy(s2, s, 4); memmove(s2, s, 4); $LINKHELPER_TLS_CODE } _GASNET_EOF compile="$CC $CFLAGS $CPPFLAGS -c $LINKHELPER_SRC -o $LINKHELPER_OBJ" eval echo "$compile" >&5 if eval $compile 2>&5 && test -s $LINKHELPER_OBJ ; then AC_MSG_RESULT(ok) else GASNET_MSG_ERROR(failed while building $1 helper object) fi ]) AC_DEFUN([GASNET_LINKHELPER_CLEANUP],[ rm -f $LINKHELPER_SRC $LINKHELPER_OBJ ]) AC_DEFUN([GASNET_LINKHELPER_TRY_INNER],[ GASNET_PUSHVAR(LIBS,"$LINKHELPER_LIBS $LIBS") ]GASNET_TRY_CACHE_[$1][($2,$3,[ $4 #ifdef __cplusplus extern "C" { #endif $LINKHELPER_DECL #ifdef __cplusplus } #endif ], [ $LINKHELPER_CODE $5 ],$6,$7) GASNET_POPVAR(LIBS) ]) AC_DEFUN([GASNET_LINKHELPER_TRY_LINK],[GASNET_LINKHELPER_TRY_INNER([LINK],$@)]) AC_DEFUN([GASNET_LINKHELPER_TRY_RUN],[GASNET_LINKHELPER_TRY_INNER([RUN_WITHCC],$@)]) #--------------------------------------------------------------------------------------------------------------- # C++ configuration AC_LANG_SAVE MISC_CXXFLAGS="" # start with a clean slate # Note: autoconf uses CPPFLAGS for both C and C++, so there is NO CXXCPPFLAGS if test "${CXX-__NOT_SET__}" = ""; then have_cxx=no GASNET_MSG_WARN([C++ compiler disabled using --without-cxx]) else # bug 1725: Run GASNET_PROG_CXX with care in case it drops dead (missing C++) # Temporary override of AC_MSG_ERROR is a dirty hack! However, the previous approach # of probing in a subshell eventually ran afoul of autoconf's AC_REQUIRE() rules. pushdef([AC_MSG_ERROR], [have_cxx=no]) have_cxx=yes GASNET_PROG_CXX popdef([AC_MSG_ERROR]) if test "$have_cxx" = no; then GASNET_MSG_WARN([It appears you have no working C++ compiler]) fi if test -n "$CXXFLAGS"; then # embed user-provided CXXFLAGS into CXX for safe-keeping CXX="$CXX $CXXFLAGS" CXXFLAGS="" fi fi if test "$have_cxx" = yes; then AC_LANG_CPLUSPLUS GASNET_ID_OTHER_COMPILER_FAMILY([CXX], [C++]) CXXDEBUGFLAGS="-g" CXXOPTFLAGS="-O2" DEVWARN_CXXFLAGS= GASNET_UDP_LIBS="" gxx_flag_prefix='' gxx_flag_delim=' ' case "$CXX_FAMILY" in GNU) GASNET_GCC_VERSION_CHECK(CXX) case "$CC_SUBFAMILY" in NVIDIA) gxx_flag_prefix='-Xcompiler ' gxx_flag_delim=',' ;; esac case "$target_cpu" in sparc) GASNET_GET_ULTRASPARC_FLAGS(CXX,["-mcpu=ultrasparc3 -mtune=ultrasparc3" "-mcpu=ultrasparc -mtune=ultrasparc"]);; rs6000|powerpc*) GASNET_GET_PPC64_FLAGS(CXX,["-force_cpusubtype_ALL" "-Wa,-mppc64"]);; esac # set CXXDEBUGFLAGS GASNET_PUSHVAR(CXXFLAGS,"${gxx_flag_prefix}-g3") case "$target_os" in darwin*) # Want -gstabs+ instead of -g3, if supported GASNET_TRY_CXXFLAG([${gxx_flag_prefix}-gstabs+], [CXXFLAGS="${gxx_flag_prefix}-gstabs+"]) ;; esac CXXDEBUGFLAGS="$CXXFLAGS" GASNET_POPVAR(CXXFLAGS) ;; NVHPC) # TODO: are either `-M` options, inherited from PGI, still required? # suppress large number of useless default warnings # get inline assembly and sign-extended widening MISC_CXXFLAGS="-w -Masmkeyword -Msignextend" CXXOPTFLAGS="-O1" # TODO: restore -O2 if/when bugs are resolved? (see bug 4158) ;; PGI) MISC_CXXFLAGS="-Masmkeyword -Msignextend" case "$GASNETI_PTR_BITS$target_os" in 64darwin*) # PGI seems to have a different ABI GASNET_TRY_CXXFLAG([-Mllalign], [MISC_CXXFLAGS="$MISC_CXXFLAGS -Mllalign"]) ;; esac GASNET_PGI_VERSION_CHECK(CXX) # DOB: don't force this in client flags by default. The payoff is small and it has potential to break clients # because it's not a valid option for PGI C compilation. GASNET_TRY_CXXFLAG([--display_error_number], [DEVWARN_CXXFLAGS="--display_error_number"]) GASNET_TRY_CXXFLAG([[-Wc,--diag_suppress=177]], [ # Intentionally empty - this is just to test whether surgical warning suppresion is available ], [ MISC_CXXFLAGS="-w $MISC_CXXFLAGS" # old versions of pgc++ have no way to indep control warnings ]) ;; Intel) # Note we need to support both older -wd and newer -diag-disable # Setting CXX_WDFLAG simplifes doing so in later tests GASNET_TRY_CXXFLAG([-diag-disable=654], [CXX_WDFLAG='-diag-disable='], [CXX_WDFLAG='-wd']) MISC_CXXFLAGS="${CXX_WDFLAG}654 ${CXX_WDFLAG}1125 ${CXX_WDFLAG}279" GASNET_TRY_CXXFLAG([${CXX_WDFLAG}1572], [MISC_CXXFLAGS="$MISC_CXXFLAGS ${CXX_WDFLAG}1572"]) ;; XLC) GASNET_GET_PPC64_FLAGS(CXX) GASNET_TRY_CXXFLAG([-qsuppress=1540-0809], # 1540-0809 = empty source file (some linux headers) [MISC_CXXFLAGS="$MISC_CXXFLAGS -qsuppress=1540-0809"]) MISC_CXXFLAGS="$MISC_CXXFLAGS -qeh" ;; Sun) if test "$target_cpu" = "sparc"; then GASNET_GET_ULTRASPARC_FLAGS(CXX,["-xarch=v8plusb" "-xarch=v8plusa" "-xarch=v8plus" "-xarch=sparcvis2" "-xarch=sparcvis" "-xarch=sparc"]) fi CXXOPTFLAGS="-xO2" # Can we go higher to match "-fast -xO5" of CCOPTFLAGS? GASNET_TRY_CXXFLAG([-xlibmopt], [CXXOPTFLAGS="$CXXOPTFLAGS -xlibmopt"]) GASNET_TRY_CXXFLAG([-errtags], [MISC_CXXFLAGS="$MISC_CXXFLAGS -errtags"]) ;; Cray) case "$target_cpu" in x86_64) # XT, XE, XK, XC, etc. CXXDEBUGFLAGS="-g -O0" # consistent with CCDEBUGFLAGS MISC_CXXFLAGS="-hnomessage=236:3185 -hexceptions -hnew_for_init" ;; *) AC_MSG_ERROR(Cray C++ compiler for unknown target CPU) ;; esac ;; Pathscale) GASNET_PATHSCALE_VERSION_CHECK(CXX) CXXDEBUGFLAGS="-g3 -O0" # consistent with CCDEBUGFLAGS CXXOPTFLAGS="-O3" # consistent with CCOPTFLAGS ;; Open64) if test "$GASNETI_PTR_BITS" = 32; then # consistent with CCOPTFLAGS CXXOPTFLAGS="-O1" else CXXOPTFLAGS="-O3 -OPT:wrap_around_unsafe=off" fi CXXDEBUGFLAGS="-g3" ;; Clang) CXXOPTFLAGS="-O3" CXXDEBUGFLAGS="-g -O0" # consistent with CCDEBUGFLAGS ;; esac if test "$BUILDCONFIG" = "optimize" ; then GASNET_OPT_CXXFLAGS="$CXXOPTFLAGS" else GASNET_OPT_CXXFLAGS="$CXXDEBUGFLAGS" fi AC_SUBST(GASNET_OPT_CXXFLAGS) # Add GNU-style warning enable/suppression flags to MISC_CXXFLAGS case "$CXX_FAMILY" in GNU | Pathscale | Open64 | Clang) GASNET_PUSHVAR(CXXFLAGS,"$MISC_CXXFLAGS") GASNET_GET_GNUWARNINGFLAGS(CXX,$CXX_FAMILY,[${gxx_flag_prefix}]) MISC_CXXFLAGS="$CXXFLAGS" GASNET_POPVAR(CXXFLAGS) ;; *) ;; esac if test "$enabled_dev_warnings" = "no" ; then DEVWARN_CXXFLAGS= fi AC_SUBST(DEVWARN_CXXFLAGS) GASNET_ID_OTHER_COMPILER_PLATFORM([CXX], [C++]) # MISC_CXXFLAGS are added to CXXFLAGS here to ensure they are used for the remaining configure tests, # but they retain a separate identity post-configure CXXFLAGS="$GASNET_OPT_CXXFLAGS $MISC_CXXFLAGS" GASNET_CORRECT_OPTIMIZEDDEBUG(CXX,CXXFLAGS,CXX,[$CPPFLAGS],[]) GASNET_ENV_DEFAULT(cxxLIBS,, [Libraries to add when linking C++ code]) GASNET_ENV_DEFAULT(cxxLDFLAGS,, [Linker flags to add when linking C++ code]) GASNET_SPLIT_LINKER_OPTS(cxxLDFLAGS,cxxLIBS) GASNET_UDP_LIBS="$GASNET_UDP_LIBS $cxxLIBS" AC_SUBST(cxxLIBS) AC_SUBST(cxxLDFLAGS) GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $cxxLDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $cxxLIBS") GASNET_TRY_CACHE_VERIFY_RUN( [for working C++ exceptions], cxx_exceptions, [ ], [ try { int *p = new int[[10]]; throw p; return 1; } catch (int *exn) { if (exn) return 0; else return 2; } ], [ "I can\'t figure out how to build and run a program that uses C++ exceptions" ] ) GASNET_CHECK_RESTRICT([GASNETI_CXX],[C++ compiler]) GASNET_CHECK_ASM_SUPPORT([C++ compiler],[CXX]) GASNET_GET_GNU_ATTRIBUTES([GASNETI_HAVE_CXX],[C++ compiler]) GASNET_GET_CXX11_ATTRIBUTES([GASNETI_HAVE_CXX],[C++ compiler]) GASNET_CHECK_BUILTINS([GASNETI_HAVE_CXX],[C++ compiler]) GASNET_TRY_CACHE_CHECK(for __VA_ARGS__ support in C++, cxx_va_args, [ GASNET_VA_ARGS_TEST ], [ ], [ AC_DEFINE(GASNETI_CXX_HAS_VA_ARGS) ]) # we link in an object compiled with CC that uses libc, to ensure that's working # [at least initially this is almost a clone of the MPI helper test] GASNET_LINKHELPER_SETUP([C++]) # Now try to link/run the helper (which was built earlier) GASNET_LINKHELPER_TRY_RUN(for working C++ to C linkage, cxx_works, [], [], [ cxx_helper_worked=yes ], [ cxx_helper_worked=no; GASNET_ERR_SAVE() ] ) # Apple's gcc/g++ don't provide TLS support, but the FSF gcc/g++ do. # The two are link compatible IF we explicitly pass -lgcc_eh # XXX: Really only needed for PAR and PARSYNC, but we don't distinguish. if test "$cxx_helper_worked$have_tls$CC_FAMILY" = noyesGNU; then LIBS="$LIBS $LIBGCC -lgcc_eh" # $LIBGCC appears in $GASNET_LIBS eventually GASNET_LINKHELPER_TRY_RUN(for working C++ to C linkage w/ added -lgcc_eh, cxx_works_gcc_eh, [],[], [ cxx_helper_worked=yes GASNET_UDP_LIBS="$GASNET_UDP_LIBS -lgcc_eh" ], [ cxx_helper_worked=no; GASNET_ERR_SAVE() ] ) fi if test "$cxx_helper_worked" = no; then have_cxx=no GASNET_MSG_WARN([It appears your C++ and C compilers are not link-compatible]) fi GASNET_LINKHELPER_CLEANUP() GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) AC_SUBST(MISC_CXXFLAGS) fi AC_LANG_RESTORE AM_CONDITIONAL(HAVE_CXX, test "$have_cxx" = yes) if test "$have_cxx" = no; then GASNET_MSG_WARN([Disabling udp-conduit, which requires C++]) fi #--------------------------------------------------------------------------------------------------------------- # CONDUIT CONFIGURATIONS #--------------------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------------------- # UDP/AMUDP Configuration CONDUIT_BEGIN(udp,yes,[Portable UDP/IP conduit (udp)]) if test "$enabled_udp" = yes; then if test "$have_cxx" = yes; then # detect libraries necessary for udp-* backends GASNET_PUSHVAR(LIBS,"") AC_SEARCH_LIBS(socket, socket, have_udp=yes, have_udp=no) AC_SEARCH_LIBS(gethostbyname, nsl, , have_udp=no) GASNET_UDP_LIBS="$GASNET_UDP_LIBS $LIBS" # Note: getifaddrs may need -lsocket and -lnsl, but we caught those above AC_CHECK_HEADERS(ifaddrs.h) AC_CHECK_FUNCS(getifaddrs) if test "$have_udp" = yes ; then AC_MSG_CHECKING(for working UDP configuration) # TODO: add a basic test of the UDP configuration to make sure it works # this is a mess because every OS has different headers required udp_test_worked=yes if test "$udp_test_worked" = yes ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) GASNET_MSG_WARN(build test failed: I don't know how to build UDP programs on your system) have_udp=no fi fi GASNET_POPVAR(LIBS) if test "$have_udp" = yes ; then GASNET_ENV_DEFAULT(GASNET_CSPAWN_CMD, "", [See udp-conduit/README]) if test "$GASNET_CSPAWN_CMD" != "" ; then AC_DEFINE_UNQUOTED(GASNET_CSPAWN_CMD, "$GASNET_CSPAWN_CMD") fi fi else have_udp=no fi fi AC_SUBST(GASNET_UDP_LIBS) CONDUIT_END([test "$enabled_udp$have_udp" = yesyes]) AM_CONDITIONAL(USE_UDP_CONDUIT, test "$enabled_udp$have_udp" = yesyes) #--------------------------------------------------------------------------------------------------------------- # MPI/AMMPI Configuration dnl GASNET_TOOLSONLY_FALSE_BEGIN # --enable-mpi-compat controls MPI compatibility in all conduits GASNET_HELP_OUTPUT([ MPI compatibility options:]) GASNET_IF_ENABLED_WITH_AUTO(mpi-compat, Enable/disable MPI compatibility in all conduits (auto-detected), [enabled_mpi_compat=yes;force_mpi_compat=yes], enabled_mpi_compat=no, enabled_mpi_compat=yes) dnl GASNET_TOOLSONLY_FALSE_END # --enable-mpi controls mpi-conduit CONDUIT_BEGIN(mpi,yes,[Portable MPI conduit (mpi)]) if test "$enabled_mpi" = yes || test "$enabled_mpi_compat" = yes; then # user can explicitly configure MPI by setting MPI_CC, MPI_CFLAGS and MPI_LIBS # First step is to provide sane defaults when the user gave us nothing have_mpi=yes # start by assuming they have it DEFAULT_MPI_CFLAGS="$GASNET_OPT_CFLAGS" # default flags, assuming they are the same compiler if false ; then # just for help strings GASNET_ENV_DEFAULT(MPI_CC,, [[The MPI C compiler wrapper]]) GASNET_ENV_DEFAULT(MPI_CFLAGS,, [[Flags to add when compiling MPI C code (overrides auto-detected default)]]) GASNET_ENV_DEFAULT(MPI_LIBS,, [[Libraries to add to the MPI link line]]) GASNET_ENV_DEFAULT(MPIRUN_CMD,, [[Command template for running MPI programs, see mpi-conduit/README for syntax]]) fi case "$target_os" in linux*) if test -n "$GASNETI_ARCH_IBMPE"; then gasnet_mpcc="mpcc -m$GASNETI_PTR_BITS" case "$CC_FAMILY" in GNU) gasnet_mpcc="$gasnet_mpcc -compiler gnu";; XLC) gasnet_mpcc="$gasnet_mpcc -compiler xl";; Intel) gasnet_mpcc="$gasnet_mpcc -compiler intel";; PGI) gasnet_mpcc="$gasnet_mpcc -compiler pgi";; Pathscale) gasnet_mpcc="$gasnet_mpcc -compiler ekopath";; esac GASNET_ENV_DEFAULT(MPI_CC, $gasnet_mpcc) GASNET_ENV_DEFAULT(MPI_LIBS, ) GASNET_ENV_DEFAULT(MPIRUN_CMD, env PAGER=cat MP_FENCE=-- poe %P -nodes %M -procs %N -use_bulk_xfer yes -- %A) else GASNET_ENV_DEFAULT(MPI_CC, mpicc) GASNET_ENV_DEFAULT(MPI_LIBS, ) GASNET_ENV_DEFAULT(MPIRUN_CMD, mpirun -np %N %C) fi ;; *) # unknown OS - if user doesn't provide info, assume generic settings that often work GASNET_ENV_DEFAULT(MPI_CC, mpicc) GASNET_ENV_DEFAULT(MPI_LIBS, ) GASNET_ENV_DEFAULT(MPIRUN_CMD, mpirun -np %N %C) ;; esac if test -z "$MPI_CC" ; then # Avoid unecessary and potentially confusing probes and their errors/warnings have_mpi=no mpi_reason="was disabled" else GASNET_GETFULLPATH(MPI_CC) if command -v $MPI_CC > /dev/null 2>&1; then # figure out a reasonable fallback MPI_CFLAGS for this arch/OS and C99 support # this is complicated by the fact that $MPI_CC may be a different compiler than $CC GASNET_PUSHVAR(CC,"$MPI_CC") GASNET_PUSHVAR(CFLAGS,"") GASNET_PUSHVAR(CPPFLAGS,"") GASNET_PUSHVAR(MISC_CFLAGS,"") GASNET_PUSHVAR(MISC_CPPFLAGS,"") GASNET_PUSHVAR(DEVWARN_CFLAGS,"") AC_MSG_CHECKING(if $MPI_CC appears functional) AC_TRY_COMPILE([],[],[AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no) have_mpi=no mpi_reason="compile test failed" GASNET_MSG_WARN([MPI compiler "$MPI_CC" does not appear to be functional. Consider passing --with-mpi-cc=/path/to/mpicc if you want mpi-conduit or require MPI compatibility]) ]) if test $have_mpi = yes; then GASNET_ID_OTHER_COMPILER_FAMILY([MPI_CC], [MPI]) if test "$BUILDCONFIG" = "debug" ; then SAFE_MPI_CFLAGS="-g" else SAFE_MPI_CFLAGS="-O" fi GASNET_SET_CHECKED_CFLAGS(MPI_CC, MPI_CFLAGS, $DEFAULT_MPI_CFLAGS, $SAFE_MPI_CFLAGS) GASNET_PUSHVAR(CC_FAMILY,"$MPI_CC_FAMILY") GASNET_PUSHVAR(CC,"$MPI_CC $MPI_CFLAGS") # detect MISC for append to user's flags # we re-detect miscflags for MPI_CC, because it may differ from CC GASNET_SET_MISCFLAGS(MPI_CC, [ GASNET_C99_TEST ]) MPI_MISCFLAGS="$MISC_CFLAGS $MISC_CPPFLAGS" GASNET_POPVAR(CC) GASNET_POPVAR(CC_FAMILY) DEVWARN_MPI_CFLAGS="$DEVWARN_CFLAGS" AC_SUBST(DEVWARN_MPI_CFLAGS) MPI_CFLAGS="$GASNET_EXTRA_DEFINES $MPI_CFLAGS $MPI_MISCFLAGS" CFLAGS="$MPI_CFLAGS" # for platform check GASNET_ID_OTHER_COMPILER_PLATFORM([MPI_CC], [MPI]) fi GASNET_POPVAR(CC) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(CPPFLAGS) GASNET_POPVAR(MISC_CFLAGS) GASNET_POPVAR(MISC_CPPFLAGS) GASNET_POPVAR(DEVWARN_CFLAGS) else GASNET_MSG_WARN([MPI compiler "$MPI_CC" was not found. Consider passing --with-mpi-cc=/path/to/mpicc if you want mpi-conduit or require MPI compatibility]) # Avoid unecessary and potentially confusing probes and their errors/warnings MPI_CC= have_mpi=no mpi_reason="was not found" fi fi if test $have_mpi = yes; then GASNET_GETFULLPATH(MPIRUN_CMD) fi # now run a basic test of the MPI configuration to make sure it works if test $have_mpi = yes; then # we link in an object compiled with CC that uses libc, to ensure that's working GASNET_LINKHELPER_SETUP(MPI) # we need a clean slate here because MPI config may be totally different GASNET_PUSHVAR(CC,"$MPI_CC") GASNET_PUSHVAR(CFLAGS,"$MPI_CFLAGS") GASNET_PUSHVAR(CPPFLAGS,"") GASNET_PUSHVAR(LDFLAGS,"") GASNET_PUSHVAR(LIBS,"$MPI_LIBS") # we just try to link an MPI app - running MPI apps is a whole new can of worms pushdef([mpi_header],[ #include #ifdef __cplusplus #error MPI_CC must be a true MPI-enabled ANSI C compiler - a C++ compiler is not an acceptable replacement. #endif ]) pushdef([mpi_body],[ MPI_Init((void*)0,(void*)0); MPI_Finalize(); ]) GASNET_LINKHELPER_TRY_LINK(for working MPI configuration, mpi_works, mpi_header, mpi_body, [ mpi_test_worked=yes ], [ mpi_test_worked=no GASNET_ERR_SAVE() ] ) # Apple's gcc (and thus their mpicc) doesn't provide TLS support, but the # FSF gcc does. The two are link compatible IF we explicitly pass -lgcc_eh # XXX: Really only needed for PAR and PARSYNC, but we don't distinguish. if test "$mpi_test_worked$have_tls$CC_FAMILY" = noyesGNU; then LIBS="$LIBS $LIBGCC -lgcc_eh" # $LIBGCC appears in $GASNET_LIBS eventually GASNET_LINKHELPER_TRY_LINK(for working MPI configuration w/ added -lgcc_eh, mpi_works_gcc_eh, mpi_header, mpi_body, [ mpi_test_worked=yes MPI_LIBS="$MPI_LIBS -lgcc_eh" ], [ mpi_test_worked=no GASNET_ERR_SAVE() ] ) fi GASNET_LINKHELPER_CLEANUP() popdef([mpi_body]) if test "$mpi_test_worked" = yes ; then GASNET_CHECK_RESTRICT([GASNETI_MPI_CC],[MPI_CC]) GASNET_CHECK_ASM_SUPPORT([MPI_CC],[MPI_CC]) GASNET_INLINE_MODIFIER([MPI_CC],[MPI_CC]) GASNET_GET_GNU_ATTRIBUTES([GASNETI_HAVE_MPI_CC],[MPI_CC]) GASNET_CHECK_BUILTINS([GASNETI_HAVE_MPI_CC],[MPI_CC]) if test "$cross_compiling" = "yes" ; then GASNET_TRY_CACHE_EXTRACT_EXPR([MPI_CC for value of MPI_VERSION (binary probe)],MPI_VERSION,mpi_header,MPI_VERSION,GASNETI_MPI_VERSION) if test -z "$GASNETI_MPI_VERSION" ; then # last resort is to use CROSS var GASNET_CROSS_VAR(GASNETI_MPI_VERSION,MPI_VERSION) fi else GASNET_TRY_CACHE_RUN_EXPR([MPI_CC for value of MPI_VERSION], MPI_VERSION, mpi_header, [val = MPI_VERSION;], GASNETI_MPI_VERSION) fi if test -z "$GASNETI_MPI_VERSION" || test 0 = "$GASNETI_MPI_VERSION" ; then # probe failed, assume worst-case MPI-1 GASNETI_MPI_VERSION=1 fi AC_DEFINE_UNQUOTED([GASNETI_MPI_VERSION],[$GASNETI_MPI_VERSION]) # confirm MPI_CC has a working C99 environment (enough to parse gasnet.h) GASNET_TRY_CACHE_CHECK(for working GASNet-required ISO C99 subset in MPI_CC, mpi_gasnet_c99_subset, [ GASNET_C99_TEST ], [], [], [ mpi_test_worked=no GASNET_MSG_WARN(Unable to find sufficient C99 support features in $MPI_CC to build GASNet. You may need to append flags in \$MPI_CC or \$MPI_CFLAGS to enable C99 support) ]) GASNET_TRY_CACHE_LINK(for MPI_Init_thread, have_mpi_init_thread, mpi_header, [{ int required1 = MPI_THREAD_SINGLE; int required2 = MPI_THREAD_FUNNELED; int required3 = MPI_THREAD_SERIALIZED; int required4 = MPI_THREAD_MULTIPLE; int provided = -1; int err = MPI_Init_thread((void*)0,(void*)0,required1,&provided); }], [ AC_DEFINE(HAVE_MPI_INIT_THREAD) ]) GASNET_TRY_CACHE_LINK(for MPI_Query_thread, have_mpi_query_thread, mpi_header, [{ int provided = -1; int err = MPI_Query_thread(&provided); }], [ AC_DEFINE(HAVE_MPI_QUERY_THREAD) ]) else # bug 3443: MPI_CC was rejected, so don't cache information about that compiler # there is no way to "AC_UNDEF" so just ensure compiler mismatch AC_DEFINE(GASNETI_PLATFORM_MPI_CC_ID, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_FAMILYID, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_VERSION, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_IDSTR, "MPI_CC-compiler-rejected") fi GASNET_POPVAR(CC) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(CPPFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) fi if test "$mpi_test_worked" = yes ; then GASNET_CORRECT_OPTIMIZEDDEBUG(MPI_CC,MPI_CFLAGS,MPI_CFLAGS,[], mpi_header, [, or consider passing --without-mpi-cc if an MPI compiler is not required.]) elif test "$mpi_reason" = ""; then GASNET_MSG_WARN([build test failed: I don't know how to build MPI programs on your system -- see $TOP_BUILDDIR/config.log for details: consider setting \$MPI_CC \$MPI_CFLAGS and \$MPI_LIBS to configure MPI support for your site if you want mpi-conduit or require MPI compatibility]) have_mpi=no fi if test "$have_mpi$mpi_reason" = no ; then mpi_reason="was not found" fi if test "$have_mpi" = no ; then # bug 3443: MPI_CC was rejected, ensure we don't cache (potentially incomplete) info about that compiler # there is no way to "AC_UNDEF" so just ensure compiler mismatch AC_DEFINE(GASNETI_PLATFORM_MPI_CC_ID, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_FAMILYID, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_VERSION, 999999) AC_DEFINE(GASNETI_PLATFORM_MPI_CC_IDSTR, "MPI_CC-compiler-rejected") fi popdef([mpi_header]) else have_mpi=no mpi_reason="was disabled" fi AC_SUBST(MPI_CC) # compiler to be used to build AMMPI, and linker for AMMPI-based backends AC_SUBST(MPI_CFLAGS) # compiler flags (optimization, includes, etc) to be used with above compiler when building AMMPI AC_SUBST(MPI_LIBS) # libs and ldflags that must be used when linking AMMPI-based backend # we don't currently GASNET_SPLIT_LINKER_OPTS on MPI_LIBS into MPI_LDFLAGS (which doesn't exist) because # a client can't portably replace the MPI_CC in GASNET_LD and still have a working MPI-enabled link AC_SUBST(MPIRUN_CMD) # prototype command used by gasnetrun to run MPI programs CONDUIT_END([test "$enabled_mpi$have_mpi" = yesyes]) AM_CONDITIONAL(USE_MPI_CONDUIT, test "$enabled_mpi$have_mpi" = yesyes) if test "$enabled_mpi$have_mpi" = yesyes; then have_ammpi=yes fi AM_CONDITIONAL(USE_AMMPI, test "$have_ammpi" = yes) if test "$force_mpi_compat$have_mpi" = yesno ; then GASNET_MSG_ERROR(User requested --enable-mpi-compat but I don't know how to build MPI programs for your system) fi if test "$enabled_mpi_compat$have_mpi" = yesyes ; then have_mpi_compat=yes else have_mpi_compat=no if test "$have_mpi" = yes; then mpi_compat_reason="was disabled" else mpi_compat_reason="$mpi_reason" fi fi AM_CONDITIONAL(USE_MPI_COMPAT, test "$have_mpi_compat" = yes) # USE_MPI == MPI-compatbility or MPI-conduit AM_CONDITIONAL(USE_MPI, test "$have_mpi" = yes) #----------------------------------------------------------------------------------------------- # SMP configuration CONDUIT_BEGIN(smp,yes,[Portable SMP-loopback conduit (smp)]) if test "$enabled_smp" = yes; then if test x"$with_pshm" != xno; then dnl TODO: factor socket related probes AC_CHECK_HEADERS(sys/socket.h) case "$target_os" in solaris*) GASNET_PUSHVAR(LIBS,"") AC_SEARCH_LIBS(socket, socket, have_smp_libs=yes, have_smp_libs=no) if test "x$have_smp_libs" = xyes ; then SMP_LIBS="$LIBS" fi GASNET_POPVAR(LIBS) ;; esac GASNET_PUSHVAR(LIBS,"$LIBS $SMP_LIBS") GASNET_TRY_CACHE_RUN_WITHCC([for socketpair() support], socketpair_works, [ #include #if defined(HAVE_SYS_TYPES_H) #include #endif #if defined(HAVE_SYS_SOCKET_H) #include #endif ], [[ int rc, sv[2]; #if defined(PF_LOCAL) rc = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv); #elif defined(PF_UNIX) rc = socketpair(PF_UNIX, SOCK_STREAM, 0, sv); #else #error #endif if (rc < 0) return 1; ]], [ socketpair_test_worked=yes ], [ socketpair_test_worked=no ]) if test "$socketpair_test_worked" = yes; then AC_DEFINE(GASNETC_USE_SOCKETPAIR) else SMP_LIBS="" fi GASNET_TRY_CACHE_RUN_WITHCC([for O_ASYNC support], o_async_works, [ #include #include #if defined(HAVE_SYS_TYPES_H) #include #endif #if defined(HAVE_SYS_SOCKET_H) #include #endif #include ], [[ int rc, sv[2]; #if !defined(GASNETC_USE_SOCKETPAIR) rc = pipe(sv); #elif defined(PF_LOCAL) rc = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv); #elif defined(PF_UNIX) rc = socketpair(PF_UNIX, SOCK_STREAM, 0, sv); #else #error #endif if (rc < 0) return 1; rc = fcntl(sv[0], F_GETFL); if (rc < 0) return 1; rc = fcntl(sv[0], F_SETFL, rc | O_ASYNC); if (rc < 0) return 1; if (SIGIO == 0) return 1; rc = fcntl(sv[0], F_SETOWN, getpid()); if (rc < 0) return 1; ]], [ o_async_test_worked=yes ], [ o_async_test_worked=no ]) if test "$o_async_test_worked" = yes; then AC_DEFINE(GASNETC_HAVE_O_ASYNC) fi GASNET_POPVAR(LIBS) fi fi AC_SUBST(SMP_LIBS) CONDUIT_END([test "$enabled_smp" = yes]) AM_CONDITIONAL(USE_SMP_CONDUIT, test "$enabled_smp" = yes) #-------------------------------------------------------------------------------------------------------- # UCX configuration # CONDUIT_BEGIN(ucx,exp,[Unified Communication X conduit (ucx)]) CONDUIT_DISALLOW_SEGMENT(everything) if test "$enabled_ucx" = no; then : elif test "$have_fork" = no; then GASNET_MSG_WARN([ucx-conduit requires fork() ($fork_reason) for startup - disabling ucx]) elif test "$have_pthread" = no; then GASNET_MSG_WARN([ucx-conduit requires libpthread ($pthread_reason) - disabling ucx]) else # # Either UCX was required explicitly, or we just need to probe for its existence # have_ucx=yes # assume success CONDUIT_HOME([UCX library], [ucx_info], [/opt/mellanox/ucx], [include/ucp/api/ucp.h]) CONDUIT_CFLAGS GASNET_ENV_DEFAULT(UCX_LIBS, -lucp -lucs -luct -lucm) CONDUIT_LDFLAGS(ucp) GASNET_SPLIT_LINKER_OPTS(UCX_LDFLAGS,UCX_LIBS) # Try to compile and link a basic UCX program GASNET_PUSHVAR(CFLAGS,"$CFLAGS $UCX_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $UCX_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $UCX_LIBS") GASNET_TRY_CACHE_LINK(for working UCX configuration, ucx_works, [ #include ], [{ unsigned major_version, minor_version, release_number; ucp_get_version(&major_version, &minor_version, &release_number); }], [ : ], [ have_ucx=no; GASNET_ERR_SAVE() ] ) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) ucx_max_med_dflt=`expr 4096 - 40 - 64` # 40 = fixed header, 64 = 16x 4-byte args GASNET_WITH(ucx-max-medium,[Specify gex_LUB*Medium() for ucx-conduit (default $ucx_max_med_dflt)], [if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 && \ expr "$withval" '>=' 512 >/dev/null 2>&1 ; then ucx_max_medium="$withval" else AC_MSG_ERROR([--with-ucx-max-medium="$withval" is not legal. Value must no smaller than 512.]) fi], [AC_MSG_ERROR([--with-ucx-max-medium must be no smaller than 512])], [ucx_max_medium=$ucx_max_med_dflt]) AC_DEFINE_UNQUOTED(GASNETC_UCX_MAX_MEDIUM_DFLT, [$ucx_max_medium]) CONDUIT_SPAWNER fi AC_SUBST(UCX_CFLAGS) AC_SUBST(UCX_LDFLAGS) AC_SUBST(UCX_LIBS) CONDUIT_END([test "$enabled_ucx$have_ucx" = yesyes]) AM_CONDITIONAL(USE_UCX_CONDUIT, test "$enabled_ucx$have_ucx" = yesyes) #-------------------------------------------------------------------------------------------------------- # IBV configuration CONDUIT_BEGIN(ibv,yes,[InfiniBand IB Verbs conduit (ibv)]) if test "$enabled_ibv$have_mpi_compat$have_fork" = yesnono; then enabled_ibv=no GASNET_MSG_WARN([ibv-conduit requires either MPI compatibility ($mpi_compat_reason) or fork() ($fork_reason) for startup - disabling ibv]) fi if test "$enabled_ibv" = yes; then # Start by assuming we do have IBV have_ibv=yes CONDUIT_HOME([IB Verbs library], [ibv_devinfo], [/usr/local/ofed /opt/ofed], [include/infiniband/verbs.h]) CONDUIT_CFLAGS GASNET_ENV_DEFAULT(IBV_LIBS, -libverbs) CONDUIT_LDFLAGS(ibverbs) GASNET_SPLIT_LINKER_OPTS(IBV_LDFLAGS,IBV_LIBS) # Try to compile and link a basic IB Verbs program GASNET_PUSHVAR(CFLAGS,"$CFLAGS $IBV_CFLAGS $GASNET_THREAD_DEFINES") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $IBV_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $IBV_LIBS $GASNET_THREAD_LIBS") GASNET_TRY_CACHE_LINK(for working IB Verbs configuration, ibv_works, [ #if defined(__GNUC__) && !defined(inline) /* ANSI-ify the verbs headers */ #define inline __inline__ #include #undef inline #else #include #endif ], [{ struct ibv_device device; const char *s = ibv_get_device_name(&device); }], [ : ], [ have_ibv=no; GASNET_ERR_SAVE() ] ) # For all platforms of interest, compiler is equivalent to native AC_MSG_CHECKING(for appropriate atomics support required by ibv-conduit) CHECK_ATOMICS([native compiler],[ AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) GASNET_MSG_WARN([ibv-conduit requires native atomicops, but $check_atomics_msg]) have_ibv=no ]) if test "$have_ibv" = yes; then GASNET_TRY_CACHE_LINK(for ibv_device.transport_type, ibv_transport_type, [ #if defined(__GNUC__) && !defined(inline) /* ANSI-ify the verbs headers */ #define inline __inline__ #include #undef inline #else #include #endif ], [ struct ibv_device device; device.transport_type = IBV_TRANSPORT_IB; ], [ AC_DEFINE(HAVE_IBV_TRANSPORT_TYPE) ] ) AC_CHECK_FUNCS(ibv_wc_status_str) fi GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) if test "$have_ibv" = yes; then # XXX: Need to support older (get_devices) interface at some point? #GASNET_PUSHVAR(LIBS,"$LIBS $IBV_LDFLAGS") #AC_SEARCH_LIBS(ibv_get_device_list, ibverbs, AC_DEFINE(HAVE_IBV_GET_DEVICE_LIST)) #AC_SEARCH_LIBS(ibv_get_devices, ibverbs, AC_DEFINE(HAVE_IBV_GET_DEVICES)) #GASNET_POPVAR(LIBS) # Since we are using firehose we need to disable certain optimizations. # See bug #350 for an example of why firehose needs this. # See bug #596 or #1031 for evidence that InfiniBand is affected by this. # See bug #1052 for evidence that xlc is affected. GASNET_FH_CFLAGS # Collect IB-specifc configure options GASNET_IF_ENABLED_WITH_AUTO(ibv-rcv-thread, [See ibv-conduit/README (enabled by default if pthreads available)], [enabled_ibv_rcv_thread=yes if test "$have_pthread" = no; then AC_MSG_ERROR([--enable-ibv-rcv-thread requires pthread support but pthreads $pthread_reason]) fi], [enabled_ibv_rcv_thread=no], [enabled_ibv_rcv_thread=$have_pthread]) if test "$enabled_ibv_rcv_thread" = yes; then AC_DEFINE(GASNETC_IBV_RCV_THREAD) fi GASNET_IF_ENABLED_WITH_AUTO(ibv-conn-thread, [See ibv-conduit/README (enabled by default if pthreads available)], [enabled_ibv_conn_thread=yes if test "$have_pthread" = no; then AC_MSG_ERROR([--enable-ibv-conn-thread requires pthread support but pthreads $pthread_reason]) fi], [enabled_ibv_conn_thread=no], [enabled_ibv_conn_thread=$have_pthread]) if test "$enabled_ibv_conn_thread" = yes; then AC_DEFINE(GASNETC_IBV_CONN_THREAD) fi CONDUIT_SPAWNER # Multirail support options # ibv-conduit/README explains the interactions gasnetc_ibv_max_hcas=2 enabled_ibv_multirail=no GASNET_WITH(ibv-max-hcas, [Maximum number of IBV HCAs to open (default is 1)], [if expr "${withval}" : "[[1-9]][[0-9]]*" >/dev/null; then gasnetc_ibv_max_hcas="$withval" enabled_ibv_multirail=yes else AC_MSG_ERROR([--with-ibv-max-hcas requires a positive integer argument]) fi], [AC_MSG_ERROR([--with-ibv-max-hcas requires a positive integer argument])], [:]) GASNET_IF_ENABLED_WITH_AUTO(ibv-multirail, [Enable IBV over multiple HCAs. Use of --with-ibv-max-hcas=N is prefered (see ibv-conduit/README for more info).], enabled_ibv_multirail=yes, enabled_ibv_multirail=no) if test "$enabled_ibv_multirail" = yes; then AC_DEFINE_UNQUOTED(GASNETC_IBV_MAX_HCAS_CONFIGURE, $gasnetc_ibv_max_hcas) fi ibv_fenced_puts=0 GASNET_WITH(ibv-fenced-puts, [Default value of GASNET_USE_FENCED_PUTS environment variable for ibv-conduit (default is 0)], [ case $withval in yes) ibv_fenced_puts=1;; 0|1) ibv_fenced_puts=$withval;; *) AC_MSG_ERROR([Optional argument to --with-ibv-fenced-puts must be 0 or 1]);; esac], [ibv_fenced_puts=0], [ibv_fenced_puts=1]) AC_DEFINE_UNQUOTED(GASNETC_IBV_FENCED_PUTS_CONFIGURE, $ibv_fenced_puts) # Default GASNET_IBV_PORTS GASNET_WITH(ibv-ports, [Default value of GASNET_IBV_PORTS environment variable (default is empty)], [if test "$withval" = 'yes'; then AC_MSG_ERROR([--with-ibv-ports requires an argument]) else AC_DEFINE_UNQUOTED(GASNETC_IBV_PORTS_CONFIGURE, "$withval") fi]) CONDUIT_PHYSMEM("2/3") GASNET_IF_DISABLED([ibv-srq], [Disable Shared Receive Queue (SRQ) support in ibv-conduit (enabled by default)], [enabled_ibv_srq=no], [AC_DEFINE(HAVE_IBV_SRQ)]) GASNET_IF_ENABLED_WITH_AUTO([ibv-xrc], [Enable/disable eXtended Reliable Connection (XRC) support in ibv-conduit (default is to probe)], [enabled_ibv_xrc="yes"; force_ibv_xrc="yes"], [enabled_ibv_xrc="no"], [enabled_ibv_xrc="yes"]) if test "x$enabled_ibv_srq" = xno; then if test "x$force_ibv_xrc" = xyes; then GASNET_MSG_ERROR([IBV XRC support was requested with --enable-ibv-xrc but requires SRQ support which has been disabled]) fi elif test "x$with_pshm" = xno; then if test "x$force_ibv_xrc" = xyes; then GASNET_MSG_ERROR([IBV XRC support was requested with --enable-ibv-xrc but requires PSHM support which is not enabled]) fi elif test "$enabled_ibv_xrc" = yes; then GASNET_PUSHVAR(LIBS,"$LIBS $IBV_LDFLAGS $IBV_LIBS $GASNET_THREAD_LIBS") AC_CHECK_FUNCS([ibv_open_xrc_domain ibv_cmd_open_xrcd], [have_ibv_xrc=yes], [have_ibv_xrc=no]) GASNET_POPVAR(LIBS) if test "$have_ibv_xrc$force_ibv_xrc" = noyes; then GASNET_MSG_ERROR([IBV XRC support was requested with --enable-ibv-xrc but is not available]) fi fi GASNET_IF_ENABLED_WITH_AUTO([ibv-odp], [Enable/disable On Demand Paging (ODP) support in ibv-conduit (default is to probe)], [enabled_ibv_odp="yes"; force_ibv_odp="yes"], [enabled_ibv_odp="no"; AC_DEFINE(GASNETC_IBV_ODP_DISABLED)], [enabled_ibv_odp="yes"]) if test "$enabled_ibv_odp" = yes; then have_ibv_odp=no GASNET_PUSHVAR(CFLAGS,"$CFLAGS $IBV_CFLAGS $GASNET_THREAD_DEFINES") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $IBV_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $IBV_LIBS $GASNET_THREAD_LIBS") GASNET_TRY_CACHE_LINK([for ibv ODP support (Mellanox)], ibv_odp_support_mlnx, [ #include ], [ struct ibv_exp_device_attr attr; attr.comp_mask = IBV_EXP_DEVICE_ATTR_ODP | IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS; int ret = ibv_exp_query_device(NULL, &attr); int ok = (attr.exp_device_cap_flags & IBV_EXP_DEVICE_ODP) && (attr.odp_caps.general_odp_caps & IBV_EXP_ODP_SUPPORT_IMPLICIT) && (attr.odp_caps.per_transport_caps.rc_odp_caps & IBV_EXP_ODP_SUPPORT_READ) && (attr.odp_caps.per_transport_caps.rc_odp_caps & IBV_EXP_ODP_SUPPORT_WRITE); struct ibv_exp_reg_mr_in x; x.exp_access = IBV_EXP_ACCESS_ON_DEMAND | IBV_EXP_ACCESS_LOCAL_WRITE; x.length = IBV_EXP_IMPLICIT_MR_SIZE; struct ibv_mr *mr = ibv_exp_reg_mr(&x); ], [ have_ibv_odp=yes AC_DEFINE(GASNETC_IBV_ODP_MLNX) ]) GASNET_TRY_CACHE_LINK(for ibv ODP support (RDMA Core), ibv_odp_support_core, [ #include ], [ struct ibv_device_attr_ex attr; attr.comp_mask = 0; int ret = ibv_query_device_ex(NULL, NULL, &attr); int ok = (attr.odp_caps.general_caps & IBV_ODP_SUPPORT) && (attr.odp_caps.general_caps & IBV_ODP_SUPPORT_IMPLICIT) && (attr.odp_caps.per_transport_caps.rc_odp_caps & IBV_ODP_SUPPORT_READ) && (attr.odp_caps.per_transport_caps.rc_odp_caps & IBV_ODP_SUPPORT_WRITE); struct ibv_mr *mr = ibv_reg_mr(NULL, NULL, SIZE_MAX, IBV_ACCESS_ON_DEMAND | IBV_ACCESS_LOCAL_WRITE); ], [ have_ibv_odp=yes AC_DEFINE(GASNETC_IBV_ODP_CORE) ]) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) if test "$have_ibv_odp$force_ibv_odp" = noyes; then GASNET_MSG_ERROR([IBV ODP support was requested with --enable-ibv-odp but is not available]) elif test "$have_ibv_odp" = yes; then AC_DEFINE(GASNETC_IBV_ODP) fi fi GASNET_IF_DISABLED([ibv-serialize-poll-cq], [Disable serialization of CQ polling in ibv-conduit (enabled by default)], [:], [AC_DEFINE(GASNETC_IBV_SERIALIZE_POLL_CQ_CONFIGURE)]) GASNET_WITH(ibv-max-medium, [Specify gasnet_AMMaxMedium() for ibv-conduit (default 65536)], [case "$withval" in 1024|2048|4096|8192|16384|32768|65536|131072|262144) ibv_max_medium="$withval";; *) AC_MSG_ERROR([--with-ibv-max-medium="$withval" is not legal. Value must be a power-of-two between 1024 and 262144, inclusive.]) ;; esac ], [AC_MSG_ERROR([--with-ibv-max-medium must be a power-of-two between 1024 and 262144, inclusive.])], [ibv_max_medium=65536]) AC_DEFINE_UNQUOTED(GASNETC_IBV_MAX_MEDIUM, [$ibv_max_medium]) fi fi AC_SUBST(IBV_CFLAGS) AC_SUBST(IBV_LDFLAGS) AC_SUBST(IBV_LIBS) AM_CONDITIONAL(IBV_SEQ_THREADS, test "$enabled_ibv_rcv_thread$enabled_ibv_conn_thread" != nono) CONDUIT_END([test "$enabled_ibv$have_ibv" = yesyes]) AM_CONDITIONAL(USE_IBV_CONDUIT, test "$enabled_ibv$have_ibv" = yesyes) #-------------------------------------------------------------------------------------------------------- # Aries Conduit CONDUIT_BEGIN(aries,yes,[Cray XC Aries conduit *DEPRECATED* (aries)]) CONDUIT_DISALLOW_SEGMENT(everything) # gni only supported on compute node linux for now (cnl) case "$target" in *-cnl-*) ;; *) if test "$force_aries" != "yes"; then enabled_aries=no fi ;; esac # Now only on Aries (not Gemini) if test "$enabled_aries$GASNET_PLATFORM" = yescrayex; then GASNET_MSG_WARN([HPE Cray EX platform detected. Please --enable-ofi rather than using aries-conduit]) enabled_aries=no elif test "$enabled_aries" = yes; then AC_MSG_CHECKING(for GNI network type) if test "${CRAYPE_NETWORK_TARGET+set}" = set ; then gni_network=${CRAYPE_NETWORK_TARGET} elif test "${XTPE_NETWORK_TARGET+set}" = set ; then gni_network=${XTPE_NETWORK_TARGET} else gni_network="unknown" fi AC_MSG_RESULT($gni_network) if test $gni_network = gemini; then GASNET_MSG_WARN([Cray gemini network software detected, but gemini-conduit has been removed.]) enabled_aries=no fi fi if test "$enabled_aries" = yes; then have_aries=yes # start by assuming we have it GNI_CFLAGS= GNI_LDFLAGS= GNI_LIBS= # We previously setup PMI spawning here, but now the probe for Cray PMI # support has been unified with the generic pmi-spawner probe. # That logic will still ensure lack of Cray PMI will be fatal. # Look for gni_pub.h, allowing for the possibility we are not using the wrapper compiler GASNET_CHECK_CRAY_HEADER([gni_pub.h],[CRAY_GNI_HEADERS_INCLUDE_OPTS],[:],[ GNI_CFLAGS="$GNI_CFLAGS $CRAY_GNI_HEADERS_INCLUDE_OPTS" ]) GNI_LDFLAGS="$GNI_LDFLAGS $CRAY_UGNI_POST_LINK_OPTS" GNI_LIBS="$GNI_LIBS -lugni" if test $have_aries = yes; then # PSHM must be XPMEM, HUGETLBFS or none. AC_MSG_CHECKING(for appropriate pshm support required by Aries) case "$with_pshm" in no) # If none, then we do still get hugetlbfs, fwiw AC_MSG_RESULT(none) ;; xpmem|hugetlbfs) AC_MSG_RESULT(yes - $with_pshm) ;; *) have_aries=no AC_MSG_RESULT(no - have '$with_pshm' but require xpmem or hugetlbfs) ;; esac fi if test $have_aries = yes; then GASNET_SPLIT_LINKER_OPTS(GNI_LDFLAGS,GNI_LIBS) GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS ${GNI_LDFLAGS}") GASNET_PUSHVAR(LIBS,"$LIBS ${GNI_LIBS}") GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS $GNI_CFLAGS") GASNET_TRY_CACHE_LINK(for working Aries configuration, aries_works, [ #include #include #include ], [ gni_cdm_handle_t cdm_hndl; gni_return_t rc = GNI_CdmDestroy(cdm_hndl); ], [ : ], [ have_aries=no; GASNET_ERR_SAVE() ] ) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) GASNET_POPVAR(CPPFLAGS) fi if test $have_aries = yes; then # require PMI spawner probe to find Cray's version force_pmi=yes fi GASNET_IF_ENABLED_WITH_AUTO(aries-udreg, [Use Cray's UDREG to cache memory registration (enabled by default if available)], [gni_udreg=yes], [gni_udreg=no], [gni_udreg=probe]) if test $gni_udreg != no; then # Look for udreg_pub.h, allowing for the possibility we are not using the wrapper compiler GASNET_CHECK_CRAY_HEADER([udreg_pub.h],[CRAY_UDREG_INCLUDE_OPTS],[ AC_DEFINE(GASNETC_GNI_UDREG) ],[ AC_DEFINE(GASNETC_GNI_UDREG) GNI_CFLAGS="$GNI_CFLAGS $CRAY_UDREG_INCLUDE_OPTS" ],[ if test "$gni_udreg" = yes; then AC_MSG_ERROR([--enable-aries-udreg was passed but udreg_pub.h header was not found]) fi ]) GNI_LIBS="$GNI_LIBS $CRAY_UDREG_POST_LINK_OPTS -ludreg" fi GASNET_WITH(aries-max-medium, [specify default value of gasnet_AMMaxMedium() (default 4032)], [tmpval=`echo "$withval" | $AWK '{sub(/^\+/,"");}1'` # strip leading '+' if expr "$tmpval" : '[[0-9]]*$' >/dev/null 2>&1 && \ expr \( "$tmpval" / 64 \) \* 64 = "$tmpval" >/dev/null 2>&1 && expr "$tmpval" '>=' 512 >/dev/null 2>&1 && expr "$tmpval" '<=' 65408 >/dev/null 2>&1 ; then gni_max_medium="$withval" else AC_MSG_ERROR([--with-aries-max-medium="$withval" is invalid. Value must be a multiple of 64, between 512 and 65408, inclusive. Unless prefixed with '+', the value will be rounded-down to the next recommended value. See the aries-conduit README for additional details.]) fi ], [AC_MSG_ERROR([--with-aries-max-medium must be a multiple of 64 and no smaller than 512])], [gni_max_medium=4032]) AC_DEFINE_UNQUOTED(GASNETC_GNI_MAX_MEDIUM_DFLT, ["$gni_max_medium"]) GASNET_IF_ENABLED(aries-multi-domain, [Use experimental multi-domain support in PAR builds], [AC_DEFINE(GASNETC_GNI_MULTI_DOMAIN)]) AC_SUBST(GNI_LDFLAGS) AC_SUBST(GNI_LIBS) AC_SUBST(GNI_CFLAGS) fi CONDUIT_END([test "$enabled_aries$have_aries" = yesyes]) AM_CONDITIONAL(USE_ARIES_CONDUIT, test "$enabled_aries$have_aries" = yesyes) if test "$enabled_aries$have_aries" = yesyes; then GASNET_MSG_WARN([aries-conduit has been deprecated. Please see the aries-conduit README for more information.]) fi #-------------------------------------------------------------------------------------------------------- # Libfabric Conduit # default to not probing ofi-conduit, regardless of enabled_auto_detect if test "${enable_ofi-unset}" = unset; then enable_ofi=no; fi CONDUIT_BEGIN(ofi,yes,[OpenFabrics Interfaces conduit (ofi)]) if test "$enabled_ofi" = yes; then have_ofi=yes CONDUIT_HOME([OFI libfabric], [fi_info], [/usr], [include/rdma/fabric.h]) CONDUIT_CFLAGS GASNET_ENV_DEFAULT(OFI_LIBS, -lfabric) CONDUIT_LDFLAGS(fabric) GASNET_SPLIT_LINKER_OPTS(OFI_LDFLAGS,OFI_LIBS) if test "$have_ofi" = yes; then GASNET_PUSHVAR(CFLAGS,"$CFLAGS $OFI_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $OFI_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $OFI_LIBS") GASNET_TRY_CACHE_LINK(for working OFI GASNet bindings, ofi_works, [ #include ], [{ int rc; rc = fi_getinfo(FI_VERSION(FI_MAJOR_VERSION,FI_MINOR_VERSION), 0, 0, 0, 0, 0); }], [ : ], [ have_ofi=no; GASNET_ERR_SAVE() ] ) if test "$have_ofi" = yes; then GASNET_TRY_CACHE_EXTRACT_EXPR(for libfabric version code, ofi_version,[ #include #ifndef FI_REVISION_VERSION /* first appears in 1.10.0 */ #define FI_REVISION_VERSION 0 #endif ],[(FI_MAJOR_VERSION*10000 + FI_MINOR_VERSION*100 + FI_REVISION_VERSION)],[ofi_version]) AC_MSG_CHECKING(for libfabric 1.5.0 or newer) if test "$ofi_version" -ge 10500; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) have_ofi=no fi fi GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) fi if test "$have_ofi" = yes; then # What we actually care about is GASNETI_HAVE_SPINLOCK, which is available # whenever !GASNETI_ATOMICOPS_NOT_SIGNALSAFE # For all platforms of likely interest, checking (compiler||native) is sufficient. AC_MSG_CHECKING(for appropriate atomics support required by ofi-conduit) CHECK_ATOMICS([native compiler],[ AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) GASNET_MSG_WARN([ofi-conduit requires native atomicops, but $check_atomics_msg]) have_ofi=no ]) fi if test "$have_ofi" = yes; then CONDUIT_SPAWNER ofi_provider="" ofi_define_mr_virt_addr="no" # tri-state: "no" omits "#define", forcing runtime selection ofi_define_mr_prov_key="no" # tri-state: "no" omits "#define", forcing runtime selection ofi_define_use_av_map="no" # tri-state: "no" omits "#define", forcing runtime selection ofi_single_provider="yes" detected_ofi_provider="" ofi_use_thread_domain=0 ofi_use_multi_cq=0 ofi_retry_recvmsg=0 # List of known providers in order of preference. # Presence on this list does not necessarily indicate support status. # Consult ofi-conduit/README for the status of supported libfabric providers. known_providers="cxi psm2 gni verbs;ofi_rxm efa sockets udp;ofi_rxd tcp;ofi_rxm" GASNET_WITH(ofi-provider, [Statically configure ofi-conduit for the given provider], ofi_provider="$withval", ) # Don't autodetect if the user knows which provider they want if test -z "$ofi_provider"; then GASNET_PUSHVAR(PATH, "$OFI_HOME/bin:$PATH") if command -v fi_info > /dev/null 2>&1; then # Only do this if fi_info is in the $PATH for word in $known_providers do if fi_info --provider="$word" > /dev/null 2>&1; then detected_ofi_provider="$word" break fi done ofi_provider="$detected_ofi_provider" fi GASNET_POPVAR(PATH) else unset aliased_ofi_provider case "$ofi_provider" in verbs) aliased_ofi_provider='verbs;ofi_rxm' ;; tcp) aliased_ofi_provider='tcp;ofi_rxm' ;; udp) aliased_ofi_provider='udp;ofi_rxd' ;; *:*) aliased_ofi_provider=`echo "$ofi_provider" | sed -e 's/:/;/'` ;; esac if test "${aliased_ofi_provider+set}" = set ; then GASNET_MSG_WARN([Option --with-ofi-provider='$ofi_provider' converted to --with-ofi-provider='$aliased_ofi_provider']) ofi_provider="$aliased_ofi_provider" fi fi ofi_floor=0 case "$ofi_provider" in psm2) ofi_define_mr_virt_addr=0 ofi_define_mr_prov_key=0 ofi_define_use_av_map=0 ofi_use_thread_domain=1 ;; cxi) ofi_define_mr_virt_addr=0 ofi_define_mr_prov_key=0 ofi_define_use_av_map=0 ofi_use_multi_cq=1 ofi_retry_recvmsg=1 ;; gni) ofi_define_mr_virt_addr=1 ofi_define_mr_prov_key=1 ofi_define_use_av_map=0 ofi_floor=11400 ;; verbs\;ofi_rxm) ofi_define_mr_virt_addr=1 ofi_define_mr_prov_key=1 ofi_define_use_av_map=0 if test "$GASNET_PLATFORM" = crayex; then ofi_floor=11100 else ofi_floor=11200 fi ;; tcp\;ofi_rxm) ofi_define_mr_virt_addr=0 ofi_define_mr_prov_key=0 ofi_define_use_av_map=0 ofi_floor=11500 ;; udp\;ofi_rxd) ofi_define_mr_virt_addr=0 ofi_define_mr_prov_key=0 ofi_define_use_av_map=0 ofi_retry_recvmsg=1 ofi_floor=10700 ;; sockets) ofi_define_mr_virt_addr=0 ofi_define_mr_prov_key=0 ofi_define_use_av_map=0 ;; efa) ofi_define_mr_virt_addr=1 ofi_define_mr_prov_key=1 ofi_define_use_av_map=0 ofi_retry_recvmsg=1 ;; default|generic|"") # NOTE: "default" is deprecated and can be removed when Spack packaging drops 2022.3.0 if test -n "$ofi_provider"; then why="as requested via --with-ofi-provider=$ofi_provider" else why='because no OFI provider was specified via the --with-ofi-provider option and no known provider could be auto-detected' fi GASNET_MSG_WARN([Using runtime provider feature detection in ofi-conduit $why.]) ofi_use_multi_cq=1 ofi_retry_recvmsg=1 ofi_single_provider='no' ;; *) GASNET_IF_ENABLED_NOHELP(allow-unknown-ofi-provider, [ GASNET_MSG_WARN([dnl Unknown OFI provider '$ofi_provider' requested together with '--enable-allow-unknown-ofi-provider'. Runtime provider feature detection and conservative defaults will be used except where overridden via --(en|dis)able-ofi-[[feature]] options.]) ofi_use_multi_cq=1 ofi_retry_recvmsg=1 ], GASNET_MSG_ERROR([Unknown OFI provider '$ofi_provider' requested])) ;; esac if test "$ofi_single_provider" = "yes"; then AC_DEFINE_UNQUOTED(GASNETC_OFI_PROVIDER_LIST, ["$ofi_provider"]) ofi_provider_ident=`echo "$ofi_provider" | cut '-d;' -f1` else AC_DEFINE_UNQUOTED(GASNETC_OFI_PROVIDER_LIST, ["$known_providers"]) ofi_provider_ident="generic" fi AC_DEFINE_UNQUOTED(GASNETC_OFI_PROVIDER_IDENT, [$ofi_provider_ident]) GASNET_IF_ENABLED_WITH_AUTO(ofi-thread-domain, [Indicates if the conduit should use the FI_THREAD_DOMAIN threading model(advanced users only)], [ofi_use_thread_domain="1"], [ofi_use_thread_domain="0"], []) GASNET_IF_ENABLED_WITH_AUTO(ofi-multi-cq, [Indicates if the conduit should use multiple CQs (advanced users only)], [ofi_use_multi_cq="1"], [ofi_use_multi_cq="0"], []) GASNET_IF_ENABLED_WITH_AUTO(ofi-retry-recvmsg, [Indicates if the conduit should allow for retry of fi_recvmsg calls (advanced users only)], [ofi_retry_recvmsg="1"], [ofi_retry_recvmsg="0"], []) GASNET_IF_ENABLED_WITH_AUTO(ofi-mr-virt-addr, [Indicates if the conduit should statically compile FI_MR_VIRT_ADDR support into ofi-conduit (advanced users only)], [ofi_define_mr_virt_addr="1"], [ofi_define_mr_virt_addr="0"], [if test x$enable_ofi_mr_virt_addr = xdynamic; then : # undocumented explict request for dynamic behavior ofi_define_mr_virt_addr=no fi ]) GASNET_IF_ENABLED_WITH_AUTO(ofi-mr-prov-key, [Indicates if the conduit should statically compile FI_MR_PROV_KEY support into ofi-conduit (advanced users only)], [ofi_define_mr_prov_key="1"], [ofi_define_mr_prov_key="0"], [if test x$enable_ofi_mr_prov_key = xdynamic; then : # undocumented explict request for dynamic behavior ofi_define_mr_prov_key=no fi ]) GASNET_IF_ENABLED_WITH_AUTO(ofi-mr-scalable, [DEPRECATED], [ if test -n "${enable_ofi_mr_virt_addr+set}${enable_ofi_mr_prov_key+set}"; then GASNET_MSG_WARN([DEPRECATED option --enable-ofi-mr-scalable has been IGNORED due to use of one or more --(en|dis)able-ofi-mr-* options]) else GASNET_MSG_WARN([option --enable-ofi-mr-scalable is DEPRECATED]) ofi_define_mr_virt_addr="0"; ofi_define_mr_prov_key="0" fi ], [ if test -n "${enable_ofi_mr_virt_addr+set}${enable_ofi_mr_prov_key+set}"; then GASNET_MSG_WARN([DEPRECATED option --disable-ofi-mr-scalable has been IGNORED due to use of one or more --(en|dis)able-ofi-mr-* options]) else GASNET_MSG_WARN([option --disable-ofi-mr-scalable is DEPRECATED]) ofi_define_mr_virt_addr="1"; ofi_define_mr_prov_key="1" fi ], []) # For separate enable/disable documentation: AC_ARG_ENABLE(ofi-av-map,GASNET_OPTION_HELP(enable-ofi-av-map, [Include conduit support for FI_AV_MAP, excluding FI_AV_TABLE (advanced users only)])) AC_ARG_ENABLE(ofi-av-map,GASNET_OPTION_HELP(disable-ofi-av-map, [Include conduit support for FI_AV_TABLE, excluding FI_AV_MAP (advanced users only)])) # Real work (w/o docs) pushdef([GASNET_SUPPRESSHELP],1) GASNET_IF_ENABLED_WITH_AUTO(ofi-av-map, [N/A], [ofi_define_use_av_map="1"], [ofi_define_use_av_map="0"], [if test x$enable_ofi_use_av_map = xdynamic; then : # undocumented explict request for dynamic behavior ofi_define_use_av_map=no fi ]) popdef([GASNET_SUPPRESSHELP]) # Inform the user that settings were autodetected if test -n "$detected_ofi_provider" \ && test "$ofi_define_use_av_map" != "no" \ && test "$ofi_define_mr_virt_addr" != "no" \ && test "$ofi_define_mr_prov_key" != "no"; then GASNET_MSG_WARN([ The $detected_ofi_provider OFI provider was detected on your system and the ofi-conduit has been configured for that provider. If that is not your desired provider, override this by using the --with-ofi-provider= configure flag. See the ofi-conduit README for details.]) fi # Check provider-specific version *after* any $detected_ofi_provider message # # REMINDER: per-provider floors are documented in ofi-conduit/README # and also enforced in ofi-conduit/gasnet_ofi.c:gasnetc_ofi_init() GASNET_IF_ENABLED_NOHELP(allow-untrusted-ofi-provider, [:], [ if test $ofi_version -ne 0; then # NOTE: ofi_floor==0 if no floor is to be enforced AC_MSG_CHECKING([for provider-specific minimum libfabric version]) if test $ofi_version -ge $ofi_floor; then AC_MSG_RESULT([yes]) else have="$(expr $ofi_version / 10000).$(expr $ofi_version / 100 % 100).$(expr $ofi_version % 100)" want="$(expr $ofi_floor / 10000).$(expr $ofi_floor / 100 % 100).$(expr $ofi_floor % 100)" AC_MSG_RESULT([no - provider '$ofi_provider' is untrusted in libfabric version $have (minimum trusted version is $want).]) have_ofi=no fi fi ]) if test "$ofi_define_mr_virt_addr" != "no"; then AC_DEFINE_UNQUOTED(GASNETC_OFI_HAS_MR_VIRT_ADDR_CONFIGURE, ["$ofi_define_mr_virt_addr"]) fi if test "$ofi_define_mr_prov_key" != "no"; then AC_DEFINE_UNQUOTED(GASNETC_OFI_HAS_MR_PROV_KEY_CONFIGURE, ["$ofi_define_mr_prov_key"]) fi if test "$ofi_define_use_av_map" != "no"; then AC_DEFINE_UNQUOTED(GASNETC_OFI_USE_AV_MAP_CONFIGURE, ["$ofi_define_use_av_map"]) fi AC_DEFINE_UNQUOTED(GASNETC_OFI_USE_THREAD_DOMAIN, [$ofi_use_thread_domain]) AC_DEFINE_UNQUOTED(GASNETC_OFI_USE_MULTI_CQ, [$ofi_use_multi_cq]) AC_DEFINE_UNQUOTED(GASNETC_OFI_RETRY_RECVMSG, [$ofi_retry_recvmsg]) GASNET_WITH(ofi-num-completions, [Max number of completions for ofi-conduit to read from a CQ at one time (default 64)], [if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 && \ expr "$withval" '>' 0 >/dev/null 2>&1 ; then ofi_num_completions="$withval" else AC_MSG_ERROR([--with-ofi-num-completions="$withval" is not legal. Value must be greater than 0]) fi ], [ AC_MSG_ERROR([--with-ofi-num-completions must be greater than 0])], [ofi_num_completions=64]) AC_DEFINE_UNQUOTED(GASNETC_OFI_NUM_COMPLETIONS, [$ofi_num_completions]) GASNET_WITH(ofi-max-medium, [gasnet_AMMaxMedium() for the ofi-conduit (default 8192)], [if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 && \ expr "$withval" '>=' 512 >/dev/null 2>&1 ; then ofi_max_medium="$withval" else AC_MSG_ERROR([--with-ofi-max-medium="$withval" is not legal. Value must be no smaller than 512.]) fi ], [AC_MSG_ERROR([--with-ofi-max-medium must be no smaller than 512])], [ofi_max_medium=8192]) AC_DEFINE_UNQUOTED(GASNETC_OFI_MAX_MEDIUM_DFLT, [$ofi_max_medium]) GASNET_IF_ENABLED_NOHELP(ofi-legacy-extended, [AC_DEFINE(GASNETC_OFI_REFERENCE_EXTENDED) GASNET_MSG_WARN([ ----------------------------------------------------------------------- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING You passed --enable-ofi-legacy-extended This is unsupported and usually has a SERIOUS impact on performance. Do not trust any performance numbers obtained from programs built using this GASNet installation!!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -----------------------------------------------------------------------])]) if test "$GASNET_PLATFORM" = crayex; then gex_fi_hmem_minor_floor=11 else gex_fi_hmem_minor_floor=12 fi GASNET_PUSHVAR(CFLAGS,"$CFLAGS $OFI_CFLAGS -DGEX_FI_MINOR_VERSION=$gex_fi_hmem_minor_floor") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $OFI_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $OFI_LIBS") # Probe for fi_mr_regattr() GASNET_TRY_CACHE_LINK(for fi_mr_regattr(), fi_mr_regattr, [ #include ],[ int rc = fi_mr_regattr(NULL, NULL, 0, NULL); ], [ AC_DEFINE(GASNETC_HAVE_FI_MR_REG_ATTR) ] ) # Probe for libfabric kinds support # FI_HMEM_{CUDA,ROCR} identifiers are an enum, so we create HAVE_* feature macros # TODO: allow-list or ban-list providers here? have_fi_hmem_cuda=no have_fi_hmem_rocr=no GASNET_TRY_CACHE_LINK(for FI_HMEM support (libfabric 1.$gex_fi_hmem_minor_floor or newer), have_fi_hmem, [ #include #include #if FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION) < FI_VERSION(1, GEX_FI_MINOR_VERSION) #error "failed check for minimum libfabric version for memory kinds support" #endif ], [{ unsigned long caps = (unsigned long)FI_HMEM; struct fi_mr_attr x; x.iface = FI_HMEM_SYSTEM; (void)(&x.device); }], [ GASNET_TRY_CACHE_LINK(for FI_HMEM_CUDA, have_fi_hmem_cuda, [ #include ], [{ struct fi_mr_attr x; x.iface = FI_HMEM_CUDA; }], [ have_fi_hmem_cuda=yes AC_DEFINE(GASNETC_HAVE_FI_HMEM_CUDA) ]) GASNET_TRY_CACHE_LINK(for FI_HMEM_ROCR, have_fi_hmem_rocr, [ #include ], [{ struct fi_mr_attr x; x.iface = FI_HMEM_ROCR; }], [ have_fi_hmem_rocr=yes AC_DEFINE(GASNETC_HAVE_FI_HMEM_ROCR) ]) GASNET_TRY_CACHE_LINK(for FI_HMEM_ZE, have_fi_hmem_ze, [ #include ], [{ struct fi_mr_attr x; x.iface = FI_HMEM_ZE; }], [ have_fi_hmem_ze=yes AC_DEFINE(GASNETC_HAVE_FI_HMEM_ZE) ]) ]) GASNET_POPVAR(CFLAGS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(LIBS) fi fi AC_SUBST(OFI_CFLAGS) AC_SUBST(OFI_LDFLAGS) AC_SUBST(OFI_LIBS) CONDUIT_END([test "$enabled_ofi$have_ofi" = yesyes]) AM_CONDITIONAL(USE_OFI_CONDUIT, test "$enabled_ofi$have_ofi" = yesyes) AM_CONDITIONAL(HAVE_FI_HMEM_CUDA, test "$have_fi_hmem_cuda" = yes) AM_CONDITIONAL(HAVE_FI_HMEM_ROCR, test "$have_fi_hmem_rocr" = yes) AM_CONDITIONAL(HAVE_FI_HMEM_ZE, test "$have_fi_hmem_ze" = yes) #--------------------------------------------------------------------------------------------------------------- # CONDUIT CONFIGURATIONS FINISH #--------------------------------------------------------------------------------------------------------------- dnl GASNET_TOOLSONLY_TRUE_BEGIN dnl undefine([GASNET_SUPPRESSHELP]) dnl GASNET_TOOLSONLY_TRUE_END CONDUITS= AC_SUBST(CONDUITS) # reporting file output at completion AC_DEFUN([CONDUIT_LIST_FILE], [ if test -n "$CONDUIT_LIST" ; then CONDUIT_LIST_CLEAN=no else CONDUIT_LIST=.gasnet-conduit-list.tmp CONDUIT_LIST_CLEAN=yes fi ]) CONDUIT_LIST_FILE() cat >$CONDUIT_LIST <>$CONDUIT_LIST <>$CONDUIT_LIST < #include #include ], [$gasnet_socklen_try x = 0; getpeername(0,NULL,&x); getsockname(0,NULL,&x);], [gasnet_socklen_t="$gasnet_socklen_try"]) fi done gasnet_cv_socklen_t="$gasnet_socklen_t"]) if test x"$gasnet_cv_socklen_t" = x; then AC_MSG_RESULT([not found]) elif test "$gasnet_cv_socklen_t" = float; then AC_MSG_RESULT([compiler unreliable - defaulting to socklen_t]) AC_DEFINE_UNQUOTED(GASNET_SOCKLEN_T, socklen_t) else AC_MSG_RESULT($gasnet_cv_socklen_t) AC_DEFINE_UNQUOTED(GASNET_SOCKLEN_T, $gasnet_cv_socklen_t) fi # Prefer setpgid(), but unless cross-compiling we can use setpgrp() AC_CHECK_FUNCS(setpgid) if test "$cross_compiling" = "no" ; then AC_CHECK_FUNCS(setpgrp, [AC_FUNC_SETPGRP()]) fi GASNET_WITH(ssh-cmd, [default value for GASNET_SSH_CMD environment variable (default "ssh")], [case "$withval" in yes|no) AC_MSG_ERROR([--with-ssh-cmd requires an argument]) ;; *) gasnet_ssh_cmd="$withval" ;; esac], [AC_MSG_ERROR([--with-ssh-cmd requires an argument])], [gasnet_ssh_cmd="ssh"]) AC_DEFINE_UNQUOTED(GASNETI_DEFAULT_SSH_CMD, "$gasnet_ssh_cmd") GASNET_WITH(ssh-options, [default value for GASNET_SSH_OPTIONS environment variable (defaults to empty)], [case "$withval" in yes|no) AC_MSG_ERROR([--with-ssh-options requires an argument]) ;; *) gasnet_ssh_options="$withval" ;; esac], [AC_MSG_ERROR([--with-ssh-options requires an argument])], [gasnet_ssh_options=""]) AC_DEFINE_UNQUOTED(GASNETI_DEFAULT_SSH_OPTIONS, "$gasnet_ssh_options") GASNET_WITH(ssh-nodefile, [default value for GASNET_SSH_NODEFILE environment variable (defaults to empty - no fixed filename)], [case "$withval" in yes|no) AC_MSG_ERROR([--with-ssh-nodefile requires an argument]) ;; *) gasnet_ssh_nodefile="$withval" ;; esac], [AC_MSG_ERROR([--with-ssh-nodefile requires an argument])], [gasnet_ssh_nodefile=""]) AC_DEFINE_UNQUOTED(GASNETI_DEFAULT_SSH_NODEFILE, "$gasnet_ssh_nodefile") GASNET_WITH(ssh-out-degree, [default value for GASNET_SSH_OUT_DEGREE environment variable (defaults to 32)], [case "$withval" in yes|no) AC_MSG_ERROR([--with-ssh-out-degree requires a non-negative integer argument]) ;; esac if expr "${withval}" : "[[0-9]][[0-9]]*" >/dev/null; then gasnet_ssh_out_degree="$withval" else AC_MSG_ERROR([--with-ssh-out-degree requires a non-negative integer argument]) fi], [AC_MSG_ERROR([--with-ssh-out-degree requires a non-negative integer argument])], [gasnet_ssh_out_degree=32]) AC_DEFINE_UNQUOTED(GASNETI_DEFAULT_SSH_OUT_DEGREE, $gasnet_ssh_out_degree) AM_CONDITIONAL(HAVE_BOOTSTRAP_SSH, test "$have_fork" = yes) # Things for pmi-spawner GASNET_IF_ENABLED_WITH_AUTO(pmi, [Enable/disable PMI support for job spawning], [enable_pmi=yes; force_pmi=yes], [enable_pmi=no], [enable_pmi=probe]) # If user specifies a PMI version, then we will not probe for others unset using_pmi_version pmi_why='Default' GASNET_WITH(pmi-version, [PMI version (x, 1, 2 or cray)] , [ case "$withval" in 1|2|x|cray) using_pmi_version="$withval";; *) GASNET_MSG_ERROR([Argument to --with-pmi-version must be 'x', '1', '2', or 'cray']);; esac pmi_why='Requested' ], [ GASNET_MSG_WARN([Ignoring --without-pmi-version]) ]) if test "$enabled_aries$have_aries" = yesyes; then if test -n "$using_pmi_version" && test "$using_pmi_version" != 'cray'; then GASNET_MSG_WARN([Ignoring --with-pmi-version=$using_pmi_version in favor of Cray PMI required by aries-conduit]) fi using_pmi_version=cray elif test "$GASNET_PLATFORM" = crayex && test -z "$using_pmi_version"; then using_pmi_version=cray fi # Check for header matching the selected lib # TODO: fragile if multiple PMI libs are installed AC_DEFUN([GASNET_PMI_SPAWNER_CFLAGS], [ GASNET_FUN_BEGIN([$0($@)]) AC_MSG_CHECKING(for location of $1) for pmi_headers in "$PMI_HOME/include/slurm" "$PMI_HOME/include/portals4" "$PMI_HOME/include" ''; do test -z "${pmi_headers}" && break test -f "${pmi_headers}/$1" && break done if test -z "${pmi_headers}"; then have_pmi=no pmi_headers='not found' elif test "${pmi_headers}" != '/usr/include'; then PMI_SPAWNER_CFLAGS="-I${pmi_headers}" fi AC_MSG_RESULT(${pmi_headers}) GASNET_FUN_END([$0]) ]) have_pmi=no if test "$enable_pmi" != 'no'; then # Auto-detect Cray PMI prefix, *unless* non-Cray version requested if ( test -n "$CRAYPE_NETWORK_TARGET" || test "$GASNET_PLATFORM" = crayex ) && ( test "$using_pmi_version" = 'cray' || test -z "$using_pmi_version" ); then # Several places to look. for dir in `expr "x${CRAY_PMI_INCLUDE_OPTS}" : 'x-I\([[^ ]]*\)' 2>/dev/null` \ `expr "x${CRAY_PMI_POST_LINK_OPTS}" : 'x-L\([[^ ]]*\)' 2>/dev/null` \ "$CRAY_PMI_PREFIX/dummy" '/opt/cray/pe/pmi/default/dummy'; do if test -n "$dir"; then pmi_guess=`dirname "$dir" 2>/dev/null` if test -e "$pmi_guess/include/pmi_cray.h"; then break fi fi done else pmi_guess='/usr' fi GASNET_ENV_DEFAULT(PMI_HOME, $pmi_guess, [Install prefix of PMI library]) GASNET_PACKAGE_LDFLAGS(PMI, [pmi pmi2 pmix]) PMI_SPAWNER_LDFLAGS=$PMI_LDFLAGS; unset PMI_LDFLAGS # Check for various implementations' libs unless disqualifed by --with-pmi-version= GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $PMI_SPAWNER_LDFLAGS") GASNET_ENV_DEFAULT(PMI_LIBS, probe) ## Cray PMI if test "$using_pmi_version" = 'cray' || test -z "$using_pmi_version"; then GASNET_PUSHVAR(LIBS,"") if test "$PMI_LIBS" = 'probe'; then # At the time of writting, XC systems use libpmi and EX systems use libpmi2. # Use of AC_SEARCH_LIBS() will yield a "none required" result when using # Cray's `cc` wrapper, which could then require pmi environment module to # be loaded at application link time. The following "just works" because, # when using the wrapper, it reduces to checking if the library exists. AC_CHECK_LIB(pmi2, PMI_Get_nidlist_ptr, [have_pmi=yes; LIBS="-lpmi2"], [AC_CHECK_LIB(pmi, PMI_Get_nidlist_ptr, [have_pmi=yes; LIBS="-lpmi"])]) else LIBS="$PMI_LIBS" AC_CHECK_FUNC(PMI_Get_nidlist_ptr, [have_pmi=yes]) fi if test "$have_pmi" = 'yes'; then GASNET_PMI_SPAWNER_CFLAGS([pmi_cray.h]) fi if test "$have_pmi" = 'yes'; then using_pmi_version=cray pretty_pmi_version=' (Cray)' AC_DEFINE(HAVE_PMI_CRAY_H) PMI_SPAWNER_LIBS="$LIBS" GASNET_IF_DISABLED_NOHELP(cray-post-link-rewrite,[], [GASNET_CRAY_FIX_LINK_OPTS([pmi],[PMI_SPAWNER_LDFLAGS])] ) fi GASNET_POPVAR(LIBS) fi ## PMIx if test "$using_pmi_version" = 'x' || test -z "$using_pmi_version"; then GASNET_PUSHVAR(LIBS,"") if test "$PMI_LIBS" = 'probe'; then AC_SEARCH_LIBS(PMIx_Init, [pmix], [have_pmi=yes]) else LIBS="$PMI_LIBS" AC_CHECK_FUNC(PMIx_Init, [have_pmi=yes]) fi if test "$have_pmi" = 'yes'; then GASNET_PMI_SPAWNER_CFLAGS([pmix.h]) fi if test "$have_pmi" = 'yes'; then AC_CHECK_HEADERS([stdbool.h]) # We support PMIx API versions 2 and 3 # At least some version 1 headers did not define PMIX_VERSION_MAJOR at all GASNET_PUSHVAR(CFLAGS,"$PMI_SPAWNER_CFLAGS") GASNET_TRY_CACHE_CHECK(for PMIx API version 2 or newer,PMIX_API,[ #include #include #include #if HAVE_STDBOOL_H #include #endif #include #ifndef PMIX_VERSION_MAJOR #error not defined #elif PMIX_VERSION_MAJOR < 2 #error too old #endif ],[],[],[ GASNET_MSG_WARN([Ignoring libpmix implementing API version 1 because version 2 or newer is required.]) have_pmi=no ]) GASNET_POPVAR(CFLAGS) fi if test "$have_pmi" = 'yes'; then using_pmi_version=x pretty_pmi_version=' (version=x)' AC_DEFINE(HAVE_PMIX_H) PMI_SPAWNER_LIBS="$LIBS" fi GASNET_POPVAR(LIBS) fi ## PMI2 if test "$using_pmi_version" = '2' || test -z "$using_pmi_version"; then GASNET_PUSHVAR(LIBS,"") if test "$PMI_LIBS" = 'probe'; then AC_SEARCH_LIBS(PMI2_Init, [pmi2 mpich], [have_pmi=yes]) else LIBS="$PMI_LIBS" AC_CHECK_FUNC(PMI2_Init, [have_pmi=yes]) fi if test "$have_pmi" = 'yes'; then GASNET_PMI_SPAWNER_CFLAGS([pmi2.h]) fi if test "$have_pmi" = 'yes'; then using_pmi_version=2 pretty_pmi_version=' (version=2)' AC_DEFINE(HAVE_PMI2_H) PMI_SPAWNER_LIBS="$LIBS" GASNET_IF_ENABLED(pmi2-fast-barrier, Use PMI2_KVS_fence as barrier. This may not work with all PMI2 implementations, [AC_DEFINE(GASNETI_PMI2_FENCE_IS_BARRIER,[1],[define to 1 if PMI2_KVS_fence() provides barrier functionality])], [] ) fi GASNET_POPVAR(LIBS) fi ## PMI (aka PMI1) if test "$using_pmi_version" = '1' || test -z "$using_pmi_version"; then GASNET_PUSHVAR(LIBS,"") if test "$PMI_LIBS" = 'probe'; then AC_SEARCH_LIBS(PMI_Init, [pmi mpich portals_runtime], [have_pmi=yes]) else LIBS="$PMI_LIBS" AC_CHECK_FUNC(PMI_Init, [have_pmi=yes]) fi if test "$have_pmi" = 'yes'; then GASNET_PMI_SPAWNER_CFLAGS([pmi.h]) fi if test "$have_pmi" = 'yes'; then using_pmi_version=1 pretty_pmi_version=' (version=1)' AC_DEFINE(HAVE_PMI_H) PMI_SPAWNER_LIBS="$LIBS" fi GASNET_POPVAR(LIBS) fi unset PMI_LIBS GASNET_POPVAR(LDFLAGS) GASNET_SPLIT_LINKER_OPTS(PMI_SPAWNER_LDFLAGS,PMI_SPAWNER_LIBS) # TODO: add a link test for a working PMI configuration # Look for use of malloc/free in the corresponding PMIx header if any if test "$have_pmi" = yes; then AC_MSG_CHECKING(for use of malloc in PMIx headers) AC_EGREP_HEADER([\<(malloc|calloc|free|strdup)\>], [${pmi_headers}/pmix_common.h], [ AC_DEFINE([GASNETI_PMIX_HACK]) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ] ) fi fi AC_MSG_CHECKING(for PMI spawner support) if test "$have_pmi" = yes; then AC_MSG_RESULT(yes) # These have not bee seen outside of Cray PMI, but we can hope: GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $PMI_SPAWNER_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $PMI_SPAWNER_LIBS") AC_CHECK_FUNCS([PMI_Allgather PMI_Allgather_on_smp PMI_Bcast PMI_Get_numpes_on_smp]) GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) # Get a full path for PMIRUN_CMD, using MPIRUN_CMD as a fallback if test "$enabled_mpi" = yes || test "$enabled_mpi_compat" = yes; then : # Have already probed MIRUN_CMD, possibly system-specific else GASNET_ENV_DEFAULT(MPIRUN_CMD, mpirun -np %N %C) fi pmirun_cmd_default="$MPIRUN_CMD" # default of defaults if test $GASNET_PLATFORM = crayex; then AC_PATH_PROGS(SRUN_PATH, $SRUN srun) AC_PATH_PROGS(APRUN_PATH, $APRUN aprun) if test -n "$SRUN_PATH" && test -n "$APRUN_PATH"; then : # Because both 'srun' and 'aprun' were found, will not use either as default PMIRUN_CMD elif test -n "$SRUN_PATH"; then pmirun_cmd_default="$SRUN_PATH -n %N -- %C" elif test -n "$APRUN_PATH"; then pmirun_cmd_default="$APRUN_PATH -n %N %C" fi fi GASNET_ENV_DEFAULT(PMIRUN_CMD, $pmirun_cmd_default, [[Command template for running PMI programs, see other/pmi-spawner/README]]) GASNET_GETFULLPATH(PMIRUN_CMD) elif test -z "$force_pmi"; then AC_MSG_RESULT(no) PMI_SPAWNER_LIBS="" PMI_SPAWNER_LDFLAGS="" PMI_SPAWNER_CFLAGS="" elif test "$enabled_aries$have_aries" = yesyes; then AC_MSG_RESULT(no) GASNET_MSG_ERROR([Cray PMI could not be found, but is required by aries-conduit. Try loading the pmi environment module.]) elif test -n "${using_pmi_version+set}"; then AC_MSG_RESULT(no) if test "$using_pmi_version" = cray; then extra='. Try loading the "cray-pmi" or "pmi" environment module, or specifying a different --with-pmi-version=?.' else extra='' fi GASNET_MSG_ERROR([$pmi_why PMI version "$using_pmi_version" could not be found$extra]) else AC_MSG_RESULT(no) GASNET_MSG_ERROR([Requested PMI support could not be found]) fi AC_SUBST(PMI_SPAWNER_LIBS) AC_SUBST(PMI_SPAWNER_LDFLAGS) AC_SUBST(PMI_SPAWNER_CFLAGS) AC_SUBST(PMIRUN_CMD) AM_CONDITIONAL(HAVE_BOOTSTRAP_PMI, test "$have_pmi" = yes) dnl GASNET_TOOLSONLY_FALSE_END ######################################################################## # Check for alloca in C code GASNET_FUNC_ALLOCA AC_CHECK_FUNCS(on_exit) AC_CHECK_FUNCS(gethostid) AC_CHECK_FUNCS(setenv unsetenv putenv) AC_CHECK_FUNCS([getrlimit setrlimit getrlimit64 setrlimit64], [], []) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/table.h) AC_CHECK_HEADERS(features.h) AC_CHECK_FUNCS(fopen64) AC_CHECK_FUNCS(sigprocmask) AC_CHECK_FUNCS(srand_deterministic) AC_CHECK_FUNCS(ffs) ######################################################################## # On various systems, the headers are missing certain functions # or only declare them under some condition we don't satisfy. AC_DEFUN([GASNET_CHECK_SYS_DECL], [ pushdef([uppername],translit($1,'a-z','A-Z')) pushdef([cvname],have_[]uppername[]_decl) GASNET_TRY_CACHE_CHECK(for declaration/definition of $1, cvname, [ #include #include #include #include #include #include #include ], [ #ifdef $1 /* It is a macro and that is OK */ #else int x = (int)sizeof(&$1); #endif ], [ cvname=yes ], [ cvname=no ]) if test $cvname = yes; then AC_DEFINE(HAVE_[]uppername[]_DECL) fi popdef([cvname]) popdef([uppername]) ]) GASNET_CHECK_SYS_DECL(setenv) GASNET_CHECK_SYS_DECL(unsetenv) GASNET_CHECK_SYS_DECL(snprintf) GASNET_CHECK_SYS_DECL(vsnprintf) ######################################################################## # ctype.h wrapper support AC_CHECK_FUNCS(isblank isascii toascii) GASNET_CHECK_SYS_DECL(isblank) GASNET_CHECK_SYS_DECL(isascii) GASNET_CHECK_SYS_DECL(toascii) AC_CACHE_CHECK([for buggy ctype.h], gasnet_cv_buggy_ctype, [ GASNET_PUSHVAR(CFLAGS,"$DEVWARN_CFLAGS $CFLAGS") gasnet_cv_buggy_ctype=unk GASNET_TRY_CCOMPILE_WITHWARN( [#include int foo(char c) { return isalpha(c); } ], [int x = foo('c');], [gasnet_cv_buggy_ctype=ok], [gasnet_cv_buggy_ctype=yes/warning], [GASNET_MSG_ERROR(failure building test of ctype.h)]) GASNET_POPVAR(CFLAGS) ]) if test x$gasnet_cv_buggy_ctype != xok; then AC_DEFINE(GASNETI_NEED_CTYPE_WRAPPERS) fi ######################################################################## # BACKTRACE support GASNET_HELP_OUTPUT([ Backtrace options:]) GASNET_IF_ENABLED_WITH_AUTO(backtrace, [support backtrace, via any mechanism (auto-detected)], [use_backtrace="try"], [use_backtrace="no"], [ if test "$cross_compiling" = "yes" ; then # disable backtrace support by default when cross-compiling, # because the debuggers on the host system running configure are usually not what we want for the target use_backtrace="no" else use_backtrace="try" fi ]) GASNET_IF_ENABLED_WITH_AUTO(backtrace-execinfo, support backtrace via execinfo.h (auto-detected), [use_execinfo="yes"], [use_execinfo="no"], [use_execinfo="$use_backtrace"]) if test "$use_execinfo" != no; then AC_CHECK_HEADERS(execinfo.h) if test "$ac_cv_header_execinfo_h" = "yes" ; then AC_SEARCH_LIBS(backtrace, execinfo) # bug3637: BSD requires -lexecinfo AC_CHECK_FUNCS(backtrace backtrace_symbols) fi if test "$use_execinfo" = 'yes' && test "$ac_cv_func_backtrace" != 'yes'; then AC_MSG_ERROR(User requested --enable-backtrace-execinfo but support is not available on your system.) fi AC_PATH_PROGS(ADDR2LINE_PATH, addr2line, , /usr/bin:${PATH}) if test -n "$ADDR2LINE_PATH"; then AC_DEFINE_UNQUOTED(ADDR2LINE_PATH,"$ADDR2LINE_PATH") fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-gdb, support backtrace via gdb (auto-detected), [use_gdb="yes"], [use_gdb="no"], [use_gdb="$use_backtrace"]) if test "$use_gdb" != no; then AC_PATH_PROGS(GDB_PATH, $GDB gdb, , /usr/bin:${PATH}) if test -n "$GDB_PATH"; then AC_DEFINE_UNQUOTED(GDB_PATH,"$GDB_PATH") elif test "$use_gdb" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-gdb but gdb was not found. Perhaps you need to set \$GDB?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-gstack, support backtrace via gstack (auto-detected), [use_gstack="yes"], [use_gstack="no"], [use_gstack="$use_backtrace"]) if test "$use_gstack" != no; then AC_PATH_PROGS(GSTACK_PATH, $GSTACK gstack, , /usr/bin:${PATH}) if test -n "$GSTACK_PATH"; then AC_DEFINE_UNQUOTED(GSTACK_PATH,"$GSTACK_PATH") elif test "$use_gstack" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-gstack but gstack was not found. Perhaps you need to set \$GSTACK?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-pstack, support backtrace via pstack (auto-detected), [use_pstack="yes"], [use_pstack="no"], [use_pstack="$use_backtrace"]) if test "$use_pstack" != no; then AC_PATH_PROGS(PSTACK_PATH, $PSTACK pstack, , /usr/bin:${PATH}) if test -n "$PSTACK_PATH"; then AC_DEFINE_UNQUOTED(PSTACK_PATH,"$PSTACK_PATH") elif test "$use_pstack" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-pstack but pstack was not found. Perhaps you need to set \$PSTACK?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-pgdbg, support backtrace via pgdbg (auto-detected), [use_pgdbg="yes"], [use_pgdbg="no"], [use_pgdbg="$use_backtrace"]) if test "$use_pgdbg" != no; then AC_PATH_PROGS(PGDBG_PATH, $PGDBG pgdbg, , /usr/bin:${PATH}) if test -n "$PGDBG_PATH"; then AC_DEFINE_UNQUOTED(PGDBG_PATH,"$PGDBG_PATH") elif test "$use_pgdbg" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-pgdbg but pgdbg was not found. Perhaps you need to set \$PGDBG?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-idb, support backtrace via idb (auto-detected), [use_idb="yes"], [use_idb="no"], [use_idb="$use_backtrace"]) if test "$use_idb" != no; then AC_PATH_PROGS(IDB_PATH, $IDB idb idb-e, , /usr/bin:${PATH}) if test -n "$IDB_PATH"; then AC_DEFINE_UNQUOTED(IDB_PATH,"$IDB_PATH") elif test "$use_idb" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-idb but idb was not found. Perhaps you need to set \$IDB?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-dbx, support backtrace via dbx (auto-detected), [use_dbx="yes"], [use_dbx="no"], [use_dbx="$use_backtrace"]) if test "$use_dbx" != no; then AC_PATH_PROGS(DBX_PATH, $DBX dbx, , /usr/bin:${PATH}) if test -n "$DBX_PATH"; then AC_DEFINE_UNQUOTED(DBX_PATH,"$DBX_PATH") elif test "$use_dbx" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-dbx but dbx was not found. Perhaps you need to set \$DBX?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-lldb, support backtrace via lldb (auto-detected), [use_lldb="yes"], [use_lldb="no"], [use_lldb="$use_backtrace"]) if test "$use_lldb" != no; then AC_PATH_PROGS(LLDB_PATH, $LLDB lldb, , /usr/bin:${PATH}) if test -n "$LLDB_PATH"; then AC_DEFINE_UNQUOTED(LLDB_PATH,"$LLDB_PATH") elif test "$use_lldb" = yes; then AC_MSG_ERROR(User requested --enable-backtrace-lldb but lldb was not found. Perhaps you need to set \$LLDB?) fi fi GASNET_IF_ENABLED_WITH_AUTO(backtrace-printstack, support backtrace via printstack (auto-detected), [use_printstack="yes"], [use_printstack="no"], [use_printstack="$use_backtrace"]) if test "$use_printstack" != no; then have_printstack=no AC_CHECK_HEADERS(ucontext.h, [AC_CHECK_FUNC(printstack, [have_printstack=yes; AC_DEFINE(HAVE_PRINTSTACK)])]) if test "$use_printstack$have_printstack" = yesno; then AC_MSG_ERROR(User requested --enable-backtrace-printstack but printstack support was not found.) fi fi ######################################################################## dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_HELP_OUTPUT([ Memory-kinds options:]) GASNET_IF_ENABLED(memory-kinds, [Prototype support for memory kinds (transfers to/from device memory). Enables default auto-detection of all device type applicable to the target platform. Individual --enable-kind-* options have precedence.], [enable_mk_default=probe], [enable_mk_default=no]) # This is potentially used CUDA_UVA and by HIP # So we'll factor it to avoid repeats in ouptut unset checked_pkg_cuda AC_DEFUN([CHECK_PKG_CUDA],[ if test "${checked_pkg_cuda-unset}" = unset; then checked_pkg_cuda=y GASNET_PACKAGE_HOME(CUDA, [CUDA toolkit], [nvcc], [/usr/local/cuda], [include/cuda.h]) GASNET_PACKAGE_CFLAGS(CUDA) GASNET_ENV_DEFAULT(CUDA_LIBS, -lcuda) GASNET_PACKAGE_LDFLAGS(CUDA, cuda) GASNET_SPLIT_LINKER_OPTS(CUDA_LDFLAGS,CUDA_LIBS) fi ]) # GEX_MK_CLASS_CUDA_UVA enable_mk_cuda_uva_implicit=no GASNET_IF_ENABLED_WITH_AUTO(kind-cuda-uva, [Support for memory kinds on UVA-capable CUDA devices (auto-detected with --enable-memory-kinds, otherwise disabled)], [enable_mk_cuda_uva="yes"; force_mk_cuda_uva="yes"], [enable_mk_cuda_uva="no"], [ if test "x$enable_kind_cuda_uva" = 'xprobe'; then enable_mk_cuda_uva="probe" elif test "$GASNETI_PTR_BITS" = 32; then enable_mk_cuda_uva="no" else enable_mk_cuda_uva="$enable_mk_default" enable_mk_cuda_uva_implicit=yes fi ]) unset have_mk_cuda_uva if test "$enable_mk_cuda_uva" != "no"; then AC_MSG_CHECKING(for target having CUDA UVA memory kinds support) if test "$GASNETI_PTR_BITS" = 32; then AC_MSG_RESULT([no (32-bit targets are not supported)]) have_mk_cuda_uva=no else have_mk_cuda_uva=no case "$target_cpu:$target_os" in x86_64:linux*) have_mk_cuda_uva='yes';; powerpc*:linux*) if test "$WORDS_BIGENDIAN" = '0'; then have_mk_cuda_uva='yes'; fi;; aarch64:linux*) have_mk_cuda_uva='maybe';; esac if test "$have_mk_cuda_uva" = 'no'; then AC_MSG_RESULT([no (unsupported or unrecognized target $target)]) else AC_MSG_RESULT([$have_mk_cuda_uva]) fi fi if test "$have_mk_cuda_uva" != "no"; then # TODO: Can/should we scrape nvcc as UPC++ does? CHECK_PKG_CUDA() # Try to compile and link a basic program using the CUDA Driver API GASNET_PUSHVAR(CFLAGS,"$CFLAGS $CUDA_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $CUDA_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $CUDA_LIBS") GASNET_TRY_CACHE_LINK(for working CUDA configuration, libcuda_works, [ #include ], [ cuInit(0); CUdevice dev = 0; CUcontext ctx; CUresult res = cuDevicePrimaryCtxRetain(&ctx, dev); int isUVA; cuDeviceGetAttribute(&isUVA, CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, dev); CUpointer_attribute attrs[[3]] = { CU_POINTER_ATTRIBUTE_MEMORY_TYPE, CU_POINTER_ATTRIBUTE_IS_MANAGED, CU_POINTER_ATTRIBUTE_CONTEXT }; ], [ : ], [ have_mk_cuda_uva=no; GASNET_ERR_SAVE() ]) GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(CFLAGS) fi # If the probe(s) above passed on a target identified as "maybe" having # support, then upgrade to "yes" with a warning. if test "$have_mk_cuda_uva" = "maybe"; then have_mk_cuda_uva=yes GASNET_MSG_WARN([CUDA UVA memory kinds support enabled for $target, which may not be officially supported]) fi if test "$have_mk_cuda_uva" = "yes"; then AC_DEFINE(GASNETI_MK_CLASS_CUDA_UVA_ENABLED) CUDA_UVA_CFLAGS="$CUDA_CFLAGS" CUDA_UVA_LDFLAGS="$CUDA_LDFLAGS" CUDA_UVA_LIBS="$CUDA_LIBS" elif test "$force_mk_cuda_uva" = "yes"; then GASNET_MSG_ERROR([CUDA UVA memory kinds support was requested with --enable-kind-cuda-uva but is not available]) else unset CUDA_UVA_CFLAGS unset CUDA_UVA_LDFLAGS unset CUDA_UVA_LIBS fi fi AC_SUBST(CUDA_UVA_CFLAGS) AC_SUBST(CUDA_UVA_LDFLAGS) AC_SUBST(CUDA_UVA_LIBS) AM_CONDITIONAL(HAVE_MK_CLASS_CUDA_UVA, test "$have_mk_cuda_uva" = "yes") # GEX_MK_CLASS_HIP enable_mk_hip_implicit=no GASNET_IF_ENABLED_WITH_AUTO(kind-hip, [support for memory kinds on HIP-compatible devices (auto-detected with --enable-memory-kinds, otherwise disabled)], [enable_mk_hip="yes"; force_mk_hip="yes"], [enable_mk_hip="no"], [ if test "x$enable_kind_hip" = 'xprobe'; then enable_mk_hip="probe" elif test "$GASNETI_PTR_BITS" = 32; then enable_mk_hip="no" else enable_mk_hip="$enable_mk_default" enable_mk_hip_implicit=yes fi ]) unset have_mk_hip if test "$enable_mk_hip" != "no"; then AC_MSG_CHECKING(for target having HIP memory kinds support) if test "$GASNETI_PTR_BITS" = 32; then AC_MSG_RESULT([no (32-bit targets are not supported)]) have_mk_hip=no else have_mk_hip=no case "$target_cpu:$target_os" in x86_64:linux*) have_mk_hip='yes';; powerpc*:linux*) have_mk_hip='maybe';; aarch64:linux*) have_mk_hip='maybe';; esac if test "$have_mk_hip" = 'no'; then AC_MSG_RESULT([no (unsupported or unrecognized target $target)]) else AC_MSG_RESULT([$have_mk_hip]) fi fi if test "$have_mk_hip" != "no"; then GASNET_PACKAGE_HOME(HIP, [HIP developer tools], [hipcc], [/opt/rocm], [include/hip/hip_runtime.h]) GASNET_PACKAGE_CFLAGS(HIP) # UNDOCUMENTED option to enable use of HIP over CUDA *by GASNet maintainers*. # TODO: Eventually we should REMOVE or DOCUMENT hip_platform=amd GASNET_WITH_NOHELP(hip-platform, [ case "$withval" in amd|hcc) hip_platform='amd';; nvidia|nvcc) hip_platform='nvidia';; *) AC_MSG_ERROR([--with-hip-platform requires an argument (amd or nvidia)]) ;; esac ]) case "$hip_platform" in amd) GASNET_ENV_DEFAULT(HIP_LIBS, -lamdhip64) GASNET_PACKAGE_LDFLAGS(HIP, amdhip64) AC_DEFINE(GASNETI_HIP_PLATFORM_AMD) ;; nvidia) CHECK_PKG_CUDA() # HIP-over-CUDA sometimes depends on amdhip64 (version-dependent) # but always depends on functions from CUDA runtime (library name can vary). # libcudart is generally NOT in CUDA_LIBS, since the CUDA MK does not require it GASNET_ENV_DEFAULT(HIP_LIBS, -lamdhip64 -lcudart) # extra_cudart_flags ensures default HIP_LDFLAGS includes the CUDA libdir (for libcudart) # which notably may or may not be in CUDA_LDFLAGS (since CUDA only requires libcuda) extra_cudart_flags="-L$CUDA_HOME/lib64" if test -n "$cc_rpath_option" && test "x$enable_cuda_rpath" != "xno" && \ test "${enable_cuda_rpath}x${enabled_rpath}" != "xno" ; then extra_cudart_flags="$extra_cudart_flags $cc_rpath_option$CUDA_HOME/lib64" fi GASNET_PACKAGE_LDFLAGS(HIP, amdhip64, $extra_cudart_flags) # Suppress warnings when compiling gasnet_hip.c and testhip.c # due to "issues" in hip_runtime.h when parsed by a C compiler in # __HIP_PLATFORM_NVCC__ mode. unset HIP_NVCC_WARNFLAGS case "$CC_FAMILY" in Intel) # Deprecated decls: GASNET_TRY_CFLAG([${CC_WDFLAG}1478], [HIP_NVCC_WARNFLAGS="$HIP_NVCC_WARNFLAGS ${CC_WDFLAG}1478"]) # "auto" becomes implicit int: GASNET_TRY_CFLAG([${CC_WDFLAG}303], [HIP_NVCC_WARNFLAGS="$HIP_NVCC_WARNFLAGS ${CC_WDFLAG}303"]) ;; PGI|NVHPC) : # Currently warning-free, so avoid the noise of the -Wno probes ;; *) # GCC and Clang, plus their derivatives and work-alikes GASNET_TRY_WNO_FLAG([C],[-Wno-deprecated-declarations], [HIP_NVCC_WARNFLAGS="$HIP_NVCC_WARNFLAGS -Wno-deprecated-declarations"]) GASNET_TRY_WNO_FLAG([C],[-Wno-implicit-int], [HIP_NVCC_WARNFLAGS="$HIP_NVCC_WARNFLAGS -Wno-implicit-int"]) GASNET_TRY_WNO_FLAG([C],[-Wno-return-type], [HIP_NVCC_WARNFLAGS="$HIP_NVCC_WARNFLAGS -Wno-return-type"]) ;; esac HIP_LIBS="$HIP_LIBS $CUDA_LIBS" HIP_LDFLAGS="$HIP_LDFLAGS $CUDA_LDFLAGS" HIP_CFLAGS="$HIP_CFLAGS $CUDA_CFLAGS $HIP_NVCC_WARNFLAGS" AC_DEFINE(GASNETI_HIP_PLATFORM_NVIDIA) ;; esac GASNET_SPLIT_LINKER_OPTS(HIP_LDFLAGS,HIP_LIBS) # Try to compile and link a basic program using the HIP Driver API GASNET_PUSHVAR(CFLAGS,"$CFLAGS $HIP_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $HIP_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $HIP_LIBS") GASNET_TRY_CACHE_LINK(for working HIP configuration, libamdhip64_works, [ #if GASNETI_HIP_PLATFORM_NVIDIA #define __HIP_PLATFORM_NVCC__ // legacy #define __HIP_PLATFORM_NVIDIA__ #else #define __HIP_PLATFORM_HCC__ // legacy #define __HIP_PLATFORM_AMD__ #endif #include ], [ void *addr; hipInit(0); hipDevice_t dev = 0; hipPointerAttribute_t attr; hipError_t res; res = hipMalloc(&addr, 1024); res = hipPointerGetAttributes(&attr, addr); int bad = (attr.memoryType != hipMemoryTypeDevice) || attr.isManaged; ], [ : ], [ have_mk_hip=no; GASNET_ERR_SAVE() ]) GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(CFLAGS) fi # If the probe(s) above passed on a target identified as "maybe" having # support, then upgrade to "yes" with a warning. if test "$have_mk_hip" = "maybe"; then have_mk_hip=yes GASNET_MSG_WARN([HIP memory kinds support enabled for $target, which may not be officially supported]) fi if test "$have_mk_hip" = "yes"; then AC_DEFINE(GASNETI_MK_CLASS_HIP_ENABLED) elif test "$force_mk_hip" = "yes"; then GASNET_MSG_ERROR([HIP memory kinds support was requested with --enable-kind-hip but is not available]) else unset HIP_CFLAGS unset HIP_LDFLAGS unset HIP_LIBS fi fi AC_SUBST(HIP_CFLAGS) AC_SUBST(HIP_LDFLAGS) AC_SUBST(HIP_LIBS) AM_CONDITIONAL(HAVE_MK_CLASS_HIP, test "$have_mk_hip" = "yes") # GEX_MK_CLASS_ZE enable_mk_ze_implicit=no GASNET_IF_ENABLED_WITH_AUTO(kind-ze, [Support for memory kinds on devices via oneAPI Level Zero (auto-detected with --enable-memory-kinds, otherwise disabled)], [enable_mk_ze="yes"; force_mk_ze="yes"], [enable_mk_ze="no"], [ if test "x$enable_kind_ze" = 'xprobe'; then enable_mk_ze="probe" elif test "$GASNETI_PTR_BITS" = 32; then enable_mk_ze="no" else enable_mk_ze="$enable_mk_default" enable_mk_ze_implicit=yes fi ]) unset have_mk_ze if test "$enable_mk_ze" != "no"; then AC_MSG_CHECKING(for target having Level Zero memory kinds support) if test "$GASNETI_PTR_BITS" = 32; then AC_MSG_RESULT([no (32-bit targets are not supported)]) have_mk_ze=no else have_mk_ze=no case "$target_cpu:$target_os" in x86_64:linux*) have_mk_ze='yes';; esac if test "$have_mk_ze" = 'no'; then AC_MSG_RESULT([no (unsupported or unrecognized target $target)]) else AC_MSG_RESULT([$have_mk_ze]) fi fi if test "$have_mk_ze" != "no"; then GASNET_PACKAGE_HOME(ZE, [oneAPI Level Zero], [ocloc], [/usr/local], [include/level_zero/ze_api.h]) GASNET_PACKAGE_CFLAGS(ZE) GASNET_ENV_DEFAULT(ZE_LIBS, -lze_loader) GASNET_PACKAGE_LDFLAGS(ZE, ze_loader) GASNET_SPLIT_LINKER_OPTS(ZE,ZE_LIBS) # Try to compile and link a basic program using the ZE APIs GASNET_PUSHVAR(CFLAGS,"$CFLAGS $ZE_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $ZE_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $ZE_LIBS") GASNET_TRY_CACHE_LINK(for working oneAPI Level Zero configuration, ze_works, [ #include ], [ ze_result_t res = zeInit(0); uint32_t count = 0; ze_driver_handle_t driver = NULL; (void) zeDriverGet(&count, &driver); ze_device_handle_t device = NULL; (void) zeDeviceGet(driver, &count, &device); ], [ : ], [ have_mk_ze=no; GASNET_ERR_SAVE() ]) GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(CFLAGS) fi if test "$have_mk_ze" = "yes"; then AC_DEFINE(GASNETI_MK_CLASS_ZE_ENABLED) GASNET_MSG_WARN([ oneAPI Level Zero memory kinds support has been enabled. This support is experimental and may have performance and correctness bugs.]) elif test "$force_mk_ze" = "yes"; then GASNET_MSG_ERROR([oneAPI Level Zero memory kinds support was requested with --enable-kind-ze but is not available]) else unset ZE_CFLAGS unset ZE_LDFLAGS unset ZE_LIBS fi fi AC_SUBST(ZE_CFLAGS) AC_SUBST(ZE_LDFLAGS) AC_SUBST(ZE_LIBS) AM_CONDITIONAL(HAVE_MK_CLASS_ZE, test "$have_mk_ze" = "yes") AC_DEFUN([MK_OUTPUT],[ pushdef([lowername],translit($1,'A-Z','a-z')) if test "$have_mk_[]lowername" = "yes"; then if test "$force_mk_[]lowername" = "yes"; then _mk_flagstr="ON (enabled)" else _mk_flagstr="ON (auto)" fi elif test "$enable_mk_[]lowername" = "probe"; then _mk_flagstr="OFF (not found)" elif test "$enable_mk_[]lowername[]_implicit" = "yes"; then _mk_flagstr="OFF (not enabled)" else _mk_flagstr="OFF (disabled)" fi echo " $2 m4_substr([ ],len($2))$_mk_flagstr" >> $CONDUIT_LIST popdef([lowername]) ]) cat >>$CONDUIT_LIST < ], [ usleep(500); ], AC_SEARCH_LIBS(usleep, posix4, AC_DEFINE(HAVE_USLEEP), AC_MSG_RESULT(entry point not found - disabled))) # Check for nanosleep GASNET_TRY_CACHE_CHECK(for nanosleep(), cc_has_nanosleep, [ #include #include ], [ struct timespec tm, tmremaining; tm.tv_sec =1; tm.tv_nsec = 1000000; nanosleep(&tm, &tmremaining); ], AC_SEARCH_LIBS(nanosleep, posix4, AC_DEFINE(HAVE_NANOSLEEP), AC_MSG_RESULT(entry point not found - disabled))) # Check for clock_nanosleep GASNET_TRY_CACHE_CHECK(for clock_nanosleep(), cc_has_clock_nanosleep, [ #include ], [ struct timespec tm, tmremaining; tm.tv_sec = 1; tm.tv_nsec = 1000000; clock_nanosleep(CLOCK_REALTIME, 0, &tm, &tmremaining); ], AC_SEARCH_LIBS(clock_nanosleep, [rt posix4], AC_DEFINE(HAVE_CLOCK_NANOSLEEP), AC_MSG_RESULT(entry point not found - disabled))) # Check for nsleep GASNET_TRY_CACHE_CHECK(for nsleep(), cc_has_nsleep, [ #include #include ], [ struct timespec tm, tmremaining; tm.tv_sec =1; tm.tv_nsec = 1000000; nsleep(&tm, &tmremaining); ], AC_SEARCH_LIBS(nsleep, posix4, AC_DEFINE(HAVE_NSLEEP), AC_MSG_RESULT(entry point not found - disabled))) # Check for sched_yield GASNET_TRY_CACHE_CHECK(for sched_yield(), cc_has_sched_yield, [ #include ], [ sched_yield(); ], AC_SEARCH_LIBS(sched_yield, posix4, AC_DEFINE(HAVE_SCHED_YIELD), AC_MSG_RESULT(entry point not found - disabled))) # timer setup case "$target_os" in freebsd* | netbsd*) AC_MSG_CHECKING(for sysctl machdep.tsc_freq) res="`/sbin/sysctl -n machdep.tsc_freq 2> /dev/null`" if test "$res" != "" -a "$res" != 0; then AC_MSG_RESULT(yes: $res) AC_DEFINE(GASNETI_HAVE_SYSCTL_MACHDEP_TSC_FREQ) else AC_MSG_RESULT(no) fi ;; esac # PLPA enabled_plpa="no" if test "$cross_compiling" = "no" ; then case "$target_os" in linux*) if test "$GASNET_PLATFORM" = "wsl" ; then enabled_plpa="no" else enabled_plpa="yes" fi ;; esac else case "$target" in x86_64-cnl-linux*) enabled_plpa="yes";; esac fi if test "$enabled_plpa" = "yes"; then GASNET_IF_ENABLED_WITH_AUTO(plpa, [use PLPA for CPU binding (default is to probe)], [enabled_plpa="yes"; force_plpa="yes"], [enabled_plpa="no - user disabled"], [enabled_plpa="yes"]) if test "$enabled_plpa" = yes; then PLPA_SET_SYMBOL_PREFIX([gasneti_plpa_]) PLPA_INIT([enabled_plpa="yes"],[enabled_plpa="no - probe failed"]) fi AC_MSG_CHECKING(whether to use PLPA for cpu binding) AC_MSG_RESULT($enabled_plpa) if test "$enabled_plpa" = yes; then AC_DEFINE(HAVE_PLPA) elif test "$force_plpa" = yes; then AC_MSG_ERROR(User requested --enable-plpa but PLPA is not supported on your system) fi fi AM_CONDITIONAL(USE_PLPA,test "$enabled_plpa" = "yes") # HWLOC header and library GASNET_IF_ENABLED_WITH_AUTO(hwloc, hwloc library (auto-detected), enabled_hwloc_lib=yes, enabled_hwloc_lib=no, enabled_hwloc_lib=probe) have_hwloc_lib=no if test "$enabled_hwloc_lib" != no; then GASNET_PACKAGE_HOME(HWLOC, [hwloc], [hwloc-info], [/usr/local], [include/hwloc.h]) GASNET_PACKAGE_CFLAGS(HWLOC) GASNET_ENV_DEFAULT(HWLOC_LIBS, -lhwloc) GASNET_PACKAGE_LDFLAGS(HWLOC, hwloc) GASNET_SPLIT_LINKER_OPTS(HWLOC_LDFLAGS,HWLOC_LIBS) # Try to compile and link a basic program using hwloc GASNET_PUSHVAR(CFLAGS,"$CFLAGS $HWLOC_CFLAGS") GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $HWLOC_LDFLAGS") GASNET_PUSHVAR(LIBS,"$LIBS $HWLOC_LIBS") GASNET_TRY_CACHE_LINK(for libhwloc with API v1.0 or newer, libhwloc_works, [ #include #if HWLOC_API_VERSION < 0x010000 #error No support for 0.9 series #endif ], [ hwloc_topology_t topology; hwloc_topology_init(&topology); hwloc_topology_load(topology); ], [ have_hwloc_lib=yes ],[ HWLOC_CFLAGS="" HWLOC_LDFLAGS="" HWLOC_LIBS="" ]) GASNET_POPVAR(LIBS) GASNET_POPVAR(LDFLAGS) GASNET_POPVAR(CFLAGS) if test "$have_hwloc_lib" = yes; then AC_DEFINE(GASNETI_HAVE_HWLOC_LIB) elif test "$enabled_hwloc_lib" = yes; then AC_MSG_ERROR(User requested --enable-hwloc but the required hwloc header or library were not found.) fi fi AC_SUBST(HWLOC_CFLAGS) AC_SUBST(HWLOC_LDFLAGS) AC_SUBST(HWLOC_LIBS) # HWLOC utilies: hwloc-{bind,calc} # Used as fallback if !have_hwloc_lib GASNET_IF_ENABLED_WITH_AUTO(hwloc-utils, hwloc utilities (auto-detected), enabled_hwloc_utils=yes, enabled_hwloc_utils=no, [ if test "$cross_compiling" = "no" || test "x$enable_hwloc_utils" = 'xprobe'; then enabled_hwloc_utils=probe else # utils on build system unlikely to represent the target enabled_hwloc_utils=no fi ]) have_hwloc_utils=no if test "$enabled_hwloc_utils" != no; then if test "$have_fork" = yes; then GASNET_ENV_DEFAULT(HWLOC_UTILS_HOME, , [Install prefix of hwloc command-line utilities (auto-detected from PATH)]) if test -n "$HWLOC_UTILS_HOME"; then hwloc_utils_path="$HWLOC_UTILS_HOME/bin" else hwloc_utils_path="$PATH" fi AC_PATH_PROGS(GASNETI_HWLOC_BIND_PATH, hwloc-bind, , $hwloc_utils_path) if test -n "$GASNETI_HWLOC_BIND_PATH" && test "$cross_compiling" = "no"; then # Require --get, added in hwloc 1.0 AC_MSG_CHECKING(for required features in hwloc-bind) if expr `$GASNETI_HWLOC_BIND_PATH --get 2>&1` : 0x >/dev/null 2>&1; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(GASNETI_HWLOC_BIND_PATH,"$GASNETI_HWLOC_BIND_PATH") else AC_MSG_RESULT(no) unset GASNETI_HWLOC_BIND_PATH fi fi AC_PATH_PROGS(GASNETI_HWLOC_CALC_PATH, hwloc-calc, , $hwloc_utils_path) if test -n "$GASNETI_HWLOC_CALC_PATH" && test "$cross_compiling" = "no"; then # Require --intersect, added in hwloc 1.1 AC_MSG_CHECKING(for required features in hwloc-calc) if $GASNETI_HWLOC_CALC_PATH --intersect Socket 0x0 /dev/null 2>&1; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(GASNETI_HWLOC_CALC_PATH,"$GASNETI_HWLOC_CALC_PATH") else AC_MSG_RESULT(no) unset GASNETI_HWLOC_CALC_PATH fi fi if test -n "$GASNETI_HWLOC_BIND_PATH" && test -n "$GASNETI_HWLOC_CALC_PATH"; then have_hwloc_utils=yes # Have both AC_DEFINE(GASNETI_HAVE_HWLOC_UTILS) if test "$cross_compiling" = "yes"; then GASNET_MSG_WARN([Utilities hwloc-bind and hwloc-calc have been located, as show above. However, their validation has been skipped due to cross-compilation.]) fi elif test "$enabled_hwloc_utils" = yes; then AC_MSG_ERROR(User requested --with-hwloc-utils but one or both of hwloc-calc or hwloc-bind was not found.) fi elif test "$enabled_hwloc_utils" = yes; then AC_MSG_ERROR(User requested --with-hwloc-utils but this option requires popen which $fork_reason.) fi fi # AC_FUNC_MMAP # Check for mmap functionality we actually use if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(HAVE_MMAP,HAVE_MMAP) mmap_reason="was disabled" else case "$target_os" in cygwin*) # mmap is known to be broken on Cygwin - dont even try HAVE_MMAP=0 mmap_reason="is not supported on Cygwin" ;; *) # default to trying it HAVE_MMAP=1 ;; esac fi GASNET_IF_ENABLED_WITH_AUTO(mmap,[force the use or non-use of mmap (default to probe)], [ if test "$HAVE_MMAP" != "1" ; then GASNET_MSG_ERROR([--enable-mmap was passed, but mmap functionality $mmap_reason]) fi FORCE_MMAP=1 ], [ HAVE_MMAP=0 mmap_reason="was disabled" ], []) if test "$HAVE_MMAP" != "0" && test "$cross_compiling" = "no" ; then GASNET_TRY_CACHE_RUN(for working mmap(), have_mmap, [ #include #include #include #include #include #include #include #include char junk[[16384]]; int testfd(int); int main(void) { int fd, retval; #if 0 char filename[[255]]; tmpnam(filename); /* unsafe */ fd = open(filename, O_RDWR | O_CREAT); #else char filename[[255]]; if (getenv("TMPDIR")) strcpy(filename,getenv("TMPDIR")); else strcpy(filename,"/tmp"); strcat(filename,"/gasnet-conftemp-XXXXXX"); fd = [mkstemp(filename)]; /* leaves crap laying around */ #endif retval = testfd(fd); close(fd); remove(filename); return retval; } int testfd(int fd) { void *ptr,*ptr2; if (fd == -1) return 1; if (write(fd, junk, 16384) == -1) return 2; ptr = mmap(0, 16384, (PROT_READ|PROT_WRITE), MAP_PRIVATE, fd, 0); if (ptr == MAP_FAILED || ptr == NULL) return 3; if (munmap(ptr,16384) != 0) return 4; ptr2 = mmap(ptr, 16384, (PROT_READ|PROT_WRITE), (MAP_PRIVATE | MAP_FIXED), fd, 0); if (ptr2 == MAP_FAILED || ptr2 == NULL || ptr2 != ptr) return 5; if (munmap(ptr,16384) != 0) return 6; return 0; }],[ HAVE_MMAP=1 ],[ HAVE_MMAP=0 if test "$FORCE_MMAP" = "1" ; then GASNET_MSG_ERROR([--enable-mmap was passed, but mmap functionality test failed]) fi mmap_reason="test failed" ]) fi if test "$HAVE_MMAP" != "0" ; then AC_DEFINE(HAVE_MMAP) # bug 1763: find the right mmap flags (which may be enum values or const vars) GASNET_TRY_CACHE_LINK([for MAP_NORESERVE],map_noreserve, [ #include ],[ void *junk = mmap(0, 0, 0, MAP_NORESERVE, 0, 0); ], [ AC_DEFINE(HAVE_MAP_NORESERVE) ] ) GASNET_TRY_CACHE_LINK([for MAP_ANONYMOUS],map_anonymous, [ #include ],[ void *junk = mmap(0, 0, 0, MAP_ANONYMOUS, 0, 0); ], [ AC_DEFINE(HAVE_MAP_ANONYMOUS) ] ) GASNET_TRY_CACHE_LINK([for MAP_ANON],map_anon, [ #include ],[ void *junk = mmap(0, 0, 0, MAP_ANON, 0, 0); ], [ AC_DEFINE(HAVE_MAP_ANON) ] ) dnl GASNET_TOOLSONLY_FALSE_BEGIN GASNET_IF_ENABLED(bug3480-workaround,[See Aries conduit README],[ AC_DEFINE(GASNETI_BUG3480_WORKAROUND) if test "$GASNETI_DISABLE_ALIGNED_SEGMENTS" != 1 && \ test "$segconfig" != everything; then GASNET_MSG_WARN([--enable-bug3480-workaround is incompatible with GASNET_ALIGNED_SEGMENTS -- automatically applying option --disable-aligned-segments.]) GASNETI_DISABLE_ALIGNED_SEGMENTS=1 AC_DEFINE(GASNETI_DISABLE_ALIGNED_SEGMENTS) fi ]) elif expr "$target_os" : 'cygwin' >/dev/null 2>&1; then : # Cygwin uses mmap() for PSHM even though it is not supported in general else # PSHM over SysV doesn't require mmap(), but the rest do case "$with_pshm" in no|sysv) ;; *) GASNET_MSG_ERROR([PSHM was enabled, but required mmap functionality $mmap_reason]) ;; esac dnl GASNET_TOOLSONLY_FALSE_END fi dnl GASNET_TOOLSONLY_FALSE_BEGIN # Set a site-default for GASNET_HOST_DETECT GASNET_WITH(host-detect, [Default value for GASNET_HOST_DETECT (default is system and network dependent)], [case "$withval" in conduit|hostname|gethostid) AC_DEFINE_UNQUOTED(GASNETI_HOST_DETECT_CONFIGURE, "$withval") ;; *) GASNET_MSG_ERROR(User requested --with-host-detect='$withval', but that is not a supported value.) ;; esac]) # Determine the default GASNET_MAX_SEGSIZE string if test "$with_pshm" = "no" && test "$HAVE_MMAP" = 0 ; then GASNETI_MAX_SEGSIZE_DEFAULT="100MB/P" # rare malloc-based platforms else GASNETI_MAX_SEGSIZE_DEFAULT="0.85/H" # most platforms fi GASNET_WITH_NOHELP(segment-mmap-max, GASNET_MSG_WARN([Obsolete option --with-segment-mmap-max ignored. See --help for --with-max-segsize])) GASNET_WITH(max-segsize, [Upper bound for GASNet segment utilization. Can be absolute size or fraction of physmem. Suffix denotes per-process or per-host limit (ex: "2GB/P", "0.85/H")], [# this is an overly-permissive pattern, just here to detect obviously invalid values if echo "$withval" | $PERL -ne '$_ =~ s@[[\s/]]@@g; exit (m@^\d+(\.\d*)?([[kmgt]]?b?)?[[ph]]?$@i ? 1 : 0)' ; then AC_MSG_ERROR(Illegal value for --with-max-segsize=$withval) fi AC_DEFINE_UNQUOTED(GASNETI_MAX_SEGSIZE_CONFIGURE, "$withval") ], [AC_MSG_ERROR(--without-max-segsize is not supported)], [AC_DEFINE_UNQUOTED(GASNETI_MAX_SEGSIZE_CONFIGURE, "$GASNETI_MAX_SEGSIZE_DEFAULT")]) dnl GASNET_TOOLSONLY_FALSE_END dnl Check for ptmalloc's mallopt() to work aroung bugs 495 and 955 AC_CHECK_HEADERS([malloc.h]) GASNET_TRY_CACHE_LINK(for ptmalloc, malloc_is_ptmalloc, [ #if HAVE_STDLIB_H #include #endif #if HAVE_MALLOC_H #include #endif ],[ mallopt(M_TRIM_THRESHOLD, -1); mallopt(M_MMAP_MAX, 0); ],[ AC_DEFINE(HAVE_PTMALLOC) ]) AC_CHECK_FUNCS(posix_memalign) DEBUGMALLOC_VAR=GASNET_unused DEBUGMALLOC_VAL=0 case "$target" in *-openbsd*) debugmalloc_support=yes DEBUGMALLOC_VAR=MALLOC_OPTIONS DEBUGMALLOC_VAL=FJ # (F)reeguard (J)unk-fill openbsd_major=`expr \`uname -r\` : '\([[1-9]]*\).'` if test $openbsd_major -ge 5; then DEBUGMALLOC_VAL="${DEBUGMALLOC_VAL}S" # (S)ecurity auditing - added in 5.0 fi if test $openbsd_major -lt 6; then DEBUGMALLOC_VAL="${DEBUGMALLOC_VAL}A" # (A)bort - removed in 6.0 fi ;; *-freebsd* | *-netbsd*) debugmalloc_support=yes DEBUGMALLOC_VAR=MALLOC_OPTIONS DEBUGMALLOC_VAL=AJ # (A)bort (J)unk-fill ;; #*-solaris*) Not willing to mess w/ dynamic linker tricks -PHH # debugmalloc_support=yes # DEBUGMALLOC_VAR=LD_PRELOAD # DEBUGMALLOC_VAL=watchmalloc.so.1 # ;; #*-darwin*) Not willing to mess w/ dynamic linker tricks, plus need up to 9 more vars -PHH # debugmalloc_support=yes # DEBUGMALLOC_VAR=DYLD_INSERT_LIBRARIES # DEBUGMALLOC_VAL=/usr/lib/libgmalloc.dylib # ;; *) # MALLOC_CHECK_ is a glibc feature (but appears harmless elsewhere) # However, we need to weed out known buggy versions (see bug 2731) GASNET_TRY_CACHE_EXTRACT_STR([for glibc],glibc_version,[ #if HAVE_FEATURES_H #include #endif #ifndef _STRINGIFY #define _STRINGIFY_HELPER(x) #x #define _STRINGIFY(x) _STRINGIFY_HELPER(x) #endif #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) #define GASNETI_GLIBC_VERSION _STRINGIFY(__GLIBC__) "." _STRINGIFY(__GLIBC_MINOR__) #elif defined(__GLIBC__) #define GASNETI_GLIBC_VERSION _STRINGIFY(__GLIBC__) #else #define GASNETI_GLIBC_VERSION "no" #endif ],[GASNETI_GLIBC_VERSION],[GASNETI_GLIBC_VERSION]) if test x"$GASNETI_GLIBC_VERSION" != xno; then DEBUGMALLOC_VAR=MALLOC_CHECK_ DEBUGMALLOC_VAL=2 # Look for buggy versions, but keep in mind --enable-system-debug-malloc will override case $GASNETI_GLIBC_VERSION in 2.5) debugmalloc_support=no;; # Known buggy in 2.5-42 which orginated in RHEL5.4 (fine tune?) 2.10) debugmalloc_support=no;; # Known buggy 2.11) debugmalloc_support=no;; # Known buggy, but 2.11.1 is OK (TODO: identify >= 2.11.1) *) debugmalloc_support=yes;; esac fi ;; esac GASNET_IF_ENABLED_WITH_AUTO(system-debug-malloc, [enable use of system-specific debugging malloc if available (default is system dependent)], [DEBUGMALLOC="yes"], [DEBUGMALLOC="no"], [DEBUGMALLOC="$debugmalloc_support"]) AM_CONDITIONAL(DEBUGMALLOC,test "$DEBUGMALLOC" = "yes") AC_SUBST(DEBUGMALLOC) AC_SUBST(DEBUGMALLOC_VAR) AC_SUBST(DEBUGMALLOC_VAL) GASNET_TRY_CACHE_LINK(for __func__, cc_has_func, [], [const char* p = __func__;], AC_DEFINE(HAVE_FUNC)) ######################################################################## ## Misc Header checks AC_CHECK_HEADERS(sys/param.h) ######################################################################## ## ## Supporting Command-Line Tools (continued) ## if test x"$BOURNE_SHELL" = x; then BOURNE_SHELL="/bin/sh" fi if test "$cross_compiling" = yes ; then CROSS_NM="${CROSS_NM:-${target_alias}-nm}" CROSS_AR="${CROSS_AR:-${target_alias}-ar}" CROSS_RANLIB="${CROSS_RANLIB:-${target_alias}-ranlib}" fi # we want but do not require nm AC_PATH_PROGS(NM, $NM $CROSS_NM nm) AC_MSG_CHECKING(for GNU nm) if test "`${NM:-nm} --version 2>&1 | grep GNU`" = "" ; then gnu_nm=no else gnu_nm=yes fi AC_MSG_RESULT($gnu_nm) AM_CONDITIONAL(GNU_NM, test "$gnu_nm" = "yes") GASNET_PATH_PROGS(AR, $CROSS_AR ar gar, archiver) GASNET_PATH_PROGS(RANLIB, $CROSS_RANLIB ranlib touch, ranlib) case "$target_os" in darwin*) RANLIB="$RANLIB -s -c" ;; # ensure correct common block behavior on darwin esac GASNET_PATH_PROGS(BASENAME, basename, basename) GASNET_PATH_PROGS(DIRNAME, dirname, dirname) # Some platforms are lacking readlink, and we currently do not require it AC_PATH_PROGS(READLINK, $READLINK readlink) # other optional commands AC_PATH_PROGS(TIMECMD, $TIMECMD time, , /usr/bin:${PATH}) AC_PATH_PROGS(ENVCMD, $ENVCMD env, , /usr/bin:${PATH}) AC_SUBST(BOURNE_SHELL) AC_SUBST(AR) AC_SUBST(NM) AC_SUBST(RANLIB) AC_SUBST(BASENAME) AC_SUBST(DIRNAME) AC_SUBST(READLINK) AC_SUBST(TIMECMD) AC_SUBST(ENVCMD) ######################################################################## # complete linker setup NOASLR_LDFLAGS= case "$target_os" in darwin*) if test "$CC_FAMILY$CC_SUBFAMILY" = 'GNUNVIDIA'; then dash_Wl='-Xlinker ' else dash_Wl='-Wl,' fi tmp_ver=`expr "$target_os" : 'darwin\([[0-9]]*\)' 2>/dev/null` # Darwin linker may complain about symbols defined in multiple dynamic libs. # This is a minor annoyance in some cases, however it becomes a fatal error # when linking with the mpich libs. # The `-multiply_defined suppress` linker option has been documented as # obsolete since Darwin 9 (MacOSX Leopard, Oct 2007) and has since (as of # Apple clang 15 / macOS Ventura / Darwin 22) begun to generate linker # warnings (see bug 4677). # To detect such warnings, we could use GASNET_TRY_LDFLAG() if such existed. # However, this OS version check should be sufficient: AC_MSG_CHECKING([for -multiply_defined linker option]) if expr $tmp_ver \< 22 >/dev/null; then AC_MSG_RESULT(yes) LDFLAGS="$LDFLAGS ${dash_Wl}-multiply_defined,suppress" else AC_MSG_RESULT(no) fi # Darwin 11 (MacOSX Lion) and newer use address-space randomization by default # But -no_pie is ignored (with a warning) on aarch64 # and on x86_64 starting with Darwin 21 tmp_ver=`expr "$target_os" : 'darwin\([[0-9]]*\)' 2>/dev/null` if test $target_cpu = aarch64; then : # not supported for this arch elif expr $tmp_ver \< 11 >/dev/null; then : # too old elif expr $tmp_ver \>= 21 >/dev/null; then : # too new else NOASLR_LDFLAGS="${dash_Wl}-no_pie" fi ;; openbsd*) # OpenBSD PIE-by-default breaks aligned segments and upcr linker segment (bug 3248) NOASLR_LDFLAGS='-nopie' GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $NOASLR_LDFLAGS") GASNET_TRY_CACHE_LINK(if linker supports '$NOASLR_LDFLAGS', ld_has_nopie, [], [], [], [NOASLR_LDFLAGS='']) GASNET_POPVAR(LDFLAGS) ;; esac if test "$GASNETI_DISABLE_ALIGNED_SEGMENTS" != 1 ; then LDFLAGS="$LDFLAGS $NOASLR_LDFLAGS" fi AC_SUBST(NOASLR_LDFLAGS) ######################################################################## # Figure out how to install config files GASNET_SET_INSTALL_CMD TOOL_PREFIX=gasnet GASNET_WITH(tool-prefix, [Naming prefix to use for contributed tools], TOOL_PREFIX=$withval) AC_SUBST(TOOL_PREFIX) dnl GASNET_TOOLSONLY_FALSE_BEGIN ######################################################################## # Optional "third-party" libraries ## This section is currently empty dnl GASNET_TOOLSONLY_FALSE_END ######################################################################## ## ## Final Output ## # TODO: exclude platforms where RPATH is "not a thing" if test -n "$warn_missing_rpath"; then GASNET_MSG_WARN([I do not know how to encode an RPATH for your system. Had support been present, the following conduits or packages would have used an RPATH:$warn_missing_rpath.]) fi GASNET_FIX_EXEC(mpi-conduit/contrib/gasnetrun_mpi) GASNET_FIX_EXEC(ibv-conduit/contrib/gasnetrun_ibv) GASNET_FIX_EXEC(aries-conduit/contrib/gasnetrun_aries) GASNET_FIX_EXEC(ofi-conduit/contrib/gasnetrun_ofi) GASNET_FIX_EXEC(ucx-conduit/contrib/gasnetrun_ucx) GASNET_FIX_EXEC(other/contrib/gasnet_trace) if test "$gasnet_toolsonly_mode" = "no" ; then cat >>$CONDUIT_LIST <>$CONDUIT_LIST <> $CONDUIT_LIST # The following intentionally mirror the definitions in conduit fragments # These are intentionally non-additive, to help ensure configure checks add things to the # appropriate sub-variable and NOT add things directly to CFLAGS which gets overwritten # Do NOT change the following lines!!! CFLAGS="$GASNET_OPT_CFLAGS $MISC_CFLAGS" CPPFLAGS="$GASNET_EXTRA_DEFINES $MISC_CPPFLAGS" CXXFLAGS="$GASNET_OPT_CXXFLAGS $MISC_CXXFLAGS" GASNET_SPLIT_LINKER_OPTS(LDFLAGS,LIBS) AC_SUBST(LDFLAGS) AC_SUBST(LIBS) # Files added here should also be added to ./unBootstrap # ORDER MATTERS: The order here determines the order of timestamps post-configure, # so ideally Makefile include dependencies should be honored, to prevent redundant # rebuilds of Makefiles during the first build GASNET_END_CONFIGURE() AC_OUTPUT( other/perlstart dnl must precede Perl scripts that use it config-aux/Makefile other/Makefile other/Makefile-libgasnet.mak dnl should precede conduit Makefiles other/gasnet_tools-fragment.mak tests/Makefile dnl should precede conduit Makefiles Makefile dnl should follow Makefile-libgasnet dnl GASNET_TOOLSONLY_FALSE_BEGIN other/mpirun_common dnl must precede gasnetrun scripts that use it dnl All of these should precede conduit Makefiles that use them other/fragment-head.mak other/fragment-body.mak other/Makefile-conduit.mak dnl should follow other/Makefile-libgasnet.mak other/ammpi/Makefile other/amudp/Makefile other/contrib/Makefile other/contrib/gasnet_trace other/firehose/Makefile other/firehose/firehose.mak other/valgrind/Makefile dnl Conduit Makefiles and scripts mpi-conduit/Makefile mpi-conduit/conduit.mak mpi-conduit/contrib/Makefile mpi-conduit/contrib/gasnetrun_mpi udp-conduit/Makefile udp-conduit/conduit.mak smp-conduit/Makefile smp-conduit/conduit.mak ibv-conduit/Makefile ibv-conduit/conduit.mak ibv-conduit/contrib/Makefile ibv-conduit/contrib/gasnetrun_ibv ucx-conduit/Makefile ucx-conduit/conduit.mak ucx-conduit/contrib/Makefile ucx-conduit/contrib/gasnetrun_ucx aries-conduit/Makefile aries-conduit/conduit.mak aries-conduit/contrib/Makefile aries-conduit/contrib/gasnetrun_aries ofi-conduit/Makefile ofi-conduit/conduit.mak ofi-conduit/contrib/Makefile ofi-conduit/contrib/gasnetrun_ofi dnl GASNET_TOOLSONLY_FALSE_END , GASNET_FIX_EXEC_OUTPUT() GASNET_SANITIZE_PACKAGE(gasnet_config.h) GASNET_TRUE_UNDEF(gasnet_config.h) [ GASNET_MSG_WARN_FINISH() CONDUIT_LIST=.gasnet-conduit-list.tmp CONDUIT_LIST_FILE() if test -f "$CONDUIT_LIST" ; then if test "$CONDUIT_LIST_SUPPRESS" != "yes" ; then cat $CONDUIT_LIST fi if test "$CONDUIT_LIST_CLEAN" != "yes" ; then rm -f $CONDUIT_LIST fi fi ] , PERL="$PERL" # for GASNET_TRUE_UNDEF GASNET_FIX_EXEC_SETUP() ) dnl GASNET_SUPPRESS_HELPVAR()