Revision 3f8040db configure

View differences:

configure
356 356
    done
357 357
}
358 358

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

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

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

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

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

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

  
825 856
check_host_cc(){
826 857
    log check_host_cc "$@"
827 858
    cat > $TMPC
......
1144 1175
    logfile
1145 1176
    malloc_prefix
1146 1177
    nm
1178
    pkg_config
1147 1179
    samples
1148 1180
    source_path
1149 1181
    strip
......
1571 1603
ln_s="ln -sf"
1572 1604
nm_default="nm"
1573 1605
objformat="elf"
1606
pkg_config_default=pkg-config
1574 1607
ranlib="ranlib"
1575 1608
strip_default="strip"
1576 1609
yasmexe="yasm"
......
1780 1813
ar_default="${cross_prefix}${ar_default}"
1781 1814
cc_default="${cross_prefix}${cc_default}"
1782 1815
nm_default="${cross_prefix}${nm_default}"
1816
pkg_config_default="${cross_prefix}${pkg_config_default}"
1783 1817
ranlib="${cross_prefix}${ranlib}"
1784 1818
strip_default="${cross_prefix}${strip_default}"
1785 1819

  
1786 1820
sysinclude_default="${sysroot}/usr/include"
1787 1821

  
1788
set_default cc nm strip sysinclude
1822
set_default cc nm pkg_config strip sysinclude
1789 1823
enabled cross_compile || host_cc_default=$cc
1790 1824
set_default host_cc
1791 1825

  

Also available in: Unified diff