X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=configure.ac;h=a49b39f4d973d71058ff2332c51578208f0e4a6e;hp=02ad2721589a7ae138167511c1d3fa64b9165341;hb=2953b501ab1dcf908d07de9b414a08397519f5b6;hpb=1eade46a854eb8211be9fd32e0cf6835576deb63 diff --git a/configure.ac b/configure.ac index 02ad272..a49b39f 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,20 @@ AH_TEMPLATE([CONFIG_RCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks c AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction if available for use on ARM.]) AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.]) -AX_TLS(AC_DEFINE_UNQUOTED([CONFIG_RCU_TLS], $ac_cv_tls), [:]) +# Allow overriding storage used for TLS variables. +AC_ARG_ENABLE([compiler-tls], + AS_HELP_STRING([--disable-compiler-tls], [Use pthread_getspecific() to emulate Thread Local Storage (TLS) variables.]), + [def_compiler_tls=$enableval], + [def_compiler_tls="yes"]) + +# If not overridden, use ax_tls.m4 to check if TLS is available. +AS_IF([test "x$def_compiler_tls" = "xyes"], + [AX_TLS([def_tls_detect=$ac_cv_tls], [:])], + [:]) + +AS_IF([test "x$def_tls_detect" = "x"], + [:], + [AC_DEFINE_UNQUOTED([CONFIG_RCU_TLS], $def_tls_detect)]) # Checks for programs. AC_PROG_CC @@ -46,7 +59,7 @@ AC_FUNC_MMAP AC_CHECK_FUNCS([bzero gettimeofday munmap sched_getcpu strtoul sysconf]) # Find arch type -AS_CASE([$target_cpu], +AS_CASE([$host_cpu], [i386], [ARCHTYPE="x86" && SUBARCHTYPE="x86compat"], [i486], [ARCHTYPE="x86"], [i586], [ARCHTYPE="x86"], @@ -64,6 +77,7 @@ AS_CASE([$target_cpu], [ia64], [ARCHTYPE="gcc"], [arm*], [ARCHTYPE="arm"], [mips*], [ARCHTYPE="mips"], + [tile*], [ARCHTYPE="gcc"], [ARCHTYPE="unknown"] ) @@ -77,7 +91,7 @@ AS_IF([test "x$SUBARCHTYPE" = xx86compat],[ AC_DEFINE([CONFIG_RCU_COMPAT_ARCH], [1]) ]) -AS_IF([test "$target_cpu" = "armv7l"],[ +AS_IF([test "$host_cpu" = "armv7l"],[ CFLAGS="$CFLAGS -mcpu=cortex-a9 -mtune=cortex-a9 -O1" ]) @@ -99,13 +113,28 @@ AS_IF([test "x$ARCHTYPE" = "xarm"],[ ]) ]) +# Tile-specific checks +AS_IF([echo "$host_cpu" | grep "^tile"],[ + AC_MSG_CHECKING([for Tile architecture type]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifndef __tilegx__ + #error + #endif + ]]) + ],[ + AC_MSG_RESULT([ok]) + ],[ + AC_MSG_FAILURE([URCU has only been tested on the TileGx architecture. For other Tile* architectures, please run the tests first and report the results to the maintainer so that proper support can be added.]) + ]) +]) + # x86-specific checks AS_IF([test "x$ARCHTYPE" = "xx86"],[ AC_MSG_CHECKING([if architecture really supports the mfence instruction]) #For now, using lock; addl compatibility mode even for i686, because the #Pentium III is seen as a i686, but lacks mfence instruction. #Only using fence for x86_64. - AS_IF([test "x$target_cpu" != "xi386" -a "x$target_cpu" != "xi486" -a "x$target_cpu" != "xi586" -a "x$target_cpu" != "xi686"],[ + AS_IF([test "x$host_cpu" != "xi386" -a "x$host_cpu" != "xi486" -a "x$host_cpu" != "xi586" -a "x$host_cpu" != "xi686"],[ AC_MSG_RESULT([yes]) AC_DEFINE([CONFIG_RCU_HAVE_FENCE], [1]) ],[ @@ -202,6 +231,26 @@ AC_CHECK_FUNCS([sched_setaffinity],[ AC_MSG_RESULT([no]) ]) + # Confirm that we have CPU_SET, and it actually works. + AC_MSG_CHECKING([whether CPU_SET works]) + AH_TEMPLATE([HAVE_CPU_SET], [Defined to 1 if we have CPU_SET and it works]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #define _GNU_SOURCE + #include + int main() + { + cpu_set_t foo, mask; CPU_SET (0, &foo); + return 0; + } + ]]) + ],[ + # Works! + AC_DEFINE(HAVE_CPU_SET, 1) + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) + # Check how many arguments does sched_setaffinity take. # Should be 3 or 2. AC_MSG_CHECKING([how many arguments sched_setaffinity takes]) @@ -252,3 +301,9 @@ AS_IF([test "x$def_smp_support" = "xyes"],[ ],[ AS_ECHO("SMP support disabled.") ]) + +AS_IF([test "x$def_tls_detect" = "x"],[ + AS_ECHO("Thread Local Storage (TLS): pthread_getspecific().") +],[ + AS_ECHO("Thread Local Storage (TLS): $def_tls_detect.") +])