[PATCH:intel-gpu-tools 6/6 v2] Fix pthread compiler flags to work on Solaris and with Studio compiler
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Jan 6 15:45:29 PST 2012
AC_USE_SYSTEM_EXTENSIONS is used to let autoconf take care of setting
the right system defintions for POSIX threads & similar extensions to
the base POSIX API. Since it will also #define _GNU_SOURCE 1, remove
the extra setting to avoid compiler warnings about redefined macros.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
v2: Move addition of #include "config.h" to this patch, now that it's
no longer needed in the sched_yield patch, but is needed for the
POSIX threads defines that AC_USE_SYSTEM_EXTENSIONS sets on Solaris.
Also remove the _GNU_SOURCE define at the same time, as noted above.
configure.ac | 11 ++++++++---
tests/Makefile.am | 2 +-
tests/gem_fence_thrash.c | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 197c622..15ade07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
+AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@@ -44,10 +45,10 @@ AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
-# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+# Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG
m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.8)
+ [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.16)
XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.23 libdrm])
@@ -87,6 +88,10 @@ if test "x$SHADER_DEBUGGER" = xyes; then
fi
fi
+# To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
+XORG_TESTSET_CFLAG([THREAD_CFLAGS], [-pthread], [-mt])
+AC_SUBST([THREAD_CFLAGS])
+
AC_CONFIG_FILES([
Makefile
benchmarks/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 770243a..4ff4376 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -103,5 +103,5 @@ endif
endif
endif
-gem_fence_thrash_CFLAGS = $(AM_CFLAGS) -pthread
+gem_fence_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
gem_fence_thrash_LDADD = $(LDADD) -lpthread
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 24147de..7b67936 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -26,7 +26,7 @@
*
*/
-#define _GNU_SOURCE
+#include "config.h"
#include <unistd.h>
#include <stdlib.h>
--
1.7.3.2
More information about the xorg-devel
mailing list