# Load procedures from common libraries.
load_lib gfortran-dg.exp
load_lib atomic-dg.exp
+load_lib target-libpath.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
global gfortran_aux_module_flags
set gfortran_test_path $srcdir/$subdir
set gfortran_aux_module_flags $DEFAULT_FFLAGS
+global enable_caf_shmem
+set gccpath [get_multilibs]
+set shlib_ext [get_shlib_extension]
+set enable_caf_shmem [expr [file exists "${gccpath}/libgfortran/.libs/libcaf_shmem.a"] || \
+ [file exists "${gccpath}/libgfortran/.libs/libcaf_shmem.${shlib_ext}"] ]
proc dg-compile-aux-modules { args } {
global gfortran_test_path
cleanup-modules ""
}
- foreach flags $option_list {
- verbose "Testing $nshort (libcaf_shmem), $flags" 1
- set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_shmem"
- dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
- cleanup-modules ""
+ if "$enable_caf_shmem" {
+ foreach flags $option_list {
+ verbose "Testing $nshort (libcaf_shmem), $flags" 1
+ set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_shmem"
+ dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
+ cleanup-modules ""
+ }
}
}
torture-finish
libcaf_single_la_DEPENDENCIES = $(libcaf_shared_DEPS)
libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS)
+if ENABLE_CAF_SHMEM
+libcaf_shmem_la_CFLAGS = $(CAF_SHMEM_CFLAGS)
libcaf_shmem_la_SOURCES = $(libcaf_shared_SRCS) \
caf/shmem.c caf/shmem/alloc.c caf/shmem/allocator.c \
caf/shmem/collective_subroutine.c caf/shmem/counter_barrier.c \
caf/shmem/counter_barrier.h caf/shmem/hashmap.h \
caf/shmem/shared_memory.h caf/shmem/supervisor.h caf/shmem/sync.h \
caf/shmem/teams_mgmt.h caf/shmem/thread_support.h
-libcaf_shmem_la_LINK = $(LINK) $(libcaf_shmem_la_LDFLAGS)
+libcaf_shmem_la_LINK = $(LINK) $(libcaf_shmem_la_LDFLAGS) $(CAF_SHMEM_LIBS)
+endif
if IEEE_SUPPORT
fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/finclude
freelocale uselocale strerror_l strtof128 strfromf128)
fi
+# Check for existing and usable pthreads.
+AX_PTHREAD([
+ enable_caf_shmem=true
+ CAF_SHMEM_CFLAGS="$PTHREAD_CFLAGS"
+ CAF_SHMEM_LIBS="$PTHREAD_LIBS"
+ ], [
+ enable_caf_shmem=false
+ ])
+AM_CONDITIONAL([ENABLE_CAF_SHMEM], [test x$enable_caf_shmem = xtrue])
+
# Check strerror_r, cannot be above as versions with two and three arguments exist
LIBGFOR_CHECK_STRERROR_R