| 1 |
## Copyright 2015 The gstreamermm Development Team |
| 2 |
## |
| 3 |
## This library is free software: you can redistribute it and/or modify it |
| 4 |
## under the terms of the GNU Lesser General Public License as published |
| 5 |
## by the Free Software Foundation, either version 2.1 of the License, |
| 6 |
## or (at your option) any later version. |
| 7 |
## |
| 8 |
## This library is distributed in the hope that it will be useful, |
| 9 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
## Lesser General Public License for more details. |
| 12 |
## |
| 13 |
## You should have received a copy of the GNU Lesser General Public License |
| 14 |
## along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
|
| 16 |
|
| 17 |
## Arguments: |
| 18 |
## * $1 - var_name (e.g. GSTREAMERMM_GL, GSTREAMERMM_NET) |
| 19 |
## * $2 - pkg-config module name sufix (e.g. gl, net) |
| 20 |
## * $3 - var_name (e.g. gl, plugins_bad) - can't contain underscores |
| 21 |
## * $4 - dependency conditions |
| 22 |
## Macro creates two variables: |
| 23 |
## * ENABLE_$1 - true, if module will be enabled, false otherwise |
| 24 |
## * gstmm_enable_$2 - "yes", if module will be enabled, "no" otherwise |
| 25 |
## Module $2 can be explicitly disabled, using --disable-$2 argument |
| 26 |
## in ./configure script. |
| 27 |
AC_DEFUN([FIND_GST_MODULE], |
| 28 |
[ |
| 29 |
PKG_CHECK_MODULES($1, gstreamer-[$2]-1.0 >= GSTREAMERMM_VERSION, |
| 30 |
[gstmm_enable_$3=yes], [gstmm_enable_$3=no]) |
| 31 |
|
| 32 |
AC_ARG_ENABLE($2, |
| 33 |
AS_HELP_STRING([--enable-$2], [Enable gstreamer-$2 library])) |
| 34 |
tst=x$4 |
| 35 |
if test $tst = "x"; then : |
| 36 |
tst=xyes |
| 37 |
fi |
| 38 |
|
| 39 |
gstmm_$3_version=$(pkg-config --modversion gstreamer-[$2]-1.0) |
| 40 |
AS_IF([test "x$enable_$3" != "xyes" || test "$tst" != xyes], [gstmm_enable_$3=no]) |
| 41 |
AM_CONDITIONAL([ENABLE_$1], [test "x$gstmm_enable_$3" = xyes]) |
| 42 |
AS_IF([test "x$gstmm_enable_$3" = xyes], [AC_DEFINE(ENABLE_$1, [], [Enable gstreamer-$2 module])]) |
| 43 |
]) |
| 44 |
|
| 45 |
## Arguments: |
| 46 |
## * $1 - modules name variable (e.g. GSTREAMERMM_PLUGINS_BAD_MODULES) |
| 47 |
## * $2 - module name (e.g. gstreamer-gl-1.0) |
| 48 |
## * $3 - conditional variable (must equals to yes) |
| 49 |
AC_DEFUN([ADD_MODULE_CONDITIONALLY], |
| 50 |
[ |
| 51 |
AS_IF([test x$3 = xyes], [ |
| 52 |
AC_SUBST([$1], ["$$1 $2"]) |
| 53 |
]) |
| 54 |
]) |
| 55 |
|
| 56 |
## Arguments: |
| 57 |
## * $1 - output file |
| 58 |
## * $2 - plugins list |
| 59 |
## Generates list of plug-ins. If USE_MAINTAINER_MODE defined, macro also |
| 60 |
## checks for the existence of the plug-ins. Note that this check doesn't |
| 61 |
## work when cross-compiling. That isn't much of a problem though since |
| 62 |
## it only applies in maintainer-mode. |
| 63 |
AC_DEFUN([GENERATE_PLUGINS_LIST_FILE], |
| 64 |
[ |
| 65 |
# clear plugins file once per file |
| 66 |
m4_ifndef([$1], [ |
| 67 |
printf "plugins_hg = \n" > $1 |
| 68 |
m4_define([$1], [yes]) |
| 69 |
]) |
| 70 |
|
| 71 |
printf "plugins_hg += " >> $1 |
| 72 |
|
| 73 |
AS_IF([test "x$USE_MAINTAINER_MODE" != xno], |
| 74 |
[ |
| 75 |
gstmm_toolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-1.0 2>&AS_MESSAGE_LOG_FD` |
| 76 |
AC_PATH_PROGS([GST_INSPECT], [gst-inspect-1.0],, |
| 77 |
[$gstmm_toolsdir$PATH_SEPARATOR$PATH]) |
| 78 |
|
| 79 |
AC_MSG_CHECKING([the existance of required plug-ins.]) |
| 80 |
]) |
| 81 |
for gstmm_plugin_def in $2 |
| 82 |
do |
| 83 |
gstmm_hg_name=`[expr "X$gstmm_plugin_def" : 'X\(.*\)|.*|.*$' 2>&]AS_MESSAGE_LOG_FD` |
| 84 |
printf "$gstmm_hg_name.hg " >> $1 |
| 85 |
AS_IF([test "x$USE_MAINTAINER_MODE" != xno], |
| 86 |
[ |
| 87 |
# Extract plugin name and run gst-inspect to check whether the plugin |
| 88 |
# is installed on the build system. |
| 89 |
gstmm_plugin_name=`[expr "X$gstmm_plugin_def" : 'X.*|\(.*\)|.*$' 2>&]AS_MESSAGE_LOG_FD` |
| 90 |
AS_IF([$GST_INSPECT "$gstmm_plugin_name" >/dev/null 2>&AS_MESSAGE_LOG_FD],, |
| 91 |
[AC_MSG_FAILURE([[The gstreamer plug-in '$gstmm_plugin_name' does not exist. |
| 92 |
If you built gst-plugins-base from source code then you might need to |
| 93 |
install the appropriate -dev or -devel packages or enable experimental |
| 94 |
plugins before rebuilding gst-plugins-base.]])]) |
| 95 |
]) |
| 96 |
done |
| 97 |
AS_IF([test "x$USE_MAINTAINER_MODE" != xno], |
| 98 |
[ |
| 99 |
AC_MSG_RESULT([All required plug-ins found.]) |
| 100 |
]) |
| 101 |
printf "\n" >> $1 |
| 102 |
]) |
| 103 |
|