mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Detect Clang masquerading as GCC.
Autoconf detects the Clang compiler as GNU GCC (clang sets defines like __GNUC__ etc) but Clang is *not* completely compatible. If we detect Clang we set ac_vc_c_compiler_gnu to 'no'.
This commit is contained in:
@@ -35,6 +35,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
|||||||
LT_INIT([win32-dll disable-static pic-only])
|
LT_INIT([win32-dll disable-static pic-only])
|
||||||
AM_PROG_AS
|
AM_PROG_AS
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
XIPH_C_COMPILER_IS_CLANG
|
||||||
|
XIPH_GCC_REALLY_IS_GCC
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
@@ -521,6 +523,7 @@ AC_MSG_RESULT([
|
|||||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||||
echo " GCC version : ......................... ${GCC_VERSION}"
|
echo " GCC version : ......................... ${GCC_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
echo " Compiler is Clang : ................... ${xiph_cv_c_compiler_clang}"
|
||||||
echo " Asm optimizations : ................... ${asm_optimisation}"
|
echo " Asm optimizations : ................... ${asm_optimisation}"
|
||||||
echo " Ogg/FLAC support : .................... ${have_ogg}"
|
echo " Ogg/FLAC support : .................... ${have_ogg}"
|
||||||
echo
|
echo
|
||||||
|
|||||||
31
m4/clang.m4
Normal file
31
m4/clang.m4
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
dnl @synopsis XIPH_C_COMPILER_IS_CLANG
|
||||||
|
dnl
|
||||||
|
dnl Find out if a compiler claiming to be gcc really is gcc (clang lies).
|
||||||
|
dnl @version 1.0 Oct 31 2013
|
||||||
|
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||||
|
dnl
|
||||||
|
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||||
|
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||||
|
dnl and this permission notice appear in all copies. No representations are
|
||||||
|
dnl made about the suitability of this software for any purpose. It is
|
||||||
|
dnl provided "as is" without express or implied warranty.
|
||||||
|
dnl
|
||||||
|
|
||||||
|
|
||||||
|
AC_DEFUN([XIPH_C_COMPILER_IS_CLANG],
|
||||||
|
[AC_CACHE_CHECK(whether we are using the CLANG C compiler,
|
||||||
|
xiph_cv_c_compiler_clang,
|
||||||
|
[ AC_LANG_ASSERT(C)
|
||||||
|
AC_TRY_LINK([
|
||||||
|
#include <stdio.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
#ifndef __clang__
|
||||||
|
This is not clang!
|
||||||
|
#endif
|
||||||
|
],
|
||||||
|
xiph_cv_c_compiler_clang=yes,
|
||||||
|
xiph_cv_c_compiler_clang=no
|
||||||
|
])
|
||||||
|
)]
|
||||||
|
)
|
||||||
32
m4/really_gcc.m4
Normal file
32
m4/really_gcc.m4
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
dnl @synopsis XIPH_GCC_REALLY_IS_GCC
|
||||||
|
dnl
|
||||||
|
dnl Find out if a compiler claiming to be gcc really is gcc (clang lies).
|
||||||
|
dnl @version 1.0 Oct 31 2013
|
||||||
|
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||||
|
dnl
|
||||||
|
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||||
|
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||||
|
dnl and this permission notice appear in all copies. No representations are
|
||||||
|
dnl made about the suitability of this software for any purpose. It is
|
||||||
|
dnl provided "as is" without express or implied warranty.
|
||||||
|
dnl
|
||||||
|
|
||||||
|
# If the configure script has already detected GNU GCC, then make sure it
|
||||||
|
# isn't CLANG masquerading as GCC.
|
||||||
|
|
||||||
|
AC_DEFUN([XIPH_GCC_REALLY_IS_GCC],
|
||||||
|
[ AC_LANG_ASSERT(C)
|
||||||
|
if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
|
||||||
|
AC_TRY_LINK([
|
||||||
|
#include <stdio.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
#ifdef __clang__
|
||||||
|
This is clang!
|
||||||
|
#endif
|
||||||
|
],
|
||||||
|
ac_cv_c_compiler_gnu=yes,
|
||||||
|
ac_cv_c_compiler_gnu=no
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
])
|
||||||
Reference in New Issue
Block a user