Add mor extra m4 packages
This commit is contained in:
parent
1fe8b81bcc
commit
62522d0fa6
46
etc/m4/ax_append_compile_flags.m4
Normal file
46
etc/m4/ax_append_compile_flags.m4
Normal file
@ -0,0 +1,46 @@
|
||||
# ============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. During the check the flag is always added to the
|
||||
# current language's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and
|
||||
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
|
||||
# AX_APPEND_LINK_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_COMPILE_FLAGS
|
||||
50
etc/m4/ax_append_flag.m4
Normal file
50
etc/m4/ax_append_flag.m4
Normal file
@ -0,0 +1,50 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
|
||||
# added in between.
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
|
||||
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
|
||||
# FLAG.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AC_DEFUN([AX_APPEND_FLAG],
|
||||
[dnl
|
||||
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
|
||||
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
|
||||
AS_VAR_SET_IF(FLAGS,[
|
||||
AS_CASE([" AS_VAR_GET(FLAGS) "],
|
||||
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
|
||||
[
|
||||
AS_VAR_APPEND(FLAGS,[" $1"])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
],
|
||||
[
|
||||
AS_VAR_SET(FLAGS,[$1])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])dnl AX_APPEND_FLAG
|
||||
44
etc/m4/ax_append_link_flags.m4
Normal file
44
etc/m4/ax_append_link_flags.m4
Normal file
@ -0,0 +1,44 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the linker works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
|
||||
# used. During the check the flag is always added to the linker's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
|
||||
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_APPEND_LINK_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_LINK_FLAGS
|
||||
53
etc/m4/ax_check_compile_flag.m4
Normal file
53
etc/m4/ax_check_compile_flag.m4
Normal file
@ -0,0 +1,53 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
136
etc/m4/ax_compiler_flags_cxxflags.m4
Normal file
136
etc/m4/ax_compiler_flags_cxxflags.m4
Normal file
@ -0,0 +1,136 @@
|
||||
# ===============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html
|
||||
# ===============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_FLAGS_CXXFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Add warning flags for the C++ compiler to VARIABLE, which defaults to
|
||||
# WARN_CXXFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
|
||||
# manually added to the CXXFLAGS variable for each target in the code
|
||||
# base.
|
||||
#
|
||||
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
|
||||
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
|
||||
# which flags to enable.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 David King <amigadave@amigadave.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 10
|
||||
|
||||
AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
|
||||
# Variable names
|
||||
m4_define([ax_warn_cxxflags_variable],
|
||||
[m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
# Always pass -Werror=unknown-warning-option to get Clang to fail on bad
|
||||
# flags, otherwise they are always appended to the warn_cxxflags variable,
|
||||
# and Clang warns on them for every compilation unit.
|
||||
# If this is passed to GCC, it will explode, so the flag must be enabled
|
||||
# conditionally.
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
|
||||
ax_compiler_flags_test="-Werror=unknown-warning-option"
|
||||
],[
|
||||
ax_compiler_flags_test=""
|
||||
])
|
||||
|
||||
# Check that -Wno-suggest-attribute=format is supported
|
||||
AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[
|
||||
ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format"
|
||||
],[
|
||||
ax_compiler_no_suggest_attribute_flags=""
|
||||
])
|
||||
|
||||
# Base flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-fno-strict-aliasing dnl
|
||||
$3 dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
|
||||
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
|
||||
# "yes" flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-Wall dnl
|
||||
-Wextra dnl
|
||||
-Wundef dnl
|
||||
-Wwrite-strings dnl
|
||||
-Wpointer-arith dnl
|
||||
-Wmissing-declarations dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wno-unused-parameter dnl
|
||||
-Wno-missing-field-initializers dnl
|
||||
-Wformat=2 dnl
|
||||
-Wcast-align dnl
|
||||
-Wformat-nonliteral dnl
|
||||
-Wformat-security dnl
|
||||
-Wsign-compare dnl
|
||||
-Wstrict-aliasing dnl
|
||||
-Wshadow dnl
|
||||
-Winline dnl
|
||||
-Wpacked dnl
|
||||
-Wmissing-format-attribute dnl
|
||||
-Wmissing-noreturn dnl
|
||||
-Winit-self dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wmissing-include-dirs dnl
|
||||
-Wunused-but-set-variable dnl
|
||||
-Warray-bounds dnl
|
||||
-Wreturn-type dnl
|
||||
-Wno-overloaded-virtual dnl
|
||||
-Wswitch-enum dnl
|
||||
-Wswitch-default dnl
|
||||
$4 dnl
|
||||
$5 dnl
|
||||
$6 dnl
|
||||
$7 dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
|
||||
# "error" flags; -Werror has to be appended unconditionally because
|
||||
# it's not possible to test for
|
||||
#
|
||||
# suggest-attribute=format is disabled because it gives too many false
|
||||
# positives
|
||||
AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable)
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
[$ax_compiler_no_suggest_attribute_flags] dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
|
||||
# In the flags below, when disabling specific flags, always add *both*
|
||||
# -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
|
||||
# we enable -Werror, disable a flag, and a build bot passes CXXFLAGS=-Wall,
|
||||
# which effectively turns that flag back on again as an error.
|
||||
for flag in $ax_warn_cxxflags_variable; do
|
||||
AS_CASE([$flag],
|
||||
[-Wno-*=*],[],
|
||||
[-Wno-*],[
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
|
||||
ax_warn_cxxflags_variable,
|
||||
[$ax_compiler_flags_test])
|
||||
])
|
||||
done
|
||||
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Substitute the variables
|
||||
AC_SUBST(ax_warn_cxxflags_variable)
|
||||
])dnl AX_COMPILER_FLAGS_CXXFLAGS
|
||||
119
etc/m4/ax_compiler_vendor.m4
Normal file
119
etc/m4/ax_compiler_vendor.m4
Normal file
@ -0,0 +1,119 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_VENDOR
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determine the vendor of the C, C++ or Fortran compiler. The vendor is
|
||||
# returned in the cache variable $ax_cv_c_compiler_vendor for C,
|
||||
# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
|
||||
# (modern) Fortran. The value is one of "intel", "ibm", "pathscale",
|
||||
# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC
|
||||
# Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer
|
||||
# Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi",
|
||||
# "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if
|
||||
# the compiler cannot be determined).
|
||||
#
|
||||
# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
|
||||
# with an appropriate preprocessor-enabled extension. For example:
|
||||
#
|
||||
# AC_LANG_PUSH([Fortran])
|
||||
# AC_PROG_FC
|
||||
# AC_FC_PP_SRCEXT([F])
|
||||
# AX_COMPILER_VENDOR
|
||||
# AC_LANG_POP([Fortran])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2008 Matteo Frigo
|
||||
# Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
|
||||
#
|
||||
# This program 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
|
||||
# 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 <https://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
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 32
|
||||
|
||||
AC_DEFUN([AX_COMPILER_VENDOR], [dnl
|
||||
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
|
||||
dnl If you modify this list of vendors, please add similar support
|
||||
dnl to ax_compiler_version.m4 if at all possible.
|
||||
dnl
|
||||
dnl Note: Do NOT check for GCC first since some other compilers
|
||||
dnl define __GNUC__ to remain compatible with it. Compilers that
|
||||
dnl are very slow to start (such as Intel) are listed first.
|
||||
|
||||
vendors="
|
||||
intel: __ICC,__ECC,__INTEL_COMPILER
|
||||
ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
|
||||
pathscale: __PATHCC__,__PATHSCALE__
|
||||
clang: __clang__
|
||||
cray: _CRAYC
|
||||
fujitsu: __FUJITSU
|
||||
sdcc: SDCC,__SDCC
|
||||
sx: _SX
|
||||
nvhpc: __NVCOMPILER
|
||||
portland: __PGI
|
||||
gnu: __GNUC__
|
||||
sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
|
||||
hp: __HP_cc,__HP_aCC
|
||||
dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
|
||||
borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
|
||||
comeau: __COMO__
|
||||
kai: __KCC
|
||||
lcc: __LCC__
|
||||
sgi: __sgi,sgi
|
||||
microsoft: _MSC_VER
|
||||
metrowerks: __MWERKS__
|
||||
watcom: __WATCOMC__
|
||||
tcc: __TINYC__
|
||||
unknown: UNKNOWN
|
||||
"
|
||||
for ventest in $vendors; do
|
||||
case $ventest in
|
||||
*:)
|
||||
vendor=$ventest
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
|
||||
#if !($vencpp)
|
||||
thisisanerror;
|
||||
#endif
|
||||
]])], [break])
|
||||
done
|
||||
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
|
||||
])
|
||||
])dnl
|
||||
173
etc/m4/ax_prog_cc_mpi.m4
Normal file
173
etc/m4/ax_prog_cc_mpi.m4
Normal file
@ -0,0 +1,173 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_mpi.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PROG_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
|
||||
# (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
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
# ACTION-IF-FOUND is not set, the macro will define HAVE_MPI.
|
||||
#
|
||||
# The following example demonstrates usage of the macro:
|
||||
#
|
||||
# # If --with-mpi=auto is used, try to find MPI, but use standard C compiler if it is not found.
|
||||
# # If --with-mpi=yes is used, try to find MPI and fail if it isn't found.
|
||||
# # If --with-mpi=no is used, use a standard C compiler instead.
|
||||
# AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi],
|
||||
# [compile with MPI (parallelization) support. If none is found,
|
||||
# MPI is not used. Default: auto])
|
||||
# ],,[with_mpi=auto])
|
||||
# #
|
||||
# AX_PROG_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.])
|
||||
# else
|
||||
# AC_MSG_WARN([No MPI compiler found, won't use MPI.])
|
||||
# fi
|
||||
# ])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2010,2011 Olaf Lenz <olenz@icp.uni-stuttgart.de>
|
||||
#
|
||||
# Modified 2015 Devin Matthews <dmatthews@utexas.edu>
|
||||
#
|
||||
# This program 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
|
||||
# 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/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN([AX_PROG_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])])
|
||||
|
||||
AS_IF([test x"$_ax_prog_cc_mpi_mpi_wanted" = xno],
|
||||
[ _ax_prog_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
|
||||
# macros.
|
||||
for lib in NONE mpi mpich; do
|
||||
save_LIBS=$LIBS
|
||||
if test x"$lib" = xNONE; then
|
||||
AC_MSG_CHECKING([for function MPI_Init])
|
||||
else
|
||||
AC_MSG_CHECKING([for function MPI_Init in -l$lib])
|
||||
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
|
||||
break;
|
||||
fi
|
||||
LIBS=$save_LIBS
|
||||
done
|
||||
|
||||
# Check for header
|
||||
AS_IF([test x"$_ax_prog_cc_mpi_mpi_found" = xyes], [
|
||||
AC_MSG_CHECKING([for mpi.h])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <mpi.h>])],
|
||||
[ AC_MSG_RESULT(yes)],
|
||||
[ AC_MSG_RESULT(no)
|
||||
_ax_prog_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], [
|
||||
ifelse([$2],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$2])
|
||||
:
|
||||
],[
|
||||
$3
|
||||
:
|
||||
])
|
||||
|
||||
])dnl AX_PROG_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 has to be split into two parts.
|
||||
dnl
|
||||
dnl Known MPI C compilers:
|
||||
dnl mpicc
|
||||
dnl mpixlc_r
|
||||
dnl mpixlc
|
||||
dnl hcc
|
||||
dnl mpxlc_r
|
||||
dnl mpxlc
|
||||
dnl sxmpicc NEC SX
|
||||
dnl mpifcc Fujitsu
|
||||
dnl mpgcc
|
||||
dnl mpcc
|
||||
dnl cmpicc
|
||||
dnl cc
|
||||
dnl
|
||||
AC_DEFUN([_AX_PROG_CC_MPI], [
|
||||
AC_ARG_VAR(MPICC,[MPI C compiler command])
|
||||
ifelse([$1],,[_ax_prog_cc_mpi_mpi_wanted=yes],[
|
||||
AC_MSG_CHECKING([whether to compile using MPI])
|
||||
if $1; then
|
||||
_ax_prog_cc_mpi_mpi_wanted=yes
|
||||
else
|
||||
_ax_prog_cc_mpi_mpi_wanted=no
|
||||
fi
|
||||
AC_MSG_RESULT($_ax_prog_cc_mpi_mpi_wanted)
|
||||
])
|
||||
if test x"$_ax_prog_cc_mpi_mpi_wanted" = xyes; then
|
||||
if test -z "$CC" && test -n "$MPICC"; then
|
||||
CC="$MPICC"
|
||||
else
|
||||
AC_CHECK_TOOLS([CC], [mpicc cc])
|
||||
fi
|
||||
fi
|
||||
AC_PROG_CC
|
||||
])dnl _AX_PROG_CC_MPI
|
||||
37
etc/m4/ax_require_defined.m4
Normal file
37
etc/m4/ax_require_defined.m4
Normal file
@ -0,0 +1,37 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_REQUIRE_DEFINED(MACRO)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
|
||||
# been defined and thus are available for use. This avoids random issues
|
||||
# where a macro isn't expanded. Instead the configure script emits a
|
||||
# non-fatal:
|
||||
#
|
||||
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
|
||||
#
|
||||
# It's like AC_REQUIRE except it doesn't expand the required macro.
|
||||
#
|
||||
# Here's an example:
|
||||
#
|
||||
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
|
||||
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
|
||||
])dnl AX_REQUIRE_DEFINED
|
||||
Loading…
Reference in New Issue
Block a user