summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2014-06-04 03:09:08 (GMT)
committerJason Evans <jasone@canonware.com>2014-06-04 04:05:01 (GMT)
commit1a3eafd1b045163f27e4a5acf01280edfe28c309 (patch)
tree1b60f77abb88375d4bd342ba3c7726d28b0bcfdb /configure.ac
parent994fad9bdaaa18273f2089856c2637cfb0c307bd (diff)
downloadjemalloc-1a3eafd1b045163f27e4a5acf01280edfe28c309.zip
jemalloc-1a3eafd1b045163f27e4a5acf01280edfe28c309.tar.gz
jemalloc-1a3eafd1b045163f27e4a5acf01280edfe28c309.tar.bz2
Check for __builtin_ffsl before ffsl.
When building with -O0, GCC doesn't use builtins for ffs and ffsl calls, and uses library function calls instead. But the Android NDK doesn't have those functions exported from any library, leading to build failure. However, using __builtin_ffs* uses the builtin inlines.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac27
1 files changed, 14 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 29edcb6..f456bd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1109,43 +1109,44 @@ elif test "x${force_tls}" = "x1" ; then
fi
dnl ============================================================================
-dnl Check for ffsl(3), then __builtin_ffsl(), and fail if neither are found.
+dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
dnl One of those two functions should (theoretically) exist on all platforms
dnl that jemalloc currently has a chance of functioning on without modification.
dnl We additionally assume ffs() or __builtin_ffs() are defined if
dnl ffsl() or __builtin_ffsl() are defined, respectively.
-JE_COMPILABLE([a program using ffsl], [
+JE_COMPILABLE([a program using __builtin_ffsl], [
#include <stdio.h>
#include <strings.h>
#include <string.h>
], [
{
- int rv = ffsl(0x08);
+ int rv = __builtin_ffsl(0x08);
printf("%d\n", rv);
}
-], [je_cv_function_ffsl])
-if test "x${je_cv_function_ffsl}" == "xyes" ; then
- AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
- AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
+], [je_cv_gcc_builtin_ffsl])
+if test "x${je_cv_gcc_builtin_ffsl}" == "xyes" ; then
+ AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
+ AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
else
- JE_COMPILABLE([a program using __builtin_ffsl], [
+ JE_COMPILABLE([a program using ffsl], [
#include <stdio.h>
#include <strings.h>
#include <string.h>
], [
{
- int rv = __builtin_ffsl(0x08);
+ int rv = ffsl(0x08);
printf("%d\n", rv);
}
- ], [je_cv_gcc_builtin_ffsl])
- if test "x${je_cv_gcc_builtin_ffsl}" == "xyes" ; then
- AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
- AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
+ ], [je_cv_function_ffsl])
+ if test "x${je_cv_function_ffsl}" == "xyes" ; then
+ AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
+ AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
else
AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
fi
fi
+
dnl ============================================================================
dnl Check for atomic(9) operations as provided on FreeBSD.