~ubuntu-branches/debian/sid/transmageddon/sid

« back to all changes in this revision

Viewing changes to common/m4/gst-args.m4

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-10-14 08:28:43 UTC
  • Revision ID: james.westby@ubuntu.com-20091014082843-uxbyrcqydc13zrim
Tags: upstream-0.14
ImportĀ upstreamĀ versionĀ 0.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl configure-time options shared among gstreamer modules
 
2
 
 
3
dnl AG_GST_ARG_DEBUG
 
4
dnl AG_GST_ARG_PROFILING
 
5
dnl AG_GST_ARG_VALGRIND
 
6
dnl AG_GST_ARG_GCOV
 
7
 
 
8
dnl AG_GST_ARG_EXAMPLES
 
9
 
 
10
dnl AG_GST_ARG_WITH_PKG_CONFIG_PATH
 
11
dnl AG_GST_ARG_WITH_PACKAGE_NAME
 
12
dnl AG_GST_ARG_WITH_PACKAGE_ORIGIN
 
13
 
 
14
dnl AG_GST_ARG_WITH_PLUGINS
 
15
dnl AG_GST_CHECK_PLUGIN
 
16
dnl AG_GST_DISABLE_PLUGIN
 
17
 
 
18
dnl AG_GST_ARG_ENABLE_EXTERNAL
 
19
dnl AG_GST_ARG_ENABLE_EXPERIMENTAL
 
20
dnl AG_GST_ARG_ENABLE_BROKEN
 
21
 
 
22
AC_DEFUN([AG_GST_ARG_DEBUG],
 
23
[
 
24
  dnl debugging stuff
 
25
  AC_ARG_ENABLE(debug,
 
26
    AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]),
 
27
    [
 
28
      case "${enableval}" in
 
29
        yes) USE_DEBUG=yes ;;
 
30
        no)  USE_DEBUG=no ;;
 
31
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
 
32
      esac
 
33
    ],
 
34
    [USE_DEBUG=yes]) dnl Default value
 
35
])
 
36
 
 
37
AC_DEFUN([AG_GST_ARG_PROFILING],
 
38
[
 
39
  AC_ARG_ENABLE(profiling,
 
40
    AC_HELP_STRING([--enable-profiling],
 
41
      [adds -pg to compiler commandline, for profiling]),
 
42
    [
 
43
      case "${enableval}" in
 
44
        yes) USE_PROFILING=yes ;;
 
45
        no)  USE_PROFILING=no ;;
 
46
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
 
47
      esac
 
48
    ], 
 
49
    [USE_PROFILING=no]) dnl Default value
 
50
])
 
51
 
 
52
AC_DEFUN([AG_GST_ARG_VALGRIND],
 
53
[
 
54
  dnl valgrind inclusion
 
55
  AC_ARG_ENABLE(valgrind,
 
56
    AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]),
 
57
    [
 
58
      case "${enableval}" in
 
59
        yes) USE_VALGRIND="$USE_DEBUG" ;;
 
60
        no)  USE_VALGRIND=no ;;
 
61
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
 
62
      esac
 
63
    ],
 
64
    [USE_VALGRIND="$USE_DEBUG"]) dnl Default value
 
65
  VALGRIND_REQ="3.0"
 
66
  if test "x$USE_VALGRIND" = xyes; then
 
67
    PKG_CHECK_MODULES(VALGRIND, valgrind >= $VALGRIND_REQ,
 
68
      USE_VALGRIND="yes",
 
69
      [
 
70
        USE_VALGRIND="no"
 
71
        AC_MSG_RESULT([no])
 
72
      ])
 
73
  fi
 
74
  if test "x$USE_VALGRIND" = xyes; then
 
75
    AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
 
76
    AC_MSG_NOTICE(Using extra code paths for valgrind)
 
77
  fi
 
78
])
 
79
 
 
80
AC_DEFUN([AG_GST_ARG_GCOV],
 
81
[
 
82
  AC_ARG_ENABLE(gcov,
 
83
    AC_HELP_STRING([--enable-gcov],
 
84
      [compile with coverage profiling instrumentation (gcc only)]),
 
85
    enable_gcov=$enableval,
 
86
    enable_gcov=no)
 
87
  if test x$enable_gcov = xyes ; then
 
88
    if test "x$GCC" != "xyes"
 
89
    then
 
90
      AC_MSG_ERROR([gcov only works if gcc is used])
 
91
    fi
 
92
 
 
93
    AS_COMPILER_FLAG(["-fprofile-arcs"],
 
94
      [GCOV_CFLAGS="$GCOV_CFLAGS -fprofile-arcs"],
 
95
      true)
 
96
    AS_COMPILER_FLAG(["-ftest-coverage"],
 
97
      [GCOV_CFLAGS="$GCOV_CFLAGS -ftest-coverage"],
 
98
      true)
 
99
    dnl remove any -O flags - FIXME: is this needed ?
 
100
    GCOV_CFLAGS=`echo "$GCOV_CFLAGS" | sed -e 's/-O[[0-9]]*//g'`
 
101
    dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags
 
102
    dnl passed to the linker, which is a bug; -fprofile-arcs implicitly
 
103
    dnl links in -lgcov, so we do it explicitly here for the same effect
 
104
    GCOV_LIBS=-lgcov
 
105
    AC_SUBST(GCOV_CFLAGS)
 
106
    AC_SUBST(GCOV_LIBS)
 
107
    GCOV=`echo $CC | sed s/gcc/gcov/g`
 
108
    AC_SUBST(GCOV)
 
109
 
 
110
    GST_GCOV_ENABLED=yes
 
111
    AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1,
 
112
      [Defined if gcov is enabled to force a rebuild due to config.h changing])
 
113
    dnl if gcov is used, we do not want default -O2 CFLAGS
 
114
    if test "x$GST_GCOV_ENABLED" = "xyes"
 
115
    then
 
116
      CFLAGS="-O0"
 
117
      AC_SUBST(CFLAGS)
 
118
      CXXFLAGS="-O0"
 
119
      AC_SUBST(CXXFLAGS)
 
120
      FFLAGS="-O0"
 
121
      AC_SUBST(FFLAGS)
 
122
      CCASFLAGS="-O0"
 
123
      AC_SUBST(CCASFLAGS)
 
124
      AC_MSG_NOTICE([gcov enabled, setting CFLAGS and friends to $CFLAGS])
 
125
    fi
 
126
  fi
 
127
  AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes)
 
128
])
 
129
 
 
130
AC_DEFUN([AG_GST_ARG_EXAMPLES],
 
131
[
 
132
  AC_ARG_ENABLE(examples,
 
133
    AC_HELP_STRING([--disable-examples], [disable building examples]),
 
134
      [
 
135
        case "${enableval}" in
 
136
          yes) BUILD_EXAMPLES=yes ;;
 
137
          no)  BUILD_EXAMPLES=no ;;
 
138
          *)   AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
 
139
        esac
 
140
      ],
 
141
      [BUILD_EXAMPLES=yes]) dnl Default value
 
142
  AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
 
143
])
 
144
 
 
145
AC_DEFUN([AG_GST_ARG_WITH_PKG_CONFIG_PATH],
 
146
[
 
147
  dnl possibly modify pkg-config path
 
148
  AC_ARG_WITH(pkg-config-path, 
 
149
     AC_HELP_STRING([--with-pkg-config-path],
 
150
                    [colon-separated list of pkg-config(1) dirs]),
 
151
     [
 
152
       export PKG_CONFIG_PATH=${withval}
 
153
       AC_MSG_NOTICE(Set PKG_CONFIG_PATH to $PKG_CONFIG_PATH)
 
154
     ])
 
155
])
 
156
 
 
157
 
 
158
dnl This macro requires that GST_CVS is set to yes or no (release)
 
159
AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_NAME],
 
160
[
 
161
  dnl package name in plugins
 
162
  AC_ARG_WITH(package-name,
 
163
    AC_HELP_STRING([--with-package-name],
 
164
      [specify package name to use in plugins]),
 
165
    [
 
166
      case "${withval}" in
 
167
        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
 
168
        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
 
169
        *)   GST_PACKAGE_NAME="${withval}" ;;
 
170
      esac
 
171
    ], 
 
172
    [
 
173
      P=$1
 
174
      if test "x$P" = "x"
 
175
      then
 
176
        P=$PACKAGE_NAME
 
177
      fi
 
178
      
 
179
      dnl default value
 
180
      if test "x$GST_CVS" = "xyes"
 
181
      then
 
182
        dnl nano >= 1
 
183
        GST_PACKAGE_NAME="$P CVS/prerelease"
 
184
      else
 
185
        GST_PACKAGE_NAME="$P source release"
 
186
      fi
 
187
    ]
 
188
  )
 
189
  AC_MSG_NOTICE(Using $GST_PACKAGE_NAME as package name)
 
190
  AC_DEFINE_UNQUOTED(GST_PACKAGE_NAME, "$GST_PACKAGE_NAME",
 
191
      [package name in plugins])
 
192
  AC_SUBST(GST_PACKAGE_NAME)
 
193
])
 
194
 
 
195
AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_ORIGIN],
 
196
[
 
197
  dnl package origin URL
 
198
  AC_ARG_WITH(package-origin,
 
199
    AC_HELP_STRING([--with-package-origin],
 
200
      [specify package origin URL to use in plugins]),
 
201
    [
 
202
      case "${withval}" in
 
203
        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
 
204
        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
 
205
        *)   GST_PACKAGE_ORIGIN="${withval}" ;;
 
206
      esac
 
207
    ], 
 
208
    [GST_PACKAGE_ORIGIN="[Unknown package origin]"] dnl Default value
 
209
  )
 
210
  AC_MSG_NOTICE(Using $GST_PACKAGE_ORIGIN as package origin)
 
211
  AC_DEFINE_UNQUOTED(GST_PACKAGE_ORIGIN, "$GST_PACKAGE_ORIGIN",
 
212
      [package origin])
 
213
  AC_SUBST(GST_PACKAGE_ORIGIN)
 
214
])
 
215
 
 
216
dnl sets WITH_PLUGINS to the list of plug-ins given as an argument
 
217
dnl also clears GST_PLUGINS_ALL and GST_PLUGINS_SELECTED
 
218
AC_DEFUN([AG_GST_ARG_WITH_PLUGINS],
 
219
[
 
220
  AC_ARG_WITH(plugins,
 
221
    AC_HELP_STRING([--with-plugins],
 
222
      [comma-separated list of dependencyless plug-ins to compile]),
 
223
    [WITH_PLUGINS=$withval],
 
224
    [WITH_PLUGINS=])
 
225
 
 
226
  GST_PLUGINS_ALL=""
 
227
  GST_PLUGINS_SELECTED=""
 
228
 
 
229
  AC_SUBST(GST_PLUGINS_ALL)
 
230
  AC_SUBST(GST_PLUGINS_SELECTED)
 
231
])
 
232
 
 
233
dnl AG_GST_CHECK_PLUGIN(PLUGIN-NAME)
 
234
dnl
 
235
dnl This macro adds the plug-in <PLUGIN-NAME> to GST_PLUGINS_ALL. Then it
 
236
dnl checks if WITH_PLUGINS is empty or the plugin is present in WITH_PLUGINS,
 
237
dnl and if so adds it to GST_PLUGINS_SELECTED. Then it checks if the plugin
 
238
dnl is present in WITHOUT_PLUGINS (ie. was disabled specifically) and if so
 
239
dnl removes it from GST_PLUGINS_SELECTED.
 
240
dnl
 
241
dnl The macro will call AM_CONDITIONAL(USE_PLUGIN_<PLUGIN-NAME>, ...) to allow
 
242
dnl control of what is built in Makefile.ams.
 
243
AC_DEFUN([AG_GST_CHECK_PLUGIN],
 
244
[
 
245
  GST_PLUGINS_ALL="$GST_PLUGINS_ALL [$1]"
 
246
 
 
247
  define([pname_def],translit([$1], -a-z, _a-z))
 
248
 
 
249
  AC_ARG_ENABLE([$1],
 
250
    AC_HELP_STRING([--disable-[$1]], [disable dependency-less $1 plugin]),
 
251
    [
 
252
      case "${enableval}" in
 
253
        yes) [gst_use_]pname_def=yes ;;
 
254
        no) [gst_use_]pname_def=no ;;
 
255
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;;
 
256
       esac
 
257
    ],
 
258
    [[gst_use_]pname_def=yes]) dnl Default value
 
259
 
 
260
  if test x$[gst_use_]pname_def = xno; then
 
261
    AC_MSG_NOTICE(disabling dependency-less plugin $1)
 
262
    WITHOUT_PLUGINS="$WITHOUT_PLUGINS [$1]"
 
263
  fi
 
264
  undefine([pname_def])
 
265
 
 
266
  if [[ -z "$WITH_PLUGINS" ]] || echo " [$WITH_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
 
267
    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED [$1]"
 
268
  fi
 
269
  if echo " [$WITHOUT_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
 
270
    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
 
271
  fi  
 
272
  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), echo " $GST_PLUGINS_SELECTED " | grep -i " [$1] " > /dev/null)
 
273
])
 
274
 
 
275
dnl AG_GST_DISABLE_PLUGIN(PLUGIN-NAME)
 
276
dnl
 
277
dnl This macro disables the plug-in <PLUGIN-NAME> by removing it from
 
278
dnl GST_PLUGINS_SELECTED.
 
279
AC_DEFUN([AG_GST_DISABLE_PLUGIN],
 
280
[
 
281
  GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
 
282
  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), false)
 
283
])
 
284
 
 
285
AC_DEFUN([AG_GST_ARG_ENABLE_EXTERNAL],
 
286
[
 
287
  AG_GST_CHECK_FEATURE(EXTERNAL, [building of plug-ins with external deps],,
 
288
    HAVE_EXTERNAL=yes, enabled,
 
289
    [
 
290
      AC_MSG_NOTICE(building external plug-ins)
 
291
      BUILD_EXTERNAL="yes"
 
292
    ],[
 
293
      AC_MSG_WARN(all plug-ins with external dependencies will not be built)
 
294
      BUILD_EXTERNAL="no"
 
295
    ])
 
296
  # make BUILD_EXTERNAL available to Makefile.am
 
297
  AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
 
298
])
 
299
 
 
300
dnl experimental plug-ins; stuff that hasn't had the dust settle yet
 
301
dnl read 'builds, but might not work'
 
302
AC_DEFUN([AG_GST_ARG_ENABLE_EXPERIMENTAL],
 
303
[
 
304
  AG_GST_CHECK_FEATURE(EXPERIMENTAL, [building of experimental plug-ins],,
 
305
    HAVE_EXPERIMENTAL=yes, disabled,
 
306
    [
 
307
      AC_MSG_WARN(building experimental plug-ins)
 
308
      BUILD_EXPERIMENTAL="yes"
 
309
    ],[
 
310
      AC_MSG_NOTICE(not building experimental plug-ins)
 
311
      BUILD_EXPERIMENTAL="no"
 
312
    ])
 
313
  # make BUILD_EXPERIMENTAL available to Makefile.am
 
314
  AM_CONDITIONAL(BUILD_EXPERIMENTAL, test "x$BUILD_EXPERIMENTAL" = "xyes")
 
315
])
 
316
 
 
317
dnl broken plug-ins; stuff that doesn't seem to build at the moment
 
318
AC_DEFUN([AG_GST_ARG_ENABLE_BROKEN],
 
319
[
 
320
  AG_GST_CHECK_FEATURE(BROKEN, [building of broken plug-ins],,
 
321
    HAVE_BROKEN=yes, disabled,
 
322
    [
 
323
      AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches ...])
 
324
    ],[
 
325
      AC_MSG_NOTICE([not building broken plug-ins])
 
326
    ])
 
327
])