+2001-03-05 Frank Ch. Eigler <fche@redhat.com>
+
+ On advice from Momchil Velikov <velco@fadata.bg>:
+ * configure.in: Test for compiler support of __builtin_expect.
+ * sidconfig.h: Define LIKELY/UNLIKEY depending on this test.
+ * configure, sidconfutil.in: Regenerated.
+
2001-03-01 Frank Ch. Eigler <fche@redhat.com>
* sidconfig.h (LIKELY, UNLIKELY): New conditional cover macros
fi
echo "$ac_t""$sid_cv_cctype_std" 1>&6
+echo $ac_n "checking whether __builtin_expect is supported""... $ac_c" 1>&6
+echo "configure:1278: checking whether __builtin_expect is supported" >&5
+if eval "test \"`echo '$''{'sid_cv_builtin_expect'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1283 "configure"
+#include "confdefs.h"
+int main() {
+ if (__builtin_expect (2, 2))
+ return 0;
+ else
+ return 1;
+
+; return 0; }
+EOF
+if { (eval echo configure:1295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ sid_cv_builtin_expect="yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ sid_cv_builtin_expect="no"
+fi
+rm -f conftest*
+fi
+
+if test "${sid_cv_builtin_expect}" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_BUILTIN_EXPECT 1
+EOF
+
+fi
+echo "$ac_t""$sid_cv_builtin_expect" 1>&6
+
trap '' 1 2 15
cat > confcache <<\EOF
fi
AC_MSG_RESULT([$sid_cv_cctype_std])
-
-
+AC_MSG_CHECKING([whether __builtin_expect is supported])
+AC_CACHE_VAL(sid_cv_builtin_expect,
+ AC_TRY_COMPILE([],[
+ if (__builtin_expect (2, 2))
+ return 0;
+ else
+ return 1;
+],[sid_cv_builtin_expect="yes"],[sid_cv_builtin_expect="no"]))
+if test "${sid_cv_builtin_expect}" = "yes"; then
+ AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define if compiler supports __builtin_expect])
+fi
+AC_MSG_RESULT([$sid_cv_builtin_expect])
+
dnl Outputs
AC_OUTPUT(Makefile)
#undef VERSION
#include <sidconfutil.h>
-// Globally useful macros
-
-#ifdef __GNUC__
+#if HAVE_BUILTIN_EXPECT
#define LIKELY(expression) (__builtin_expect(!!(expression), 1))
#define UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
#else
/* Define if std:: prefix works for <cctype> functions */
#undef STD_CCTYPE
+/* Define if compiler supports __builtin_expect */
+#undef HAVE_BUILTIN_EXPECT
+