Revision 5d117bd4

View differences:

configure
357 357
    done
358 358
}
359 359

  
360
set_safe(){
361
    var=$1
362
    shift
363
    eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
364
}
365

  
366
get_safe(){
367
    eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
368
}
369

  
360 370
pushvar(){
361 371
    for var in $*; do
362 372
        eval level=\${${var}_level:=0}
......
742 752
    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
743 753
}
744 754

  
755
check_pkg_config(){
756
    log check_pkg_config "$@"
757
    pkg="$1"
758
    headers="$2"
759
    funcs="$3"
760
    shift 3
761
    $pkg_config --exists $pkg || return
762
    pkg_cflags=$($pkg_config --cflags $pkg)
763
    pkg_libs=$($pkg_config --libs $pkg)
764
    check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
765
        set_safe ${pkg}_cflags $pkg_cflags   &&
766
        set_safe ${pkg}_libs   $pkg_libs
767
}
768

  
745 769
check_exec(){
746 770
    check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
747 771
}
......
823 847
    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
824 848
}
825 849

  
850
require_pkg_config(){
851
    pkg="$1"
852
    check_pkg_config "$@" || die "ERROR: $pkg not found"
853
    add_cflags    $(get_safe ${pkg}_cflags)
854
    add_extralibs $(get_safe ${pkg}_libs)
855
}
856

  
826 857
check_host_cc(){
827 858
    log check_host_cc "$@"
828 859
    cat > $TMPC
......
1149 1180
    logfile
1150 1181
    malloc_prefix
1151 1182
    nm
1183
    pkg_config
1152 1184
    samples
1153 1185
    source_path
1154 1186
    strip
......
1587 1619
ln_s="ln -sf"
1588 1620
nm_default="nm"
1589 1621
objformat="elf"
1622
pkg_config_default=pkg-config
1590 1623
ranlib="ranlib"
1591 1624
strip_default="strip"
1592 1625
yasmexe="yasm"
......
1796 1829
ar_default="${cross_prefix}${ar_default}"
1797 1830
cc_default="${cross_prefix}${cc_default}"
1798 1831
nm_default="${cross_prefix}${nm_default}"
1832
pkg_config_default="${cross_prefix}${pkg_config_default}"
1799 1833
ranlib="${cross_prefix}${ranlib}"
1800 1834
strip_default="${cross_prefix}${strip_default}"
1801 1835

  
1802 1836
sysinclude_default="${sysroot}/usr/include"
1803 1837

  
1804
set_default cc nm strip sysinclude
1838
set_default cc nm pkg_config strip sysinclude
1805 1839
enabled cross_compile || host_cc_default=$cc
1806 1840
set_default host_cc
1807 1841

  

Also available in: Unified diff