Revision 8876c8ae configure

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

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

  
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

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

  
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

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

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

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

  

Also available in: Unified diff