build: define to 0 if builtin is not available

In order to let us use "#if HAVE__BUILTIN_*" without checking if it's
actually define, make sure we define it to 0 in config.h when the
function is not available.
This commit is contained in:
Lucas De Marchi 2015-02-10 10:32:10 -02:00
parent 67466f266d
commit 14c3244f04

View File

@ -256,7 +256,7 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [
AC_DEFUN([CC_CHECK_FUNC_BUILTIN], [
m4_pushdef([UPNAME], m4_translit([$1], [-a-z], [_A-Z]))
AC_CACHE_CHECK([if compiler has $1 function],
AC_CACHE_CHECK([if compiler has $1 builtin function],
[cc_cv_have_$1],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [
m4_case([$1],
@ -268,9 +268,11 @@ AC_DEFUN([CC_CHECK_FUNC_BUILTIN], [
[cc_cv_have_$1=no])])
AS_IF([test "x$cc_cv_have_$1" = "xyes"],
[AC_DEFINE([HAVE_]m4_defn([UPNAME]), 1, [Define this if the compiler supports $1() function])
[AC_DEFINE([HAVE_]m4_defn([UPNAME]), 1, [Define to 1 if compiler has $1() builtin function])
$2],
[AS_IF([test "x$3" = "x"], [AC_MSG_ERROR([*** builtin function not found: $1()])], [$3])]
[AS_IF([test "x$3" = "x"], [AC_MSG_ERROR([*** builtin function not found: $1()])],
[AC_DEFINE([HAVE_]m4_defn([UPNAME]), 0)
$3])]
)
m4_popdef([UPNAME])
])