[FFmpeg-devel] [PATCH/RFC] Prefer getaddrinfo over gethostbyname

Måns Rullgård mans
Fri Jan 8 02:31:45 CET 2010


Martin Storsj? <martin at martin.st> writes:

> From 6ada91df4401aa2492b5504ca839dcd5e3173172 Mon Sep 17 00:00:00 2001
> From: Martin Storsjo <martin at martin.st>
> Date: Sat, 2 Jan 2010 23:44:42 +0200
> Subject: [PATCH 1/8] Check for the getaddrinfo function
>
> ---
>  configure |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 60e16c1..f120936 100755
> --- a/configure
> +++ b/configure
> @@ -954,6 +954,7 @@ HAVE_LIST="
>      fast_cmov
>      fast_unaligned
>      fork
> +    getaddrinfo
>      gethrtime
>      GetProcessTimes
>      getrusage
> @@ -2309,6 +2310,7 @@ fi
>  check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
>  
>  check_func  fork
> +check_func  getaddrinfo $network_extralibs
>  check_func  gethrtime
>  check_func  getrusage
>  check_func  inet_aton $network_extralibs

OK

> From 4401515fe5b291d1773533092f24fe4a057a50bd Mon Sep 17 00:00:00 2001
> From: Martin Storsjo <martin at martin.st>
> Date: Mon, 4 Jan 2010 00:19:24 +0200
> Subject: [PATCH 3/8] Make check_type handle type names containing spaces
>
> ---
>  configure |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/configure b/configure
> index f120936..810cec8 100755
> --- a/configure
> +++ b/configure
> @@ -735,6 +735,7 @@ check_type(){
>      log check_type "$@"
>      headers=$1
>      type=$2
> +    type_quoted=$(echo "$type" | sed 's/ /_/g')
>      shift 2
>      disable $type

You missed one.

>      incs=""
> @@ -742,7 +743,7 @@ check_type(){
>          incs="$incs
>  #include <$hdr>"
>      done
> -    check_cc "$@" <<EOF && enable $type
> +    check_cc "$@" <<EOF && enable $type_quoted
>  $incs
>  $type v;
>  EOF

Use enable_safe/disable_safe instead.  They do the required
replacements already.

> From 763487b4acd223499a95b7c8ed03de0ec3b7becf Mon Sep 17 00:00:00 2001
> From: Martin Storsjo <martin at martin.st>
> Date: Mon, 4 Jan 2010 00:07:59 +0200
> Subject: [PATCH 4/8] Check for the structs associated with getaddrinfo
>
> ---
>  configure |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 810cec8..a96f11e 100755
> --- a/configure
> +++ b/configure
> @@ -986,6 +986,8 @@ HAVE_LIST="
>      socklen_t
>      soundcard_h
>      poll_h
> +    struct_addrinfo
> +    struct_sockaddr_storage
>      sys_mman_h
>      sys_resource_h
>      sys_select_h
> @@ -2445,6 +2447,8 @@ texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
>  
>  if enabled network; then
>      check_type "sys/types.h sys/socket.h" socklen_t
> +    check_type netdb.h "struct addrinfo"
> +    check_type sys/socket.h "struct sockaddr_storage"
>      # Prefer arpa/inet.h over winsock2
>      if check_header arpa/inet.h ; then
>          check_func closesocket
> @@ -2454,6 +2458,8 @@ if enabled network; then
>          { check_func_headers winsock2.h closesocket -lws2_32 && \
>              network_extralibs="-lws2_32"; }
>          check_type ws2tcpip.h socklen_t
> +        check_type ws2tcpip.h "struct addrinfo"
> +        check_type ws2tcpip.h "struct sockaddr_storage"
>      else
>          disable network
>      fi

OK

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



More information about the ffmpeg-devel mailing list