Merge pull request #1056 from ranma42/vc-compat-C90
[mono.git] / libgc / configure.in
index 3d6df69a452f163c5b6c6d11c304b2fff9215cdf..837e2cb9f158c14f8cdbe47e0abc14091db14edf 100644 (file)
@@ -28,6 +28,8 @@ AC_SUBST(GC_VERSION)
 AC_PROG_CC
 AC_PROG_CXX
 
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
 dnl automake 1.6 and later need the AM_PROG_AS macro.
 ifdef([AM_PROG_AS],[AM_PROG_AS],[])
 AC_CHECK_TOOL(AR, ar)
@@ -75,7 +77,7 @@ AC_ARG_ENABLE(cplusplus,
 [  --enable-cplusplus          install C++ support],
 )
 
-INCLUDES=-I${srcdir}/include
+AM_CPPFLAGS=-I${srcdir}/include
 THREADDLLIBS=
 ## Libraries needed to support dynamic loading and/or threads.
 case "$THREADS" in
@@ -115,13 +117,14 @@ case "$THREADS" in
       *-*-freebsd*)
        AC_DEFINE(GC_FREEBSD_THREADS)
        if test "x$PTHREAD_CFLAGS" != "x"; then
-               INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
+               AM_CPPFLAGS="$AM_CPPFLAGS $PTHREAD_CFLAGS"
        fi
        if test "x$PTHREAD_LIBS" = "x"; then
                THREADDLLIBS=-pthread
        else
                THREADDLLIBS="$PTHREAD_LIBS"
        fi
+       AC_DEFINE(THREAD_LOCAL_ALLOC)
        ;;
      *-*-solaris*)
        AC_DEFINE(GC_SOLARIS_THREADS)
@@ -162,7 +165,7 @@ case "$THREADS" in
          # May want to enable it in other cases, too.
          # Measurements havent yet been done.
        fi
-       INCLUDES="$INCLUDES -pthread"
+       AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
        THREADDLLIBS="-lpthread -lrt"
        ;;
       *)
@@ -190,7 +193,7 @@ case "$THREADS" in
     AC_DEFINE(GC_DGUX386_THREADS)
     AC_DEFINE(DGUX_THREADS)
     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
-    INCLUDES="-pthread $INCLUDES"
+    AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
     ;;
  aix)
     THREADS=posix
@@ -214,6 +217,22 @@ case "$host" in
 esac
 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
 
+# Check if the GCC builtin __sync_bool_compare_and_swap is available.
+# It is preferred in gc_locks.h for PPC as GCC 4.4 has a problem with the inline assembly there.
+AC_MSG_CHECKING(for __sync_bool_compare_and_swap)
+AC_TRY_COMPILE([],[
+volatile unsigned int foo = 0;
+int main(int argc, char** argv) {
+    unsigned int r1 = __sync_bool_compare_and_swap(&foo, 0, 1);
+    return 0;
+}
+], [
+AC_MSG_RESULT(yes)
+AC_DEFINE(HAS___SYNC_BOOL_COMPARE_AND_SWAP)
+], [
+AC_MSG_RESULT(no)
+])
+
 AC_MSG_CHECKING(for xlc)
 AC_TRY_COMPILE([],[
  #ifndef __xlC__
@@ -255,7 +274,7 @@ addobjs=
 addlibs=
 addincludes=
 addtests=
-CXXINCLUDES=
+CXXAM_CPPFLAGS=
 case "$TARGET_ECOS" in
    no)
       ;;
@@ -275,7 +294,7 @@ AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
 
 AC_SUBST(CXX)
 
-AC_SUBST(INCLUDES)
+AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(CXXINCLUDES)
 
 # Configuration of shared libraries
@@ -518,12 +537,8 @@ else
   multilib_arg=
 fi
 
-if test x$enable_quiet_build = xyes; then
-   AC_CONFIG_COMMANDS([quiet], [for i in `find . -name Makefile.in | sed -e 's/Makefile.in/Makefile/g'`; do if test -f $i; then $srcdir/../scripts/patch-quiet.sh $i; fi; done], [shell=$SHELL])
-   AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/$echo "copying selected/$show "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
-fi
-
 AC_OUTPUT(Makefile
+m4/Makefile
 include/Makefile
 include/private/Makefile
 doc/Makefile,,