[FFmpeg-devel] [PATCH] pthread detection on mingw + static pthread

Ramiro Polla ramiro
Thu Apr 24 05:53:21 CEST 2008

M?ns Rullg?rd wrote:
> Gianluigi Tiesi <mplayer at netfarm.it> writes:
>> This patch makes configure script detect pthreads win32 on mingw
>> first it tries to link directly if it fails
>> it tries by adding -lws2_32 this means that pthread lib is
>> static compiled, in this case a define is needed (and added)
>> also x264 if compiled with the same pthread lib needs extralibs
>> to compile, anyway it seems that libx264 needs stdint.h inclusion
>> there is a patch for ffmpeg.c to handle pthread static,
>> it's needed also for other executables using pthreads
>> I don't use/compile ffserver / ffplay so I have no clue
>> but adding the same fix on them should be strightforward
>> Currently I've only tested detection for static pthread
>> but it should be fine also with pthreadGC2.dll + .a
>> Regards
>> -- 
>> Gianluigi Tiesi <sherpya at netfarm.it>
>> EDP Project Leader
>> Netfarm S.r.l. - http://www.netfarm.it/
>> Free Software: http://oss.netfarm.it/
>> Index: configure
>> ===================================================================
>> --- configure	(revision 12924)
>> +++ configure	(working copy)
>> @@ -1593,6 +1593,11 @@
>>      elif check_func pthread_create -pthreads; then
>>          add_cflags -pthreads
>>          add_extralibs -pthreads
>> +    elif check_func pthread_create -lpthreadGC2; then
>> +        add_extralibs -lpthreadGC2
> OK


>> +    elif check_func pthread_create -DPTW32_STATIC_LIB -lpthreadGC2 -lws2_32; then
> The -D flag in that line has no effect, and can thus be removed.

Indeed it can.

>> +        add_cflags -DPTW32_STATIC_LIB
> Is this preprocessor define required by the library, or was it
> something you invented for use in ffmpeg.c?

pthreads-win32 requires this.

>> +        add_extralibs -lpthreadGC2 -lws2_32
>>      elif ! check_lib pthread.h pthread_create -lpthread; then
>>          die "ERROR: can't find pthreads library"
>>      fi
>> @@ -1629,7 +1634,7 @@
>>  enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
>>  enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
>>  enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
>> -enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
>> +enabled libx264    && require2 x264 "stdint.h x264.h" x264_encoder_open -lx264 -lm
> Not necessary.

It is necessary, but belongs in a separate patch. It checks not only 
that the x264_encoder_open symbols exists, but that we can actually link 
against this library.

libx264.diff uses require2 in configure
pthreadsGC2_static.diff adds static pthreads-win32 support, given that a 
certain patch be applied to x264 (which I'll send to the x264 
mailinglist right away).

Ramiro Polla
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pthreadsGC2_static.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080424/f630c1c8/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libx264.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080424/f630c1c8/attachment.txt>

More information about the ffmpeg-devel mailing list