python an optional dependency
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ(2.60)
2 dnl initialize autoconf
3 dnl when going to/from release please set the nano (fourth number) right !
4 dnl releases only do Wall, cvs and prerelease does Werror too
5 AC_INIT(Gst-RTSP, 0.10.7.1,
6     http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
7     gst-rtsp)
8 AG_GST_INIT
9
10 dnl initialize automake
11 AM_INIT_AUTOMAKE([-Wno-portability 1.10])
12
13 dnl define PACKAGE_VERSION_* variables
14 AS_VERSION
15
16 dnl check if this is a release version
17 AS_NANO(GST_GIT="no", GST_GIT="yes")
18
19 dnl can autoconf find the source ?
20 AC_CONFIG_SRCDIR([gst/rtsp-server/rtsp-server.c])
21
22 dnl define the output header for config
23 AM_CONFIG_HEADER([config.h])
24
25 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
26 AM_MAINTAINER_MODE
27
28 dnl sets host_* variables
29 AC_CANONICAL_HOST
30
31 dnl use pretty build output with automake >= 1.11
32 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
33   [AM_DEFAULT_VERBOSITY=1
34    AC_SUBST(AM_DEFAULT_VERBOSITY)])
35
36 dnl our libraries and install dirs use major.minor as a version
37 GST_MAJORMINOR=$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR
38 dnl we override it here if we need to for the release candidate of new series
39 GST_MAJORMINOR=0.10
40 AC_SUBST(GST_MAJORMINOR)
41
42 AM_PROG_LIBTOOL
43
44 dnl *** required versions of GStreamer stuff ***
45 GST_REQ=0.10.29
46 GSTPB_REQ=0.10.29
47
48 dnl *** autotools stuff ****
49
50 dnl allow for different autotools
51 AS_AUTOTOOLS_ALTERNATE
52
53 dnl Add parameters for aclocal
54 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
55
56 dnl set up gettext
57 dnl the version check needs to stay here because autopoint greps for it
58 AM_GNU_GETTEXT_VERSION([0.17])
59 AM_GNU_GETTEXT([external])
60 AG_GST_GETTEXT([gstreamer-$GST_MAJORMINOR])
61
62 dnl *** check for arguments to configure ***
63
64 AG_GST_ARG_DEBUG
65 AG_GST_ARG_VALGRIND
66 AG_GST_ARG_GCOV
67 AG_GST_ARG_WITH_PACKAGE_NAME
68 AG_GST_ARG_WITH_PACKAGE_ORIGIN
69
70 dnl *** checks for platform ***
71
72 dnl * hardware/architecture *
73
74 dnl *** checks for programs ***
75
76 dnl find a compiler
77 AC_PROG_CC
78 AM_PROG_CC_C_O
79
80 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
81 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
82
83 dnl check for gobject-introspection
84 GOBJECT_INTROSPECTION_CHECK([0.6.3])
85
86 dnl check for documentation tools
87 AG_GST_DOCBOOK_CHECK
88 GTK_DOC_CHECK([1.3])
89
90 dnl check for python
91 AM_PATH_PYTHON
92 AC_MSG_CHECKING(for python >= 2.3)
93 prog="
94 import sys, string
95 minver = (2,3,0,'final',0)
96 if sys.version_info < minver:
97   sys.exit(1)
98 sys.exit(0)"
99
100 if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
101 then
102   HAVE_PYTHON=yes
103   AC_MSG_RESULT(okay)
104 else
105   HAVE_PYTHON=no
106   AC_MSG_RESULT(no python)
107 fi
108
109 AM_CHECK_PYTHON_HEADERS([HAVE_PYTHON_HEADERS=yes],[HAVE_PYTHON_HEADERS=no])
110
111 dnl check for pygobject (optional, used in the bindings)
112 PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= $PYGOBJECT_REQ,
113   [HAVE_PYGOBJECT="yes"], [HAVE_PYGOBJECT="no"])
114 AC_SUBST(PYGOBJECT_CFLAGS)
115 AC_SUBST(PYGOBJECT_REQ, 2.11.2)
116
117 dnl check for gst-python
118 PKG_CHECK_MODULES(PYGST, gst-python-0.10,
119   [HAVE_PYGST="yes"], [HAVE_PYGST="no"])
120
121 if test "x$HAVE_PYGST" = "xyes"; then
122   PYGST_DEFSDIR=`pkg-config gst-python-0.10 --variable=defsdir`
123 fi
124 AC_SUBST(PYGST_DEFSDIR, $PYGST_DEFSDIR)
125
126 if test \
127     "x$HAVE_PYTHON" = "xyes" -a \
128     "x$HAVE_PYTHON_HEADERS" = "xyes" -a \
129     "x$HAVE_PYGOBJECT" = "xyes" -a \
130     "x$HAVE_PYGST" = "xyes"; then
131   HAVE_PYTHON_BINDINGS="yes"
132 else
133   HAVE_PYTHON_BINDINGS="no"
134 fi
135
136 AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYTHON_BINDINGS" = "xyes"])
137
138 dnl Check for Vala
139 AC_ARG_ENABLE([vala],
140   AC_HELP_STRING([--enable-vala],[enable Vala bindings (default=yes)]),
141   [case "${enableval}" in
142     yes) enable_vala=yes ;;
143     no)  enable_vala=no ;;
144     *) AC_MSG_ERROR(bad value ${enableval} for --enable-vala) ;;
145    esac
146   ],
147   [enable_vala=yes]) dnl Default value
148 AM_CONDITIONAL(WITH_VALA, [test "x$enable_vala" = "xyes"])
149
150 dnl *** checks for libraries ***
151
152 dnl *** checks for header files ***
153
154 dnl *** checks for types/defines ***
155
156 dnl *** checks for structures ***
157
158 dnl *** checks for compiler characteristics ***
159
160 dnl *** checks for library functions ***
161
162 dnl *** checks for dependancy libraries ***
163
164 dnl GLib is required (GStreamer is ok with GLib-2.8, but we want at least 2.10)
165 GLIB_REQ=2.10.0
166 AC_SUBST([GLIB_REQ])
167 AG_GST_GLIB_CHECK([$GLIB_REQ])
168
169 dnl checks for gstreamer
170 dnl uninstalled is selected preferentially -- see pkg-config(1)
171 AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ], [yes])
172
173 GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-$GST_MAJORMINOR`
174 if test -z $GST_TOOLS_DIR; then
175   AC_MSG_ERROR([no tools dir defined in GStreamer pkg-config file; core upgrade needed.])
176 fi
177 AC_SUBST(GST_TOOLS_DIR)
178
179 GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_MAJORMINOR --variable pluginsdir`
180 AC_SUBST(GST_PLUGINS_DIR)
181 AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
182
183 AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQ], [yes])
184
185 AG_GST_CHECK_GST_PLUGINS_BASE($GST_MAJORMINOR, [$GSTPB_REQ], [yes])
186 GSTPB_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-base-$GST_MAJORMINOR --variable pluginsdir`
187 AC_SUBST(GSTPB_PLUGINS_DIR)
188 AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
189
190 AG_GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQ], no)
191
192 dnl FIXME: get rid of this by making sure gstreamer-check brings it in
193 dnl check for "check", unit testing library/header
194 AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
195 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
196
197 dnl *** set variables based on configure arguments ***
198
199 dnl set license and copyright notice
200 GST_LICENSE="LGPL"
201 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
202 AC_SUBST(GST_LICENSE)
203
204 dnl set location of plugin directory
205 AG_GST_SET_PLUGINDIR
206
207 dnl define an ERROR_CFLAGS Makefile variable
208 AG_GST_SET_ERROR_CFLAGS($GST_GIT)
209
210 dnl define correct level for debugging messages
211 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
212
213 dnl used in examples
214 AG_GST_DEFAULT_ELEMENTS
215
216 dnl *** finalize CFLAGS, LDFLAGS, LIBS
217
218 dnl Overview:
219 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
220 dnl GST_*:              flags shared by built objects to link against GStreamer
221 dnl GST_ALL_LDFLAGS:    linker flags shared by all
222 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
223 dnl GST_LT_LDFLAGS:     library versioning of our libraries
224 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
225
226 dnl GST_OPTION_CFLAGS
227 if test "x$USE_DEBUG" = xyes; then
228    PROFILE_CFLAGS="-g"
229 fi
230 AC_SUBST(PROFILE_CFLAGS)
231
232 DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
233 AC_SUBST(DEPRECATED_CFLAGS)
234
235 dnl every flag in GST_OPTION_CFLAGS can be overridden at make time
236 GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
237 AC_SUBST(GST_OPTION_CFLAGS)
238
239 dnl FIXME: do we want to rename to GST_ALL_* ?
240 dnl prefer internal headers to already installed ones
241 dnl add GST_OPTION_CFLAGS, but overridable
242 GST_CFLAGS="$GST_CFLAGS \$(GST_OPTION_CFLAGS)"
243 AC_SUBST(GST_CFLAGS)
244 AC_SUBST(GST_LIBS)
245
246 dnl GST_ALL_*
247 dnl vars common to for all internal objects (core libs, elements, applications)
248 dnl CFLAGS:
249 dnl - src and build dirs need to be added because every piece that gets built
250 dnl   will need the GStreamer source and generated headers
251 GST_ALL_CFLAGS="-I\$(top_srcdir) -I\$(top_builddir) $GST_CFLAGS \$(GST_OPTION_CFLAGS)"
252 AC_SUBST([GST_ALL_CFLAGS])
253
254 dnl FIXME: check if LTLIBINTL is needed everywhere
255 dnl I presume it is given that it contains the symbols that _() stuff maps to
256 GST_ALL_LIBS="$GST_LIBS $LTLIBINTL \$(GCOV_LIBS)"
257 AC_SUBST([GST_ALL_LIBS])
258
259 dnl LDFLAGS really should only contain flags, not libs - they get added before
260 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
261 GST_ALL_LDFLAGS="-no-undefined"
262 AC_SUBST(GST_ALL_LDFLAGS)
263
264 dnl GST_OBJ_*
265 dnl default vars for all internal objects built on libgstphonon
266 dnl includes GST_ALL_*
267 GST_OBJ_CFLAGS="\$(GST_ALL_CFLAGS)"
268 AC_SUBST([GST_OBJ_CFLAGS])
269 GST_OBJ_LIBS="\$(top_builddir)/gst-phonon/libgstphonon.la \$(GST_ALL_LIBS)"
270 AC_SUBST([GST_OBJ_LIBS])
271
272 dnl this really should only contain flags, not libs - they get added before
273 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
274
275 dnl *** output files ***
276
277 dnl keep this alphabetic per directory, please
278 AC_CONFIG_FILES([
279 Makefile
280 gst-rtsp.spec
281 common/Makefile
282 common/m4/Makefile
283 m4/Makefile
284 gst/Makefile
285 gst/rtsp-server/Makefile
286 examples/Makefile
287 bindings/Makefile
288 bindings/python/Makefile
289 bindings/python/codegen/Makefile
290 bindings/vala/Makefile
291 pkgconfig/Makefile
292 pkgconfig/gst-rtsp-server.pc
293 pkgconfig/gst-rtsp-server-uninstalled.pc
294 docs/Makefile
295 docs/version.entities
296 docs/libs/Makefile
297 ])
298 AC_OUTPUT
299
300 echo "
301
302 Configuration
303         Version                    : ${VERSION}
304         Source code location       : ${srcdir}
305         Prefix                     : ${prefix}
306         Compiler                   : ${CC}
307         Vala bindings              : ${enable_vala}
308         Python bindings:           : ${HAVE_PYTHON_BINDINGS}
309
310 Gst-rtsp-server configured. Type 'make' to build.
311 "