From 14c3244f04002380d94903b661b93185c158077b Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 10 Feb 2015 10:32:10 -0200 Subject: [PATCH] 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. --- m4/attributes.m4 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index db39bf9..7922746 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -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]) ]) -- 2.7.4