llvm.org GIT mirror llvm / d4b272b
Test for the presence of GCC atomic builtins at configure time. If not found, disable building LLVM in thread-safe mode and print a nice warning. Regenerate configure for these changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72075 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 11 years ago
2 changed file(s) with 119 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
371371 default) AC_SUBST(ENABLE_THREADS,[1]) ;;
372372 *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
373373 esac
374 AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
375374
376375 dnl Allow building without position independent code
377376 AC_ARG_ENABLE(pic,
896895 fi
897896 fi
898897
898 dnl atomic builtins are required for threading support.
899 if test "$ENABLE_THREADS" -eq 1 ; then
900 AC_MSG_CHECKING(for GCC atomic builtins)
901 AC_LINK_IFELSE(
902 AC_LANG_SOURCE(
903 [[int main() {
904 volatile unsigned long val = 1;
905 __sync_synchronize();
906 __sync_val_compare_and_swap(&val, 1, 0);
907 return 0;
908 }
909 ]]),
910 AC_MSG_RESULT(yes),
911 AC_MSG_RESULT(no)
912 AC_SUBST(ENABLE_THREADS, [0])
913 AC_MSG_WARN([Threading support disabled because atomic builtins are missing]))
914 fi
915
916 AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
917
899918 dnl===-----------------------------------------------------------------------===
900919 dnl===
901920 dnl=== SECTION 9: Additional checks, variables, etc.
48694869 { (exit 1); exit 1; }; } ;;
48704870 esac
48714871
4872 cat >>confdefs.h <<_ACEOF
4873 #define ENABLE_THREADS $ENABLE_THREADS
4874 _ACEOF
4875
4876
48774872 # Check whether --enable-pic was given.
48784873 if test "${enable_pic+set}" = set; then
48794874 enableval=$enable_pic;
1057410569 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1057510570 lt_status=$lt_dlunknown
1057610571 cat > conftest.$ac_ext <
10577 #line 10578 "configure"
10572 #line 10573 "configure"
1057810573 #include "confdefs.h"
1057910574
1058010575 #if HAVE_DLFCN_H
1271812713 ;;
1271912714 *-*-irix6*)
1272012715 # Find out which ABI we are using.
12721 echo '#line 12722 "configure"' > conftest.$ac_ext
12716 echo '#line 12717 "configure"' > conftest.$ac_ext
1272212717 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1272312718 (eval $ac_compile) 2>&5
1272412719 ac_status=$?
1443614431 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1443714432 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1443814433 -e 's:$: $lt_compiler_flag:'`
14439 (eval echo "\"\$as_me:14440: $lt_compile\"" >&5)
14434 (eval echo "\"\$as_me:14435: $lt_compile\"" >&5)
1444014435 (eval "$lt_compile" 2>conftest.err)
1444114436 ac_status=$?
1444214437 cat conftest.err >&5
14443 echo "$as_me:14444: \$? = $ac_status" >&5
14438 echo "$as_me:14439: \$? = $ac_status" >&5
1444414439 if (exit $ac_status) && test -s "$ac_outfile"; then
1444514440 # The compiler can only warn and ignore the option if not recognized
1444614441 # So say no if there are warnings other than the usual output.
1470414699 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1470514700 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1470614701 -e 's:$: $lt_compiler_flag:'`
14707 (eval echo "\"\$as_me:14708: $lt_compile\"" >&5)
14702 (eval echo "\"\$as_me:14703: $lt_compile\"" >&5)
1470814703 (eval "$lt_compile" 2>conftest.err)
1470914704 ac_status=$?
1471014705 cat conftest.err >&5
14711 echo "$as_me:14712: \$? = $ac_status" >&5
14706 echo "$as_me:14707: \$? = $ac_status" >&5
1471214707 if (exit $ac_status) && test -s "$ac_outfile"; then
1471314708 # The compiler can only warn and ignore the option if not recognized
1471414709 # So say no if there are warnings other than the usual output.
1480814803 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1480914804 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1481014805 -e 's:$: $lt_compiler_flag:'`
14811 (eval echo "\"\$as_me:14812: $lt_compile\"" >&5)
14806 (eval echo "\"\$as_me:14807: $lt_compile\"" >&5)
1481214807 (eval "$lt_compile" 2>out/conftest.err)
1481314808 ac_status=$?
1481414809 cat out/conftest.err >&5
14815 echo "$as_me:14816: \$? = $ac_status" >&5
14810 echo "$as_me:14811: \$? = $ac_status" >&5
1481614811 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1481714812 then
1481814813 # The compiler can only warn and ignore the option if not recognized
1726017255 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1726117256 lt_status=$lt_dlunknown
1726217257 cat > conftest.$ac_ext <
17263 #line 17264 "configure"
17258 #line 17259 "configure"
1726417259 #include "confdefs.h"
1726517260
1726617261 #if HAVE_DLFCN_H
1736017355 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1736117356 lt_status=$lt_dlunknown
1736217357 cat > conftest.$ac_ext <
17363 #line 17364 "configure"
17358 #line 17359 "configure"
1736417359 #include "confdefs.h"
1736517360
1736617361 #if HAVE_DLFCN_H
1972819723 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1972919724 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1973019725 -e 's:$: $lt_compiler_flag:'`
19731 (eval echo "\"\$as_me:19732: $lt_compile\"" >&5)
19726 (eval echo "\"\$as_me:19727: $lt_compile\"" >&5)
1973219727 (eval "$lt_compile" 2>conftest.err)
1973319728 ac_status=$?
1973419729 cat conftest.err >&5
19735 echo "$as_me:19736: \$? = $ac_status" >&5
19730 echo "$as_me:19731: \$? = $ac_status" >&5
1973619731 if (exit $ac_status) && test -s "$ac_outfile"; then
1973719732 # The compiler can only warn and ignore the option if not recognized
1973819733 # So say no if there are warnings other than the usual output.
1983219827 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1983319828 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1983419829 -e 's:$: $lt_compiler_flag:'`
19835 (eval echo "\"\$as_me:19836: $lt_compile\"" >&5)
19830 (eval echo "\"\$as_me:19831: $lt_compile\"" >&5)
1983619831 (eval "$lt_compile" 2>out/conftest.err)
1983719832 ac_status=$?
1983819833 cat out/conftest.err >&5
19839 echo "$as_me:19840: \$? = $ac_status" >&5
19834 echo "$as_me:19835: \$? = $ac_status" >&5
1984019835 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1984119836 then
1984219837 # The compiler can only warn and ignore the option if not recognized
2140221397 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2140321398 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2140421399 -e 's:$: $lt_compiler_flag:'`
21405 (eval echo "\"\$as_me:21406: $lt_compile\"" >&5)
21400 (eval echo "\"\$as_me:21401: $lt_compile\"" >&5)
2140621401 (eval "$lt_compile" 2>conftest.err)
2140721402 ac_status=$?
2140821403 cat conftest.err >&5
21409 echo "$as_me:21410: \$? = $ac_status" >&5
21404 echo "$as_me:21405: \$? = $ac_status" >&5
2141021405 if (exit $ac_status) && test -s "$ac_outfile"; then
2141121406 # The compiler can only warn and ignore the option if not recognized
2141221407 # So say no if there are warnings other than the usual output.
2150621501 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2150721502 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2150821503 -e 's:$: $lt_compiler_flag:'`
21509 (eval echo "\"\$as_me:21510: $lt_compile\"" >&5)
21504 (eval echo "\"\$as_me:21505: $lt_compile\"" >&5)
2151021505 (eval "$lt_compile" 2>out/conftest.err)
2151121506 ac_status=$?
2151221507 cat out/conftest.err >&5
21513 echo "$as_me:21514: \$? = $ac_status" >&5
21508 echo "$as_me:21509: \$? = $ac_status" >&5
2151421509 if (exit $ac_status) && test -s out/conftest2.$ac_objext
2151521510 then
2151621511 # The compiler can only warn and ignore the option if not recognized
2374123736 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2374223737 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2374323738 -e 's:$: $lt_compiler_flag:'`
23744 (eval echo "\"\$as_me:23745: $lt_compile\"" >&5)
23739 (eval echo "\"\$as_me:23740: $lt_compile\"" >&5)
2374523740 (eval "$lt_compile" 2>conftest.err)
2374623741 ac_status=$?
2374723742 cat conftest.err >&5
23748 echo "$as_me:23749: \$? = $ac_status" >&5
23743 echo "$as_me:23744: \$? = $ac_status" >&5
2374923744 if (exit $ac_status) && test -s "$ac_outfile"; then
2375023745 # The compiler can only warn and ignore the option if not recognized
2375123746 # So say no if there are warnings other than the usual output.
2400924004 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2401024005 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2401124006 -e 's:$: $lt_compiler_flag:'`
24012 (eval echo "\"\$as_me:24013: $lt_compile\"" >&5)
24007 (eval echo "\"\$as_me:24008: $lt_compile\"" >&5)
2401324008 (eval "$lt_compile" 2>conftest.err)
2401424009 ac_status=$?
2401524010 cat conftest.err >&5
24016 echo "$as_me:24017: \$? = $ac_status" >&5
24011 echo "$as_me:24012: \$? = $ac_status" >&5
2401724012 if (exit $ac_status) && test -s "$ac_outfile"; then
2401824013 # The compiler can only warn and ignore the option if not recognized
2401924014 # So say no if there are warnings other than the usual output.
2411324108 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2411424109 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2411524110 -e 's:$: $lt_compiler_flag:'`
24116 (eval echo "\"\$as_me:24117: $lt_compile\"" >&5)
24111 (eval echo "\"\$as_me:24112: $lt_compile\"" >&5)
2411724112 (eval "$lt_compile" 2>out/conftest.err)
2411824113 ac_status=$?
2411924114 cat out/conftest.err >&5
24120 echo "$as_me:24121: \$? = $ac_status" >&5
24115 echo "$as_me:24116: \$? = $ac_status" >&5
2412124116 if (exit $ac_status) && test -s out/conftest2.$ac_objext
2412224117 then
2412324118 # The compiler can only warn and ignore the option if not recognized
3360533600 echo "$as_me: WARNING: mmap() of files required but not found" >&2;}
3360633601 fi
3360733602 fi
33603
33604 if test "$ENABLE_THREADS" -eq 1 ; then
33605 { echo "$as_me:$LINENO: checking for GCC atomic builtins" >&5
33606 echo $ECHO_N "checking for GCC atomic builtins... $ECHO_C" >&6; }
33607 cat >conftest.$ac_ext <<_ACEOF
33608 /* confdefs.h. */
33609 _ACEOF
33610 cat confdefs.h >>conftest.$ac_ext
33611 cat >>conftest.$ac_ext <<_ACEOF
33612 /* end confdefs.h. */
33613 int main() {
33614 volatile unsigned long val = 1;
33615 __sync_synchronize();
33616 __sync_val_compare_and_swap(&val, 1, 0);
33617 return 0;
33618 }
33619
33620 _ACEOF
33621 rm -f conftest.$ac_objext conftest$ac_exeext
33622 if { (ac_try="$ac_link"
33623 case "(($ac_try" in
33624 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33625 *) ac_try_echo=$ac_try;;
33626 esac
33627 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33628 (eval "$ac_link") 2>conftest.er1
33629 ac_status=$?
33630 grep -v '^ *+' conftest.er1 >conftest.err
33631 rm -f conftest.er1
33632 cat conftest.err >&5
33633 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33634 (exit $ac_status); } &&
33635 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
33636 { (case "(($ac_try" in
33637 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33638 *) ac_try_echo=$ac_try;;
33639 esac
33640 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33641 (eval "$ac_try") 2>&5
33642 ac_status=$?
33643 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33644 (exit $ac_status); }; } &&
33645 { ac_try='test -s conftest$ac_exeext'
33646 { (case "(($ac_try" in
33647 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33648 *) ac_try_echo=$ac_try;;
33649 esac
33650 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33651 (eval "$ac_try") 2>&5
33652 ac_status=$?
33653 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33654 (exit $ac_status); }; }; then
33655 { echo "$as_me:$LINENO: result: yes" >&5
33656 echo "${ECHO_T}yes" >&6; }
33657 else
33658 echo "$as_me: failed program was:" >&5
33659 sed 's/^/| /' conftest.$ac_ext >&5
33660
33661 { echo "$as_me:$LINENO: result: no" >&5
33662 echo "${ECHO_T}no" >&6; }
33663 ENABLE_THREADS=0
33664
33665 { echo "$as_me:$LINENO: WARNING: Threading support disabled because atomic builtins are missing" >&5
33666 echo "$as_me: WARNING: Threading support disabled because atomic builtins are missing" >&2;}
33667 fi
33668
33669 rm -f core conftest.err conftest.$ac_objext \
33670 conftest$ac_exeext conftest.$ac_ext
33671 fi
33672
33673
33674 cat >>confdefs.h <<_ACEOF
33675 #define ENABLE_THREADS $ENABLE_THREADS
33676 _ACEOF
33677
3360833678
3360933679
3361033680