summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorDiogo Franco <diogomfranco@gmail.com>2011-03-27 12:38:01 -0300
committerUoti Urpala <uau@mplayer2.org>2011-03-30 14:50:47 +0300
commit5c731e2ea669bbc732e51dc95c1ec68cc41050e6 (patch)
tree44f2f7560c6d277493777f1b9638f0c66e30fe32 /configure
parent7131fceb0b80c462604e65fe1869db6e14791b4e (diff)
downloadmpv-5c731e2ea669bbc732e51dc95c1ec68cc41050e6.tar.bz2
mpv-5c731e2ea669bbc732e51dc95c1ec68cc41050e6.tar.xz
configure, Windows: support static pthreads on Windows
Windows pthreads requires certain functions to be called to initialize itself. It can do that through DllMain but no such luck when linked statically; mplayer needs to call the initialization explicitly.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure13
1 files changed, 12 insertions, 1 deletions
diff --git a/configure b/configure
index 21360b36e0..4a0f88712e 100755
--- a/configure
+++ b/configure
@@ -3186,7 +3186,14 @@ if test "$_pthreads" = auto ; then
cat > $TMPC << EOF
#include <pthread.h>
static void *func(void *arg) { return arg; }
-int main(void) { pthread_t tid; return pthread_create(&tid, 0, func, 0) == 0 ? 0 : 1; }
+int main(void) {
+ pthread_t tid;
+#ifdef PTW32_STATIC_LIB
+ pthread_win32_process_attach_np();
+ pthread_win32_thread_attach_np();
+#endif
+ return pthread_create (&tid, 0, func, 0) != 0;
+}
EOF
_pthreads=no
if ! hpux ; then
@@ -3194,6 +3201,10 @@ if ! hpux ; then
# for crosscompilation, we cannot execute the program, be happy if we can link statically
cc_check $THREAD_CFLAGS $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break
done
+ if test "$_pthreads" = no && mingw32 ; then
+ _ld_tmp="-lpthreadGC2 -lws2_32"
+ cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
+ fi
fi
fi
if test "$_pthreads" = yes ; then