Hi

This adds a check for the GCC atomic functions to the configure script.

(unrelated, but git master has a nasty build failure when sqlite is not 
installed, it too should get a configure check)

-- 
- Lauri
From 7b23f52884ac4be9c1b326291b29ac954fba17a7 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Fri, 20 Apr 2012 17:14:33 +0300
Subject: [PATCH] Add GCC atomics check to configure


Signed-off-by: Lauri Kasanen <[email protected]>
---
 configure |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 079d0ca..9fd10a7 100755
--- a/configure
+++ b/configure
@@ -114,6 +114,10 @@ main()
            check_pthread_lib lang
         fi
 
+       # Atomics check
+       echo -n "+ Checking for GCC atomic functions... "
+       check_atomic_funcs
+
         echo
         echo -e "\033[1m=== Plugins included ===\033[0m"
 
@@ -204,6 +208,30 @@ fi
 rm -rf check* configure.log a.out
 }
 
+# Check atomic support
+check_atomic_funcs()
+{
+cat > check.c << "EOF"
+int main() {
+
+        int conn = 0;
+        __sync_fetch_and_add(&conn, 1);
+        __sync_bool_compare_and_swap(&conn, conn, 2);
+
+        return 0;
+}
+EOF
+functest=`$CC $CFLAGS check.c &>configure.log`
+funcstatus=`cat configure.log`
+if test -n "$funcstatus" ; then
+       rm -rf check* configure.log a.out
+       echo -en $GREEN$BOLD"No. Please add -march=i486 to CFLAGS if on 
x86_32"$END_COLOR"\n"
+       exit 1
+fi
+echo -en $GREEN$BOLD"Yes"$END_COLOR"\n"
+rm -rf check* configure.log a.out
+}
+
 # Check pthreads lib
 check_pthread_lib()
 {
-- 
1.7.2.1

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to