• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# libva-utils package version number
24# package version number follows libva package version number to
25# comply with the same version used for released
26#
27# - major version is libva_major_version
28# - minor version is libva_minor_version
29# - micro version is libva_micro_version
30# - pre version is libva_pre_version, usually development version
31m4_define([libva_utils_major_version], [2])
32m4_define([libva_utils_minor_version], [21])
33m4_define([libva_utils_micro_version], [0])
34m4_define([libva_utils_pre_version],   [0])
35
36m4_define([libva_utils_version],
37          [libva_utils_major_version.libva_utils_minor_version.libva_utils_micro_version])
38m4_if(libva_utils_pre_version, [0], [], [
39m4_append([libva_utils_version], libva_utils_pre_version, [.pre])
40])
41
42# libva minimum version requirement, at this released version
43# libva-utils was created
44m4_define([libva_api_min_version], [1.1.0])
45
46# Wayland minimum version number
47m4_define([wayland_api_version], [1.0.0])
48
49AC_PREREQ(2.57)
50AC_INIT([libva_utils],
51        [libva_utils_version],
52        [https://github.com/intel/libva-utils/issues/new],
53        [libva-utils],
54        [https://github.com/intel/libva-utils])
55AC_CONFIG_SRCDIR([Makefile.am])
56AC_CONFIG_MACRO_DIR([m4])
57AM_INIT_AUTOMAKE([dist-bzip2])
58
59AC_CONFIG_HEADERS([config.h])
60m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
61
62TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
63AC_SUBST(TODAY)
64
65LIBVA_UTILS_MAJOR_VERSION=libva_utils_major_version
66LIBVA_UTILS_MINOR_VERSION=libva_utils_minor_version
67LIBVA_UTILS_MICRO_VERSION=libva_utils_micro_version
68LIBVA_UTILS_VERSION=libva_utils_version
69AC_SUBST(LIBVA_UTILS_MAJOR_VERSION)
70AC_SUBST(LIBVA_UTILS_MINOR_VERSION)
71AC_SUBST(LIBVA_UTILS_MICRO_VERSION)
72AC_SUBST(LIBVA_UTILS_VERSION)
73
74AC_ARG_ENABLE(drm,
75    [AC_HELP_STRING([--enable-drm],
76                    [build with VA/DRM API support @<:@default=yes@:>@])],
77    [], [enable_drm="yes"])
78
79AC_ARG_ENABLE(x11,
80    [AC_HELP_STRING([--enable-x11],
81                    [build with VA/X11 API support @<:@default=auto@:>@])],
82    [enable_x11="$enableval"],
83    [enable_x11="auto"])
84
85AC_ARG_ENABLE([wayland],
86    [AC_HELP_STRING([--enable-wayland],
87                    [build with VA/Wayland API support @<:@default=auto@:>@])],
88    [enable_wayland="$enableval"],
89    [enable_wayland="auto"])
90
91AC_ARG_ENABLE([tests],
92    [AC_HELP_STRING([--enable-tests],
93                    [build unit tests @<:@default=no@:>@])],
94    [], [enable_tests="no"])
95
96
97LT_INIT
98AC_DISABLE_STATIC
99AC_PROG_CC
100AC_PROG_CXX
101AM_PROG_CC_C_O
102PKG_PROG_PKG_CONFIG
103
104AC_HEADER_STDC
105AC_SYS_LARGEFILE
106
107# Check for __attribute__((visibility()))
108AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
109    ac_cv_have_gnuc_visibility_attribute,
110    [cat > conftest.c <<EOF
111int foo __attribute__ ((visibility ("hidden"))) = 1;
112int bar __attribute__ ((visibility ("protected"))) = 1;
113EOF
114    ac_cv_have_gnuc_visibility_attribute="no"
115    if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
116        if grep '\.hidden.*foo' conftest.s >/dev/null; then
117            if grep '\.protected.*bar' conftest.s >/dev/null; then
118                ac_cv_have_gnuc_visibility_attribute="yes"
119            fi
120        fi
121    fi
122    rm -f conftest.[cs]
123])
124if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
125    AC_DEFINE([HAVE_GNUC_VISIBILITY_ATTRIBUTE], [1],
126              [Defined to 1 if GCC visibility attribute is supported])
127fi
128
129# Check for -fstack-protector
130ssp_cc=yes
131if test "X$CC-cc" != "X"; then
132    AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
133    ssp_old_cflags="$CFLAGS"
134    CFLAGS="$CFLAGS -fstack-protector"
135    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [], [ssp_cc=no])
136    AC_MSG_RESULT([$ssp_cc])
137    if test "X$ssp_cc" = "Xno"; then
138        CFLAGS="$ssp_old_cflags"
139    else
140        AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
141    fi
142fi
143AM_CONDITIONAL(USE_SSP, test "$ssp_cc" = "yes")
144
145# Check for libva (for dynamic linking)
146LIBVA_API_MIN_VERSION=libva_api_min_version
147PKG_CHECK_MODULES([LIBVA], [libva >= $LIBVA_API_MIN_VERSION])
148LIBVA_VERSION=`$PKG_CONFIG --variable=libva_version libva`
149AC_SUBST(LIBVA_VERSION)
150LIBVA_API_VERSION=`$PKG_CONFIG --modversion libva`
151VA_MAJOR_VERSION=`echo "$LIBVA_API_VERSION" | cut -d'.' -f1`
152VA_MINOR_VERSION=`echo "$LIBVA_API_VERSION" | cut -d'.' -f2`
153VA_MICRO_VERSION=`echo "$LIBVA_API_VERSION" | cut -d'.' -f3`
154
155# Check for DRM (mandatory)
156PKG_CHECK_MODULES([LIBVA_DRM], [libdrm libva-drm = $LIBVA_API_VERSION])
157
158USE_DRM="no"
159if test "$enable_drm" = "yes"; then
160    USE_DRM="yes"
161    AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is supported])
162fi
163AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
164
165# Check for X11
166USE_X11="no"
167if test "x$enable_x11" != "xno"; then
168    PKG_CHECK_MODULES([X11],    [x11 libva-x11 = $LIBVA_API_VERSION],
169        [USE_X11="yes"], [:])
170
171    if test "x$USE_X11" = "xno" -a "x$enable_x11" = "xyes"; then
172       AC_MSG_ERROR([X11 explicitly enabled, but $X11_PKG_ERRORS])
173    fi
174
175    if test "$USE_X11" = "yes"; then
176       AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is supported])
177    fi
178fi
179AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
180
181dnl Check for Wayland
182WAYLAND_API_VERSION=wayland_api_version
183AC_SUBST(WAYLAND_API_VERSION)
184
185USE_WAYLAND="no"
186if test "x$enable_wayland" != "xno"; then
187    PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version libva-wayland = $LIBVA_API_VERSION],
188        [USE_WAYLAND="yes"], [:])
189
190    if test "x$USE_WAYLAND" = "xno" -a "x$enable_wayland" = "xyes"; then
191        AC_MSG_ERROR([wayland explicitly enabled, but $WAYLAND_PKG_ERRORS])
192    fi
193
194    if test "$USE_WAYLAND" = "yes"; then
195
196        WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
197        AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
198                     [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
199
200        AC_DEFINE([HAVE_VA_WAYLAND], [1],
201                  [Defined to 1 if VA/Wayland API is supported])
202    fi
203fi
204
205AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
206
207pkgconfigdir=${libdir}/pkgconfig
208AC_SUBST(pkgconfigdir)
209
210dnl Check for builds without backend
211if test "$USE_DRM:$USE_X11:$USE_WAYLAND" = "no:no:no"; then
212    AC_MSG_ERROR([Please select at least one backend (DRM, X11, Wayland)])
213fi
214
215AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" = "yes")
216
217AC_OUTPUT([
218    Makefile
219    common/Makefile
220    test/Makefile
221    vainfo/Makefile
222    encode/Makefile
223    decode/Makefile
224    putsurface/Makefile
225    videoprocess/Makefile
226    vendor/intel/Makefile
227    vendor/intel/sfcsample/Makefile
228])
229
230
231# Print a small summary
232BACKENDS=""
233AS_IF([test $USE_DRM = yes], [BACKENDS="$BACKENDS drm"])
234AS_IF([test $USE_X11 = yes], [BACKENDS="$BACKENDS x11"])
235AS_IF([test $USE_WAYLAND = yes], [BACKENDS="$BACKENDS wayland"])
236
237echo
238echo "libva-utils - ${LIBVA_UTILS_VERSION}"
239echo
240echo Libva VA-API version ............. : $LIBVA_API_VERSION
241echo Installation prefix .............. : $prefix
242echo Extra window systems ............. : $BACKENDS
243echo Enable Unit-tests .................... : $enable_tests
244echo
245