h264encode: fix some issues
[profile/ivi/libva.git] / configure.ac
1 # Copyright (c) 2007 Intel Corporation. All Rights Reserved.
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish,
7 # distribute, sub license, and/or sell copies of the Software, and to
8 # permit persons to whom the Software is furnished to do so, subject to
9 # the following conditions:
10 #
11 # The above copyright notice and this permission notice (including the
12 # next paragraph) shall be included in all copies or substantial portions
13 # of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
18 # IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
19 # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 # VA-API version
24 # - increment major for any ABI change (which shall not occur!)
25 # - increment minor for any interface change (e.g. new/modified function)
26 # - increment micro for any other change (new flag, new codec definition, etc.)
27 # - reset micro version to zero when minor version is incremented
28 # - reset minor version to zero when major version is incremented
29 m4_define([va_api_major_version], [0])
30 m4_define([va_api_minor_version], [34])
31 m4_define([va_api_micro_version], [0])
32
33 m4_define([va_api_version],
34           [va_api_major_version.va_api_minor_version.va_api_micro_version])
35
36 # libva package version number, (as distinct from shared library version)
37 # XXX: we want the package version to remain at 1.0.x for VA-API 0.32.y
38 #
39 # - major version is automatically generated from VA-API major version
40 # - minor version is automatically generated from VA-API minor version
41 # - increment micro for any library release
42 # - reset micro version to zero when VA-API major or minor version is changed
43 m4_define([libva_major_version], [m4_eval(va_api_major_version + 1)])
44 m4_define([libva_minor_version], [m4_eval(va_api_minor_version - 32)])
45 m4_define([libva_micro_version], [0])
46 m4_define([libva_pre_version],   [1])
47
48 m4_define([libva_version],
49           [libva_major_version.libva_minor_version.libva_micro_version])
50 m4_if(libva_pre_version, [0], [], [
51 m4_append([libva_version], libva_pre_version, [.pre])
52 ])
53
54 # libva library version number (generated, do not change)
55 # XXX: we want the SONAME to remain at libva.so.1 for VA-API major == 0
56 #
57 # The library name is generated libva.<x>.<y>.0 where
58 # <x> = VA-API major version + 1
59 # <y> = 100 * VA-API minor version + VA-API micro version
60 #
61 # For example:
62 # VA-API 0.32.0 generates libva.so.1.3200.0
63 # VA-API 0.34.1 generates libva.so.1.3401.0
64 # VA-API 1.2.13 generates libva.so.2.213.0
65 m4_define([libva_interface_bias], [m4_eval(va_api_major_version + 1)])
66 m4_define([libva_interface_age],  [0])
67 m4_define([libva_binary_age],
68           [m4_eval(100 * va_api_minor_version + va_api_micro_version - libva_interface_age)])
69
70 m4_define([libva_lt_current],
71           [m4_eval(100 * va_api_minor_version + va_api_micro_version + libva_interface_bias)])
72 m4_define([libva_lt_revision],
73           [m4_eval(libva_interface_age)])
74 m4_define([libva_lt_age],
75           [m4_eval(libva_binary_age - libva_interface_age)])
76
77 # libdrm minimun version requirement
78 m4_define([libdrm_version], [2.4])
79
80 # Wayland minimum version number
81 m4_define([wayland_api_version], [1.0.0])
82
83 AC_PREREQ(2.57)
84 AC_INIT([libva], [libva_version], [waldo.bastian@intel.com], libva)
85 AC_CONFIG_SRCDIR([Makefile.am])
86 AM_INIT_AUTOMAKE([dist-bzip2])
87
88 AM_CONFIG_HEADER([config.h])
89 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
90
91 VA_API_MAJOR_VERSION=va_api_major_version
92 VA_API_MINOR_VERSION=va_api_minor_version
93 VA_API_MICRO_VERSION=va_api_micro_version
94 VA_API_VERSION=va_api_version
95 AC_SUBST(VA_API_MAJOR_VERSION)
96 AC_SUBST(VA_API_MINOR_VERSION)
97 AC_SUBST(VA_API_MICRO_VERSION)
98 AC_SUBST(VA_API_VERSION)
99
100 LIBVA_MAJOR_VERSION=libva_major_version
101 LIBVA_MINOR_VERSION=libva_minor_version
102 LIBVA_MICRO_VERSION=libva_micro_version
103 LIBVA_VERSION=libva_version
104 AC_SUBST(LIBVA_MAJOR_VERSION)
105 AC_SUBST(LIBVA_MINOR_VERSION)
106 AC_SUBST(LIBVA_MICRO_VERSION)
107 AC_SUBST(LIBVA_VERSION)
108
109 LIBVA_LT_CURRENT=libva_lt_current
110 LIBVA_LT_REV=libva_lt_revision
111 LIBVA_LT_AGE=libva_lt_age
112 LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
113 LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
114 AC_SUBST(LIBVA_LT_VERSION)
115 AC_SUBST(LIBVA_LT_LDFLAGS)
116
117 AC_ARG_ENABLE(docs,
118     [AC_HELP_STRING([--enable-docs],
119                     [build Doxygen documentation @<:@default=no@:>@])],
120     [], [enable_docs="no"])
121
122 AC_ARG_ENABLE(drm,
123     [AC_HELP_STRING([--enable-drm],
124                     [build with VA/DRM API support @<:@default=yes@:>@])],
125     [], [enable_drm="yes"])
126
127 AC_ARG_ENABLE(x11,
128     [AC_HELP_STRING([--enable-x11],
129                     [build with VA/X11 API support @<:@default=yes@:>@])],
130     [], [enable_x11="yes"])
131
132 AC_ARG_ENABLE(glx,
133     [AC_HELP_STRING([--enable-glx],
134                     [build with VA/GLX API support @<:@default=yes@:>@])],
135     [], [enable_glx="yes"])
136
137 AC_ARG_ENABLE(egl,
138     [AC_HELP_STRING([--enable-egl],
139                     [build with VA/EGL API support @<:@default=yes@:>@])],
140     [], [enable_egl="yes"])
141
142 AC_ARG_ENABLE([wayland],
143     [AC_HELP_STRING([--enable-wayland],
144                     [build with VA/Wayland API support @<:@default=yes@:>@])],
145     [], [enable_wayland="yes"])
146
147 AC_ARG_ENABLE(dummy-driver,
148     [AC_HELP_STRING([--enable-dummy-driver],
149                     [build dummy video driver @<:@default=yes@:>@])],
150     [], [enable_dummy_driver="yes"])
151 AM_CONDITIONAL(BUILD_DUMMY_DRIVER, test x$enable_dummy_driver = xyes)
152
153 AC_ARG_ENABLE(dummy-backend,
154     [AC_HELP_STRING([--enable-dummy-backend],
155                     [build dummy libva backend])],
156     [], [enable_dummy_backend="no"])
157
158 AC_ARG_WITH(drivers-path,
159     [AC_HELP_STRING([--with-drivers-path=[[path]]],
160                     [drivers path])],
161     [], [with_drivers_path="$libdir/dri"])
162
163 LIBVA_DRIVERS_PATH="$with_drivers_path"
164 AC_SUBST(LIBVA_DRIVERS_PATH)
165
166 AC_DISABLE_STATIC
167 AC_PROG_LIBTOOL
168 AC_PROG_CC
169 AC_PROG_CXX
170 AM_PROG_CC_C_O
171 PKG_PROG_PKG_CONFIG
172
173 AC_HEADER_STDC
174 AC_SYS_LARGEFILE
175
176 # Check for Doxygen
177 if test "$enable_docs" = "yes"; then
178     AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
179     if test "$DOXYGEN" = "no"; then
180        enable_docs="no"
181     fi
182 fi
183 AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
184
185 # Check for __attribute__((visibility()))
186 AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
187     ac_cv_have_gnuc_visibility_attribute,
188     [cat > conftest.c <<EOF
189 int foo __attribute__ ((visibility ("hidden"))) = 1;
190 int bar __attribute__ ((visibility ("protected"))) = 1;
191 EOF
192     ac_cv_have_gnuc_visibility_attribute="no"
193     if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
194         if grep '\.hidden.*foo' conftest.s >/dev/null; then
195             if grep '\.protected.*bar' conftest.s >/dev/null; then
196                 ac_cv_have_gnuc_visibility_attribute="yes"
197             fi
198         fi
199     fi
200     rm -f conftest.[cs]
201 ])
202 if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
203     AC_DEFINE([HAVE_GNUC_VISIBILITY_ATTRIBUTE], [1],
204               [Defined to 1 if GCC visibility attribute is supported])
205 fi
206
207 # Dummy backend
208 if test x$enable_dummy_backend = xyes; then
209     PKG_CHECK_MODULES([UDEV], [libudev], [libudev=yes], [libudev=no])
210 fi
211 if test x$libudev = xno; then
212    enable_dummy_backend=no
213 fi
214 AM_CONDITIONAL(BUILD_DUMMY_BACKEND, test x$enable_dummy_backend = xyes)
215
216 # Check for DRM (mandatory)
217 LIBDRM_VERSION=libdrm_version
218 PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
219 AC_SUBST(LIBDRM_VERSION)
220
221 USE_DRM="no"
222 if test "$enable_drm" = "yes"; then
223     USE_DRM="yes"
224     AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is built])
225 fi
226 AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
227
228 # Check for X11
229 USE_X11="no"
230 if test "$enable_x11" = "yes"; then
231     USE_X11="yes"
232     PKG_CHECK_MODULES([X11],    [x11],    [:], [USE_X11="no"])
233     PKG_CHECK_MODULES([XEXT],   [xext],   [:], [USE_X11="no"])
234     PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
235     if test "$USE_X11" = "yes"; then
236         AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
237     fi
238 fi
239 AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
240
241 # Check for GLX
242 USE_GLX="no"
243 if test "$USE_X11:$enable_glx" = "yes:yes"; then
244     PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
245     saved_CPPFLAGS="$CPPFLAGS"
246     saved_LIBS="$LIBS"
247     CPPFLAGS="$CPPFLAGS $GLX_CFLAGS"
248     LIBS="$LIBS $GLX_LIBS"
249     AC_CHECK_HEADERS([GL/gl.h GL/glx.h], [:], [USE_GLX="no"])
250     AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
251     CPPFLAGS="$saved_CPPFLAGS"
252     LIBS="$saved_LIBS"
253     if test "$USE_GLX" = "yes"; then
254         AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
255     fi
256 fi
257 AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
258
259 # Check for EGL
260 USE_EGL="no"
261 if test "$enable_egl" = "yes"; then
262     PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [:])
263     saved_CPPFLAGS="$CPPFLAGS"
264     saved_LIBS="$LIBS"
265     CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
266     LIBS="$LIBS $EGL_LIBS"
267     AC_CHECK_HEADERS([EGL/egl.h], [:], [USE_EGL="no"])
268     AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
269     CPPFLAGS="$saved_CPPFLAGS"
270     LIBS="$saved_LIBS"
271     if test "$USE_EGL" = "yes"; then
272         AC_DEFINE([HAVE_VA_EGL], [1], [Defined to 1 if VA/EGL API is built])
273     fi
274 fi
275 AM_CONDITIONAL(USE_EGL, test "$USE_EGL" = "yes")
276
277 # Check for Wayland
278 WAYLAND_API_VERSION=wayland_api_version
279 AC_SUBST(WAYLAND_API_VERSION)
280
281 USE_WAYLAND="no"
282 if test "$enable_wayland" = "yes"; then
283     PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
284         [USE_WAYLAND="yes"], [:])
285     if test "$USE_WAYLAND" = "yes"; then
286         AC_DEFINE([HAVE_VA_WAYLAND], [1],
287                   [Defined to 1 if VA/Wayland API is built])
288     fi
289 fi
290 AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
291
292 m4_ifdef([WAYLAND_SCANNER_RULES],
293     [WAYLAND_SCANNER_RULES(['$(top_srcdir)/va/wayland/protocol'])],
294     [wayland_scanner_rules=""; AC_SUBST(wayland_scanner_rules)])
295
296 # We only need the headers, we don't link against the DRM libraries
297 LIBVA_CFLAGS="$DRM_CFLAGS"
298 AC_SUBST(LIBVA_CFLAGS)
299 AC_SUBST(LIBVA_LIBS)
300
301 pkgconfigdir=${libdir}/pkgconfig
302 AC_SUBST(pkgconfigdir)
303
304 # Check for builds without backend
305 if test "$USE_DRM:$USE_X11:$USE_WAYLAND" = "no:no:no"; then
306     AC_MSG_ERROR([Please select at least one backend (DRM, X11, Wayland)])
307 fi
308
309 AC_OUTPUT([
310     Makefile
311     debian.upstream/Makefile
312     doc/Makefile
313     dummy_drv_video/Makefile
314     pkgconfig/Makefile
315     pkgconfig/libva-drm.pc
316     pkgconfig/libva-egl.pc
317     pkgconfig/libva-glx.pc
318     pkgconfig/libva-tpi.pc
319     pkgconfig/libva-wayland.pc
320     pkgconfig/libva-x11.pc
321     pkgconfig/libva.pc
322     test/Makefile
323     test/basic/Makefile
324     test/common/Makefile
325     test/decode/Makefile
326     test/encode/Makefile
327     test/putsurface/Makefile
328     test/transcode/Makefile
329     test/vainfo/Makefile
330     va/Makefile
331     va/drm/Makefile
332     va/dummy/Makefile
333     va/egl/Makefile
334     va/glx/Makefile
335     va/va_version.h
336     va/wayland/Makefile
337     va/wayland/protocol/Makefile
338     va/x11/Makefile
339 ])
340
341 # Print a small summary
342 AS_IF([test x$USE_DRM = xyes], [BACKENDS="drm $BACKENDS"])
343 AS_IF([test x$USE_X11 = xyes], [BACKENDS="x11 $BACKENDS"])
344 AS_IF([test x$USE_GLX = xyes], [BACKENDS="glx $BACKENDS"])
345 AS_IF([test x$USE_EGL = xyes], [BACKENDS="egl $BACKENDS"])
346 AS_IF([test x$USE_WAYLAND = xyes], [BACKENDS="wayland $BACKENDS"])
347
348 echo
349 echo "libva - ${LIBVA_VERSION} (VA-API ${VA_API_VERSION})"
350 echo
351 echo Installation prefix .............. : $prefix
352 echo Default driver path .............. : $LIBVA_DRIVERS_PATH
353 echo Extra window systems ............. : $BACKENDS
354 echo build dummy backend .............. : $enable_dummy_backend
355 echo Build dummy driver ............... : $enable_dummy_driver
356 echo Build documentation .............. : $enable_docs
357 echo