configure: Synchronise with the configure scripts of the other modules
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ(2.62)
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([GStreamer RTSP Server Library], [1.3.0.1],
6     [http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],
7     [gst-rtsp-server])
8 AG_GST_INIT
9
10 dnl initialize automake
11 AM_INIT_AUTOMAKE([-Wno-portability 1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])
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 AC_CONFIG_HEADERS([config.h])
24
25 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
26 AM_MAINTAINER_MODE([enable])
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 dnl GST_API_VERSION=$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_API_VERSION=1.0
40 AC_SUBST(GST_API_VERSION)
41
42 dnl CURRENT, REVISION, AGE
43 dnl - library source changed -> increment REVISION
44 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
45 dnl - interfaces added -> increment AGE
46 dnl - interfaces removed -> AGE = 0
47 dnl
48 dnl Keep CURRENT as MINOR * 100 + MICRO
49 dnl Ex : 1.0.0 => 0
50 dnl      1.0.3 => 3
51 dnl      1.1.0 => 100
52 dnl      1.2.5 => 205
53 dnl      1.10.9 (who knows) => 1009
54 dnl
55 dnl sets GST_LT_LDFLAGS
56 AS_LIBTOOL(GST, 300, 0, 300)
57
58 dnl *** required versions of GStreamer stuff ***
59 GST_REQ=1.3.0.1
60 GSTPB_REQ=1.3.0.1
61 GSTPG_REQ=1.3.0.1
62
63 dnl *** autotools stuff ****
64
65 dnl allow for different autotools
66 AS_AUTOTOOLS_ALTERNATE
67
68 dnl Add parameters for aclocal
69 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
70 AC_CONFIG_MACRO_DIR([m4])
71
72 dnl set up gettext
73 dnl the version check needs to stay here because autopoint greps for it
74 #AM_GNU_GETTEXT_VERSION([0.17])
75 #AM_GNU_GETTEXT([external])
76 #AG_GST_GETTEXT([gst-rtsp-server-$GST_API_VERSION])
77
78 dnl *** check for arguments to configure ***
79
80 AG_GST_ARG_DISABLE_FATAL_WARNINGS
81
82 AG_GST_ARG_DEBUG
83 AG_GST_ARG_VALGRIND
84 AG_GST_ARG_GCOV
85 AG_GST_ARG_WITH_PKG_CONFIG_PATH
86 AG_GST_ARG_WITH_PACKAGE_NAME
87 AG_GST_ARG_WITH_PACKAGE_ORIGIN
88
89 AG_GST_PKG_CONFIG_PATH
90
91 AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
92   ["${srcdir}/gst-rtsp-server.doap"],
93   [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
94
95 dnl building of tests
96 AC_ARG_ENABLE(tests,
97   AS_HELP_STRING([--disable-tests],[disable building test apps]),
98   [
99     case "${enableval}" in
100       yes) BUILD_TESTS=yes ;;
101       no)  BUILD_TESTS=no ;;
102       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
103     esac
104   ],
105 [BUILD_TESTS=yes]) dnl Default value
106 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
107
108 dnl *** checks for platform ***
109
110 dnl * hardware/architecture *
111
112 dnl *** checks for programs ***
113
114 dnl find a compiler
115 AC_PROG_CC
116 AC_PROG_CC_STDC
117
118 dnl check if the compiler supports '-c' and '-o' options
119 AM_PROG_CC_C_O
120
121 dnl find an assembler
122 AM_PROG_AS
123
124 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
125 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
126
127 dnl check for gobject-introspection
128 GOBJECT_INTROSPECTION_CHECK([1.31.1])
129
130 dnl check for documentation tools
131 AG_GST_DOCBOOK_CHECK
132 GTK_DOC_CHECK([1.12])
133
134 dnl *** checks for libraries ***
135
136 dnl *** checks for header files ***
137
138 dnl *** checks for types/defines ***
139
140 dnl *** checks for structures ***
141
142 dnl *** checks for compiler characteristics ***
143
144 dnl *** checks for library functions ***
145
146 dnl *** checks for dependancy libraries ***
147
148 dnl GLib is required
149 GLIB_REQ=2.32.0
150 AC_SUBST([GLIB_REQ])
151 AG_GST_GLIB_CHECK([$GLIB_REQ])
152
153 dnl checks for gstreamer
154 dnl uninstalled is selected preferentially -- see pkg-config(1)
155 AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ], [yes])
156
157 GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-$GST_API_VERSION`
158 if test -z $GST_TOOLS_DIR; then
159   AC_MSG_ERROR([no tools dir defined in GStreamer pkg-config file; core upgrade needed.])
160 fi
161 AC_SUBST(GST_TOOLS_DIR)
162
163 GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_API_VERSION --variable pluginsdir`
164 AC_SUBST(GST_PLUGINS_DIR)
165 AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
166
167 AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ], [yes])
168
169 AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ], [yes])
170 GSTPB_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-base-$GST_API_VERSION --variable pluginsdir`
171 AC_SUBST(GSTPB_PLUGINS_DIR)
172 AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
173
174 AG_GST_CHECK_GST_PLUGINS_GOOD($GST_API_VERSION, [$GSTPG_REQ], [yes])
175 GSTPG_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-good-$GST_API_VERSION --variable pluginsdir`
176 AC_SUBST(GSTPG_PLUGINS_DIR)
177 AC_MSG_NOTICE(Using GStreamer Good Plugins in $GSTPG_PLUGINS_DIR)
178
179 AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
180 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
181
182 dnl Check for -Bsymbolic-functions linker flag used to avoid
183 dnl intra-library PLT jumps, if available.
184 AC_ARG_ENABLE(Bsymbolic,
185               [AS_HELP_STRING([--disable-Bsymbolic],[avoid linking with -Bsymbolic])],,
186               [SAVED_LDFLAGS="${LDFLAGS}"
187                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
188                LDFLAGS=-Wl,-Bsymbolic-functions
189                AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int main (void) { return 0; }]])],[
190                            AC_MSG_RESULT(yes)
191                            enable_Bsymbolic=yes],[
192                            AC_MSG_RESULT(no)
193                            enable_Bsymbolic=no])
194                LDFLAGS="${SAVED_LDFLAGS}"])
195
196 dnl *** set variables based on configure arguments ***
197
198 dnl set license and copyright notice
199 GST_LICENSE="LGPL"
200 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
201 AC_SUBST(GST_LICENSE)
202
203 dnl set location of plugin directory
204 AG_GST_SET_PLUGINDIR
205
206 # set by AG_GST_PARSE_SUBSYSTEM_DISABLES above
207 dnl make sure it doesn't complain about unused variables if debugging is disabled
208 NO_WARNINGS=""
209 AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
210
211 dnl define an ERROR_CFLAGS Makefile variable
212 AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs $NO_WARNINGS])
213
214 dnl define correct level for debugging messages
215 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
216
217 dnl used in examples
218 AG_GST_DEFAULT_ELEMENTS
219
220 dnl *** finalize CFLAGS, LDFLAGS, LIBS
221
222 dnl Overview:
223 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
224 dnl GST_*:              flags shared by built objects to link against GStreamer
225 dnl GST_ALL_LDFLAGS:    linker flags shared by all
226 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
227 dnl GST_LT_LDFLAGS:     library versioning of our libraries
228 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
229
230 dnl GST_OPTION_CFLAGS
231 if test "x$USE_DEBUG" = xyes; then
232    PROFILE_CFLAGS="-g"
233 fi
234 AC_SUBST(PROFILE_CFLAGS)
235
236 # GST_DISABLE_DEPRECATED: hide the visibility of deprecated
237 # functionality from the API that gstreamer uses
238 # GST_REMOVE_DEPRECATED: don't compile deprecated functionality (breaks ABI)
239 if test "x$PACKAGE_VERSION_NANO" = "x1"; then
240   dnl Define _only_ when compiling from git (not for pre-releases or releases)
241   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
242 else
243   DEPRECATED_CFLAGS=""
244 fi
245 AC_SUBST(DEPRECATED_CFLAGS)
246
247 dnl every flag in GST_OPTION_CFLAGS can be overridden at make time
248 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
249 AC_SUBST(GST_OPTION_CFLAGS)
250
251 dnl FIXME: do we want to rename to GST_ALL_* ?
252 dnl prefer internal headers to already installed ones
253 dnl add GST_OPTION_CFLAGS, but overridable
254 GST_CFLAGS="$GST_CFLAGS \$(GST_OPTION_CFLAGS)"
255 AC_SUBST(GST_CFLAGS)
256 AC_SUBST(GST_LIBS)
257
258 dnl GST_ALL_*
259 dnl vars common to for all internal objects (core libs, elements, applications)
260 dnl CFLAGS:
261 dnl - src and build dirs need to be added because every piece that gets built
262 dnl   will need the GStreamer source and generated headers
263 GST_ALL_CFLAGS="-I\$(top_srcdir) -I\$(top_builddir) $GST_PLUGINS_BASE_CFLAGS $GST_CFLAGS \$(GST_OPTION_CFLAGS)"
264 AC_SUBST([GST_ALL_CFLAGS])
265
266 dnl FIXME: check if LTLIBINTL is needed everywhere
267 dnl I presume it is given that it contains the symbols that _() stuff maps to
268 GST_ALL_LIBS="$GST_LIBS $LTLIBINTL \$(GCOV_LIBS)"
269 AC_SUBST([GST_ALL_LIBS])
270
271 dnl LDFLAGS really should only contain flags, not libs - they get added before
272 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
273 GST_ALL_LDFLAGS="-no-undefined"
274 if test "x${enable_Bsymbolic}" = "xyes"; then
275   GST_ALL_LDFLAGS="$GST_ALL_LDFLAGS -Wl,-Bsymbolic-functions"
276 fi
277
278 AC_SUBST(GST_ALL_LDFLAGS)
279
280 dnl GST_LIB_LDFLAGS
281 dnl linker flags shared by all libraries
282 dnl LDFLAGS modifier defining exported symbols from built libraries
283 GST_LIB_LDFLAGS="-export-symbols-regex \^[_]?\(gst_\|Gst\|GST_\).*"
284 AC_SUBST(GST_LIB_LDFLAGS)
285
286 dnl GST_OBJ_*
287 dnl default vars for all internal objects built on libgstrtspserver
288 dnl includes GST_ALL_*
289 GST_OBJ_CFLAGS="\$(GST_ALL_CFLAGS)"
290 AC_SUBST([GST_OBJ_CFLAGS])
291 GST_OBJ_LIBS="\$(top_builddir)/gst/rtsp-server/libgstrtspserver-$GST_API_VERSION.la \$(GST_ALL_LIBS)"
292 AC_SUBST([GST_OBJ_LIBS])
293
294 PKG_CHECK_MODULES(LIBCGROUP, libcgroup >= 0.26, HAVE_LIBCGROUP="yes", HAVE_LIBCGROUP="no")
295 AC_SUBST(LIBCGROUP_CFLAGS)
296 AC_SUBST(LIBCGROUP_LIBS)
297 AM_CONDITIONAL(HAVE_LIBCGROUP, test "x$HAVE_LIBCGROUP" = "xyes")
298
299 dnl this really should only contain flags, not libs - they get added before
300 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
301
302 dnl *** output files ***
303
304 dnl keep this alphabetic per directory, please
305 AC_CONFIG_FILES([
306 Makefile
307 gst-rtsp.spec
308 common/Makefile
309 common/m4/Makefile
310 gst/Makefile
311 gst/rtsp-server/Makefile
312 examples/Makefile
313 tests/Makefile
314 tests/check/Makefile
315 pkgconfig/Makefile
316 pkgconfig/gstreamer-rtsp-server.pc
317 pkgconfig/gstreamer-rtsp-server-uninstalled.pc
318 docs/Makefile
319 docs/version.entities
320 docs/libs/Makefile
321 ])
322 AC_OUTPUT
323
324 echo "
325
326 Configuration
327         Version                    : ${VERSION}
328         Source code location       : ${srcdir}
329         Prefix                     : ${prefix}
330         Compiler                   : ${CC}
331         CGroups example            : ${HAVE_LIBCGROUP}
332
333 gst-rtsp-server configured. Type 'make' to build.
334 "