Browse code

configure: fail if autodetect-libraries are requested but not found

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>

Andreas Cadhalpun authored on 2016/12/01 07:50:17
Showing 2 changed files
... ...
@@ -7,6 +7,7 @@ version <next>:
7 7
 - Pro-MPEG CoP #3-R2 FEC protocol
8 8
 - premultiply video filter
9 9
 - Support for spherical videos
10
+- configure now fails if autodetect-libraries are requested but not found
10 11
 
11 12
 version 3.2:
12 13
 - libopenmpt demuxer
... ...
@@ -597,6 +597,13 @@ popvar(){
597 597
     done
598 598
 }
599 599
 
600
+request(){
601
+    for var in $*; do
602
+        eval ${var}_requested=yes
603
+        eval $var=
604
+    done
605
+}
606
+
600 607
 enable(){
601 608
     set_all yes $*
602 609
 }
... ...
@@ -653,6 +660,11 @@ enable_deep_weak(){
653 653
     done
654 654
 }
655 655
 
656
+requested(){
657
+    test "${1#!}" = "$1" && op='=' || op=!=
658
+    eval test "x\$${1#!}_requested" $op "xyes"
659
+}
660
+
656 661
 enabled(){
657 662
     test "${1#!}" = "$1" && op='=' || op=!=
658 663
     eval test "x\$${1#!}" $op "xyes"
... ...
@@ -724,9 +736,9 @@ do_check_deps(){
724 724
 
725 725
         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
726 726
         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
727
-        enabled_all  $dep_all || disable $cfg
728
-        enabled_any  $dep_any || disable $cfg
729
-        disabled_any $dep_sel && disable $cfg
727
+        enabled_all  $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
728
+        enabled_any  $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
729
+        disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
730 730
 
731 731
         if enabled $cfg; then
732 732
             enable_deep $dep_sel
... ...
@@ -1481,10 +1493,25 @@ EXAMPLE_LIST="
1481 1481
     transcode_aac_example
1482 1482
     transcoding_example
1483 1483
 "
1484
+EXTERNAL_AUTODETECT_LIBRARY_LIST="
1485
+    bzlib
1486
+    iconv
1487
+    libxcb
1488
+    libxcb_shm
1489
+    libxcb_shape
1490
+    libxcb_xfixes
1491
+    lzma
1492
+    schannel
1493
+    sdl
1494
+    sdl2
1495
+    securetransport
1496
+    xlib
1497
+    zlib
1498
+"
1484 1499
 
1485 1500
 EXTERNAL_LIBRARY_LIST="
1501
+    $EXTERNAL_AUTODETECT_LIBRARY_LIST
1486 1502
     avisynth
1487
-    bzlib
1488 1503
     chromaprint
1489 1504
     crystalhd
1490 1505
     decklink
... ...
@@ -1492,7 +1519,6 @@ EXTERNAL_LIBRARY_LIST="
1492 1492
     gcrypt
1493 1493
     gmp
1494 1494
     gnutls
1495
-    iconv
1496 1495
     jni
1497 1496
     ladspa
1498 1497
     libass
... ...
@@ -1545,42 +1571,26 @@ EXTERNAL_LIBRARY_LIST="
1545 1545
     libx264
1546 1546
     libx265
1547 1547
     libxavs
1548
-    libxcb
1549
-    libxcb_shm
1550
-    libxcb_shape
1551
-    libxcb_xfixes
1552 1548
     libxvid
1553 1549
     libzimg
1554 1550
     libzmq
1555 1551
     libzvbi
1556
-    lzma
1557 1552
     mediacodec
1558 1553
     netcdf
1559 1554
     openal
1560 1555
     opencl
1561 1556
     opengl
1562 1557
     openssl
1563
-    schannel
1564
-    sdl
1565
-    sdl2
1566
-    securetransport
1567 1558
     videotoolbox
1568 1559
     x11grab
1569
-    xlib
1570
-    zlib
1571 1560
 "
1572
-
1573
-HWACCEL_LIBRARY_LIST="
1561
+HWACCEL_AUTODETECT_LIBRARY_LIST="
1574 1562
     audiotoolbox
1575 1563
     cuda
1576 1564
     cuvid
1577 1565
     d3d11va
1578 1566
     dxva2
1579
-    libmfx
1580
-    libnpp
1581
-    mmal
1582 1567
     nvenc
1583
-    omx
1584 1568
     vaapi
1585 1569
     vda
1586 1570
     vdpau
... ...
@@ -1588,6 +1598,14 @@ HWACCEL_LIBRARY_LIST="
1588 1588
     xvmc
1589 1589
 "
1590 1590
 
1591
+HWACCEL_LIBRARY_LIST="
1592
+    $HWACCEL_AUTODETECT_LIBRARY_LIST
1593
+    libmfx
1594
+    libnpp
1595
+    mmal
1596
+    omx
1597
+"
1598
+
1591 1599
 DOCUMENT_LIST="
1592 1600
     doc
1593 1601
     htmlpages
... ...
@@ -1684,6 +1702,12 @@ ATOMICS_LIST="
1684 1684
     atomics_win32
1685 1685
 "
1686 1686
 
1687
+AUTODETECT_LIBS="
1688
+    $EXTERNAL_AUTODETECT_LIBRARY_LIST
1689
+    $HWACCEL_AUTODETECT_LIBRARY_LIST
1690
+    $THREADS_LIST
1691
+"
1692
+
1687 1693
 ARCH_LIST="
1688 1694
     aarch64
1689 1695
     alpha
... ...
@@ -3483,6 +3507,11 @@ for e in $env; do
3483 3483
     eval "export $e"
3484 3484
 done
3485 3485
 
3486
+# Mark specifically enabled, but normally autodetected libraries as requested.
3487
+for lib in $AUTODETECT_LIBS; do
3488
+    enabled $lib && request $lib
3489
+done
3490
+
3486 3491
 # Enable platform codecs by default.
3487 3492
 enable_weak audiotoolbox
3488 3493
 
... ...
@@ -6399,6 +6428,11 @@ if disabled stdatomic_h; then
6399 6399
     fi
6400 6400
 fi
6401 6401
 
6402
+# Check if requested libraries were found.
6403
+for lib in $AUTODETECT_LIBS; do
6404
+    requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
6405
+done
6406
+
6402 6407
 enabled zlib && add_cppflags -DZLIB_CONST
6403 6408
 
6404 6409
 # conditional library dependencies, in linking order