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