use_gcc_stdint=wrap
;;
i[34567]86-*-mingw* | x86_64-*-mingw*)
- tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
+ tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h"
xm_file=i386/xm-mingw32.h
case ${target} in
x86_64-*-* | *-w64-*)
*)
;;
esac
+ if test x$enable_threads = xposix ; then
+ tm_file="${tm_file} i386/mingw-pthread.h"
+ fi
+ tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
*-w64-*)
use_gcc_stdint=wrap
case ${enable_threads} in
"" | yes | win32) thread_file='win32'
- tmake_file="${tmake_file} i386/t-gthr-win32"
- ;;
+ tmake_file="${tmake_file} i386/t-gthr-win32"
+ ;;
+ posix)
+ thread_file='posix'
+ tmake_file="i386/t-mingw-pthread ${tmake_file}"
+ ;;
esac
case ${target} in
x86_64-*-mingw*)
posix
Driver
+
+; Retain blank line above
/* Operating system specific defines to be used when targeting GCC for
hosting on Windows 32/64 via mingw-w64 runtime, using GNU tools and
the Windows API Library.
- Copyright (C) 2009,
- 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010,
+ 2011 Free Software Foundation, Inc.
This file is part of GCC.
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* Enable -municode feature. */
+/* Enable -municode feature and support optional pthread support. */
#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
- %{municode:-DUNICODE}"
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
+ "%{municode:-DUNICODE} " \
+ "%{" SPEC_PTHREAD1 ":-D_REENTRANCE} " \
+ "%{" SPEC_PTHREAD2 ":-U_REENTRANCE} "
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
#undef ASM_SPEC
#define ASM_SPEC "%{m32:--32} %{m64:--64}"
+#undef LIB_SPEC
+#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
+ "%{" SPEC_PTHREAD2 ": } " \
+ "%{mwindows:-lgdi32 -lcomdlg32} " \
+ "-ladvapi32 -lshell32 -luser32 -lkernel32"
+
#undef SPEC_32
#undef SPEC_64
#if TARGET_64BIT_DEFAULT
municode
Target
Use unicode startup and define UNICODE macro
+
+; Retain blank line above.
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
+pthread
+Driver
+
+no-pthread
+Driver
+
Wpedantic-ms-format
C ObjC C++ ObjC++ Var(warn_pedantic_ms_format) Init(1) Warning
Warn about none ISO msvcrt scanf/printf width extensions
fset-stack-executable
Common Report Var(flag_setstackexecutable) Init(1) Optimization
For nested functions on stack executable permission is set.
+
+; Need to retain blank line above.
} \
while (0)
+#ifndef TARGET_USE_PTHREAD_BY_DEFAULT
+#define SPEC_PTHREAD1 "pthread"
+#define SPEC_PTHREAD2 "!no-pthread"
+#else
+#define SPEC_PTHREAD1 "!no-pthread"
+#define SPEC_PTHREAD2 "pthread"
+#endif
+
#undef SUB_LINK_ENTRY32
#undef SUB_LINK_ENTRY64
#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
#define STANDARD_INCLUDE_COMPONENT "MINGW"
#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
+ "%{" SPEC_PTHREAD1 ":-D_REENTRANCE} " \
+ "%{" SPEC_PTHREAD2 ": } "
/* For Windows applications, include more libraries, but always include
kernel32. */
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
- -ladvapi32 -lshell32 -luser32 -lkernel32"
+#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
+ "%{" SPEC_PTHREAD2 ": } " \
+ "%{mwindows:-lgdi32 -lcomdlg32} " \
+ "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
ifndef SHLIB_DLLDIR
$(error SHLIB_DLLDIR must be defined)
endif
+ifndef SHLIB_PTHREAD_CFLAG
+SHLIB_PTHREAD_CFLAG =
+endif
+ifndef SHLIB_PTHREAD_LDFLAG
+SHLIB_PTHREAD_LDFLAG =
+endif
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
if [ ! -d $(SHLIB_DIR) ]; then \
mkdir $(SHLIB_DIR); \
else true; fi && \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \
+ -shared -nodefaultlibs \
$(SHLIB_MAP).def \
-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
- $(SHLIB_OBJS) $(SHLIB_LC) && \
+ $(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \
if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \