[FFmpeg-devel] [PATCH 2/2] Autodetect pthreads

Måns Rullgård mans
Mon Apr 19 13:30:07 CEST 2010


David Conrad <lessen42 at gmail.com> writes:

> ---
>  configure |   38 +++++++++++++++++++++++++++-----------
>  1 files changed, 27 insertions(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 9b9ae51..0005416 100755
> --- a/configure
> +++ b/configure
> @@ -93,7 +93,7 @@ Configuration options:
>    --enable-avfilter-lavf   video filters dependent on avformat [no]
>    --enable-beosthreads     use BeOS threads [no]
>    --enable-os2threads      use OS/2 threads [no]
> -  --enable-pthreads        use pthreads [no]
> +  --enable-pthreads        use pthreads [autodetect]
>    --enable-w32threads      use Win32 threads [no]
>    --enable-x11grab         enable X11 grabbing [no]
>    --disable-network        disable network support [no]
> @@ -2565,9 +2565,24 @@ fi
>  disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
>  disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
>
> +pthreads_deps="!w32threads !beosthreads !os2threads"
> +pthreads_if_any='
> +    dnxhd_decoder
> +    dnxhd_encoder
> +    dvvideo_decoder
> +    dvvideo_encoder
> +    h263_encoder
> +    h264_decoder
> +    libx264_encoder
> +    mpeg1video_decoder
> +    mpeg1video_encoder
> +    mpeg2video_decoder
> +    mpeg2video_encoder
> +'
> +
>  # check for some common methods of building with pthread support
>  # do this before the optional library checks as some of them require pthreads
> -if enabled pthreads; then
> +if ! disabled pthreads; then
>      if check_func pthread_create; then
>          :
>      elif check_func pthread_create -pthread; then
> @@ -2579,18 +2594,10 @@ if enabled pthreads; then
>      elif check_func pthread_create -lpthreadGC2; then
>          add_extralibs -lpthreadGC2
>      elif ! check_lib pthread.h pthread_create -lpthread; then
> -        die "ERROR: can't find pthreads library"
> +        disable pthreads
>      fi
>  fi

This will cause libpthread to be linked in even if it's not used.

> -for thread in $THREADS_LIST; do
> -    if enabled $thread; then
> -        test -n "$thread_type" &&
> -            die "ERROR: Only one thread type must be selected." ||
> -            thread_type="$thread"
> -    fi
> -done
> -
>  check_lib math.h sin -lm
>  check_lib va/va.h vaInitialize -lva
>
> @@ -2825,6 +2832,15 @@ enabled_any $THREADS_LIST      && enable threads
>
>  enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
>
> +for thread in $THREADS_LIST; do
> +    if enabled $thread; then
> +        echo "enabled $thread"
> +        test -n "$thread_type" &&
> +            die "ERROR: Only one thread type must be selected." ||
> +            thread_type="$thread"
> +    fi
> +done

Why are you moving this?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list