blob: 1d9be8d1bd0b818deaad1c4f5fed45f022dc2be9 [file] [log] [blame]
root86c93d92010-04-07 11:47:48 +08001# 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:
Fei Jiang901c77a2010-10-02 02:19:14 +080010#
root86c93d92010-04-07 11:47:48 +080011# 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.
Fei Jiang901c77a2010-10-02 02:19:14 +080014#
root86c93d92010-04-07 11:47:48 +080015# 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
hding34b672db2012-06-11 21:10:54 +080023# 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
29m4_define([va_api_major_version], [0])
30m4_define([va_api_minor_version], [34])
31m4_define([va_api_micro_version], [0])
32
33m4_define([va_api_version],
34 [va_api_major_version.va_api_minor_version.va_api_micro_version])
35
root86c93d92010-04-07 11:47:48 +080036# libva package version number, (as distinct from shared library version)
hding34b672db2012-06-11 21:10:54 +080037# 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
43m4_define([libva_major_version], [m4_eval(va_api_major_version + 1)])
44m4_define([libva_minor_version], [m4_eval(va_api_minor_version - 32)])
wangkuncceaa052011-03-09 13:39:43 +080045m4_define([libva_micro_version], [0])
hding34b672db2012-06-11 21:10:54 +080046m4_define([libva_pre_version], [1])
root86c93d92010-04-07 11:47:48 +080047
48m4_define([libva_version],
49 [libva_major_version.libva_minor_version.libva_micro_version])
hding34b672db2012-06-11 21:10:54 +080050m4_if(libva_pre_version, [0], [], [
51m4_append([libva_version], libva_pre_version, [.pre])
52])
root86c93d92010-04-07 11:47:48 +080053
hding34b672db2012-06-11 21:10:54 +080054# 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
65m4_define([libva_interface_bias], [m4_eval(va_api_major_version + 1)])
66m4_define([libva_interface_age], [0])
67m4_define([libva_binary_age],
68 [m4_eval(100 * va_api_minor_version + va_api_micro_version - libva_interface_age)])
69
70m4_define([libva_lt_current],
71 [m4_eval(100 * va_api_minor_version + va_api_micro_version + libva_interface_bias)])
72m4_define([libva_lt_revision],
73 [m4_eval(libva_interface_age)])
74m4_define([libva_lt_age],
75 [m4_eval(libva_binary_age - libva_interface_age)])
76
77# libdrm minimun version requirement
78m4_define([libdrm_version], [2.4])
root86c93d92010-04-07 11:47:48 +080079
Austin Yuan409de6a2013-03-05 14:54:42 +080080# Wayland minimum version number
81m4_define([wayland_api_version], [1.0.0])
82
root86c93d92010-04-07 11:47:48 +080083AC_PREREQ(2.57)
84AC_INIT([libva], [libva_version], [waldo.bastian@intel.com], libva)
85AC_CONFIG_SRCDIR([Makefile.am])
86AM_INIT_AUTOMAKE([dist-bzip2])
87
88AM_CONFIG_HEADER([config.h])
wangkuncceaa052011-03-09 13:39:43 +080089m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
root86c93d92010-04-07 11:47:48 +080090
hding34b672db2012-06-11 21:10:54 +080091VA_API_MAJOR_VERSION=va_api_major_version
92VA_API_MINOR_VERSION=va_api_minor_version
93VA_API_MICRO_VERSION=va_api_micro_version
94VA_API_VERSION=va_api_version
95AC_SUBST(VA_API_MAJOR_VERSION)
96AC_SUBST(VA_API_MINOR_VERSION)
97AC_SUBST(VA_API_MICRO_VERSION)
98AC_SUBST(VA_API_VERSION)
99
root86c93d92010-04-07 11:47:48 +0800100LIBVA_MAJOR_VERSION=libva_major_version
101LIBVA_MINOR_VERSION=libva_minor_version
102LIBVA_MICRO_VERSION=libva_micro_version
103LIBVA_VERSION=libva_version
104AC_SUBST(LIBVA_MAJOR_VERSION)
105AC_SUBST(LIBVA_MINOR_VERSION)
106AC_SUBST(LIBVA_MICRO_VERSION)
107AC_SUBST(LIBVA_VERSION)
108
109LIBVA_LT_CURRENT=libva_lt_current
110LIBVA_LT_REV=libva_lt_revision
111LIBVA_LT_AGE=libva_lt_age
112LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
113LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
114AC_SUBST(LIBVA_LT_VERSION)
115AC_SUBST(LIBVA_LT_LDFLAGS)
116
hding34b672db2012-06-11 21:10:54 +0800117AC_ARG_ENABLE(docs,
118 [AC_HELP_STRING([--enable-docs],
119 [build Doxygen documentation @<:@default=no@:>@])],
120 [], [enable_docs="no"])
121
Austin Yuan409de6a2013-03-05 14:54:42 +0800122AC_ARG_ENABLE(drm,
123 [AC_HELP_STRING([--enable-drm],
124 [build with VA/DRM API support @<:@default=yes@:>@])],
125 [], [enable_drm="yes"])
126
127AC_ARG_ENABLE(x11,
128 [AC_HELP_STRING([--enable-x11],
129 [build with VA/X11 API support @<:@default=yes@:>@])],
130 [], [enable_x11="yes"])
131
Fei Jiangb0fac492010-06-11 10:38:21 +0800132AC_ARG_ENABLE(glx,
hding34b672db2012-06-11 21:10:54 +0800133 [AC_HELP_STRING([--enable-glx],
Austin Yuan409de6a2013-03-05 14:54:42 +0800134 [build with VA/GLX API support @<:@default=yes@:>@])],
hding34b672db2012-06-11 21:10:54 +0800135 [], [enable_glx="yes"])
136
137AC_ARG_ENABLE(egl,
138 [AC_HELP_STRING([--enable-egl],
Austin Yuan409de6a2013-03-05 14:54:42 +0800139 [build with VA/EGL API support @<:@default=yes@:>@])],
hding34b672db2012-06-11 21:10:54 +0800140 [], [enable_egl="yes"])
Fei Jiangb0fac492010-06-11 10:38:21 +0800141
Austin Yuan409de6a2013-03-05 14:54:42 +0800142AC_ARG_ENABLE([wayland],
143 [AC_HELP_STRING([--enable-wayland],
144 [build with VA/Wayland API support @<:@default=yes@:>@])],
145 [], [enable_wayland="yes"])
146
root86c93d92010-04-07 11:47:48 +0800147AC_ARG_WITH(drivers-path,
hding34b672db2012-06-11 21:10:54 +0800148 [AC_HELP_STRING([--with-drivers-path=[[path]]],
149 [drivers path])],
150 [], [with_drivers_path="$libdir/dri"])
root86c93d92010-04-07 11:47:48 +0800151
152LIBVA_DRIVERS_PATH="$with_drivers_path"
153AC_SUBST(LIBVA_DRIVERS_PATH)
154
155AC_DISABLE_STATIC
156AC_PROG_LIBTOOL
157AC_PROG_CC
Austin Yuandb88fae2011-05-03 15:55:46 +0800158AC_PROG_CXX
Austin Yuan409de6a2013-03-05 14:54:42 +0800159AM_PROG_CC_C_O
160PKG_PROG_PKG_CONFIG
root86c93d92010-04-07 11:47:48 +0800161
162AC_HEADER_STDC
163AC_SYS_LARGEFILE
164
hding34b672db2012-06-11 21:10:54 +0800165# Check for Doxygen
166if test "$enable_docs" = "yes"; then
Austin Yuan409de6a2013-03-05 14:54:42 +0800167 AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
168 if test "$DOXYGEN" = "no"; then
169 enable_docs="no"
170 fi
hding34b672db2012-06-11 21:10:54 +0800171fi
172AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
173
Austin Yuan409de6a2013-03-05 14:54:42 +0800174# Check for __attribute__((visibility()))
175AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
176 ac_cv_have_gnuc_visibility_attribute,
177 [cat > conftest.c <<EOF
178int foo __attribute__ ((visibility ("hidden"))) = 1;
179int bar __attribute__ ((visibility ("protected"))) = 1;
180EOF
181 ac_cv_have_gnuc_visibility_attribute="no"
182 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
183 if grep '\.hidden.*foo' conftest.s >/dev/null; then
184 if grep '\.protected.*bar' conftest.s >/dev/null; then
185 ac_cv_have_gnuc_visibility_attribute="yes"
186 fi
187 fi
188 fi
189 rm -f conftest.[cs]
190])
191if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
192 AC_DEFINE([HAVE_GNUC_VISIBILITY_ATTRIBUTE], [1],
193 [Defined to 1 if GCC visibility attribute is supported])
194fi
root86c93d92010-04-07 11:47:48 +0800195
Fei Jiangb0fac492010-06-11 10:38:21 +0800196
Austin Yuan409de6a2013-03-05 14:54:42 +0800197# Check for DRM (mandatory)
198LIBDRM_VERSION=libdrm_version
199PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
200AC_SUBST(LIBDRM_VERSION)
201
202USE_DRM="no"
203if test "$enable_drm" = "yes"; then
204 USE_DRM="yes"
205 AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is built])
206fi
207AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
208
209# Check for X11
210USE_X11="no"
211if test "$enable_x11" = "yes"; then
212 USE_X11="yes"
213 PKG_CHECK_MODULES([X11], [x11], [:], [USE_X11="no"])
214 PKG_CHECK_MODULES([XEXT], [xext], [:], [USE_X11="no"])
215 PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
216 if test "$USE_X11" = "yes"; then
217 AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
218 fi
219fi
220AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
221
hding34b672db2012-06-11 21:10:54 +0800222# Check for GLX
Fei Jiangb0fac492010-06-11 10:38:21 +0800223USE_GLX="no"
Austin Yuan409de6a2013-03-05 14:54:42 +0800224if test "$USE_X11:$enable_glx" = "yes:yes"; then
225 PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
226 saved_CPPFLAGS="$CPPFLAGS"
227 saved_LIBS="$LIBS"
228 CPPFLAGS="$CPPFLAGS $GLX_CFLAGS"
229 LIBS="$LIBS $GLX_LIBS"
230 AC_CHECK_HEADERS([GL/gl.h GL/glx.h], [:], [USE_GLX="no"])
231 AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
232 CPPFLAGS="$saved_CPPFLAGS"
233 LIBS="$saved_LIBS"
234 if test "$USE_GLX" = "yes"; then
235 AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
236 fi
Fei Jiangb0fac492010-06-11 10:38:21 +0800237fi
Fei Jiangb0fac492010-06-11 10:38:21 +0800238AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
239
hding34b672db2012-06-11 21:10:54 +0800240# Check for EGL
241USE_EGL="no"
hding34b672db2012-06-11 21:10:54 +0800242if test "$enable_egl" = "yes"; then
Austin Yuan409de6a2013-03-05 14:54:42 +0800243 PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [:])
244 saved_CPPFLAGS="$CPPFLAGS"
245 saved_LIBS="$LIBS"
246 CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
247 LIBS="$LIBS $EGL_LIBS"
248 AC_CHECK_HEADERS([EGL/egl.h], [:], [USE_EGL="no"])
249 AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
250 CPPFLAGS="$saved_CPPFLAGS"
251 LIBS="$saved_LIBS"
252 if test "$USE_EGL" = "yes"; then
253 AC_DEFINE([HAVE_VA_EGL], [1], [Defined to 1 if VA/EGL API is built])
254 fi
hding34b672db2012-06-11 21:10:54 +0800255fi
wangkuncceaa052011-03-09 13:39:43 +0800256AM_CONDITIONAL(USE_EGL, test "$USE_EGL" = "yes")
257
Austin Yuan409de6a2013-03-05 14:54:42 +0800258# Check for Wayland
259WAYLAND_API_VERSION=wayland_api_version
260AC_SUBST(WAYLAND_API_VERSION)
261
262USE_WAYLAND="no"
263if test "$enable_wayland" = "yes"; then
264 PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
265 [USE_WAYLAND="yes"], [:])
266 if test "$USE_WAYLAND" = "yes"; then
267 AC_DEFINE([HAVE_VA_WAYLAND], [1],
268 [Defined to 1 if VA/Wayland API is built])
269 fi
270fi
271AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
272
273m4_ifdef([WAYLAND_SCANNER_RULES],
274 [WAYLAND_SCANNER_RULES(['$(top_srcdir)/va/wayland/protocol'])],
275 [wayland_scanner_rules=""; AC_SUBST(wayland_scanner_rules)])
276
root86c93d92010-04-07 11:47:48 +0800277# We only need the headers, we don't link against the DRM libraries
278LIBVA_CFLAGS="$DRM_CFLAGS"
279AC_SUBST(LIBVA_CFLAGS)
280AC_SUBST(LIBVA_LIBS)
281
282pkgconfigdir=${libdir}/pkgconfig
283AC_SUBST(pkgconfigdir)
284
Austin Yuan409de6a2013-03-05 14:54:42 +0800285# Check for builds without backend
286if test "$USE_DRM:$USE_X11:$USE_WAYLAND" = "no:no:no"; then
287 AC_MSG_ERROR([Please select at least one backend (DRM, X11, Wayland)])
288fi
root86c93d92010-04-07 11:47:48 +0800289
290AC_OUTPUT([
hding34b672db2012-06-11 21:10:54 +0800291 Makefile
292 debian.upstream/Makefile
293 doc/Makefile
hding34b672db2012-06-11 21:10:54 +0800294 pkgconfig/Makefile
Austin Yuan409de6a2013-03-05 14:54:42 +0800295 pkgconfig/libva-drm.pc
hding34b672db2012-06-11 21:10:54 +0800296 pkgconfig/libva-egl.pc
297 pkgconfig/libva-glx.pc
298 pkgconfig/libva-tpi.pc
Austin Yuan409de6a2013-03-05 14:54:42 +0800299 pkgconfig/libva-wayland.pc
hding34b672db2012-06-11 21:10:54 +0800300 pkgconfig/libva-x11.pc
301 pkgconfig/libva.pc
302 test/Makefile
303 test/basic/Makefile
Austin Yuan409de6a2013-03-05 14:54:42 +0800304 test/common/Makefile
hding34b672db2012-06-11 21:10:54 +0800305 test/decode/Makefile
306 test/encode/Makefile
307 test/putsurface/Makefile
308 test/transcode/Makefile
309 test/vainfo/Makefile
310 va/Makefile
Austin Yuan409de6a2013-03-05 14:54:42 +0800311 va/drm/Makefile
hding34b672db2012-06-11 21:10:54 +0800312 va/egl/Makefile
313 va/glx/Makefile
314 va/va_version.h
Austin Yuan409de6a2013-03-05 14:54:42 +0800315 va/wayland/Makefile
316 va/wayland/protocol/Makefile
hding34b672db2012-06-11 21:10:54 +0800317 va/x11/Makefile
root86c93d92010-04-07 11:47:48 +0800318])
319
wangkuncceaa052011-03-09 13:39:43 +0800320# Print a small summary
Austin Yuan409de6a2013-03-05 14:54:42 +0800321AS_IF([test x$USE_DRM = xyes], [BACKENDS="drm $BACKENDS"])
322AS_IF([test x$USE_X11 = xyes], [BACKENDS="x11 $BACKENDS"])
wangkuncceaa052011-03-09 13:39:43 +0800323AS_IF([test x$USE_GLX = xyes], [BACKENDS="glx $BACKENDS"])
324AS_IF([test x$USE_EGL = xyes], [BACKENDS="egl $BACKENDS"])
Austin Yuan409de6a2013-03-05 14:54:42 +0800325AS_IF([test x$USE_WAYLAND = xyes], [BACKENDS="wayland $BACKENDS"])
wangkuncceaa052011-03-09 13:39:43 +0800326
hding34b672db2012-06-11 21:10:54 +0800327echo
328echo "libva - ${LIBVA_VERSION} (VA-API ${VA_API_VERSION})"
329echo
330echo Installation prefix .............. : $prefix
331echo Default driver path .............. : $LIBVA_DRIVERS_PATH
332echo Extra window systems ............. : $BACKENDS
hding34b672db2012-06-11 21:10:54 +0800333echo Build documentation .............. : $enable_docs
334echo