meson: move omx features check after target selection
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ(2.62)
2
3 dnl please read gstreamer/docs/random/autotools before changing this file
4
5 dnl initialize autoconf
6 dnl releases only do -Wall, git and prerelease does -Werror too
7 dnl use a three digit version number for releases, and four for git/prerelease
8 AC_INIT(GStreamer OpenMAX Plug-ins, 1.13.0.1,
9     http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
10     gst-omx)
11
12 AG_GST_INIT
13
14 dnl initialize automake
15 AM_INIT_AUTOMAKE([-Wno-portability 1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])
16
17 dnl define PACKAGE_VERSION_* variables
18 AS_VERSION
19
20 dnl check if this is a release version
21 AS_NANO(GST_GIT="no", GST_GIT="yes")
22
23 dnl can autoconf find the source ?
24 AC_CONFIG_SRCDIR([omx/gstomx.c])
25
26 dnl define the output header for config
27 AC_CONFIG_HEADERS([config.h])
28
29 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
30 AM_MAINTAINER_MODE([enable])
31
32 dnl sets host_* variables
33 AC_CANONICAL_HOST
34
35 dnl use pretty build output with automake >= 1.11
36 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
37   [AM_DEFAULT_VERBOSITY=1
38    AC_SUBST(AM_DEFAULT_VERBOSITY)])
39
40 dnl our libraries and install dirs use GST_API_VERSION in the filename
41 dnl to allow side-by-side installation of different API versions
42 GST_API_VERSION=1.0
43 AC_SUBST(GST_API_VERSION)
44 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
45   [GStreamer API Version])
46
47 AG_GST_LIBTOOL_PREPARE
48 AS_LIBTOOL(GST, 1300, 0, 1300)
49
50 dnl *** required versions of GStreamer stuff ***
51 GST_REQ=1.13.0.1
52
53 dnl *** autotools stuff ****
54
55 dnl allow for different autotools
56 AS_AUTOTOOLS_ALTERNATE
57
58 dnl Add parameters for aclocal
59 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
60
61 dnl *** check for arguments to configure ***
62
63 AG_GST_ARG_DISABLE_FATAL_WARNINGS
64
65 AG_GST_ARG_DEBUG
66 AG_GST_ARG_PROFILING
67 AG_GST_ARG_VALGRIND
68 AG_GST_ARG_GCOV
69
70 AG_GST_ARG_EXAMPLES
71
72 AG_GST_ARG_WITH_PKG_CONFIG_PATH
73 AG_GST_ARG_WITH_PACKAGE_NAME
74 AG_GST_ARG_WITH_PACKAGE_ORIGIN
75
76 AG_GST_PKG_CONFIG_PATH
77
78 AG_GST_ARG_WITH_PLUGINS
79
80 AG_GST_ARG_ENABLE_EXPERIMENTAL
81
82 dnl *** checks for platform ***
83
84 dnl * hardware/architecture *
85
86 dnl common/m4/gst-arch.m4
87 dnl check CPU type
88 AG_GST_ARCH
89
90 dnl check for large file support
91 dnl affected plugins must include config.h
92 AC_SYS_LARGEFILE
93
94 dnl *** checks for programs ***
95
96 dnl find a compiler
97 AC_PROG_CC
98 AC_PROG_CC_STDC
99
100 dnl check if the compiler supports '-c' and '-o' options
101 AM_PROG_CC_C_O
102
103 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
104 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
105
106 dnl check for documentation tools
107 GTK_DOC_CHECK([1.3])
108 AS_PATH_PYTHON([2.1])
109 AG_GST_PLUGIN_DOCS([1.3],[2.1])
110
111 dnl *** checks for libraries ***
112
113 dnl libm, for sin() etc.
114 LT_LIB_M
115 AC_SUBST(LIBM)
116
117 dnl *** checks for header files ***
118
119 dnl check if we have ANSI C header files
120 AC_HEADER_STDC
121
122 AX_CREATE_STDINT_H
123
124 dnl *** checks for functions ***
125
126 dnl *** checks for types/defines ***
127
128 dnl *** checks for structures ***
129
130 dnl *** checks for compiler characteristics ***
131
132 dnl *** checks for library functions ***
133
134 dnl Check for a way to display the function name in debug output
135 AG_GST_CHECK_FUNCTION
136
137 dnl *** checks for dependency libraries ***
138
139 dnl GLib is required
140 AG_GST_GLIB_CHECK([2.40.0])
141
142 dnl Needed by plugins that use g_module_*() API
143 PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
144
145 dnl checks for gstreamer
146 dnl uninstalled is selected preferentially -- see pkg-config(1)
147 AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ], yes)
148 AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ], yes)
149 AG_GST_CHECK_GST_CONTROLLER($GST_API_VERSION, [$GST_REQ], yes)
150 AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
151 AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_REQ], yes)
152 AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
153 PKG_CHECK_MODULES([GST_GL], [gstreamer-gl-1.0 >= $GST_REQ], [
154   AC_DEFINE(HAVE_GST_GL, 1, [Have gstreamer-gl])
155   GST_GL=yes
156 ], [GST_GL=no])
157 AM_CONDITIONAL(HAVE_GST_GL, test "x$GST_GL" = "xyes")
158 PKG_CHECK_MODULES([GST_ALLOCATORS], [gstreamer-allocators-1.0])
159
160 dnl Check for documentation xrefs
161 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
162 GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_API_VERSION`"
163 AC_SUBST(GLIB_PREFIX)
164 AC_SUBST(GST_PREFIX)
165
166 dnl Check for -Bsymbolic-functions linker flag used to avoid
167 dnl intra-library PLT jumps, if available.
168 AC_ARG_ENABLE(Bsymbolic,
169               [AS_HELP_STRING([--disable-Bsymbolic],[avoid linking with -Bsymbolic])],,
170               [SAVED_LDFLAGS="${LDFLAGS}" SAVED_LIBS="${LIBS}"
171                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
172                LDFLAGS=-Wl,-Bsymbolic-functions
173                LIBS=
174                AC_TRY_LINK([], [return 0],
175                            AC_MSG_RESULT(yes)
176                            enable_Bsymbolic=yes,
177                            AC_MSG_RESULT(no)
178                            enable_Bsymbolic=no)
179                LDFLAGS="${SAVED_LDFLAGS}" LIBS="${SAVED_LIBS}"])
180
181 AC_ARG_WITH([omx-target],
182         AS_HELP_STRING([--with-omx-target],[Use this OpenMAX IL target (generic, bellagio, rpi, tizonia, zynqultrascaleplus)]),
183         [ac_cv_omx_target="$withval"], [ac_cv_omx_target="none"])
184
185 ac_cv_omx_target_struct_packing="none"
186 AC_MSG_NOTICE([Using $ac_cv_omx_target as OpenMAX IL target])
187 case "${ac_cv_omx_target}" in
188   generic)
189     AC_DEFINE(USE_OMX_TARGET_GENERIC, 1, [Use generic OpenMAX IL target])
190     ;;
191   rpi)
192     AC_DEFINE(USE_OMX_TARGET_RPI, 1, [Use RPi OpenMAX IL target])
193     AC_DEFINE(OMX_SKIP64BIT, 1, [Required by the RPi implementation])
194     ac_cv_omx_target_struct_packing=4
195     ;;
196   bellagio)
197     AC_DEFINE(USE_OMX_TARGET_BELLAGIO, 1, [Use Bellagio OpenMAX IL target])
198     ;;
199   zynqultrascaleplus)
200     AC_DEFINE(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, 1, [Use Zynq UltraScale+ OpenMAX IL target])
201     ;;
202   tizonia)
203     AC_DEFINE(USE_OMX_TARGET_TIZONIA, 1, [Use Tizonia OpenMAX IL target])
204     ;;
205   none|*)
206     AC_ERROR([invalid OpenMAX IL target, you must specify one of --with-omx-target={generic,rpi,bellagio,tizonia,zynqultrascaleplus}])
207     ;;
208 esac
209 AM_CONDITIONAL(USE_OMX_TARGET_GENERIC, test "x$ac_cv_omx_target" = "xgeneric")
210 AM_CONDITIONAL(USE_OMX_TARGET_BELLAGIO, test "x$ac_cv_omx_target" = "xbellagio")
211 AM_CONDITIONAL(USE_OMX_TARGET_TIZONIA, test "x$ac_cv_omx_target" = "xtizonia")
212 AM_CONDITIONAL(USE_OMX_TARGET_RPI, test "x$ac_cv_omx_target" = "xrpi")
213 AM_CONDITIONAL(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, test "x$ac_cv_omx_target" = "xzynqultrascaleplus")
214
215 AC_ARG_WITH([omx-struct-packing],
216         AS_HELP_STRING([--with-omx-struct-packing],[Force OpenMAX struct packing, (default is none)]),
217         [ac_cv_omx_struct_packing="$withval"], [ac_cv_omx_struct_packing="none"])
218
219 if test x"$ac_cv_omx_struct_packing" != x"none"; then
220   AC_MSG_NOTICE([Using $ac_cv_omx_struct_packing as OpenMAX struct packing])
221   AC_DEFINE_UNQUOTED(GST_OMX_STRUCT_PACKING, $ac_cv_omx_struct_packing, [The struct packing used for OpenMAX structures])
222 elif test x"$ac_cv_omx_target_struct_packing" != x"none"; then
223   AC_MSG_NOTICE([Using $ac_cv_omx_target_struct_packing as OpenMAX struct packing])
224   AC_DEFINE_UNQUOTED(GST_OMX_STRUCT_PACKING, $ac_cv_omx_target_struct_packing, [The struct packing used for OpenMAX structures])
225 fi
226
227 dnl settings for tizonia target
228 if test "x$ac_cv_omx_target" = "xtizonia"; then
229     PKG_CHECK_MODULES([TIZONIA], [tizilheaders])
230     CPPFLAGS="$CPPFLAGS $TIZONIA_CFLAGS"
231     TIZONIA_LIBDIR="`$PKG_CONFIG --variable=libdir tizilheaders`"
232     AC_SUBST(TIZONIA_LIBDIR)
233 fi
234
235 AC_ARG_WITH([omx-header-path],
236             AS_HELP_STRING([--with-omx-header-path],[path of external OpenMAX IL header files]),
237         [omx_header_path="$withval"], [omx_header_path="none"])
238
239 if test x"$omx_header_path" != x"none"; then
240     CPPFLAGS="$CPPFLAGS -I$omx_header_path"
241 fi
242 dnl Check for external OpenMAX IL headers
243 AC_CHECK_HEADER([OMX_Core.h], [HAVE_EXTERNAL_OMX=yes], [HAVE_EXTERNAL_OMX=no], [AC_INCLUDES_DEFAULT])
244 AM_CONDITIONAL(HAVE_EXTERNAL_OMX, test "x$HAVE_EXTERNAL_OMX" = "xyes")
245
246 dnl Our internal OpenMAX IL headers have OMX_VideoExt.h, OMX_IndexExt.h and OMX_ComponentExt.h
247 HAVE_VIDEO_EXT=yes
248 HAVE_INDEX_EXT=yes
249 HAVE_COMPONENT_EXT=yes
250 if test "x$HAVE_EXTERNAL_OMX" = "xyes"; then
251     AC_CHECK_HEADER([OMX_VideoExt.h], [HAVE_VIDEO_EXT=yes], [HAVE_VIDEO_EXT=no], [AC_INCLUDES_DEFAULT])
252     AC_CHECK_HEADER([OMX_IndexExt.h], [HAVE_INDEX_EXT=yes], [HAVE_INDEX_EXT=no], [AC_INCLUDES_DEFAULT])
253     AC_CHECK_HEADER([OMX_ComponentExt.h], [HAVE_COMPONENT_EXT=yes], [HAVE_COMPONENT_EXT=no], [AC_INCLUDES_DEFAULT])
254 fi
255
256 VIDEO_HEADERS="#include <OMX_Video.h>"
257 if test "x$HAVE_VIDEO_EXT" = "xyes"; then
258     AC_DEFINE(HAVE_VIDEO_EXT, 1, [OpenMAX IL has OMX_VideoExt.h header])
259     VIDEO_HEADERS="$VIDEO_HEADERS
260 #include <OMX_VideoExt.h>
261 "
262 fi
263
264 if test "x$HAVE_INDEX_EXT" = "xyes"; then
265     AC_DEFINE(HAVE_INDEX_EXT, 1, [OpenMAX IL has OMX_IndexExt.h header])
266 fi
267
268 if test "x$HAVE_COMPONENT_EXT" = "xyes"; then
269     AC_DEFINE(HAVE_COMPONENT_EXT, 1, [OpenMAX IL has OMX_ComponentExt.h header])
270 fi
271
272 AC_CHECK_DECLS([OMX_VIDEO_CodingVP8],
273   [
274     AC_DEFINE(HAVE_VP8, 1, [OpenMAX IL has VP8 support])
275     HAVE_VP8=yes
276   ], [
277     HAVE_VP8=no
278   ], [[$VIDEO_HEADERS]])
279 AM_CONDITIONAL(HAVE_VP8, test "x$HAVE_VP8" = "xyes")
280
281 AC_CHECK_DECLS([OMX_VIDEO_CodingTheora],
282   [
283     AC_DEFINE(HAVE_THEORA, 1, [OpenMAX IL has Theora support])
284     HAVE_THEORA=yes
285   ], [
286     HAVE_THEORA=no
287   ], [[$VIDEO_HEADERS]])
288 AM_CONDITIONAL(HAVE_THEORA, test "x$HAVE_THEORA" = "xyes")
289
290 AC_CHECK_DECLS([OMX_VIDEO_CodingHEVC],
291   [
292     AC_DEFINE(HAVE_HEVC, 1, [OpenMAX IL has HEVC support])
293     HAVE_HEVC=yes
294   ], [
295     HAVE_HEVC=no
296   ], [[$VIDEO_HEADERS]])
297 AM_CONDITIONAL(HAVE_HEVC, test "x$HAVE_HEVC" = "xyes")
298
299 if test "x$ac_cv_omx_target" = "xzynqultrascaleplus"; then
300     AC_CHECK_HEADER([OMX_Allegro.h], [], [AC_ERROR([Need Allegro OMX headers to build for Zynq UltraScale+. Use --with-omx-header-path= argument to specify the path of those headers.])], [AC_INCLUDES_DEFAULT])
301 fi
302
303 dnl *** set variables based on configure arguments ***
304
305 dnl set license and copyright notice
306 GST_LICENSE="LGPL"
307 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
308 AC_SUBST(GST_LICENSE)
309
310 dnl set location of plugin directory
311 AG_GST_SET_PLUGINDIR
312
313 dnl set release date/time
314 AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
315   ["${srcdir}/gst-omx.doap"],
316   [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
317
318 dnl define an ERROR_CFLAGS Makefile variable
319 AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
320     -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef
321     -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wformat-nonliteral
322     -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return
323     -Wno-multichar -Wnested-externs ])
324
325 dnl define correct level for debugging messages
326 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
327
328 dnl used in examples
329 AG_GST_DEFAULT_ELEMENTS
330
331 dnl *** plug-ins to include ***
332
333 dnl these are all the gst plug-ins, compilable without additional libs
334 AG_GST_CHECK_PLUGIN(omx)
335
336 dnl *** finalize CFLAGS, LDFLAGS, LIBS
337
338 dnl Overview:
339 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
340 dnl GST_*:              flags shared by built objects to link against GStreamer
341 dnl GST_PLUGINS_BASE_CFLAGS: to link internally against the plugins base libs
342 dnl                          (compare to other modules) or for i18n
343 dnl GST_ALL_LDFLAGS:    linker flags shared by all
344 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
345 dnl GST_LT_LDFLAGS:     library versioning of our libraries
346 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
347
348 dnl GST_OPTION_CFLAGS
349 if test "x$USE_DEBUG" = xyes; then
350    PROFILE_CFLAGS="-g"
351 fi
352 AC_SUBST(PROFILE_CFLAGS)
353
354 if test "x$PACKAGE_VERSION_NANO" = "x1"; then
355   dnl Define _only_ when compiling a git version (not pre-releases or releases)
356   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
357 else
358   DEPRECATED_CFLAGS=""
359 fi
360 AC_SUBST(DEPRECATED_CFLAGS)
361
362 dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
363 dnl at make time with e.g. make ERROR_CFLAGS=""
364 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
365 AC_SUBST(GST_OPTION_CFLAGS)
366
367 dnl GST_PLUGINS_BASE_CFLAGS
368 dnl prefer internal headers to already installed ones
369 dnl also add builddir include for enumtypes and marshal
370 GST_OMX_CFLAGS=""
371 AC_SUBST(GST_OMX_CFLAGS)
372
373 dnl FIXME: do we want to rename to GST_ALL_* ?
374 dnl add GST_OPTION_CFLAGS, but overridable
375 GST_CFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
376 AC_SUBST(GST_CFLAGS)
377 dnl add GCOV libs because libtool strips -fprofile-arcs -ftest-coverage
378 GST_LIBS="$GST_LIBS \$(GCOV_LIBS)"
379 AC_SUBST(GST_LIBS)
380
381 dnl LDFLAGS really should only contain flags, not libs - they get added before
382 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
383 GST_ALL_LDFLAGS="-no-undefined"
384 if test "x${enable_Bsymbolic}" = "xyes"; then
385   GST_ALL_LDFLAGS="$GST_ALL_LDFLAGS -Wl,-Bsymbolic-functions"
386 fi
387 AC_SUBST(GST_ALL_LDFLAGS)
388
389 dnl this really should only contain flags, not libs - they get added before
390 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
391 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_.*' $GST_ALL_LDFLAGS"
392 AC_SUBST(GST_PLUGIN_LDFLAGS)
393
394 AS_AC_EXPAND(GST_OMX_CONFIG_DIR, ${sysconfdir}/xdg)
395 AC_DEFINE_UNQUOTED(GST_OMX_CONFIG_DIR, "$GST_OMX_CONFIG_DIR", [gst-omx configuration directory])
396
397 dnl *** output files ***
398
399 AC_CONFIG_FILES(
400 Makefile
401 omx/Makefile
402 common/Makefile
403 common/m4/Makefile
404 tools/Makefile
405 config/Makefile
406 config/bellagio/Makefile
407 config/rpi/Makefile
408 config/tizonia/gstomx.conf
409 config/tizonia/Makefile
410 config/zynqultrascaleplus/Makefile
411 examples/Makefile
412 examples/egl/Makefile
413 m4/Makefile
414 tests/Makefile
415 tests/check/Makefile
416 )
417
418 AC_OUTPUT
419