]> granicus.if.org Git - handbrake/commitdiff
Work around fedora mingw pthread library requirement
authorjstebbins <jstebbins.hb@gmail.com>
Sun, 18 Jan 2015 17:25:51 +0000 (17:25 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Sun, 18 Jan 2015 17:25:51 +0000 (17:25 +0000)
Fedora mingw seems to require it's own pthread library which causes build
conflicts with our pthread lib.  So this patch distinguishes whether
libpthread or libpthreadGC2 is already installed on the system and uses
the appropriate system lib when found.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6766 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/module.defs
libhb/ports.c
make/configure.py
make/include/main.defs
test/module.defs

index a6eb72fe9c00a75dcd87ea6528d49dacee5140d1..473a058cae21de8631c21f18e0d959fb6f3394ad 100644 (file)
@@ -53,7 +53,10 @@ else ifeq ($(BUILD.system),darwin)
 else ifeq ($(BUILD.system),linux)
     LIBHB.GCC.D += SYS_LINUX _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64
 else ifeq ($(BUILD.system),mingw)
-    LIBHB.GCC.D += SYS_MINGW PTW32_STATIC_LIB
+    LIBHB.GCC.D += SYS_MINGW
+ifeq ($(HAS.pthreadGC2),1)
+    LIBHB.GCC.D += PTW32_STATIC_LIB
+endif
        LIBHB.GCC.args.extra.dylib++ += -Wl,--enable-auto-import -static
 else ifeq ($(BUILD.system),solaris)
     LIBHB.GCC.D += SYS_SunOS _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 _POSIX_C_SOURCE=200112L __EXTENSIONS__
@@ -140,7 +143,9 @@ else
        LIBHB.GCC.l += fribidi
 endif
 
-ifneq ($(HAS.pthread),1)
+ifeq ($(HAS.pthread),1)
+    LIBHB.GCC.l += pthread
+else ifneq ($(HAS.pthreadGC2),1)
 LIBHB.dll.libs += $(CONTRIB.build/)lib/libpthreadGC2.a
 else
     LIBHB.GCC.l += pthreadGC2
index bb7c235a2a0b37442a5caa6d8c65c5f38781506e..d519f593c8c2c8e357be730f3a5f6b397b2ba9ac 100644 (file)
@@ -697,7 +697,11 @@ static uint64_t hb_thread_to_integer( const hb_thread_t* t )
     #if defined( SYS_CYGWIN )
         return (uint64_t)t->thread;
     #elif defined( _WIN32 ) || defined( __MINGW32__ )
+    #if defined(PTW32_STATIC_LIB)
         return (uint64_t)(ptrdiff_t)t->thread.p;
+    #else
+        return (uint64_t)t->thread;
+    #endif
     #elif defined( SYS_DARWIN )
         return (unsigned long)t->thread;
     #else
index 1bac0874f6956f4c9c5f3250767ffcd2ece34601..e1e8e4d662cd72334b5b7babbd7bde9e33e4162a 100644 (file)
@@ -1541,7 +1541,8 @@ int main ()
   return 0;
 }
 """
-        pthread = LDProbe( 'static pthread', '%s -static' % Tools.gcc.pathname, '-lpthreadGC2', pthread_test )
+        pthreadGC2 = LDProbe( 'static pthread', '%s -static' % Tools.gcc.pathname, '-lpthreadGC2', pthread_test )
+        pthread = LDProbe( 'static pthread', '%s -static' % Tools.gcc.pathname, '-lpthread', pthread_test )
         pthread.run()
 
         bz2_test = """
@@ -1733,6 +1734,8 @@ int main()
             doc.add( 'HAS.dlfcn', 1 )
         if not pthread.fail:
             doc.add( 'HAS.pthread', 1 )
+        if not pthreadGC2.fail:
+            doc.add( 'HAS.pthreadGC2', 1 )
         if not bz2.fail:
             doc.add( 'HAS.bz2', 1 )
         if not libz.fail:
index 4aa659c6ec9256831d7a165e01033a023ffb7064..56db40c4df6ae006c7de6988c4d20138e8bcd378 100644 (file)
@@ -69,9 +69,11 @@ MODULES += contrib/libbluray
 
 ifneq (,$(filter $(BUILD.system),mingw))
 ifneq ($(HAS.pthread),1)
+ifneq ($(HAS.pthreadGC2),1)
     MODULES += contrib/pthreadw32
 endif
 endif
+endif
 
 ifeq (1,$(FEATURE.qsv))
     MODULES += contrib/libmfx
index 6f99048523e90c87ca765fd815924fdd0e4f291d..1f794e93abe0824c66690bb21cf5c11f419f2bce 100644 (file)
@@ -60,7 +60,12 @@ endif
 ifeq (1,$(FEATURE.hwd))
     TEST.GCC.D += USE_HWD
 endif
-    TEST.GCC.l += pthreadGC2 iconv ws2_32 regex
+ifeq (1,$(HAS.pthread))
+    TEST.GCC.l += pthread
+else
+    TEST.GCC.l += pthreadGC2
+endif
+    TEST.GCC.l += iconv ws2_32 regex
     TEST.GCC.D += PTW32_STATIC_LIB
     TEST.GCC.args.extra.exe++ += -static
 endif #   (1-mingw,$(BUILD.cross)-$(BUILD.system))