premake/Linux/SDL_config_premake.h
author Sam Lantinga
Mon, 07 Jul 2014 21:27:42 -0700
changeset 8991 13b0df1793e8
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
permissions -rw-r--r--
Fixed bug 2618 - incomplete pthread-based lock support should be removed

binarycrusader

Since changeset 358696c354a8, SDL 2.0 has been broken on Solaris when compiling with the Solaris Studio compiler (which uses the pthread implementation of SDL_AtomicLock).

Notably, it gets stuck at the MemoryBarrierRelease in SDL_GetErrBuf:

6585 # 218
6586 if (!tls_errbuf && !tls_being_created) {
6587 SDL_AtomicLock_REAL ( & tls_lock );
6588 if (!tls_errbuf) {
6589 SDL_TLSID slot;
6590 tls_being_created = SDL_TRUE;
6591 slot = SDL_TLSCreate_REAL ( );
6592 tls_being_created = SDL_FALSE;
6593 { SDL_SpinLock _tmp = 0 ; SDL_AtomicLock_REAL ( & _tmp ) ; SDL_AtomicUnlock_REAL ( & _tmp ) ; };
^^^ loops forever above
6594 tls_errbuf = slot;
6595 }
6596 SDL_AtomicUnlock_REAL ( & tls_lock );
6597 }


Running: testthread
(process id 28926)
^Cdbx: warning: Interrupt ignored but forwarded to child.
signal INT (Interrupt) in __nanosleep at 0xfe52a875
0xfe52a875: __nanosleep+0x0015: jae __nanosleep+0x23 [ 0xfe52a883, .+0xe ]
Current function is SDL_Delay_REAL
204 was_error = nanosleep(&tv, &elapsed);
(dbx) where
[1] __nanosleep(0xfeffe848, 0xfeffe850, 0xfe75a5ac, 0xfe5169d8), at 0xfe52a875
[2] nanosleep(0xfeffe848, 0xfeffe850), at 0xfe516a3b
=>[3] SDL_Delay_REAL(ms = 0), line 204 in "SDL_systimer.c"
[4] SDL_AtomicLock_REAL(lock = 0xfeffe88c), line 104 in "SDL_spinlock.c"
[5] SDL_GetErrBuf(), line 225 in "SDL_thread.c"
[6] SDL_ClearError_REAL(), line 216 in "SDL_error.c"
[7] SDL_InitSubSystem_REAL(flags = 0), line 116 in "SDL.c"
[8] SDL_Init_REAL(flags = 0), line 244 in "SDL.c"
[9] SDL_Init(a = 0), line 89 in "SDL_dynapi_procs.h"
[10] main(argc = 1, argv = 0xfeffe948), line 65 in "testthread.c"

As far as I can tell, this is because pthread_spin_trylock() always returns EBUSY for this particular lock; since it works in other places, I'm suspicious.

Different Solaris Studio compiler versions seem to make no difference.

I've verified this is broken on Linux as well if SDL_spinlock.c is modified to use the pthread implementation.

This appears to be because pthread_spin_init() and pthread_spin_destroy() are not used with the locks as required.
icculus@7925
     1
/* include/SDL_config.h.  Generated from SDL_config.h.in by configure.  */
icculus@7925
     2
/*
icculus@7925
     3
  Simple DirectMedia Layer
slouken@8149
     4
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
icculus@7925
     5
icculus@7925
     6
  This software is provided 'as-is', without any express or implied
icculus@7925
     7
  warranty.  In no event will the authors be held liable for any damages
icculus@7925
     8
  arising from the use of this software.
icculus@7925
     9
icculus@7925
    10
  Permission is granted to anyone to use this software for any purpose,
icculus@7925
    11
  including commercial applications, and to alter it and redistribute it
icculus@7925
    12
  freely, subject to the following restrictions:
icculus@7925
    13
icculus@7925
    14
  1. The origin of this software must not be misrepresented; you must not
icculus@7925
    15
     claim that you wrote the original software. If you use this software
icculus@7925
    16
     in a product, an acknowledgment in the product documentation would be
icculus@7925
    17
     appreciated but is not required.
icculus@7925
    18
  2. Altered source versions must be plainly marked as such, and must not be
icculus@7925
    19
     misrepresented as being the original software.
icculus@7925
    20
  3. This notice may not be removed or altered from any source distribution.
icculus@7925
    21
*/
icculus@7925
    22
icculus@7925
    23
#ifndef _SDL_config_linux_h
icculus@7925
    24
#define _SDL_config_linux_h
icculus@7925
    25
icculus@7925
    26
/**
icculus@7925
    27
 *  \file SDL_config.h.in
icculus@7925
    28
 *
icculus@7925
    29
 *  This is a set of defines to configure the SDL features
icculus@7925
    30
 */
icculus@7925
    31
icculus@7925
    32
/* General platform specific identifiers */
icculus@7925
    33
#include "SDL_platform.h"
icculus@7925
    34
icculus@7925
    35
/* Make sure that this isn't included by Visual C++ */
icculus@7925
    36
#ifdef _MSC_VER
icculus@7925
    37
#error You should run hg revert SDL_config.h 
icculus@7925
    38
#endif
icculus@7925
    39
icculus@7925
    40
/* C language features */
icculus@7925
    41
/* #undef const */
icculus@7925
    42
/* #undef inline */
icculus@7925
    43
/* #undef volatile */
icculus@7925
    44
icculus@7925
    45
/* C datatypes */
icculus@7925
    46
#ifdef __LP64__
icculus@7925
    47
#define SIZEOF_VOIDP 8
icculus@7925
    48
#else
icculus@7925
    49
#define SIZEOF_VOIDP 4
icculus@7925
    50
#endif
icculus@7925
    51
#define HAVE_GCC_ATOMICS 1
icculus@7925
    52
/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
icculus@7925
    53
icculus@7925
    54
/* Comment this if you want to build without any C library requirements */
icculus@7925
    55
#define HAVE_LIBC 1
icculus@7925
    56
#if HAVE_LIBC
icculus@7925
    57
icculus@7925
    58
/* Useful headers */
icculus@7925
    59
#define HAVE_ALLOCA_H 1
icculus@7925
    60
#define HAVE_SYS_TYPES_H 1
icculus@7925
    61
#define HAVE_STDIO_H 1
icculus@7925
    62
#define STDC_HEADERS 1
icculus@7925
    63
#define HAVE_STDLIB_H 1
icculus@7925
    64
#define HAVE_STDARG_H 1
icculus@7925
    65
#define HAVE_MALLOC_H 1
icculus@7925
    66
#define HAVE_MEMORY_H 1
icculus@7925
    67
#define HAVE_STRING_H 1
icculus@7925
    68
#define HAVE_STRINGS_H 1
icculus@7925
    69
#define HAVE_INTTYPES_H 1
icculus@7925
    70
#define HAVE_STDINT_H 1
icculus@7925
    71
#define HAVE_CTYPE_H 1
icculus@7925
    72
#define HAVE_MATH_H 1
icculus@7925
    73
#define HAVE_ICONV_H 1
icculus@7925
    74
#define HAVE_SIGNAL_H 1
icculus@7925
    75
/* #undef HAVE_ALTIVEC_H */
icculus@7925
    76
/* #undef HAVE_PTHREAD_NP_H */
icculus@7925
    77
/* #undef HAVE_LIBUDEV_H */
icculus@7925
    78
#define HAVE_DBUS_DBUS_H 1
icculus@7925
    79
icculus@7925
    80
/* C library functions */
icculus@7925
    81
#define HAVE_MALLOC 1
icculus@7925
    82
#define HAVE_CALLOC 1
icculus@7925
    83
#define HAVE_REALLOC 1
icculus@7925
    84
#define HAVE_FREE 1
icculus@7925
    85
#define HAVE_ALLOCA 1
icculus@7925
    86
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
icculus@7925
    87
#define HAVE_GETENV 1
icculus@7925
    88
#define HAVE_SETENV 1
icculus@7925
    89
#define HAVE_PUTENV 1
icculus@7925
    90
#define HAVE_UNSETENV 1
icculus@7925
    91
#endif
icculus@7925
    92
#define HAVE_QSORT 1
icculus@7925
    93
#define HAVE_ABS 1
icculus@7925
    94
#define HAVE_BCOPY 1
icculus@7925
    95
#define HAVE_MEMSET 1
icculus@7925
    96
#define HAVE_MEMCPY 1
icculus@7925
    97
#define HAVE_MEMMOVE 1
icculus@7925
    98
#define HAVE_MEMCMP 1
icculus@7925
    99
#define HAVE_STRLEN 1
icculus@7925
   100
/* #undef HAVE_STRLCPY */
icculus@7925
   101
/* #undef HAVE_STRLCAT */
icculus@7925
   102
#define HAVE_STRDUP 1
icculus@7925
   103
/* #undef HAVE__STRREV */
icculus@7925
   104
/* #undef HAVE__STRUPR */
icculus@7925
   105
/* #undef HAVE__STRLWR */
icculus@7925
   106
/* #undef HAVE_INDEX */
icculus@7925
   107
/* #undef HAVE_RINDEX */
icculus@7925
   108
#define HAVE_STRCHR 1
icculus@7925
   109
#define HAVE_STRRCHR 1
icculus@7925
   110
#define HAVE_STRSTR 1
icculus@7925
   111
/* #undef HAVE_ITOA */
icculus@7925
   112
/* #undef HAVE__LTOA */
icculus@7925
   113
/* #undef HAVE__UITOA */
icculus@7925
   114
/* #undef HAVE__ULTOA */
icculus@7925
   115
#define HAVE_STRTOL 1
icculus@7925
   116
#define HAVE_STRTOUL 1
icculus@7925
   117
/* #undef HAVE__I64TOA */
icculus@7925
   118
/* #undef HAVE__UI64TOA */
icculus@7925
   119
#define HAVE_STRTOLL 1
icculus@7925
   120
#define HAVE_STRTOULL 1
icculus@7925
   121
#define HAVE_STRTOD 1
icculus@7925
   122
#define HAVE_ATOI 1
icculus@7925
   123
#define HAVE_ATOF 1
icculus@7925
   124
#define HAVE_STRCMP 1
icculus@7925
   125
#define HAVE_STRNCMP 1
icculus@7925
   126
/* #undef HAVE__STRICMP */
icculus@7925
   127
#define HAVE_STRCASECMP 1
icculus@7925
   128
/* #undef HAVE__STRNICMP */
icculus@7925
   129
#define HAVE_STRNCASECMP 1
icculus@8089
   130
#define HAVE_VSSCANF 1
icculus@7925
   131
#define HAVE_VSNPRINTF 1
icculus@7925
   132
#define HAVE_M_PI /**/
icculus@7925
   133
#define HAVE_ATAN 1
icculus@7925
   134
#define HAVE_ATAN2 1
icculus@7925
   135
#define HAVE_CEIL 1
icculus@7925
   136
#define HAVE_COPYSIGN 1
icculus@7925
   137
#define HAVE_COS 1
icculus@7925
   138
#define HAVE_COSF 1
icculus@7925
   139
#define HAVE_FABS 1
icculus@7925
   140
#define HAVE_FLOOR 1
icculus@7925
   141
#define HAVE_LOG 1
icculus@7925
   142
#define HAVE_POW 1
icculus@7925
   143
#define HAVE_SCALBN 1
icculus@7925
   144
#define HAVE_SIN 1
icculus@7925
   145
#define HAVE_SINF 1
icculus@7925
   146
#define HAVE_SQRT 1
icculus@7925
   147
#define HAVE_FSEEKO 1
icculus@7925
   148
#define HAVE_FSEEKO64 1
icculus@7925
   149
#define HAVE_SIGACTION 1
icculus@7925
   150
#define HAVE_SA_SIGACTION 1
icculus@7925
   151
#define HAVE_SETJMP 1
icculus@7925
   152
#define HAVE_NANOSLEEP 1
icculus@7925
   153
#define HAVE_SYSCONF 1
icculus@7925
   154
/* #undef HAVE_SYSCTLBYNAME */
icculus@7925
   155
#define HAVE_CLOCK_GETTIME 1
icculus@7925
   156
/* #undef HAVE_GETPAGESIZE */
icculus@7925
   157
#define HAVE_MPROTECT 1
icculus@7925
   158
#define HAVE_ICONV 1
icculus@7925
   159
#define HAVE_PTHREAD_SETNAME_NP 1
icculus@7925
   160
/* #undef HAVE_PTHREAD_SET_NAME_NP */
icculus@7925
   161
#define HAVE_SEM_TIMEDWAIT 1
icculus@7925
   162
icculus@7925
   163
#else
icculus@7925
   164
#define HAVE_STDARG_H 1
icculus@7925
   165
#define HAVE_STDDEF_H 1
icculus@7925
   166
#define HAVE_STDINT_H 1
icculus@7925
   167
#endif /* HAVE_LIBC */
icculus@7925
   168
icculus@7925
   169
/* SDL internal assertion support */
icculus@7925
   170
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
icculus@7925
   171
icculus@7925
   172
#ifndef SDL_AUDIO_DRIVER_DUMMY
icculus@7925
   173
#define SDL_AUDIO_DRIVER_DUMMY 1
icculus@7925
   174
#endif
icculus@7925
   175
#ifndef SDL_AUDIO_DRIVER_DISK
icculus@7925
   176
#define SDL_AUDIO_DRIVER_DISK 1
icculus@7925
   177
#endif
icculus@7925
   178
#ifndef SDL_VIDEO_DRIVER_DUMMY
icculus@7925
   179
#define SDL_VIDEO_DRIVER_DUMMY 1
icculus@7925
   180
#endif
icculus@7925
   181
#ifndef SDL_VIDEO_RENDER_OGL
icculus@7925
   182
#define SDL_VIDEO_RENDER_OGL 1
icculus@7925
   183
#endif
icculus@7925
   184
#ifndef SDL_VIDEO_OPENGL
icculus@7925
   185
#define SDL_VIDEO_OPENGL 1
icculus@7925
   186
#endif
icculus@7925
   187
#ifndef SDL_VIDEO_OPENGL_GLX
icculus@7925
   188
#define SDL_VIDEO_OPENGL_GLX 1
icculus@7925
   189
#endif
icculus@7925
   190
#ifndef SDL_LOADSO_DLOPEN
icculus@7925
   191
#define SDL_LOADSO_DLOPEN 1
icculus@7925
   192
#endif
icculus@7925
   193
#ifndef SDL_AUDIO_DRIVER_ALSA
icculus@7925
   194
#define SDL_AUDIO_DRIVER_ALSA 1
icculus@7925
   195
#endif
icculus@7925
   196
#ifndef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
icculus@7925
   197
#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so"
icculus@7925
   198
#endif
icculus@7925
   199
#ifndef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
icculus@7925
   200
#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "libpulse-simple.so"
icculus@7925
   201
#endif
icculus@7925
   202
#ifndef SDL_AUDIO_DRIVER_PULSEAUDIO
icculus@7925
   203
#define SDL_AUDIO_DRIVER_PULSEAUDIO 1
icculus@7925
   204
#endif
icculus@7925
   205
#ifndef SDL_AUDIO_DRIVER_ESD
icculus@7925
   206
#define SDL_AUDIO_DRIVER_ESD 1
icculus@7925
   207
#endif
icculus@7925
   208
#ifndef SDL_AUDIO_DRIVER_ESD_DYNAMIC
icculus@7925
   209
#define SDL_AUDIO_DRIVER_ESD_DYNAMIC "libesd.so"
icculus@7925
   210
#endif
icculus@7925
   211
#ifndef SDL_AUDIO_DRIVER_NAS
icculus@7925
   212
#define SDL_AUDIO_DRIVER_NAS 1
icculus@7925
   213
#endif
icculus@7925
   214
#ifndef SDL_AUDIO_DRIVER_NAS_DYNAMIC
icculus@7925
   215
#define SDL_AUDIO_DRIVER_NAS_DYNAMIC "libaudio.so"
icculus@7925
   216
#endif
icculus@7925
   217
#ifndef SDL_AUDIO_DRIVER_OSS
icculus@7925
   218
#define SDL_AUDIO_DRIVER_OSS 1
icculus@7925
   219
#endif
icculus@7925
   220
#ifndef SDL_VIDEO_DRIVER_X11_XINERAMA
icculus@7925
   221
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
icculus@7925
   222
#endif
icculus@7925
   223
#ifndef SDL_VIDEO_DRIVER_X11
icculus@7925
   224
#define SDL_VIDEO_DRIVER_X11 1
icculus@7925
   225
#endif
icculus@7925
   226
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
icculus@7925
   227
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so"
icculus@7925
   228
#endif
icculus@7925
   229
#ifndef SDL_VIDEO_DRIVER_X11_XCURSOR
icculus@7925
   230
#define SDL_VIDEO_DRIVER_X11_XCURSOR 1
icculus@7925
   231
#endif
icculus@7925
   232
#ifndef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
icculus@7925
   233
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
icculus@7925
   234
#endif
icculus@7925
   235
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
icculus@7925
   236
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "libXi.so"
icculus@7925
   237
#endif
icculus@7925
   238
#ifndef SDL_VIDEO_DRIVER_X11_XVIDMODE
icculus@7925
   239
#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
icculus@7925
   240
#endif
icculus@7925
   241
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
icculus@7925
   242
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "libXinerama.so"
icculus@7925
   243
#endif
icculus@7925
   244
#ifndef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
icculus@7925
   245
#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
icculus@7925
   246
#endif
icculus@7925
   247
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC
icculus@7925
   248
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so"
icculus@7925
   249
#endif
icculus@7925
   250
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
icculus@7925
   251
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "libXss.so"
icculus@7925
   252
#endif
icculus@7925
   253
#ifndef SDL_VIDEO_DRIVER_X11_XINPUT2
icculus@7925
   254
#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
icculus@7925
   255
#endif
icculus@7925
   256
#ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
icculus@7925
   257
#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
icculus@7925
   258
#endif
icculus@7925
   259
#ifndef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
icculus@7925
   260
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
icculus@7925
   261
#endif
icculus@7925
   262
#ifndef SDL_VIDEO_DRIVER_X11_XSHAPE
icculus@7925
   263
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
icculus@7925
   264
#endif
icculus@7925
   265
#ifndef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
icculus@7925
   266
#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1
icculus@7925
   267
#endif
icculus@7925
   268
#ifndef SDL_VIDEO_DRIVER_X11_XRANDR
icculus@7925
   269
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
icculus@7925
   270
#endif
icculus@7925
   271
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
icculus@7925
   272
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "libXxf86vm.so"
icculus@7925
   273
#endif
icculus@7925
   274
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
icculus@7925
   275
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "libXcursor.so"
icculus@7925
   276
#endif
icculus@7925
   277
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
icculus@7925
   278
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so"
icculus@7925
   279
#endif
icculus@7925
   280
#ifndef SDL_INPUT_LINUXEV
icculus@7925
   281
#define SDL_INPUT_LINUXEV 1
icculus@7925
   282
#endif
icculus@7925
   283
#ifndef SDL_HAPTIC_LINUX
icculus@7925
   284
#define SDL_HAPTIC_LINUX 1
icculus@7925
   285
#endif
icculus@7925
   286
#ifndef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
icculus@7925
   287
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
icculus@7925
   288
#endif
icculus@7925
   289
#ifndef SDL_JOYSTICK_LINUX
icculus@7925
   290
#define SDL_JOYSTICK_LINUX 1
icculus@7925
   291
#endif
icculus@7925
   292
#ifndef SDL_THREAD_PTHREAD
icculus@7925
   293
#define SDL_THREAD_PTHREAD 1
icculus@7925
   294
#endif
icculus@7925
   295
#ifndef SDL_POWER_LINUX
icculus@7925
   296
#define SDL_POWER_LINUX 1
icculus@7925
   297
#endif
icculus@7925
   298
#ifndef SDL_TIMER_UNIX
icculus@7925
   299
#define SDL_TIMER_UNIX 1
icculus@7925
   300
#endif
icculus@7925
   301
#ifndef SDL_FILESYSTEM_UNIX
icculus@7925
   302
#define SDL_FILESYSTEM_UNIX 1
icculus@7925
   303
#endif
icculus@7925
   304
icculus@7925
   305
/* Enable assembly routines */
icculus@7925
   306
#define SDL_ASSEMBLY_ROUTINES 1
icculus@7925
   307
/* #undef SDL_ALTIVEC_BLITTERS */
icculus@7925
   308
icculus@7925
   309
#endif /* _SDL_config_h */