Commit Graph

29 Commits

Author SHA1 Message Date
Martin Storsjö 407ac22322 w32pthreads: Map MemoryBarrier to __sync_synchronize on mingw
This fixes building on older mingw (both mingw.org and mingw64;
mingw64 from before May 2011).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-30 20:15:11 +02:00
Hendrik Leppkes 68e00ad66d w32pthreads: fix mingw build on x86 with -msse2 or higher
When SSE2 or higher compiler optimizations are used, mingw uses
the _mm_mfence intrinsic for MemoryBarrier, however it doesn't include
the appropriate headers automatically.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-16 17:46:41 +02:00
Sean McGovern c1aac39eac build: add Solaris symbol versioning
The versioning facility in the Solaris linker differs from Linux in 3 ways:

1. It does not support globs in linker scripts for
symbol versioning -- this is a GNU extension.

2. The linker argument is '-M', instead of '--version-script'.

3. It is picky about line endings.
Each symbol or directive must be on a line of it's own.

Let's use make_sunver.pl from GCC to generate a version script that works
correctly with the Solaris linker. It's function is to correctly expand the
globs in the original generated version script.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-11 15:42:36 +02:00
Hendrik Leppkes 2830bce47e w32pthreads: Load dynamically loaded functions on demand
This removes the requirement of calling w32thread_init before being
able to use the threading primitives.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-07 18:45:50 +02:00
Hendrik Leppkes b22693b06d w32pthreads: Add pthread_once emulation
The emulation uses native InitOnce* APIs on Windows Vista+, and a
lock-free/allocation-free approach using atomics and spinning for
Windows XP.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-07 18:45:50 +02:00
Steve Lhomme c9edbe4af9 use a wrapper script to call MS link.exe to avoid mixing with /usr/bin/link.exe
Fallback to "link" in the path if the one next to cl is not found.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-07-24 18:21:22 +03:00
James Almer b7c3bfd5eb w32pthreads: use the condition variable API directly when targeting newer versions of Windows
Wrap the function calls in a similar fashion to how it's being done
with the critical section API.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-10 11:27:30 +03:00
James Almer 73ea3ffcd5 w32pthreads: use the CONDITION_VARIABLE typedef if available
This silences warnings about passing arguments from incompatible pointer type
when targeting Windows Vista or newer.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-10 11:27:26 +03:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Diego Biurrun 6baeadd110 w32pthreads: Mark functions in compatibility wrapper as av_unused
This avoids annoying warnings about unused functions. The compatibility
wrapper is designed to provide a complete (stub) API, so some functions
being unused by some files is natural and no reason for a warning.
2014-08-15 09:37:38 +02:00
Martin Storsjö 428b0578c6 w32threads: Use newer thread synchronization functions when targeting Vista
When explicitly targeting Vista or newer (which only happens if the
caller explicitly sets _WIN32_WINNT to a high enough value via the
extra cflags option - otherwise configure script sets
-D_WIN32_WINNT=0x0502), we already unconditionally link to the
ConditionVariable functions, since 4622f11f9.

Similarly use the newer -Ex versions of CreateEvent, CreateSemaphore,
InitializeCriticalSection and WaitForSingleObject, that all appeared
in Vista. When building Windows Store applications, the older versions
of these functions aren't available, only the -Ex functions. When
doing such a build, the user can set -D_WIN32_WINNT=0x0600 to
forcibly use the newer functions instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-08-13 14:38:18 +03:00
Anton Khirnov e854b8f9f4 Work around broken floating point limits on some systems.
The values of {FLT,DBL}_{MAX,MIN} macros on some systems (older musl
libc, some BSD flavours) are not exactly representable, i.e.
(double)DBL_MAX == DBL_MAX is false
This violates (at least some interpretations of) the C99 standard and
breaks code (e.g. in vf_fps) like
double f = DBL_MAX;
[...]
if (f == DBL_MAX) { // f has not been changed yet
    [....]
}
2014-03-10 10:27:17 +01:00
Derek Buitenhuis dedfa00107 build: Import makedef script from c99-to-c89
This allows MSVC 2013 and ICL to build with no external
dependencies.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-11-24 19:36:09 +00:00
Diego Biurrun 86f910806b Remove #undefs for formerly forbidden system functions
The macros forbidding the system functions no longer exist, obviating
the need for the #undefs.
2013-11-07 00:26:15 +01:00
Martin Storsjö ef51692a49 Revert "w32pthread: help compiler figure out undeeded code"
This reverts commit 4622f11f9c.

The compiler should be able to do the dead code elimination now
without this when the cond_* names point directly to the real
functions instead of to local function pointers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-27 23:12:49 +03:00
Martin Storsjö 4332bf98dc w32threads: Don't use function pointers when linking directly to newer APIs
This reduces the call overhead slightly. More noticeably, it
restores the earlier (unintended?) feature that condition variable
functions work just fine even if w32thread_init() hasn't been called.
This was broken as a side effect of 4622f11f9, if explicitly targeting
Vista+.

This makes w32threading work in VP8 again, if targeting Vista+.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-27 23:12:28 +03:00
Rafaël Carré 4622f11f9c w32pthread: help compiler figure out undeeded code
The emulation code is not needed when targetting Vista+
This helps getting rid of CreateSemaphore symbol, which is
forbidden in Windows Store apps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-21 14:20:33 +01:00
Diego Biurrun 910042072a compat: Add missing license boilerplates 2013-07-18 18:12:38 +02:00
Diego Biurrun 439902e0d6 Employ consistent LIBAV_COMPAT_ multiple inclusion guards in compat/
Also fix a comment and an #endif comment.
2013-07-18 18:12:38 +02:00
Luca Barbato d3635f3ab0 compat: wrap math.h to avoid AIX-specific clashes
AIX defines a class() function in its math.h header without any
guard.
2013-07-04 21:54:32 +02:00
Anton Khirnov 90f9a5830b w32pthreads: move from lavc to compat/
It will be used in other places than lavc.
2013-05-24 09:26:54 +02:00
Reimar Döffinger efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Mans Rullgard 4ebc6a7410 build: Plan 9 support
This adds support for building on Plan 9 x86-32.  The compat/plan9
directory contains these items:

- replacements for the 'head' and 'printf' shell commands
- wrapper for main() to disable FPU exceptions

Larger required changes to the system are described in the
documentation.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-23 12:01:18 +01:00
Mans Rullgard b6f8d635f2 build: tms470: work around glibc math.h problems
The glibc definitions of INFINITY and NAN do not work with the
tms470 compiler, nor do our usual fallbacks.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-13 18:21:36 +01:00
Ronald S. Bultje c1c8fdab46 compat/vsnprintf: return number of bytes required on truncation.
This conforms to C99, but requires Windows >= XP.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-09-15 14:33:11 -04:00
Ronald S. Bultje 4fa661a857 lavu: add snprintf(), vsnprint() and strtod() replacements for MS runtime.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-05 17:07:30 +03:00
Martin Storsjö 962e912a49 getopt: Remove an unnecessary define
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-16 23:12:50 +03:00
Martin Storsjö da8201cc82 getopt: Add missing includes
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-16 22:25:13 +03:00
Ronald S. Bultje 667fb97a65 dct/fft-test: use a replacement getopt() if the system has none present.
This allows compiling and running these tests on systems lacking a built-
in version of getopt(), such as MSVC.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-07-11 21:24:37 +02:00