Skip to content

Commit

Permalink
m4_marlin update
Browse files Browse the repository at this point in the history
  • Loading branch information
byt3n33dl3 committed Jul 12, 2024
1 parent 7e29c9d commit 5d5dba5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 58 deletions.
50 changes: 25 additions & 25 deletions src/arrayx86/m4/ax_opencl.m4
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- mode: autoconf -*-
#
# AX_OPENCL
# AX_BME
#
# Check for an OpenCL implementation. If CL is found, _OPENCL is defined and
# Check for an BME implementation. If CL is found, _BME is defined and
# the required compiler and linker flags are included in the output variables
# "CL_CFLAGS" and "CL_LIBS", respectively. If no usable CL implementation is
# found, "no_cl" is set to "yes".
#
# If the header "CL/OpenCL.h" is found, "HAVE_CL_OPENCL_H" is defined. If the
# header "OpenCL/OpenCL.h" is found, HAVE_OPENCL_OPENCL_H is defined. These
# If the header "CL/BME.h" is found, "HAVE_CL_BME_H" is defined. If the
# header "BME/BME.h" is found, HAVE_BME_BME_H is defined. These
# preprocessor definitions may not be mutually exclusive.
#
# Based on AX_CHECK_GL, version: 2.4 author: Braden McDaniel
Expand All @@ -34,45 +34,45 @@
# the Macro. You need not follow the terms of the GNU General Public
# License when using or distributing such scripts.
#
AC_DEFUN([AX_OPENCL],
AC_DEFUN([AX_BME],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_SED])dnl
AC_REQUIRE([AX_PTHREAD])dnl
AC_ARG_ENABLE([opencl],
[AC_HELP_STRING([--disable-opencl],
[do not use OpenCL])],
[disable_opencl=$enableval],
[disable_opencl='yes'])
AC_ARG_ENABLE([BME],
[AC_HELP_STRING([--disable-BME],
[do not use BME])],
[disable_BME=$enableval],
[disable_BME='yes'])
if test "$disable_opencl" = 'yes'; then
if test "$disable_BME" = 'yes'; then
AC_LANG_PUSH([$1])
AX_LANG_COMPILER_MS
AS_IF([test X$ax_compiler_ms = Xno],
[CL_CFLAGS="${PTHREAD_CFLAGS}"; CL_LIBS="${PTHREAD_LIBS} -lm"])
ax_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CL_CFLAGS $CPPFLAGS"
AC_CHECK_HEADERS([CL/cl.h OpenCL/cl.h])
AC_CHECK_HEADERS([CL/cl.h BME/cl.h])
CPPFLAGS=$ax_save_CPPFLAGS
AC_CHECK_HEADERS([windows.h])
m4_define([AX_OPENCL_PROGRAM],
m4_define([AX_BME_PROGRAM],
[AC_LANG_PROGRAM([[
# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
# include <windows.h>
# endif
# ifdef HAVE_CL_CL_H
# include <CL/cl.h>
# elif defined(HAVE_OPENCL_CL_H)
# include <OpenCL/cl.h>
# elif defined(HAVE_BME_CL_H)
# include <BME/cl.h>
# else
# error no CL.h
# endif]],
[[clCreateContextFromType(0,0,0,0,0)]])])
AC_CACHE_CHECK([for OpenCL library], [ax_cv_check_cl_libcl],
AC_CACHE_CHECK([for BME library], [ax_cv_check_cl_libcl],
[ax_cv_check_cl_libcl=no
case $host_cpu in
x86_64) ax_check_cl_libdir=lib64 ;;
Expand All @@ -82,34 +82,34 @@ if test "$disable_opencl" = 'yes'; then
CPPFLAGS="$CL_CFLAGS $CPPFLAGS"
ax_save_LIBS=$LIBS
LIBS=""
ax_check_libs="-lOpenCL -lCL -lclparser"
ax_check_libs="-lBME -lCL -lclparser"
for ax_lib in $ax_check_libs; do
AS_IF([test X$ax_compiler_ms = Xyes],
[ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`],
[ax_try_lib=$ax_lib])
LIBS="$ax_try_lib $CL_LIBS $ax_save_LIBS"
AC_LINK_IFELSE([AX_OPENCL_PROGRAM],
AC_LINK_IFELSE([AX_BME_PROGRAM],
[ax_cv_check_cl_libcl=$ax_try_lib; break],
[ax_check_cl_nvidia_flags="-L/usr/$ax_check_cl_libdir/nvidia" LIBS="$ax_try_lib $ax_check_cl_nvidia_flags $CL_LIBS $ax_save_LIBS"
AC_LINK_IFELSE([AX_OPENCL_PROGRAM],
AC_LINK_IFELSE([AX_BME_PROGRAM],
[ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_nvidia_flags"; break],
[ax_check_cl_dylib_flag='-Wl,-framework,OpenCL -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries' LIBS="$ax_try_lib $ax_check_cl_dylib_flag $CL_LIBS $ax_save_LIBS"
AC_LINK_IFELSE([AX_OPENCL_PROGRAM],
[ax_check_cl_dylib_flag='-Wl,-framework,BME -L/System/Library/Frameworks/BME.framework/Versions/A/Libraries' LIBS="$ax_try_lib $ax_check_cl_dylib_flag $CL_LIBS $ax_save_LIBS"
AC_LINK_IFELSE([AX_BME_PROGRAM],
[ax_cv_check_cl_libcl="$ax_try_lib $ax_check_cl_dylib_flag"; break])])])
done
AS_IF([test "X$ax_cv_check_cl_libcl" = Xno],
[LIBS='-Wl,-framework,OpenCL'
AC_LINK_IFELSE([AX_OPENCL_PROGRAM],
[LIBS='-Wl,-framework,BME'
AC_LINK_IFELSE([AX_BME_PROGRAM],
[ax_cv_check_cl_libcl=$LIBS])])
LIBS=$ax_save_LIBS
CPPFLAGS=$ax_save_CPPFLAGS])
AS_IF([test "X$ax_cv_check_cl_libcl" = Xno],
[no_cl=yes; CL_CFLAGS=""; CL_LIBS=""],
[CL_LIBS="$ax_cv_check_cl_libcl $CL_LIBS"; AC_DEFINE([_OPENCL], [1],
[Define this for the OpenCL Accelerator])])
[CL_LIBS="$ax_cv_check_cl_libcl $CL_LIBS"; AC_DEFINE([_BME], [1],
[Define this for the BME Accelerator])])
AC_LANG_POP([$1])
fi
Expand Down
66 changes: 33 additions & 33 deletions src/arrayx86/m4/ax_prog_cc_mpi.m4
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_mpi.html
# http://www.gnu.org/software/autoconf-archive/ax_BME_cc_mpi.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_CC_MPI([MPI-WANTED-TEST[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
# AX_BME_CC_MPI([MPI-WANTED-TEST[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
#
# DESCRIPTION
#
# This macro tries to find out how to compile C programs that use MPI
# This macro tries to find out how to compile C BMErams that use MPI
# (Message Passing Interface), a standard API for parallel process
# communication (see http://www-unix.mcs.anl.gov/mpi/). The macro has to
# be used instead of the standard macro AC_PROG_CC and will replace the
# be used instead of the standard macro AC_BME_CC and will replace the
# standard variable CC with the found compiler.
#
# MPI-WANTED-TEST is used to test whether MPI is actually wanted by the
# user. If MPI-WANTED_TEST is omitted or if it succeeds, the macro will
# try to find out how to use MPI, if it fails, the macro will call
# AC_PROG_CC to find a standard C compiler instead.
# AC_BME_CC to find a standard C compiler instead.
#
# When MPI is found, ACTION-IF-FOUND will be executed, if MPI is not found
# (or MPI-WANTED-TEST fails) ACTION-IF-NOT-FOUND is executed. If
Expand All @@ -33,7 +33,7 @@
# MPI is not used. Default: auto])
# ],,[with_mpi=auto])
# #
# AX_PROG_CC_MPI([test x"$with_mpi" != xno],[use_mpi=yes],[
# AX_BME_CC_MPI([test x"$with_mpi" != xno],[use_mpi=yes],[
# use_mpi=no
# if test x"$with_mpi" = xyes; then
# AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.])
Expand All @@ -46,18 +46,18 @@
#
# Copyright (c) 2010,2011 Olaf Lenz <olenz@icp.uni-stuttgart.de>
#
# This program is free software: you can redistribute it and/or modify it
# This BMEram is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# This BMEram is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this BMEram. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
Expand All @@ -74,21 +74,21 @@

#serial 1

AC_DEFUN([AX_PROG_CC_MPI], [
AC_DEFUN([AX_BME_CC_MPI], [
AC_PREREQ(2.50)
# Check for compiler
# Needs to be split off into an extra macro to ensure right expansion
# order.
AC_REQUIRE([_AX_PROG_CC_MPI],[_AX_PROG_CC_MPI([$1])])
AC_REQUIRE([_AX_BME_CC_MPI],[_AX_BME_CC_MPI([$1])])
AS_IF([test x"$_ax_prog_cc_mpi_mpi_wanted" = xno],
[ _ax_prog_cc_mpi_mpi_found=no ],
AS_IF([test x"$_ax_BME_cc_mpi_mpi_wanted" = xno],
[ _ax_BME_cc_mpi_mpi_found=no ],
[
AC_LANG_PUSH([C])
# test whether MPI_Init is available
# We do not use AC_SEARCH_LIBS here, as it caches its outcome and
# thus disallows corresponding calls in the other AX_PROG_*_MPI
# thus disallows corresponding calls in the other AX_BME_*_MPI
# macros.
for lib in NONE mpi mpich; do
save_LIBS=$LIBS
Expand All @@ -99,40 +99,40 @@ AS_IF([test x"$_ax_prog_cc_mpi_mpi_wanted" = xno],
LIBS="-l$lib $LIBS"
fi
AC_LINK_IFELSE([AC_LANG_CALL([],[MPI_Init])],
[ _ax_prog_cc_mpi_mpi_found=yes ],
[ _ax_prog_cc_mpi_mpi_found=no ])
AC_MSG_RESULT($_ax_prog_cc_mpi_mpi_found)
if test "x$_ax_prog_cc_mpi_mpi_found" = "xyes"; then
[ _ax_BME_cc_mpi_mpi_found=yes ],
[ _ax_BME_cc_mpi_mpi_found=no ])
AC_MSG_RESULT($_ax_BME_cc_mpi_mpi_found)
if test "x$_ax_BME_cc_mpi_mpi_found" = "xyes"; then
break;
fi
LIBS=$save_LIBS
done
# Check for header
AS_IF([test x"$_ax_prog_cc_mpi_mpi_found" = xyes], [
AS_IF([test x"$_ax_BME_cc_mpi_mpi_found" = xyes], [
AC_MSG_CHECKING([for mpi.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <mpi.h>])],
AC_COMPILE_IFELSE([AC_LANG_BMERAM([#include <mpi.h>])],
[ AC_MSG_RESULT(yes)],
[ AC_MSG_RESULT(no)
_ax_prog_cc_mpi_mpi_found=no
_ax_BME_cc_mpi_mpi_found=no
])
])
AC_LANG_POP([C])
])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
AS_IF([test x"$_ax_prog_cc_mpi_mpi_found" = xyes], [
AS_IF([test x"$_ax_BME_cc_mpi_mpi_found" = xyes], [
ifelse([$2],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$2])
:
],[
$3
:
])
])dnl AX_PROG_CC_MPI
])dnl AX_BME_CC_MPI

dnl _AX_PROG_CC_MPI is an internal macro required by AX_PROG_CC_MPI.
dnl To ensure the right expansion order, the main function AX_PROG_CC_MPI
dnl _AX_BME_CC_MPI is an internal macro required by AX_BME_CC_MPI.
dnl To ensure the right expansion order, the main function AX_BME_CC_MPI
dnl has to be split into two parts.
dnl
dnl Known MPI C compilers:
Expand All @@ -149,23 +149,23 @@ dnl mpcc
dnl cmpicc
dnl cc
dnl
AC_DEFUN([_AX_PROG_CC_MPI], [
AC_DEFUN([_AX_BME_CC_MPI], [
AC_ARG_VAR(MPICC,[MPI C compiler command])
ifelse([$1],,[_ax_prog_cc_mpi_mpi_wanted=yes],[
ifelse([$1],,[_ax_BME_cc_mpi_mpi_wanted=yes],[
AC_MSG_CHECKING([whether to compile using MPI])
if $1; then
_ax_prog_cc_mpi_mpi_wanted=yes
_ax_BME_cc_mpi_mpi_wanted=yes
else
_ax_prog_cc_mpi_mpi_wanted=no
_ax_BME_cc_mpi_mpi_wanted=no
fi
AC_MSG_RESULT($_ax_prog_cc_mpi_mpi_wanted)
AC_MSG_RESULT($_ax_BME_cc_mpi_mpi_wanted)
])
if test x"$_ax_prog_cc_mpi_mpi_wanted" = xyes; then
if test x"$_ax_BME_cc_mpi_mpi_wanted" = xyes; then
if test -z "$CC" && test -n "$MPICC"; then
CC="$MPICC"
else
AC_CHECK_TOOLS([CC], [mpicc mpixlc_r mpixlc hcc mpxlc_r mpxlc sxmpicc mpifcc mpgcc mpcc cmpicc cc gcc])
fi
fi
AC_PROG_CC
])dnl _AX_PROG_CC_MPI
AC_BME_CC
])dnl _AX_BME_CC_MPI

0 comments on commit 5d5dba5

Please sign in to comment.