summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclPanic.c12
-rwxr-xr-xwin/configure73
-rw-r--r--win/configure.in25
4 files changed, 111 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index fb04804..92ba873 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-12-20 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/configure.in: Explicitely test for intrinsics support in compiler,
+ before assuming only MSVC has it.
+ * win/configure: (autoconf-2.59)
+ * generic/tclPanic.c:
+
2010-12-19 Jan Nijtmans <nijtmans@users.sf.net>
* win/tclWin32Dll.c: [Patch 3059922]: fixes for mingw64 - gcc4.5.1
diff --git a/generic/tclPanic.c b/generic/tclPanic.c
index 6ef39e1..ad17360 100644
--- a/generic/tclPanic.c
+++ b/generic/tclPanic.c
@@ -12,12 +12,12 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPanic.c,v 1.18 2010/12/16 08:52:37 nijtmans Exp $
+ * RCS: @(#) $Id: tclPanic.c,v 1.19 2010/12/20 10:28:48 nijtmans Exp $
*/
#include "tclInt.h"
#ifdef _WIN32
-# ifdef _MSC_VER
+# ifdef HAVE_INTRIN_H
# include <intrin.h>
# endif
MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
@@ -106,10 +106,12 @@ Tcl_PanicVA(
}
/* In case the users panic proc does not abort, we do it here */
#ifdef _WIN32
-# ifdef __GNUC__
- __builtin_trap();
-# elif _MSC_VER
+# ifdef HAVE_INTRIN_H
__debugbreak();
+# elif defined(__GNUC__)
+ __builtin_trap();
+# else
+ DebugBreak();
# endif
ExitProcess(1);
#else
diff --git a/win/configure b/win/configure
index 32d9310..01bb01a 100755
--- a/win/configure
+++ b/win/configure
@@ -3628,6 +3628,79 @@ _ACEOF
fi
+# See if the compiler supports intrinsics.
+
+echo "$as_me:$LINENO: checking for intrinsics support in compiler" >&5
+echo $ECHO_N "checking for intrinsics support in compiler... $ECHO_C" >&6
+if test "${tcl_cv_intrinsics+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#include <intrin.h>
+
+int
+main ()
+{
+
+ unsigned int regs4;
+ __cpuid(&regs,0);
+ __debugbreak();
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_intrinsics=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_intrinsics=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_intrinsics" >&5
+echo "${ECHO_T}$tcl_cv_intrinsics" >&6
+if test "$tcl_cv_intrinsics" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTRIN_H 1
+_ACEOF
+
+fi
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------
diff --git a/win/configure.in b/win/configure.in
index 3ffe9f2..50f5de4 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -3,7 +3,7 @@
# generate the file "configure", which is run during Tcl installation
# to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.127 2010/12/10 15:44:53 nijtmans Exp $
+# RCS: @(#) $Id: configure.in,v 1.128 2010/12/20 10:28:47 nijtmans Exp $
AC_INIT(../generic/tcl.h)
AC_PREREQ(2.59)
@@ -272,6 +272,29 @@ if test "$tcl_cv_mwmo_alertable" = "no"; then
[Defined when MWMO_ALERTABLE is missing from winuser.h])
fi
+# See if the compiler supports intrinsics.
+
+AC_CACHE_CHECK(for intrinsics support in compiler,
+ tcl_cv_intrinsics,
+AC_TRY_COMPILE([
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#include <intrin.h>
+],
+[
+ unsigned int regs[4];
+ __cpuid(&regs,0);
+ __debugbreak();
+],
+ tcl_cv_intrinsics=yes,
+ tcl_cv_intrinsics=no)
+)
+if test "$tcl_cv_intrinsics" = "yes"; then
+ AC_DEFINE(HAVE_INTRIN_H, 1,
+ [Defined when the compilers supports intrinsics])
+fi
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------