[m-rev.] diff: fix another build error on MinGW systems.

Julien Fischer jfischer at opturion.com
Thu May 1 15:31:11 AEST 2014


Branches: 14.01, master

========================================

Fix another build error on MinGW systems.

On MinGW system do not try to link against libpthread if that library is not
actually present on the system.  This is an issue in the compiler directory
because we link the compiler against the thread libraries regardless of the
grade.  This is due to the implementation of --make.

configure.ac:
 	On MinGW, if we cannot find pthreads then set THREAD_LIBS to empty.

Julien.

diff --git a/configure.ac b/configure.ac
index c756fad..01e039b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3117,11 +3117,20 @@ case "$host" in
                  LD_LIBFLAGS_FOR_THREADS="-MD"
                  ;;
              *)
-                # By default the MinGW port of GCC targets the i386
-                # architecture.  We need to tell it to target a later
-                # architecture for the GCC built-in atomic ops to be available.
-                CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -march=i686"
-                THREAD_LIBS="-lpthread"
+                if test "$MR_HAVE_PTHREAD_H" = 1
+                then
+                    # By default the MinGW port of GCC targets the i386
+                    # architecture.  We need to tell it to target a later
+                    # architecture for the GCC built-in atomic ops to be available.
+                    CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -march=i686"
+                    THREAD_LIBS="-lpthread"
+                else
+                    # The compiler is unconditionally linked against the thread
+                    # libraries so if pthreads is not present then we need to
+                    # set THREAD_LIBS to empty in order to avoid linker errors.
+                    CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
+                    THREAD_LIBS=
+                fi
                  ;;
          esac
          ;;



More information about the reviews mailing list