mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 18:09:59 +00:00
Detect Clang compiler compiler.
Autoconf detects the Clang compiler as GNU GCC (clang sets defines like __GNUC__ etc) but Clang is *not* completely compatible. We detect Clang and set ac_vc_c_compiler_gnu to 'no'. Closes: https://github.com/erikd/libsndfile/issues/49
This commit is contained in:
parent
99985f4c62
commit
d7cc3dd0a4
31
M4/clang.m4
Normal file
31
M4/clang.m4
Normal file
@ -0,0 +1,31 @@
|
||||
dnl @synopsis MN_C_COMPILER_IS_CLANG
|
||||
dnl
|
||||
dnl Find out if a compiler claiming to be gcc really is gcc (fuck you clang).
|
||||
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([MN_C_COMPILER_IS_CLANG],
|
||||
[AC_CACHE_CHECK(whether we are using the CLANG C compiler,
|
||||
mn_cv_c_compiler_clang,
|
||||
[ AC_LANG_ASSERT(C)
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
],
|
||||
[
|
||||
#ifndef __clang__
|
||||
This is not clang!
|
||||
#endif
|
||||
],
|
||||
AC_MSG_RESULT([yes]),
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
)
|
||||
])
|
33
M4/really_gcc.m4
Normal file
33
M4/really_gcc.m4
Normal file
@ -0,0 +1,33 @@
|
||||
dnl @synopsis MN_GCC_REALLY_IS_GCC
|
||||
dnl
|
||||
dnl Find out if a compiler claiming to be gcc really is gcc (fuck you clang).
|
||||
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([MN_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
|
||||
|
||||
])
|
11
configure.ac
11
configure.ac
@ -24,6 +24,10 @@ AC_PROG_CC_STDC
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
|
||||
MN_C_COMPILER_IS_CLANG
|
||||
MN_GCC_REALLY_IS_GCC
|
||||
|
||||
AC_PROG_SED
|
||||
|
||||
# Do not check for F77.
|
||||
@ -661,10 +665,11 @@ if test -z "$PKG_CONFIG" ; then
|
||||
echo
|
||||
fi
|
||||
|
||||
echo " Tools :"
|
||||
echo
|
||||
echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
|
||||
|
||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
echo " Tools :"
|
||||
echo
|
||||
echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
|
||||
echo " GCC version : ......................... ${GCC_VERSION}"
|
||||
if test $GCC_MAJOR_VERSION -lt 3 ; then
|
||||
echo "\n"
|
||||
|
Loading…
Reference in New Issue
Block a user