1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright (C) 2022-2023 Free Software Foundation, Inc.
4 dnl This file is part of GDB.
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3 of the License, or
9 dnl (at your option) any later version.
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Sets up GDB_COMPILER_TYPE to either 'gcc', 'clang', or 'unknown'.
20 # The autoconf compiler check will set GCC=yes for clang as well as
21 # gcc, it's really more of a "is gcc like" check.
23 # By contrast, this will set the GDB_COMPILER_TYPE to 'gcc' only for
26 # There's no reason why this can't be extended to identify other
27 # compiler types if needed in the future, users of this variable
28 # should therefore avoid relying on the 'unknown' value, instead
29 # checks should be written in terms of the known compiler types.
30 AC_DEFUN([AM_GDB_COMPILER_TYPE],[
32 AC_CACHE_CHECK([the compiler type],
33 [gdb_cv_compiler_type],
34 [gdb_cv_compiler_type=unknown
35 if test "$gdb_cv_compiler_type" = unknown; then
39 #if !defined __GNUC__ || defined __clang__
43 [gdb_cv_compiler_type=gcc], [])
46 if test "$gdb_cv_compiler_type" = unknown; then
54 [gdb_cv_compiler_type=clang], [])
58 GDB_COMPILER_TYPE="$gdb_cv_compiler_type"