xref: /aosp_15_r20/external/libffi/m4/ax_compiler_vendor.m4 (revision 1fd5a2e1d639cd1ddf29dd0c484c123bbd850c21)
1*1fd5a2e1SPrashanth Swaminathan# ===========================================================================
2*1fd5a2e1SPrashanth Swaminathan#    https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
3*1fd5a2e1SPrashanth Swaminathan# ===========================================================================
4*1fd5a2e1SPrashanth Swaminathan#
5*1fd5a2e1SPrashanth Swaminathan# SYNOPSIS
6*1fd5a2e1SPrashanth Swaminathan#
7*1fd5a2e1SPrashanth Swaminathan#   AX_COMPILER_VENDOR
8*1fd5a2e1SPrashanth Swaminathan#
9*1fd5a2e1SPrashanth Swaminathan# DESCRIPTION
10*1fd5a2e1SPrashanth Swaminathan#
11*1fd5a2e1SPrashanth Swaminathan#   Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
12*1fd5a2e1SPrashanth Swaminathan#   hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
13*1fd5a2e1SPrashanth Swaminathan#   watcom, etc. The vendor is returned in the cache variable
14*1fd5a2e1SPrashanth Swaminathan#   $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
15*1fd5a2e1SPrashanth Swaminathan#
16*1fd5a2e1SPrashanth Swaminathan# LICENSE
17*1fd5a2e1SPrashanth Swaminathan#
18*1fd5a2e1SPrashanth Swaminathan#   Copyright (c) 2008 Steven G. Johnson <[email protected]>
19*1fd5a2e1SPrashanth Swaminathan#   Copyright (c) 2008 Matteo Frigo
20*1fd5a2e1SPrashanth Swaminathan#
21*1fd5a2e1SPrashanth Swaminathan#   This program is free software: you can redistribute it and/or modify it
22*1fd5a2e1SPrashanth Swaminathan#   under the terms of the GNU General Public License as published by the
23*1fd5a2e1SPrashanth Swaminathan#   Free Software Foundation, either version 3 of the License, or (at your
24*1fd5a2e1SPrashanth Swaminathan#   option) any later version.
25*1fd5a2e1SPrashanth Swaminathan#
26*1fd5a2e1SPrashanth Swaminathan#   This program is distributed in the hope that it will be useful, but
27*1fd5a2e1SPrashanth Swaminathan#   WITHOUT ANY WARRANTY; without even the implied warranty of
28*1fd5a2e1SPrashanth Swaminathan#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
29*1fd5a2e1SPrashanth Swaminathan#   Public License for more details.
30*1fd5a2e1SPrashanth Swaminathan#
31*1fd5a2e1SPrashanth Swaminathan#   You should have received a copy of the GNU General Public License along
32*1fd5a2e1SPrashanth Swaminathan#   with this program. If not, see <https://www.gnu.org/licenses/>.
33*1fd5a2e1SPrashanth Swaminathan#
34*1fd5a2e1SPrashanth Swaminathan#   As a special exception, the respective Autoconf Macro's copyright owner
35*1fd5a2e1SPrashanth Swaminathan#   gives unlimited permission to copy, distribute and modify the configure
36*1fd5a2e1SPrashanth Swaminathan#   scripts that are the output of Autoconf when processing the Macro. You
37*1fd5a2e1SPrashanth Swaminathan#   need not follow the terms of the GNU General Public License when using
38*1fd5a2e1SPrashanth Swaminathan#   or distributing such scripts, even though portions of the text of the
39*1fd5a2e1SPrashanth Swaminathan#   Macro appear in them. The GNU General Public License (GPL) does govern
40*1fd5a2e1SPrashanth Swaminathan#   all other use of the material that constitutes the Autoconf Macro.
41*1fd5a2e1SPrashanth Swaminathan#
42*1fd5a2e1SPrashanth Swaminathan#   This special exception to the GPL applies to versions of the Autoconf
43*1fd5a2e1SPrashanth Swaminathan#   Macro released by the Autoconf Archive. When you make and distribute a
44*1fd5a2e1SPrashanth Swaminathan#   modified version of the Autoconf Macro, you may extend this special
45*1fd5a2e1SPrashanth Swaminathan#   exception to the GPL to apply to your modified version as well.
46*1fd5a2e1SPrashanth Swaminathan
47*1fd5a2e1SPrashanth Swaminathan#serial 17
48*1fd5a2e1SPrashanth Swaminathan
49*1fd5a2e1SPrashanth SwaminathanAC_DEFUN([AX_COMPILER_VENDOR],
50*1fd5a2e1SPrashanth Swaminathan[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
51*1fd5a2e1SPrashanth Swaminathan  dnl Please add if possible support to ax_compiler_version.m4
52*1fd5a2e1SPrashanth Swaminathan  [# note: don't check for gcc first since some other compilers define __GNUC__
53*1fd5a2e1SPrashanth Swaminathan  vendors="intel:     __ICC,__ECC,__INTEL_COMPILER
54*1fd5a2e1SPrashanth Swaminathan           ibm:       __xlc__,__xlC__,__IBMC__,__IBMCPP__
55*1fd5a2e1SPrashanth Swaminathan           pathscale: __PATHCC__,__PATHSCALE__
56*1fd5a2e1SPrashanth Swaminathan           clang:     __clang__
57*1fd5a2e1SPrashanth Swaminathan           cray:      _CRAYC
58*1fd5a2e1SPrashanth Swaminathan           fujitsu:   __FUJITSU
59*1fd5a2e1SPrashanth Swaminathan           sdcc:      SDCC, __SDCC
60*1fd5a2e1SPrashanth Swaminathan           gnu:       __GNUC__
61*1fd5a2e1SPrashanth Swaminathan           sun:       __SUNPRO_C,__SUNPRO_CC
62*1fd5a2e1SPrashanth Swaminathan           hp:        __HP_cc,__HP_aCC
63*1fd5a2e1SPrashanth Swaminathan           dec:       __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
64*1fd5a2e1SPrashanth Swaminathan           borland:   __BORLANDC__,__CODEGEARC__,__TURBOC__
65*1fd5a2e1SPrashanth Swaminathan           comeau:    __COMO__
66*1fd5a2e1SPrashanth Swaminathan           kai:       __KCC
67*1fd5a2e1SPrashanth Swaminathan           lcc:       __LCC__
68*1fd5a2e1SPrashanth Swaminathan           sgi:       __sgi,sgi
69*1fd5a2e1SPrashanth Swaminathan           microsoft: _MSC_VER
70*1fd5a2e1SPrashanth Swaminathan           metrowerks: __MWERKS__
71*1fd5a2e1SPrashanth Swaminathan           watcom:    __WATCOMC__
72*1fd5a2e1SPrashanth Swaminathan           portland:  __PGI
73*1fd5a2e1SPrashanth Swaminathan	   tcc:       __TINYC__
74*1fd5a2e1SPrashanth Swaminathan           unknown:   UNKNOWN"
75*1fd5a2e1SPrashanth Swaminathan  for ventest in $vendors; do
76*1fd5a2e1SPrashanth Swaminathan    case $ventest in
77*1fd5a2e1SPrashanth Swaminathan      *:) vendor=$ventest; continue ;;
78*1fd5a2e1SPrashanth Swaminathan      *)  vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
79*1fd5a2e1SPrashanth Swaminathan    esac
80*1fd5a2e1SPrashanth Swaminathan    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
81*1fd5a2e1SPrashanth Swaminathan      #if !($vencpp)
82*1fd5a2e1SPrashanth Swaminathan        thisisanerror;
83*1fd5a2e1SPrashanth Swaminathan      #endif
84*1fd5a2e1SPrashanth Swaminathan    ])], [break])
85*1fd5a2e1SPrashanth Swaminathan  done
86*1fd5a2e1SPrashanth Swaminathan  ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
87*1fd5a2e1SPrashanth Swaminathan ])
88*1fd5a2e1SPrashanth Swaminathan])
89