summaryrefslogtreecommitdiff
path: root/multimedia/mediatomb/mediatomb-mp4v2-check.patch
blob: 226a22a63154f4030f2e7f25678f89c10abe28c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
commit bed8f03202336fc7863ec6a39e130473f59061c6
Author: Sergey 'Jin' Bostandzhyan <jin at mediatomb dot cc>
Date:   Sun Jan 27 23:08:04 2013 +0100

    Extra configure check for libmp4v2 compatibility
    
    We do not support the newer libmpv2 version yet, so don't error out when
    compiling, catch it in configure.

diff --git a/acinclude.m4 b/acinclude.m4
index f4962c6..3cc5ec3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -533,7 +533,8 @@ AC_DEFUN([MT_CHECK_OPTIONAL_PACKAGE],
         AC_MSG_ERROR([unable to configure $1 support])
     fi
 
-    if test "x$mt_[]translit($1, `/.-', `___')_status" = xyes; then
+    if ((test "x$mt_[]translit($1, `/.-', `___')_status" = xyes) &&
+        (test "x$9" != "xundef")); then
         AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
     fi
     
diff --git a/configure.ac b/configure.ac
index e72dd78..9241797 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1390,7 +1390,7 @@ LIBMP4V2_STATUS=
 
 MT_CHECK_OPTIONAL_PACKAGE([libmp4v2], [disable],
                  [libmp4v2 support for mp4 metadata extraction],
-                 [$MP4_HEADER], [mp4v2], [MP4Read]) 
+                 [$MP4_HEADER], [mp4v2], [MP4Read], [], [], [undef]) 
 
 if test "x$LIBMP4V2_STATUS" = xyes; then
    CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
@@ -1399,6 +1399,37 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
    AC_DEFINE_UNQUOTED([LIBMP4V2_INCLUDE], [<$MP4_HEADER.h>], [$MP4_HEADER.h])
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
+   AC_MSG_CHECKING([for libmp4v2 compatibility])
+   AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+            [
+                #include <$MP4_HEADER.h>
+            ],
+            [
+                (void)MP4GetMetadataName(0, 0);
+            ]
+        )],
+        [
+            AC_MSG_RESULT([yes])
+            AC_DEFINE([HAVE_LIBMP4V2], [1], [libmp4v2 library presence])
+        ],
+        [
+            AC_MSG_RESULT([not compatible])
+            if test "x$LIBMP4V2_OPTION_REQUESTED" = "xyes"; then
+                AC_MSG_ERROR([Unable to configure libmp4v2 support])
+            else
+                LIBMP4V2_STATUS="not compatible"
+            fi
+        ])
+    LDFLAGS="$LDFLAGS_SAVE"
+    CFLAGS="$CFLAGS_SAVE"
+    CXXFLAGS="$CXXFLAGS_SAVE"
+fi
+
+if test "x$LIBMP4V2_STATUS" = "xyes"; then
+   CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
+   CXXFLAGS="$CXXFLAGS $LIBMP4V2_CFLAGS"
+   LDFLAGS="$LDFLAGS $LIBMP4V2_LDFLAGS $LIBMP4V2_LIBS"
    AC_MSG_CHECKING([for MP4GetMetadataCoverArtCount() in libmp4v2])
    AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM(
@@ -1437,7 +1468,10 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
             AC_MSG_RESULT([no])
         ])
 
-   AC_LANG_RESTORE
+    AC_LANG_RESTORE
+    LDFLAGS="$LDFLAGS_SAVE"
+    CFLAGS="$CFLAGS_SAVE"
+    CXXFLAGS="$CXXFLAGS_SAVE"
 fi
 
 ########## INOTIFY TOOLS