OSDN Git Service

Bump libva to 1.8.2.pre1 for development
[android-x86/hardware-intel-common-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], [40])
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], [2])
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],
85         [libva_version],
86         [https://github.com/01org/libva/issues/new],
87         [libva],
88         [https://github.com/01org/libva])
89
90 AC_CONFIG_SRCDIR([Makefile.am])
91 AC_CONFIG_MACRO_DIR([m4])
92 AM_INIT_AUTOMAKE([dist-bzip2])
93
94 AC_CONFIG_HEADERS([config.h])
95 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
96
97 TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
98 AC_SUBST(TODAY)
99
100 VA_API_MAJOR_VERSION=va_api_major_version
101 VA_API_MINOR_VERSION=va_api_minor_version
102 VA_API_MICRO_VERSION=va_api_micro_version
103 VA_API_VERSION=va_api_version
104 AC_SUBST(VA_API_MAJOR_VERSION)
105 AC_SUBST(VA_API_MINOR_VERSION)
106 AC_SUBST(VA_API_MICRO_VERSION)
107 AC_SUBST(VA_API_VERSION)
108
109 LIBVA_MAJOR_VERSION=libva_major_version
110 LIBVA_MINOR_VERSION=libva_minor_version
111 LIBVA_MICRO_VERSION=libva_micro_version
112 LIBVA_VERSION=libva_version
113 AC_SUBST(LIBVA_MAJOR_VERSION)
114 AC_SUBST(LIBVA_MINOR_VERSION)
115 AC_SUBST(LIBVA_MICRO_VERSION)
116 AC_SUBST(LIBVA_VERSION)
117
118 LIBVA_LT_CURRENT=libva_lt_current
119 LIBVA_LT_REV=libva_lt_revision
120 LIBVA_LT_AGE=libva_lt_age
121 LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
122 LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
123 AC_SUBST(LIBVA_LT_VERSION)
124 AC_SUBST(LIBVA_LT_LDFLAGS)
125
126 AC_ARG_ENABLE(docs,
127     [AC_HELP_STRING([--enable-docs],
128                     [build Doxygen documentation @<:@default=no@:>@])],
129     [], [enable_docs="no"])
130
131 AC_ARG_ENABLE(drm,
132     [AC_HELP_STRING([--enable-drm],
133                     [build with VA/DRM API support @<:@default=yes@:>@])],
134     [], [enable_drm="yes"])
135
136 AC_ARG_ENABLE(x11,
137     [AC_HELP_STRING([--enable-x11],
138                     [build with VA/X11 API support @<:@default=yes@:>@])],
139     [], [enable_x11="yes"])
140
141 AC_ARG_ENABLE(glx,
142     [AC_HELP_STRING([--enable-glx],
143                     [build with VA/GLX API support @<:@default=yes@:>@])],
144     [], [enable_glx="yes"])
145
146 AC_ARG_ENABLE(egl,
147     [AC_HELP_STRING([--enable-egl],
148                     [build with VA/EGL API support @<:@default=yes@:>@])],
149     [], [enable_egl="yes"])
150
151 AC_ARG_ENABLE([wayland],
152     [AC_HELP_STRING([--enable-wayland],
153                     [build with VA/Wayland API support @<:@default=yes@:>@])],
154     [], [enable_wayland="yes"])
155
156 AC_ARG_ENABLE([va-messaging],
157     [AC_HELP_STRING([--enable-va-messaging],
158                     [build with va info and error messaging @<:@default=yes@:>@])],
159     [], [enable_va_messaging="yes"])
160
161 AC_ARG_ENABLE(dummy-driver,
162     [AC_HELP_STRING([--enable-dummy-driver],
163                     [build dummy video driver @<:@default=yes@:>@])],
164     [], [enable_dummy_driver="yes"])
165 AM_CONDITIONAL(BUILD_DUMMY_DRIVER, test x$enable_dummy_driver = xyes)
166
167 AC_ARG_WITH(drivers-path,
168     [AC_HELP_STRING([--with-drivers-path=[[path]]],
169                     [drivers path])],
170     [], [with_drivers_path="$libdir/dri"])
171
172 LIBVA_DRIVERS_PATH="$with_drivers_path"
173 AC_SUBST(LIBVA_DRIVERS_PATH)
174
175 AC_DISABLE_STATIC
176 AC_PROG_LIBTOOL
177 AC_PROG_CC
178 AC_PROG_CXX
179 AM_PROG_CC_C_O
180 PKG_PROG_PKG_CONFIG
181
182 AC_HEADER_STDC
183 AC_SYS_LARGEFILE
184
185 # Check for Doxygen
186 if test "$enable_docs" = "yes"; then
187     AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
188     if test "$DOXYGEN" = "no"; then
189        enable_docs="no"
190     fi
191 fi
192 AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
193
194 # Check for va messaging
195 if test "$enable_va_messaging" = "yes"; then
196     AC_DEFINE([ENABLE_VA_MESSAGING], [1], [Defined to 1 if va messaging is needed])
197 fi
198
199 # Check for __attribute__((visibility()))
200 AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
201     ac_cv_have_gnuc_visibility_attribute,
202     [cat > conftest.c <<EOF
203 int foo __attribute__ ((visibility ("hidden"))) = 1;
204 int bar __attribute__ ((visibility ("protected"))) = 1;
205 EOF
206     ac_cv_have_gnuc_visibility_attribute="no"
207     if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
208         if grep '\.hidden.*foo' conftest.s >/dev/null; then
209             if grep '\.protected.*bar' conftest.s >/dev/null; then
210                 ac_cv_have_gnuc_visibility_attribute="yes"
211             fi
212         fi
213     fi
214     rm -f conftest.[cs]
215 ])
216 if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
217     AC_DEFINE([HAVE_GNUC_VISIBILITY_ATTRIBUTE], [1],
218               [Defined to 1 if GCC visibility attribute is supported])
219 fi
220
221 # Check for DRM (mandatory)
222 LIBDRM_VERSION=libdrm_version
223 PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
224 AC_SUBST(LIBDRM_VERSION)
225
226 USE_DRM="no"
227 if test "$enable_drm" = "yes"; then
228     USE_DRM="yes"
229     AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is built])
230 fi
231 AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
232
233 # Check for X11
234 USE_X11="no"
235 if test "$enable_x11" = "yes"; then
236     USE_X11="yes"
237     PKG_CHECK_MODULES([X11],    [x11],    [:], [USE_X11="no"])
238     PKG_CHECK_MODULES([XEXT],   [xext],   [:], [USE_X11="no"])
239     PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
240     if test "$USE_X11" = "yes"; then
241         AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
242     fi
243 fi
244 AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
245
246 # Check for GLX
247 USE_GLX="no"
248 if test "$USE_X11:$enable_glx" = "yes:yes"; then
249     PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
250     saved_CPPFLAGS="$CPPFLAGS"
251     saved_LIBS="$LIBS"
252     CPPFLAGS="$CPPFLAGS $GLX_CFLAGS"
253     LIBS="$LIBS $GLX_LIBS"
254     AC_CHECK_HEADERS([GL/gl.h GL/glx.h], [:], [USE_GLX="no"])
255     AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
256     CPPFLAGS="$saved_CPPFLAGS"
257     LIBS="$saved_LIBS"
258     if test "$USE_GLX" = "yes"; then
259         AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
260     fi
261 fi
262 AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
263
264 # Check for EGL
265 USE_EGL="no"
266 if test "$enable_egl" = "yes"; then
267     PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [:])
268     saved_CPPFLAGS="$CPPFLAGS"
269     saved_LIBS="$LIBS"
270     CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
271     LIBS="$LIBS $EGL_LIBS"
272     AC_CHECK_HEADERS([EGL/egl.h], [:], [USE_EGL="no"])
273     AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
274     CPPFLAGS="$saved_CPPFLAGS"
275     LIBS="$saved_LIBS"
276     if test "$USE_EGL" = "yes"; then
277         AC_DEFINE([HAVE_VA_EGL], [1], [Defined to 1 if VA/EGL API is built])
278     fi
279 fi
280 AM_CONDITIONAL(USE_EGL, test "$USE_EGL" = "yes")
281
282 # Check for Wayland
283 WAYLAND_API_VERSION=wayland_api_version
284 AC_SUBST(WAYLAND_API_VERSION)
285
286 USE_WAYLAND="no"
287 if test "$enable_wayland" = "yes"; then
288     PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
289         [USE_WAYLAND="yes"], [:])
290     if test "$USE_WAYLAND" = "yes"; then
291
292         WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
293         AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
294                      [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
295         if test "x$WAYLAND_SCANNER" = "x"; then
296             AC_MSG_ERROR([wayland-scanner not found: Install it or use --disable-wayland])
297         fi
298
299         AC_DEFINE([HAVE_VA_WAYLAND], [1],
300                   [Defined to 1 if VA/Wayland API is built])
301     fi
302 fi
303
304 AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
305
306 pkgconfigdir=${libdir}/pkgconfig
307 AC_SUBST(pkgconfigdir)
308
309 # Check for builds without backend
310 if test "$USE_DRM:$USE_X11:$USE_WAYLAND" = "no:no:no"; then
311     AC_MSG_ERROR([Please select at least one backend (DRM, X11, Wayland)])
312 fi
313
314 # Define __vaDriverInit*() function name for dummy backend
315 VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_API_MAJOR_VERSION}_${VA_API_MINOR_VERSION}"
316 AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC],
317     [Defined to the versioned __vaDriverInit function name])
318
319 AC_OUTPUT([
320     Makefile
321     doc/Makefile
322     dummy_drv_video/Makefile
323     pkgconfig/Makefile
324     pkgconfig/libva-drm.pc
325     pkgconfig/libva-egl.pc
326     pkgconfig/libva-glx.pc
327     pkgconfig/libva-tpi.pc
328     pkgconfig/libva-wayland.pc
329     pkgconfig/libva-x11.pc
330     pkgconfig/libva.pc
331     va/Makefile
332     va/drm/Makefile
333     va/egl/Makefile
334     va/glx/Makefile
335     va/va_version.h
336     va/wayland/Makefile
337     va/x11/Makefile
338 ])
339
340 # Print a small summary
341 BACKENDS=""
342 AS_IF([test x$USE_DRM = xyes], [BACKENDS="$BACKENDS drm"])
343 AS_IF([test x$USE_X11 = xyes], [BACKENDS="$BACKENDS x11"])
344 AS_IF([test x$USE_GLX = xyes], [BACKENDS="$BACKENDS glx"])
345 AS_IF([test x$USE_EGL = xyes], [BACKENDS="$BACKENDS egl"])
346 AS_IF([test x$USE_WAYLAND = xyes], [BACKENDS="$BACKENDS wayland"])
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 driver ............... : $enable_dummy_driver
355 echo Build documentation .............. : $enable_docs
356 echo Build with messaging ............. : $enable_va_messaging
357 echo