1# intel-hybrid-driver package version number
2m4_define([intel_driver_major_version], [1])
3m4_define([intel_driver_minor_version], [0])
4m4_define([intel_driver_micro_version], [2])
5m4_define([intel_driver_pre_version],   [0])
6m4_define([intel_driver_version],
7          [intel_driver_major_version.intel_driver_minor_version.intel_driver_micro_version])
8m4_if(intel_driver_pre_version, [0], [], [
9m4_append([intel_driver_version], intel_driver_pre_version, [.pre])
10])
11
12# libva minimum version requirement
13m4_define([va_api_version], [1.0.0])
14
15# libdrm minimum version requirement
16m4_define([libdrm_version], [2.4.45])
17
18# cmrt minimum version requirement
19m4_define([cmrt_version], [0.10.0])
20
21AC_PREREQ([2.57])
22AC_INIT([intel_driver], [intel_driver_version], [haihao.xiang@intel.com],
23        [libva-intel-driver])
24AC_CONFIG_SRCDIR([Makefile.am])
25AM_INIT_AUTOMAKE([1.9 tar-ustar])
26
27AC_CONFIG_HEADERS([src/config.h])
28
29INTEL_DRIVER_MAJOR_VERSION=intel_driver_major_version
30INTEL_DRIVER_MINOR_VERSION=intel_driver_minor_version
31INTEL_DRIVER_MICRO_VERSION=intel_driver_micro_version
32AC_DEFINE([INTEL_DRIVER_MAJOR_VERSION], [intel_driver_major_version], [Major version of the driver])
33AC_DEFINE([INTEL_DRIVER_MINOR_VERSION], [intel_driver_minor_version], [Minor version of the driver])
34AC_DEFINE([INTEL_DRIVER_MICRO_VERSION], [intel_driver_micro_version], [Micro version of the driver])
35AC_DEFINE([INTEL_DRIVER_PRE_VERSION], [intel_driver_pre_version], [Preversion of the driver])
36
37INTEL_DRIVER_LT_LDFLAGS="-avoid-version"
38AC_SUBST(INTEL_DRIVER_LT_LDFLAGS)
39
40dnl Use pretty build output with automake >= 1.11
41m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [
42    AM_DEFAULT_VERBOSITY=1
43    AC_SUBST(AM_DEFAULT_VERBOSITY)
44])
45
46AC_ARG_ENABLE(drm,
47    [AC_HELP_STRING([--enable-drm],
48                    [build with VA/DRM API support @<:@default=yes@:>@])],
49    [], [enable_drm="yes"])
50
51AC_ARG_ENABLE(x11,
52    [AC_HELP_STRING([--enable-x11],
53                    [build with VA/X11 API support @<:@default=yes@:>@])],
54    [], [enable_x11="yes"])
55
56AC_ARG_ENABLE([wayland],
57    [AC_HELP_STRING([--enable-wayland],
58                    [build with VA/Wayland API support @<:@default=yes@:>@])],
59    [], [enable_wayland="yes"])
60
61AC_DISABLE_STATIC
62AC_PROG_LIBTOOL
63AC_PROG_CC
64AM_PROG_CC_C_O
65AC_PROG_CXX
66
67AC_C_BIGENDIAN
68AC_HEADER_STDC
69AC_SYS_LARGEFILE
70AC_CHECK_LIB([m], [sin])
71AC_CHECK_FUNCS([log2f])
72
73dnl Check for recent enough DRM
74LIBDRM_VERSION=libdrm_version
75PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
76PKG_CHECK_MODULES([DRM_INTEL], [libdrm_intel >= $LIBDRM_VERSION])
77AC_SUBST(LIBDRM_VERSION)
78
79dnl Check for recent enough CMRT
80CMRT_VERSION=cmrt_version
81PKG_CHECK_MODULES([CMRT], [libcmrt >= $CMRT_VERSION])
82AC_SUBST(CMRT_VERSION)
83
84dnl Check for gen4asm
85PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.9], [gen4asm=yes], [gen4asm=no])
86AC_PATH_PROG([GEN4ASM], [intel-gen4asm])
87AS_IF([test "x$GEN4ASM" = "x" ], [AM_CONDITIONAL(HAVE_GEN4ASM, false)],
88    [AM_CONDITIONAL(HAVE_GEN4ASM, [test x$gen4asm = xyes])])
89
90dnl Check for VA-API
91PKG_CHECK_MODULES(LIBVA_DEPS,     [libva >= va_api_version])
92
93dnl Check for VA/DRM API
94USE_DRM="$enable_drm"
95if test "$USE_DRM" = "yes"; then
96    PKG_CHECK_MODULES(LIBVA_DRM_DEPS, [libva-drm],
97      [AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is enabled])],
98      [USE_DRM="no"])
99
100    # Check for <drm_fourcc.h>
101    if test "$USE_DRM" = "yes"; then
102        saved_CPPFLAGS="$CPPFLAGS"
103        CPPFLAGS="$CPPFLAGS $DRM_CFLAGS"
104        AC_CHECK_HEADERS([drm_fourcc.h], [:], [USE_DRM="no"])
105        CPPFLAGS="$saved_CPPFLAGS"
106    fi
107fi
108AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
109
110VA_VERSION=`$PKG_CONFIG --modversion libva`
111VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
112VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
113VA_MICRO_VERSION=`echo "$VA_VERSION" | cut -d'.' -f3`
114VA_VERSION_STR="$VA_VERSION"
115
116va_full_version_int=`expr ${VA_MAJOR_VERSION:-0} "*" 1000000 + \
117                          ${VA_MINOR_VERSION:-0} "*" 10000   + \
118                          ${VA_MICRO_VERSION:-0} "*" 100     + \
119                          0`
120VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_MAJOR_VERSION}_${VA_MINOR_VERSION}"
121AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC],
122    [Define driver entry-point])
123
124dnl Check for VA/DRM API
125USE_X11="$enable_x11"
126if test "$USE_X11" = "yes"; then
127    PKG_CHECK_MODULES(LIBVA_X11_DEPS, [libva-x11],
128      [AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is enabled])],
129      [USE_X11="no"])
130fi
131AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
132
133dnl Check for VA-API drivers path
134AC_MSG_CHECKING([for VA drivers path])
135LIBVA_DRIVERS_PATH=`$PKG_CONFIG libva --variable driverdir`
136if test -z "$LIBVA_DRIVERS_PATH"; then
137    LIBVA_DRIVERS_PATH="${libdir}/xorg/modules/drivers"
138fi
139AC_MSG_RESULT([$LIBVA_DRIVERS_PATH])
140AC_SUBST(LIBVA_DRIVERS_PATH)
141
142# Check for EGL
143if test "$enable_wayland" = "yes"; then
144    enable_egl="yes"
145fi
146
147USE_EGL="no"
148if test "$enable_egl" = "yes"; then
149    PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [USE_EGL="no"])
150    saved_CPPFLAGS="$CPPFLAGS"
151    saved_LIBS="$LIBS"
152    CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
153    LIBS="$LIBS $EGL_LIBS"
154    AC_CHECK_HEADERS([EGL/egl.h], [:], [USE_EGL="no"])
155    AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
156    CPPFLAGS="$saved_CPPFLAGS"
157    LIBS="$saved_LIBS"
158fi
159AM_CONDITIONAL(USE_EGL, test "$USE_EGL" = "yes")
160
161# Check for Wayland
162USE_WAYLAND="no"
163if test "$enable_wayland" = "yes"; then
164    PKG_CHECK_MODULES([WAYLAND], [wayland-client], [USE_WAYLAND="yes"], [:])
165    PKG_CHECK_MODULES([LIBVA_WAYLAND_DEPS], [libva-wayland],
166        [AC_DEFINE([HAVE_VA_WAYLAND], [1], [Defined to 1 if VA/Wayland API is enabled])],
167        [USE_WAYLAND="no"])
168fi
169AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
170
171m4_ifdef([WAYLAND_SCANNER_RULES],
172    [WAYLAND_SCANNER_RULES(['$(top_builddir)/src/wayland'])],
173    [wayland_scanner_rules=""; AC_SUBST(wayland_scanner_rules)])
174
175AC_OUTPUT([
176    Makefile
177    debian.upstream/Makefile
178    src/Makefile
179    src/vp9hdec/Makefile
180    ])
181
182dnl Print summary
183BACKENDS=""
184AS_IF([test "$USE_DRM" = "yes"], [BACKENDS="$BACKENDS drm"])
185AS_IF([test "$USE_X11" = "yes"], [BACKENDS="$BACKENDS x11"])
186AS_IF([test "$USE_WAYLAND" = "yes"], [BACKENDS="$BACKENDS wayland"])
187
188echo
189echo $PACKAGE configuration summary:
190echo
191echo VA-API version ................... : $VA_VERSION_STR
192echo VA-API drivers path .............. : $LIBVA_DRIVERS_PATH
193echo Windowing systems ................ : $BACKENDS
194echo
195