From: Lucas De Marchi Date: Tue, 10 Feb 2015 02:45:11 +0000 (-0200) Subject: build: check for required builtin functions X-Git-Tag: v20~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6307200af74d1556466522216e8ae77b7c8b843;p=thirdparty%2Fkmod.git build: check for required builtin functions These builtins are implemented by both gcc and clang since a long time and we don't provide fallback for them. Let the configure phase check for them. --- diff --git a/configure.ac b/configure.ac index 3dde5d93..30eea861 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,9 @@ AC_CHECK_FUNCS_ONCE(__xstat) AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) AC_CHECK_FUNCS_ONCE([finit_module]) +CC_CHECK_FUNC_BUILTIN([__builtin_clz]) +CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p]) + # dietlibc doesn't have st.st_mtim struct member AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include ]) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index af17a6b8..db39bf9f 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -260,6 +260,8 @@ AC_DEFUN([CC_CHECK_FUNC_BUILTIN], [ [cc_cv_have_$1], [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [ m4_case([$1], + [__builtin_clz], [$1(0)], + [__builtin_types_compatible_p], [$1(int, int)], [__builtin_expect], [$1(0, 0)] )])], [cc_cv_have_$1=yes], @@ -267,7 +269,9 @@ AC_DEFUN([CC_CHECK_FUNC_BUILTIN], [ AS_IF([test "x$cc_cv_have_$1" = "xyes"], [AC_DEFINE([HAVE_]m4_defn([UPNAME]), 1, [Define this if the compiler supports $1() function]) - $2], [$3]) + $2], + [AS_IF([test "x$3" = "x"], [AC_MSG_ERROR([*** builtin function not found: $1()])], [$3])] + ) m4_popdef([UPNAME]) ])