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