[v4l2videodecoder] Post message for number of buffers
[platform/upstream/gst-plugins-good.git] / m4 / a52.m4
1 dnl
2 dnl A52_CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
3 dnl                     ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
4 dnl                     EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
5 dnl
6 dnl FEATURE-NAME        - feature name; library and header files are treated
7 dnl                       as feature, which we look for
8 dnl LIB-NAME            - library name as in AC_CHECK_LIB macro
9 dnl LIB-FUNCTION        - library symbol as in AC_CHECK_LIB macro
10 dnl HEADER-NAME         - header file name as in AC_CHECK_HEADER
11 dnl ACTION-IF-FOUND     - when feature is found then execute given action
12 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
13 dnl EXTRA-LDFLAGS       - extra linker flags (-L or -l)
14 dnl EXTRA-CPPFLAGS      - extra C preprocessor flags, i.e. -I/usr/X11R6/include
15 dnl
16 dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
17 dnl
18 AC_DEFUN([A52_CHECK_LIBHEADER],
19 [
20   AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
21   check_libheader_feature_name=translit([$1], A-Z, a-z)
22
23   if test "x$HAVE_[$1]" = "xyes"; then
24     check_libheader_save_CPPFLAGS=$CPPFLAGS
25     CPPFLAGS="[$8] $CPPFLAGS"
26     AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
27     CPPFLAGS=$check_libheader_save_CPPFLAGS
28   fi
29
30   if test "x$HAVE_[$1]" = "xyes"; then
31     ifelse([$5], , :, [$5])
32   else
33     ifelse([$6], , :, [$6])
34   fi
35 ]
36 )
37
38 dnl
39 dnl AC_CHECK_A52DEC(ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
40 dnl
41 dnl ACTION-IF-FOUND     - when feature is found then execute given action
42 dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
43 dnl
44 dnl Defines HAVE_A52DEC to yes if liba52 is found
45 dnl
46 dnl CFLAGS and LDFLAGS for the library are stored in A52DEC_CFLAGS and
47 dnl A52DEC_LIBS, respectively
48 dnl
49 dnl Based on GST_CHECK_A52DEC from gstreamer plugins 0.3.3.1
50 dnl Thomas Vander Stichele <thomas@apestaart.org>, Andy Wingo <wingo@pobox.com>
51 dnl
52 AC_DEFUN([AC_CHECK_A52DEC], 
53 [dnl
54 AC_ARG_WITH(a52dec-prefix,
55     AC_HELP_STRING([--with-a52dec-prefix=PFX],
56                    [prefix where a52dec is installed (optional)]),
57     a52dec_config_prefix="$withval", a52dec_config_prefix="")
58
59 if test x$a52dec_config_prefix = x ; then
60     A52_CHECK_LIBHEADER(A52DEC, a52, a52_init, a52dec/a52.h,
61         A52DEC_LIBS="-la52 -lm", , -lm)
62 else
63     A52_CHECK_LIBHEADER(A52DEC, a52, a52_init, a52dec/a52.h, [
64             A52DEC_LIBS="-la52 -L$a52dec_config_prefix/lib -lm"
65             A52DEC_CFLAGS="-I$a52dec_config_prefix/include"
66         ], , -L$a52dec_config_prefix/lib, -I$a52dec_config_prefix/include)
67 fi
68
69 if test $HAVE_A52DEC = "yes"; then
70     ac_save_CFLAGS="$CFLAGS"
71     ac_save_LIBS="$LIBS"
72     CFLAGS="$CFLAGS $A52DEC_CFLAGS"
73     LIBS="$A52DEC_LIBS $LIBS"
74     AC_TRY_RUN([
75 #include <inttypes.h>
76 #include <a52dec/a52.h>
77
78 int 
79 main ()
80 {
81   a52_state_t *state;
82   state = a52_init (0);
83   a52_free (state);
84   return 0;
85 }
86         ],, HAVE_A52DEC=no, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
87
88     if test HAVE_A52DEC = "no"; then
89         echo "*** Your a52dec is borked somehow. Please update to 0.7.4."
90     else
91         AC_TRY_RUN([
92 #include <inttypes.h>
93 #include <a52dec/a52.h>
94
95 int 
96 main ()
97 {
98   int i = sizeof (a52_state_t);
99   if ( i )
100     return 0;
101 }
102             ], HAVE_A52DEC=no,, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
103
104         if test HAVE_A52DEC = "no"; then
105             echo "*** Your a52dec is too old. Please update to 0.7.4."
106         fi
107     fi
108     CFLAGS="$ac_save_CFLAGS"
109     LIBS="$ac_save_LIBS"
110 fi
111
112 if test HAVE_A52DEC = "no"; then
113     A52DEC_CFLAGS=""
114     A52DEC_LIBS=""
115 fi
116
117 if test "x$HAVE_A52DEC" = "xyes"; then
118   ifelse([$1], , :, [$1])
119 else
120   ifelse([$2], , :, [$2])
121 fi
122
123 AC_SUBST(A52DEC_CFLAGS)
124 AC_SUBST(A52DEC_LIBS)
125 ])