build: Use AX_PTHREAD's HAVE_PTHREAD preprocessor definition

This commit is contained in:
Matt Turner 2012-09-18 22:09:26 -07:00
parent b6651ae6ad
commit 814345f54b
15 changed files with 35 additions and 35 deletions

View file

@ -40,7 +40,7 @@ LOCAL_CFLAGS += \
-DANDROID_VERSION=0x0$(major)0$(minor) -DANDROID_VERSION=0x0$(major)0$(minor)
LOCAL_CFLAGS += \ LOCAL_CFLAGS += \
-DPTHREADS \ -DHAVE_PTHREAD=1 \
-fvisibility=hidden \ -fvisibility=hidden \
-Wno-sign-compare -Wno-sign-compare

View file

@ -160,13 +160,13 @@ DEFINES=""
AC_SUBST([DEFINES]) AC_SUBST([DEFINES])
case "$host_os" in case "$host_os" in
linux*|*-gnu*|gnu*) linux*|*-gnu*|gnu*)
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" DEFINES="$DEFINES -D_GNU_SOURCE"
;; ;;
solaris*) solaris*)
DEFINES="$DEFINES -DPTHREADS -DSVR4" DEFINES="$DEFINES -DSVR4"
;; ;;
cygwin*) cygwin*)
DEFINES="$DEFINES -DPTHREADS" DEFINES="$DEFINES"
;; ;;
esac esac
@ -955,8 +955,8 @@ AC_ARG_ENABLE([glx-tls],
[GLX_USE_TLS=no]) [GLX_USE_TLS=no])
AC_SUBST(GLX_TLS, ${GLX_USE_TLS}) AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
AS_IF([test "x$GLX_USE_TLS" = xyes], AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
[DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"]) [DEFINES="${DEFINES} -DGLX_USE_TLS"])
dnl dnl
dnl More DRI setup dnl More DRI setup
@ -1040,7 +1040,7 @@ if test "x$enable_dri" = xyes; then
esac esac
;; ;;
freebsd* | dragonfly* | *netbsd*) freebsd* | dragonfly* | *netbsd*)
DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
if test "x$DRI_DIRS" = "xyes"; then if test "x$DRI_DIRS" = "xyes"; then

View file

@ -205,7 +205,7 @@ few preprocessor defines.</p>
<ul> <ul>
<li>If <tt>GLX_USE_TLS</tt> is defined, method #4 is used.</li> <li>If <tt>GLX_USE_TLS</tt> is defined, method #4 is used.</li>
<li>If <tt>PTHREADS</tt> is defined, method #3 is used.</li> <li>If <tt>HAVE_PTHREAD</tt> is defined, method #3 is used.</li>
<li>If <tt>WIN32_THREADS</tt> is defined, method #2 is used.</li> <li>If <tt>WIN32_THREADS</tt> is defined, method #2 is used.</li>
<li>If none of the preceeding are defined, method #1 is used.</li> <li>If none of the preceeding are defined, method #1 is used.</li>
</ul> </ul>

View file

@ -251,7 +251,7 @@ def generate(env):
'_SVID_SOURCE', '_SVID_SOURCE',
'_BSD_SOURCE', '_BSD_SOURCE',
'_GNU_SOURCE', '_GNU_SOURCE',
'PTHREADS', 'HAVE_PTHREAD',
'HAVE_POSIX_MEMALIGN', 'HAVE_POSIX_MEMALIGN',
] ]
if env['platform'] == 'darwin': if env['platform'] == 'darwin':

View file

@ -42,7 +42,7 @@
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#if PTHREADS #if HAVE_PTHREAD
#include <pthread.h> #include <pthread.h>
static _EGL_DECLARE_MUTEX(_egl_TSDMutex); static _EGL_DECLARE_MUTEX(_egl_TSDMutex);
@ -108,7 +108,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE; return EGL_TRUE;
} }
#else /* PTHREADS */ #else /* HAVE_PTHREAD */
static const _EGLThreadInfo *_egl_TSD; static const _EGLThreadInfo *_egl_TSD;
static void (*_egl_FreeTSD)(_EGLThreadInfo *); static void (*_egl_FreeTSD)(_EGLThreadInfo *);
@ -137,7 +137,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE; return EGL_TRUE;
} }
#endif /* !PTHREADS */ #endif /* !HAVE_PTHREAD */
static void static void

View file

@ -31,7 +31,7 @@
#include "eglcompiler.h" #include "eglcompiler.h"
#ifdef PTHREADS #ifdef HAVE_PTHREAD
#include <pthread.h> #include <pthread.h>
typedef pthread_mutex_t _EGLMutex; typedef pthread_mutex_t _EGLMutex;

View file

@ -7,7 +7,7 @@ top_srcdir = $(TOP)
include $(TOP)/configs/current include $(TOP)/configs/current
#CC=gcc #CC=gcc
#GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT $(RC_CFLAGS) $(CFLAGS) #GL_CFLAGS=-Wall -ggdb3 -Os -DHAVE_PTHREAD -D_REENTRANT $(RC_CFLAGS) $(CFLAGS)
#GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module #GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module
TCLSH=tclsh8.5 TCLSH=tclsh8.5

View file

@ -53,7 +53,7 @@
#include "GL/glxproto.h" #include "GL/glxproto.h"
#include "glxconfig.h" #include "glxconfig.h"
#include "glxhash.h" #include "glxhash.h"
#if defined( PTHREADS ) #if defined( HAVE_PTHREAD )
# include <pthread.h> # include <pthread.h>
#endif #endif
@ -623,7 +623,7 @@ extern void __glXPreferEGL(int state);
extern int __glXDebug; extern int __glXDebug;
/* This is per-thread storage in an MT environment */ /* This is per-thread storage in an MT environment */
#if defined( PTHREADS ) #if defined( HAVE_PTHREAD )
extern void __glXSetCurrentContext(struct glx_context * c); extern void __glXSetCurrentContext(struct glx_context * c);
@ -646,7 +646,7 @@ extern struct glx_context *__glXcurrentContext;
#define __glXGetCurrentContext() __glXcurrentContext #define __glXGetCurrentContext() __glXcurrentContext
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc #define __glXSetCurrentContext(gc) __glXcurrentContext = gc
#endif /* defined( PTHREADS ) */ #endif /* defined( HAVE_PTHREAD ) */
extern void __glXSetCurrentContextNull(void); extern void __glXSetCurrentContextNull(void);
@ -655,7 +655,7 @@ extern void __glXSetCurrentContextNull(void);
** Global lock for all threads in this address space using the GLX ** Global lock for all threads in this address space using the GLX
** extension ** extension
*/ */
#if defined( PTHREADS ) #if defined( HAVE_PTHREAD )
extern pthread_mutex_t __glXmutex; extern pthread_mutex_t __glXmutex;
#define __glXLock() pthread_mutex_lock(&__glXmutex) #define __glXLock() pthread_mutex_lock(&__glXmutex)
#define __glXUnlock() pthread_mutex_unlock(&__glXmutex) #define __glXUnlock() pthread_mutex_unlock(&__glXmutex)

View file

@ -33,7 +33,7 @@
* Client-side GLX interface for current context management. * Client-side GLX interface for current context management.
*/ */
#ifdef PTHREADS #ifdef HAVE_PTHREAD
#include <pthread.h> #include <pthread.h>
#endif #endif
@ -73,7 +73,7 @@ struct glx_context dummyContext = {
* Current context management and locking * Current context management and locking
*/ */
#if defined( PTHREADS ) #if defined( HAVE_PTHREAD )
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER; _X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;

View file

@ -120,7 +120,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\' print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\'
print '\t.size\tfn,.-fn;' print '\t.size\tfn,.-fn;'
print '' print ''
print '#elif defined(PTHREADS)' print '#elif defined(HAVE_PTHREAD)'
print '' print ''
print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */' print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */'
print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */' print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */'

View file

@ -138,7 +138,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))' print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
print '# endif' print '# endif'
print '' print ''
print '#if defined(PTHREADS) || defined(_WIN32)' print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
print '# define THREADS' print '# define THREADS'
print '#endif' print '#endif'
print '' print ''
@ -158,7 +158,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tret' print '\tret'
print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch' print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch'
print '' print ''
print '#elif defined(PTHREADS)' print '#elif defined(HAVE_PTHREAD)'
print '' print ''
print '\t.extern\t_glapi_Dispatch' print '\t.extern\t_glapi_Dispatch'
print '\t.extern\t_gl_DispatchTSD' print '\t.extern\t_gl_DispatchTSD'
@ -251,7 +251,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tcall\t_x86_64_get_dispatch@PLT' print '\tcall\t_x86_64_get_dispatch@PLT'
print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8) print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
print '\tjmp\t*%r11' print '\tjmp\t*%r11'
print '#elif defined(PTHREADS)' print '#elif defined(HAVE_PTHREAD)'
save_all_regs(registers) save_all_regs(registers)
print '\tcall\t_x86_64_get_dispatch@PLT' print '\tcall\t_x86_64_get_dispatch@PLT'

View file

@ -78,7 +78,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '#define GLOBL_FN(x) GLOBL x' print '#define GLOBL_FN(x) GLOBL x'
print '#endif' print '#endif'
print '' print ''
print '#if defined(PTHREADS) || defined(_WIN32)' print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
print '# define THREADS' print '# define THREADS'
print '#endif' print '#endif'
print '' print ''
@ -98,7 +98,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tCTX_INSNS ; \\' print '\tCTX_INSNS ; \\'
print '\tJMP(GL_OFFSET(off))' print '\tJMP(GL_OFFSET(off))'
print '' print ''
print '#elif defined(PTHREADS)' print '#elif defined(HAVE_PTHREAD)'
print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\' print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
print 'ALIGNTEXT16;\t\t\t\t\t\t\\' print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\' print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
@ -152,7 +152,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax' print '\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax'
print '\tret' print '\tret'
print '' print ''
print '#elif defined(PTHREADS)' print '#elif defined(HAVE_PTHREAD)'
print 'EXTERN GLNAME(_glapi_Dispatch)' print 'EXTERN GLNAME(_glapi_Dispatch)'
print 'EXTERN GLNAME(_gl_DispatchTSD)' print 'EXTERN GLNAME(_gl_DispatchTSD)'
print 'EXTERN GLNAME(pthread_getspecific)' print 'EXTERN GLNAME(pthread_getspecific)'

View file

@ -136,7 +136,7 @@ extern void __glapi_sparc_icache_flush(unsigned int *);
static void static void
init_glapi_relocs( void ) init_glapi_relocs( void )
{ {
#if defined(PTHREADS) || defined(GLX_USE_TLS) #if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
static const unsigned int template[] = { static const unsigned int template[] = {
#ifdef GLX_USE_TLS #ifdef GLX_USE_TLS
0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */ 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
@ -266,7 +266,7 @@ init_glapi_relocs( void )
_glapi_proc _glapi_proc
generate_entrypoint(GLuint functionOffset) generate_entrypoint(GLuint functionOffset)
{ {
#if defined(PTHREADS) || defined(GLX_USE_TLS) #if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
static const unsigned int template[] = { static const unsigned int template[] = {
0x07000000, /* sethi %hi(0), %g3 */ 0x07000000, /* sethi %hi(0), %g3 */
0x8210000f, /* mov %o7, %g1 */ 0x8210000f, /* mov %o7, %g1 */
@ -337,7 +337,7 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
void void
init_glapi_relocs_once( void ) init_glapi_relocs_once( void )
{ {
#if defined(PTHREADS) || defined(GLX_USE_TLS) #if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
static pthread_once_t once_control = PTHREAD_ONCE_INIT; static pthread_once_t once_control = PTHREAD_ONCE_INIT;
pthread_once( & once_control, init_glapi_relocs ); pthread_once( & once_control, init_glapi_relocs );
#endif #endif

View file

@ -55,7 +55,7 @@ static int next_dynamic_slot = MAPI_TABLE_NUM_STATIC;
void void
stub_init_once(void) stub_init_once(void)
{ {
#ifdef PTHREADS #ifdef HAVE_PTHREAD
static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_once_t once = PTHREAD_ONCE_INIT;
pthread_once(&once, entry_patch_public); pthread_once(&once, entry_patch_public);
#else #else

View file

@ -46,14 +46,14 @@
#include <stdlib.h> #include <stdlib.h>
#include "u_compiler.h" #include "u_compiler.h"
#if defined(PTHREADS) #if defined(HAVE_PTHREAD)
#include <pthread.h> /* POSIX threads headers */ #include <pthread.h> /* POSIX threads headers */
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(PTHREADS) || defined(_WIN32) #if defined(HAVE_PTHREAD) || defined(_WIN32)
#ifndef THREADS #ifndef THREADS
#define THREADS #define THREADS
#endif #endif
@ -88,7 +88,7 @@ extern "C" {
* compiler flag. On Solaris with gcc, use -D_REENTRANT to enable * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable
* proper compiling for MT-safe libc etc. * proper compiling for MT-safe libc etc.
*/ */
#if defined(PTHREADS) #if defined(HAVE_PTHREAD)
struct u_tsd { struct u_tsd {
pthread_key_t key; pthread_key_t key;
@ -145,7 +145,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
} }
} }
#endif /* PTHREADS */ #endif /* HAVE_PTHREAD */
/* /*