Fix build with older VA-API (libva).
[profile/ivi/vaapi-intel-driver.git] / configure.ac
1 # intel-driver package version number
2 m4_define([intel_driver_major_version], [1])
3 m4_define([intel_driver_minor_version], [0])
4 m4_define([intel_driver_micro_version], [16])
5 m4_define([intel_driver_pre_version],   [1])
6 m4_define([intel_driver_version],
7           [intel_driver_major_version.intel_driver_minor_version.intel_driver_micro_version])
8 m4_if(intel_driver_pre_version, [0], [], [
9 m4_append([intel_driver_version], intel_driver_pre_version, [.pre])
10 ])
11
12 # libva minimum version requirement
13 m4_define([libva_package_version], [1.0.14])
14
15 # libdrm minimum version requirement
16 m4_define([libdrm_version], [2.4.23])
17
18 AC_PREREQ([2.57])
19 AC_INIT([intel_driver], [intel_driver_version], [haihao.xiang@intel.com],
20         [libva-driver-intel])
21 AC_CONFIG_SRCDIR([Makefile.am])
22 AM_INIT_AUTOMAKE
23
24 AM_CONFIG_HEADER([src/config.h])
25
26 INTEL_DRIVER_MAJOR_VERSION=intel_driver_major_version
27 INTEL_DRIVER_MINOR_VERSION=intel_driver_minor_version
28 INTEL_DRIVER_MICRO_VERSION=intel_driver_micro_version
29 AC_DEFINE([INTEL_DRIVER_MAJOR_VERSION], [intel_driver_major_version], [Major version of the driver])
30 AC_DEFINE([INTEL_DRIVER_MINOR_VERSION], [intel_driver_minor_version], [Minor version of the driver])
31 AC_DEFINE([INTEL_DRIVER_MICRO_VERSION], [intel_driver_micro_version], [Micro version of the driver])
32 AC_DEFINE([INTEL_DRIVER_PRE_VERSION], [intel_driver_pre_version], [Preversion of the driver])
33
34 INTEL_DRIVER_LT_LDFLAGS="-avoid-version"
35 AC_SUBST(INTEL_DRIVER_LT_LDFLAGS)
36
37 dnl Use pretty build output with automake >= 1.11
38 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [
39     AM_DEFAULT_VERBOSITY=1
40     AC_SUBST(AM_DEFAULT_VERBOSITY)
41 ])
42
43 AC_DISABLE_STATIC
44 AC_PROG_LIBTOOL
45 AC_PROG_CC
46 AM_PROG_CC_C_O
47
48 AC_C_BIGENDIAN
49 AC_HEADER_STDC
50 AC_SYS_LARGEFILE
51
52 LIBVA_PACKAGE_VERSION=libva_package_version
53 AC_SUBST(LIBVA_PACKAGE_VERSION)
54
55 dnl Check for recent enough DRM
56 LIBDRM_VERSION=libdrm_version
57 PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
58 AC_SUBST(LIBDRM_VERSION)
59
60 dnl Check for gen4asm
61 PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.2], [gen4asm=yes], [gen4asm=no])
62 AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes)
63 AC_PATH_PROG([GEN4ASM], [intel-gen4asm])
64
65 dnl Check for VA-API
66 PKG_CHECK_MODULES(LIBVA_DEPS,     [libva])
67 PKG_CHECK_MODULES(LIBVA_X11_DEPS, [libva-x11])
68
69 VA_VERSION=`$PKG_CONFIG --modversion libva`
70 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
71 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
72 VA_MICRO_VERSION=`echo "$VA_VERSION" | cut -d'.' -f3`
73 VA_VERSION_STR="$VA_VERSION"
74
75 va_full_version_int=`expr ${VA_MAJOR_VERSION:-0} "*" 1000000 + \
76                           ${VA_MINOR_VERSION:-0} "*" 10000   + \
77                           ${VA_MICRO_VERSION:-0} "*" 100     + \
78                           0`
79 VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_MAJOR_VERSION}_${VA_MINOR_VERSION}"
80 AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC],
81     [Define driver entry-point])
82
83 dnl Check for VA-API drivers path
84 AC_MSG_CHECKING([for VA drivers path])
85 LIBVA_DRIVERS_PATH=`$PKG_CONFIG libva --variable driverdir`
86 if test -z "$LIBVA_DRIVERS_PATH"; then
87     LIBVA_DRIVERS_PATH="/usr/lib/xorg/modules/drivers"
88 fi
89 AC_MSG_RESULT([$LIBVA_DRIVERS_PATH])
90 AC_SUBST(LIBVA_DRIVERS_PATH)
91
92 dnl Check for JPEG decoding API
93 AC_CACHE_CHECK([for JPEG decoding API], ac_cv_have_jpeg_decoding_api, [
94     saved_CFLAGS="$CFLAGS"
95     CFLAGS="$CFLAGS $LIBVA_DEPS_CFLAGS"
96     saved_LIBS="$LIBS"
97     LIBS="$CFLAGS $LIBVA_DEPS_LIBS"
98     AC_TRY_COMPILE(
99         [#include <va/va.h>],
100         [VAPictureParameterBufferJPEG pic_param;
101          VASliceParameterBufferJPEG slice_param;
102          VAIQMatrixBufferJPEG iq_matrix;],
103         [ac_cv_have_jpeg_decoding_api="yes"],
104         [ac_cv_have_jpeg_decoding_api="no"]
105     )
106     CFLAGS="$saved_CFLAGS"
107     LIBS="$saved_LIBS"
108 ])
109 if test "$ac_cv_have_jpeg_decoding_api" = "yes"; then
110     AC_DEFINE(HAVE_JPEG_DECODING, 1,
111         [Defined to 1 if VA-API exposes JPEG decoding])
112 fi
113
114 AC_OUTPUT([
115     Makefile
116     debian.upstream/Makefile 
117     src/Makefile
118     src/shaders/Makefile
119     src/shaders/h264/Makefile
120     src/shaders/h264/ildb/Makefile
121     src/shaders/h264/mc/Makefile
122     src/shaders/mpeg2/Makefile
123     src/shaders/mpeg2/vld/Makefile
124     src/shaders/post_processing/Makefile
125     src/shaders/render/Makefile
126     src/shaders/vme/Makefile
127 ])
128
129 dnl Print summary
130 echo
131 echo $PACKAGE configuration summary:
132 echo
133 echo VA-API version ................... : $VA_VERSION_STR
134 echo VA-API drivers path .............. : $LIBVA_DRIVERS_PATH
135 echo