qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] Remove the extra -lrt switch


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2] Remove the extra -lrt switch
Date: Fri, 27 Apr 2012 15:55:42 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 04/27/2012 02:16 PM, Peter Portante wrote:
> The package config check for gthreads might have already placed
> a -lrt switch in LIBS earlier.
> 
> Refactored the code from the pthread switch removal, from commit
> e3c56761b465a4253871c32b06ebbc2d8b3fc3e1, to make it work for the
> more general case.
> 

> +add_to_libs() {
> +  found=no
> +  for lib_entry in $LIBS; do
> +    if test "$lib_entry" = "$1"; then
> +      found=yes
> +      break
> +    fi
> +  done
> +  if test "$found" = "no"; then
> +    LIBS="$1 $LIBS"
> +  fi
> +}

Shorter (and probably faster) to write this as:

add_to_libs() {
  case " $LIBS " in
    " $1 ") ;;
    *) LIBS="$1 $LIBS" ;;
  esac
}

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]