public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Disable libitm if unsupported
@ 2011-11-08 16:55 Richard Henderson
  2011-11-08 17:38 ` Pedro Alves
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Henderson @ 2011-11-08 16:55 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

As suggested by Joseph, this consolidates the knowledge of libitm
support in the libitm directory.  And better, in a file not controlled
by autoconf, so less fumbling around for the correct edition.  ;-)

Committed in two hunks because I faffed it the first time and managed
to not notice that I'd disabled libitm on supported systems too.

Tested on x86_64-linux and ppc64-linux.


r~

[-- Attachment #2: z --]
[-- Type: text/plain, Size: 4192 bytes --]

toplevel/
	* configure.ac: Adjust srcdir for running libitm/configure.tgt.

	* configure.ac: Test libitm/configure.tgt to disable libitm.
	* configure: Rebuild.

libitm/
	* configure.tgt: Test correct directory for supported cpus.

	* configure.ac: Exit if unsupported.
	* configure: Rebuild.
	* configure.tgt: Delete boilerplate from libgomp for unsupported
	targets.  Set UNSUPPORTED for unsupported targets.



diff --git a/configure.ac b/configure.ac
index 4bca6d8..888d051 100644
--- a/configure.ac
+++ b/configure.ac
@@ -493,22 +493,17 @@ if test x$enable_libgomp = x ; then
     esac
 fi
 
-# Disable libitm on non POSIX hosted systems.
-if test x$enable_libitm = x ; then
-    # Enable libitm by default on hosted POSIX systems.
-    case "${target}" in
-    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
-	;;
-    *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
-	;;
-    *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
-	;;
-    *-*-darwin* | *-*-aix*)
-	;;
-    *)
+# Disable libitm on unsupported hosted systems.
+if test x$enable_libitm = x; then
+   AC_MSG_CHECKING([for libitm support])
+   if (srcdir=${srcdir}/libitm; \
+       . ${srcdir}/configure.tgt; \
+       test -n "$UNSUPPORTED"); then
+	AC_MSG_RESULT([no])
 	noconfigdirs="$noconfigdirs target-libitm"
-	;;
-    esac
+   else
+	AC_MSG_RESULT([yes])
+   fi
 fi
 
 # Disable libssp for some systems.
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 7f35b15..dea7038 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -224,6 +224,10 @@ LIBITM_CHECK_SIZE_T_MANGLING
 
 # Get target configury.
 . ${srcdir}/configure.tgt
+if test -n "$UNSUPPORTED"; then
+  AC_MSG_ERROR([Configuration ${target} is unsupported.])
+fi
+
 CFLAGS="$save_CFLAGS $XCFLAGS"
 
 # Check for __sync_val_compare_and_swap, but only after the target has
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 7d9b7f6..eac6f50 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -28,7 +28,7 @@
 #  XLDFLAGS		Add extra link flags to use.
 
 # Optimize TLS usage by avoiding the overhead of dynamic allocation.
-if test $gcc_cv_have_tls = yes ; then
+if test "$gcc_cv_have_tls" = yes ; then
   case "${target}" in
 
     # For x86, we use slots in the TCB head for most of our TLS.
@@ -47,10 +47,6 @@ fi
 # work out any special compilation flags as necessary.
 case "${target_cpu}" in
   alpha*)	ARCH=alpha ;;
-  ia64*)	ARCH=ia64 ;;
-  mips*)	ARCH=mips ;;
-  powerpc*)	ARCH=powerpc ;;
-  s390*)	ARCH=s390 ;;
 
   i[3456]86)
 	case " ${CC} ${CFLAGS} " in
@@ -75,57 +71,33 @@ case "${target_cpu}" in
 	ARCH=x86
 	;;
 
-  sparcv9 | sparc64)
-	# Note that sparcv7 and sparcv8 is not included here.  We need cas.
-	echo "int i;" > conftestx.c
-	if ${CC} ${CFLAGS} -c -o conftestx.o conftestx.c > /dev/null 2>&1; then
-	  case "`/usr/bin/file conftestx.o`" in
-	    *32-bit*)
-	      case " ${CC} ${CFLAGS}" in
-		*" -mcpu=ultrasparc"*)
-		  ;;
-		*)
-		  XCFLAGS="${XCFLAGS} -mcpu=v9"
-		  ;;
-	      esac
-	      ;;
-	  esac
-	fi
-	rm -f conftestx.c conftestx.o
-	ARCH=sparc
-	;;
-
   *)
 	ARCH="${target_cpu}"
 	;;
 esac
-  
+
+# For the benefit of top-level configure, determine if the cpu is supported.
+test -d ${srcdir}/config/$ARCH || UNSUPPORTED=1
+
 # Since we require POSIX threads, assume a POSIX system by default.
 config_path="$ARCH posix generic"
 
 # Other system configury
 case "${target}" in
   *-*-linux*)
-	if test $enable_linux_futex = yes; then
+	if test "$enable_linux_futex" = yes; then
 	  config_path="linux/$ARCH linux $config_path"
 	fi
 	;;
 
-  *-*-hpux11*)
-	# HPUX v11.x requires -lrt to resolve sem_init in libgomp.la
-	XLDFLAGS="${XLDFLAGS} -lrt"
-	;;
-
-  *-*-mingw32*)
-	config_path="$ARCH mingw32 posix generic"
-	;;
-
-  *-*-solaris2.[56]*)
-	config_path="$ARCH posix95 posix generic"
-	XLDFLAGS="${XLDFLAGS} -lposix4"
+  *-*-gnu* | *-*-k*bsd*-gnu \
+  | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
+  | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
+  | *-*-darwin* | *-*-aix*)
+	# POSIX system.  The OS is supported.
 	;;
 
-  *-*-darwin*)
-	config_path="$ARCH bsd posix generic"
+  *)	# Non-POSIX, or embedded system
+	UNSUPPORTED=1
 	;;
 esac

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-11-09 18:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 16:55 Disable libitm if unsupported Richard Henderson
2011-11-08 17:38 ` Pedro Alves
2011-11-08 17:40   ` Richard Henderson
2011-11-08 18:13     ` Pedro Alves
2011-11-08 18:35       ` Richard Henderson
2011-11-08 21:29         ` Iain Sandoe
2011-11-08 21:33           ` Richard Henderson
2011-11-08 21:56             ` Iain Sandoe
2011-11-09 17:01             ` Iain Sandoe
2011-11-09 17:14               ` Richard Henderson
2011-11-09 17:36                 ` Iain Sandoe
2011-11-09 18:56                   ` Richard Henderson
2011-11-09 18:58                     ` Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).