]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
build: define to 0 if builtin is not available
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 10 Feb 2015 12:32:10 +0000 (10:32 -0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 10 Feb 2015 12:32:10 +0000 (10:32 -0200)
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

index db39bf9f577176d14f1146fb11203fa32e9e19c8..79227460e2d1d90741e776f71b1eff49aaab48cf 100644 (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])
 ])