Revision f8d7b072 configure

View differences:

configure
438 438
EOF
439 439
}
440 440

  
441
check_func2(){
442
    log check_func2 "$@"
443
    headers=$1
444
    func=$2
445
    shift 2
446
    disable $func
447
    incs=""
448
    for hdr in $headers; do
449
        incs="$incs
450
#include <$hdr>"
451
    done
452
    check_ld "$@" <<EOF && enable $func
453
$incs
454
int main(){
455
    (void) $func;
456
    return 0;
457
}
458
EOF
459
}
460

  
441 461
check_lib(){
442 462
    log check_lib "$@"
443 463
    header="$1"
......
450 470
    return $err
451 471
}
452 472

  
473
check_lib2(){
474
    log check_lib2 "$@"
475
    headers="$1"
476
    func="$2"
477
    shift 2
478
    temp_extralibs "$@"
479
    check_func2 "$headers" $func && add_extralibs "$@"
480
    err=$?
481
    restore_flags
482
    return $err
483
}
484

  
453 485
check_exec(){
454 486
    check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
455 487
}
......
462 494
    check_lib $header $func "$@" || die "ERROR: $name not found"
463 495
}
464 496

  
497
require2(){
498
    name="$1"
499
    headers="$2"
500
    func="$3"
501
    shift 3
502
    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
503
}
504

  
465 505
apply(){
466 506
    file=$1
467 507
    shift
......
1486 1526
enabled x264       && require x264 x264.h x264_encoder_open -lx264
1487 1527
enabled dc1394     && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1488 1528
enabled mlib       && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1489

  
1490
# Ugh, libfaac uses stdcall calling convention on win32 so we can't use
1491
# the generic test functions
1492
if enabled libfaac; then
1493
    save_flags
1494
    temp_extralibs -lfaac
1495
    check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1496
#include <stdint.h>
1497
#include <faac.h>
1498
int main(){
1499
    char *id, *cpr;
1500
    faacEncGetVersion(&id, &cpr);
1501
    return 0;
1502
}
1503
EOF
1504
    restore_flags
1505
fi
1506

  
1507
# Ugh, recent faad2 versions have renamed all functions and #define the
1508
# old names in faad.h.  Generic tests won't work.
1509
if enabled libfaad; then
1510
    save_flags
1511
    temp_extralibs -lfaad
1512
    check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1513
#include <faad.h>
1514
int main(){
1515
    faacDecOpen();
1516
    return 0;
1517
}
1518
EOF
1519
    restore_flags
1520
fi
1521

  
1522
# Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1523
if enabled avisynth; then
1524
    save_flags
1525
    temp_extralibs -lvfw32
1526
    check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1527
#include <windows.h>
1528
#include <vfw.h>
1529
int main(){
1530
    AVIFileInit();
1531
    return 0;
1532
}
1533
EOF
1534
    restore_flags
1535
fi
1536

  
1529
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1530
enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
1531
enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1537 1532

  
1538 1533
# test for lrintf in math.h
1539 1534
check_exec <<EOF && lrintf=yes || lrintf=no

Also available in: Unified diff