Initial release
[adaptation/ap_samsung/gst-plugins-s5pc2xx.git] / common / m4 / gst-check.m4
1 dnl pkg-config-based checks for GStreamer modules and dependency modules
2
3 dnl generic:
4 dnl AG_GST_PKG_CHECK_MODULES([PREFIX], [WHICH], [REQUIRED])
5 dnl sets HAVE_[$PREFIX], [$PREFIX]_*
6 dnl AG_GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED])
7 dnl sets HAVE_[$PREFIX], [$PREFIX]_*
8
9 dnl specific:
10 dnl AG_GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED])
11 dnl   also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR
12 dnl AG_GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED])
13 dnl AG_GST_CHECK_GST_GDP([MAJMIN], [MINVER], [REQUIRED])
14 dnl AG_GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED])
15 dnl AG_GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED])
16 dnl AG_GST_CHECK_GST_PLUGINS_BASE([MAJMIN], [MINVER], [REQUIRED])
17 dnl   also sets/ACSUBSTs GSTPB_PLUGINS_DIR
18
19 AC_DEFUN([AG_GST_PKG_CHECK_MODULES],
20 [
21   which="[$2]"
22   dnl not required by default, since we use this mostly for plugin deps
23   required=ifelse([$3], , "no", [$3])
24
25   PKG_CHECK_MODULES([$1], $which,
26     [
27       HAVE_[$1]="yes"
28     ],
29     [
30       HAVE_[$1]="no"
31       AC_MSG_RESULT(no)
32       if test "x$required" = "xyes"; then
33         AC_MSG_ERROR($[$1]_PKG_ERRORS)
34       else
35         AC_MSG_NOTICE($[$1]_PKG_ERRORS)
36       fi
37     ])
38
39   dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
40   dnl It gets done automatically in automake >= 1.7, which we now require
41 ]))
42
43 AC_DEFUN([AG_GST_CHECK_MODULES],
44 [
45   module=[$2]
46   minver=[$3]
47   name="[$4]"
48   required=ifelse([$5], , "yes", [$5]) dnl required by default
49
50   PKG_CHECK_MODULES([$1], $module >= $minver,
51     [
52       HAVE_[$1]="yes"
53     ],
54     [
55       HAVE_[$1]="no"
56       AC_MSG_RESULT(no)
57       AC_MSG_NOTICE($[$1]_PKG_ERRORS)
58       if test "x$required" = "xyes"; then
59         AC_MSG_ERROR([no $module >= $minver ($name) found])
60       else
61         AC_MSG_NOTICE([no $module >= $minver ($name) found])
62       fi
63     ])
64
65   dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
66   dnl It gets done automatically in automake >= 1.7, which we now require
67 ]))
68
69 AC_DEFUN([AG_GST_CHECK_GST],
70 [
71   AG_GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3])
72   dnl allow setting before calling this macro to override
73   if test -z $GST_TOOLS_DIR; then
74     GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-[$1]`
75     if test -z $GST_TOOLS_DIR; then
76       AC_MSG_ERROR(
77         [no tools dir set in GStreamer pkg-config file, core upgrade needed.])
78     fi
79   fi
80   AC_MSG_NOTICE([using GStreamer tools in $GST_TOOLS_DIR])
81   AC_SUBST(GST_TOOLS_DIR)
82
83   dnl check for where core plug-ins got installed
84   dnl this is used for unit tests
85   dnl allow setting before calling this macro to override
86   if test -z $GST_PLUGINS_DIR; then
87     GST_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-[$1]`
88     if test -z $GST_PLUGINS_DIR; then
89       AC_MSG_ERROR(
90         [no pluginsdir set in GStreamer pkg-config file, core upgrade needed.])
91     fi
92   fi
93   AC_MSG_NOTICE([using GStreamer plug-ins in $GST_PLUGINS_DIR])
94   AC_SUBST(GST_PLUGINS_DIR)
95 ])
96
97 AC_DEFUN([AG_GST_CHECK_GST_BASE],
98 [
99   AG_GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2],
100     [GStreamer Base Libraries], [$3])
101 ])
102   
103 AC_DEFUN([AG_GST_CHECK_GST_GDP],
104 [
105   AG_GST_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-[$1], [$2],
106     [GStreamer Data Protocol Library], [$3])
107 ])
108   
109 AC_DEFUN([AG_GST_CHECK_GST_CONTROLLER],
110 [
111   AG_GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2],
112     [GStreamer Controller Library], [$3])
113 ])  
114
115 AC_DEFUN([AG_GST_CHECK_GST_CHECK],
116 [
117   AG_GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2],
118     [GStreamer Check unittest Library], [$3])
119 ])
120
121 AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BASE],
122 [
123   AG_GST_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-[$1], [$2],
124     [GStreamer Base Plug-ins Library], [$3])
125
126   dnl check for where base plug-ins got installed
127   dnl this is used for unit tests
128   dnl allow setting before calling this macro to override
129   if test -z $GSTPB_PLUGINS_DIR; then
130     GSTPB_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-base-[$1]`
131     if test -z $GSTPB_PLUGINS_DIR; then
132       AC_MSG_ERROR(
133         [no pluginsdir set in GStreamer Base Plug-ins pkg-config file])
134     fi
135   fi
136   AC_MSG_NOTICE([using GStreamer Base Plug-ins in $GSTPB_PLUGINS_DIR])
137   AC_SUBST(GSTPB_PLUGINS_DIR)
138 ])