11cb0ef41Sopenharmony_ci# ===========================================================================
21cb0ef41Sopenharmony_ci#    https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
31cb0ef41Sopenharmony_ci# ===========================================================================
41cb0ef41Sopenharmony_ci#
51cb0ef41Sopenharmony_ci# SYNOPSIS
61cb0ef41Sopenharmony_ci#
71cb0ef41Sopenharmony_ci#   AX_COMPILER_VENDOR
81cb0ef41Sopenharmony_ci#
91cb0ef41Sopenharmony_ci# DESCRIPTION
101cb0ef41Sopenharmony_ci#
111cb0ef41Sopenharmony_ci#   Determine the vendor of the C, C++ or Fortran compiler.  The vendor is
121cb0ef41Sopenharmony_ci#   returned in the cache variable $ax_cv_c_compiler_vendor for C,
131cb0ef41Sopenharmony_ci#   $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
141cb0ef41Sopenharmony_ci#   (modern) Fortran.  The value is one of "intel", "ibm", "pathscale",
151cb0ef41Sopenharmony_ci#   "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC
161cb0ef41Sopenharmony_ci#   Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer
171cb0ef41Sopenharmony_ci#   Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi",
181cb0ef41Sopenharmony_ci#   "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if
191cb0ef41Sopenharmony_ci#   the compiler cannot be determined).
201cb0ef41Sopenharmony_ci#
211cb0ef41Sopenharmony_ci#   To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
221cb0ef41Sopenharmony_ci#   with an appropriate preprocessor-enabled extension.  For example:
231cb0ef41Sopenharmony_ci#
241cb0ef41Sopenharmony_ci#     AC_LANG_PUSH([Fortran])
251cb0ef41Sopenharmony_ci#     AC_PROG_FC
261cb0ef41Sopenharmony_ci#     AC_FC_PP_SRCEXT([F])
271cb0ef41Sopenharmony_ci#     AX_COMPILER_VENDOR
281cb0ef41Sopenharmony_ci#     AC_LANG_POP([Fortran])
291cb0ef41Sopenharmony_ci#
301cb0ef41Sopenharmony_ci# LICENSE
311cb0ef41Sopenharmony_ci#
321cb0ef41Sopenharmony_ci#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
331cb0ef41Sopenharmony_ci#   Copyright (c) 2008 Matteo Frigo
341cb0ef41Sopenharmony_ci#   Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
351cb0ef41Sopenharmony_ci#
361cb0ef41Sopenharmony_ci#   This program is free software: you can redistribute it and/or modify it
371cb0ef41Sopenharmony_ci#   under the terms of the GNU General Public License as published by the
381cb0ef41Sopenharmony_ci#   Free Software Foundation, either version 3 of the License, or (at your
391cb0ef41Sopenharmony_ci#   option) any later version.
401cb0ef41Sopenharmony_ci#
411cb0ef41Sopenharmony_ci#   This program is distributed in the hope that it will be useful, but
421cb0ef41Sopenharmony_ci#   WITHOUT ANY WARRANTY; without even the implied warranty of
431cb0ef41Sopenharmony_ci#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
441cb0ef41Sopenharmony_ci#   Public License for more details.
451cb0ef41Sopenharmony_ci#
461cb0ef41Sopenharmony_ci#   You should have received a copy of the GNU General Public License along
471cb0ef41Sopenharmony_ci#   with this program. If not, see <https://www.gnu.org/licenses/>.
481cb0ef41Sopenharmony_ci#
491cb0ef41Sopenharmony_ci#   As a special exception, the respective Autoconf Macro's copyright owner
501cb0ef41Sopenharmony_ci#   gives unlimited permission to copy, distribute and modify the configure
511cb0ef41Sopenharmony_ci#   scripts that are the output of Autoconf when processing the Macro. You
521cb0ef41Sopenharmony_ci#   need not follow the terms of the GNU General Public License when using
531cb0ef41Sopenharmony_ci#   or distributing such scripts, even though portions of the text of the
541cb0ef41Sopenharmony_ci#   Macro appear in them. The GNU General Public License (GPL) does govern
551cb0ef41Sopenharmony_ci#   all other use of the material that constitutes the Autoconf Macro.
561cb0ef41Sopenharmony_ci#
571cb0ef41Sopenharmony_ci#   This special exception to the GPL applies to versions of the Autoconf
581cb0ef41Sopenharmony_ci#   Macro released by the Autoconf Archive. When you make and distribute a
591cb0ef41Sopenharmony_ci#   modified version of the Autoconf Macro, you may extend this special
601cb0ef41Sopenharmony_ci#   exception to the GPL to apply to your modified version as well.
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci#serial 32
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ciAC_DEFUN([AX_COMPILER_VENDOR], [dnl
651cb0ef41Sopenharmony_ci    AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
661cb0ef41Sopenharmony_ci	dnl  If you modify this list of vendors, please add similar support
671cb0ef41Sopenharmony_ci	dnl  to ax_compiler_version.m4 if at all possible.
681cb0ef41Sopenharmony_ci	dnl
691cb0ef41Sopenharmony_ci	dnl  Note: Do NOT check for GCC first since some other compilers
701cb0ef41Sopenharmony_ci	dnl  define __GNUC__ to remain compatible with it.  Compilers that
711cb0ef41Sopenharmony_ci	dnl  are very slow to start (such as Intel) are listed first.
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ci	vendors="
741cb0ef41Sopenharmony_ci		intel:		__ICC,__ECC,__INTEL_COMPILER
751cb0ef41Sopenharmony_ci		ibm:		__xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
761cb0ef41Sopenharmony_ci		pathscale:	__PATHCC__,__PATHSCALE__
771cb0ef41Sopenharmony_ci		clang:		__clang__
781cb0ef41Sopenharmony_ci		cray:		_CRAYC
791cb0ef41Sopenharmony_ci		fujitsu:	__FUJITSU
801cb0ef41Sopenharmony_ci		sdcc:		SDCC,__SDCC
811cb0ef41Sopenharmony_ci		sx:		_SX
821cb0ef41Sopenharmony_ci		nvhpc:		__NVCOMPILER
831cb0ef41Sopenharmony_ci		portland:	__PGI
841cb0ef41Sopenharmony_ci		gnu:		__GNUC__
851cb0ef41Sopenharmony_ci		sun:		__SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
861cb0ef41Sopenharmony_ci		hp:		__HP_cc,__HP_aCC
871cb0ef41Sopenharmony_ci		dec:		__DECC,__DECCXX,__DECC_VER,__DECCXX_VER
881cb0ef41Sopenharmony_ci		borland:	__BORLANDC__,__CODEGEARC__,__TURBOC__
891cb0ef41Sopenharmony_ci		comeau:		__COMO__
901cb0ef41Sopenharmony_ci		kai:		__KCC
911cb0ef41Sopenharmony_ci		lcc:		__LCC__
921cb0ef41Sopenharmony_ci		sgi:		__sgi,sgi
931cb0ef41Sopenharmony_ci		microsoft:	_MSC_VER
941cb0ef41Sopenharmony_ci		metrowerks:	__MWERKS__
951cb0ef41Sopenharmony_ci		watcom:		__WATCOMC__
961cb0ef41Sopenharmony_ci		tcc:		__TINYC__
971cb0ef41Sopenharmony_ci		unknown:	UNKNOWN
981cb0ef41Sopenharmony_ci	"
991cb0ef41Sopenharmony_ci	for ventest in $vendors; do
1001cb0ef41Sopenharmony_ci	    case $ventest in
1011cb0ef41Sopenharmony_ci		*:)
1021cb0ef41Sopenharmony_ci		    vendor=$ventest
1031cb0ef41Sopenharmony_ci		    continue
1041cb0ef41Sopenharmony_ci		    ;;
1051cb0ef41Sopenharmony_ci		*)
1061cb0ef41Sopenharmony_ci		    vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
1071cb0ef41Sopenharmony_ci		    ;;
1081cb0ef41Sopenharmony_ci	    esac
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci	    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1111cb0ef41Sopenharmony_ci#if !($vencpp)
1121cb0ef41Sopenharmony_ci      thisisanerror;
1131cb0ef41Sopenharmony_ci#endif
1141cb0ef41Sopenharmony_ci	    ]])], [break])
1151cb0ef41Sopenharmony_ci	done
1161cb0ef41Sopenharmony_ci
1171cb0ef41Sopenharmony_ci	ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
1181cb0ef41Sopenharmony_ci    ])
1191cb0ef41Sopenharmony_ci])dnl
120