| 1 |
# =========================================================================== |
| 2 |
# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html |
| 3 |
# =========================================================================== |
| 4 |
# |
| 5 |
# SYNOPSIS |
| 6 |
# |
| 7 |
# AX_COMPILER_VENDOR |
| 8 |
# |
| 9 |
# DESCRIPTION |
| 10 |
# |
| 11 |
# Determine the vendor of the C, C++ or Fortran compiler. The vendor is |
| 12 |
# returned in the cache variable $ax_cv_c_compiler_vendor for C, |
| 13 |
# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for |
| 14 |
# (modern) Fortran. The value is one of "intel", "ibm", "pathscale", |
| 15 |
# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC |
| 16 |
# Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer |
| 17 |
# Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi", |
| 18 |
# "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if |
| 19 |
# the compiler cannot be determined). |
| 20 |
# |
| 21 |
# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT |
| 22 |
# with an appropriate preprocessor-enabled extension. For example: |
| 23 |
# |
| 24 |
# AC_LANG_PUSH([Fortran]) |
| 25 |
# AC_PROG_FC |
| 26 |
# AC_FC_PP_SRCEXT([F]) |
| 27 |
# AX_COMPILER_VENDOR |
| 28 |
# AC_LANG_POP([Fortran]) |
| 29 |
# |
| 30 |
# LICENSE |
| 31 |
# |
| 32 |
# Copyright (c) 2008 Steven G. Johnson <[email protected]> |
| 33 |
# Copyright (c) 2008 Matteo Frigo |
| 34 |
# Copyright (c) 2018-19 John Zaitseff <[email protected]> |
| 35 |
# |
| 36 |
# This program is free software: you can redistribute it and/or modify it |
| 37 |
# under the terms of the GNU General Public License as published by the |
| 38 |
# Free Software Foundation, either version 3 of the License, or (at your |
| 39 |
# option) any later version. |
| 40 |
# |
| 41 |
# This program is distributed in the hope that it will be useful, but |
| 42 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 43 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 44 |
# Public License for more details. |
| 45 |
# |
| 46 |
# You should have received a copy of the GNU General Public License along |
| 47 |
# with this program. If not, see <https://www.gnu.org/licenses/>. |
| 48 |
# |
| 49 |
# As a special exception, the respective Autoconf Macro's copyright owner |
| 50 |
# gives unlimited permission to copy, distribute and modify the configure |
| 51 |
# scripts that are the output of Autoconf when processing the Macro. You |
| 52 |
# need not follow the terms of the GNU General Public License when using |
| 53 |
# or distributing such scripts, even though portions of the text of the |
| 54 |
# Macro appear in them. The GNU General Public License (GPL) does govern |
| 55 |
# all other use of the material that constitutes the Autoconf Macro. |
| 56 |
# |
| 57 |
# This special exception to the GPL applies to versions of the Autoconf |
| 58 |
# Macro released by the Autoconf Archive. When you make and distribute a |
| 59 |
# modified version of the Autoconf Macro, you may extend this special |
| 60 |
# exception to the GPL to apply to your modified version as well. |
| 61 |
|
| 62 |
#serial 32 |
| 63 |
|
| 64 |
AC_DEFUN([AX_COMPILER_VENDOR], [dnl |
| 65 |
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl |
| 66 |
dnl If you modify this list of vendors, please add similar support |
| 67 |
dnl to ax_compiler_version.m4 if at all possible. |
| 68 |
dnl |
| 69 |
dnl Note: Do NOT check for GCC first since some other compilers |
| 70 |
dnl define __GNUC__ to remain compatible with it. Compilers that |
| 71 |
dnl are very slow to start (such as Intel) are listed first. |
| 72 |
|
| 73 |
vendors=" |
| 74 |
intel: __ICC,__ECC,__INTEL_COMPILER |
| 75 |
ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__ |
| 76 |
pathscale: __PATHCC__,__PATHSCALE__ |
| 77 |
clang: __clang__ |
| 78 |
cray: _CRAYC |
| 79 |
fujitsu: __FUJITSU |
| 80 |
sdcc: SDCC,__SDCC |
| 81 |
sx: _SX |
| 82 |
nvhpc: __NVCOMPILER |
| 83 |
portland: __PGI |
| 84 |
gnu: __GNUC__ |
| 85 |
sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95 |
| 86 |
hp: __HP_cc,__HP_aCC |
| 87 |
dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER |
| 88 |
borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ |
| 89 |
comeau: __COMO__ |
| 90 |
kai: __KCC |
| 91 |
lcc: __LCC__ |
| 92 |
sgi: __sgi,sgi |
| 93 |
microsoft: _MSC_VER |
| 94 |
metrowerks: __MWERKS__ |
| 95 |
watcom: __WATCOMC__ |
| 96 |
tcc: __TINYC__ |
| 97 |
unknown: UNKNOWN |
| 98 |
" |
| 99 |
for ventest in $vendors; do |
| 100 |
case $ventest in |
| 101 |
*:) |
| 102 |
vendor=$ventest |
| 103 |
continue |
| 104 |
;; |
| 105 |
*) |
| 106 |
vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" |
| 107 |
;; |
| 108 |
esac |
| 109 |
|
| 110 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ |
| 111 |
#if !($vencpp) |
| 112 |
thisisanerror; |
| 113 |
#endif |
| 114 |
]])], [break]) |
| 115 |
done |
| 116 |
|
| 117 |
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` |
| 118 |
]) |
| 119 |
])dnl |