261817c8caab87510105a2ca927527125aefccdf
[profile/ivi/gstreamer-vaapi.git] / configure.ac
1 # gst version number
2 m4_define([gst_major_version], [0])
3 m4_define([gst_minor_version], [10])
4 m4_define([gst_micro_version], [0])
5 m4_define([gst_major_minor_version],
6           [gst_major_version.gst_minor_version])
7 m4_define([gst_version],
8           [gst_major_version.gst_minor_version.gst_micro_version])
9
10 # gst plugins-base version number
11 m4_define([gst_plugins_base_major_version], [0])
12 m4_define([gst_plugins_base_minor_version], [10])
13 m4_define([gst_plugins_base_micro_version], [0])
14 m4_define([gst_plugins_base_version],
15           [gst_plugins_base_major_version.gst_plugins_base_minor_version.gst_plugins_base_micro_version])
16
17 # gst_vaapi package version number
18 m4_define([gst_vaapi_major_version], [0])
19 m4_define([gst_vaapi_minor_version], [1])
20 m4_define([gst_vaapi_micro_version], [0])
21 m4_define([gst_vaapi_version],
22           [gst_vaapi_major_version.gst_vaapi_minor_version.gst_vaapi_micro_version])
23
24 AC_PREREQ([2.57])
25 AC_INIT([gst_vaapi], [gst_vaapi_version],
26     [gbeauchesne@splitted-desktop.com],
27     [gstreamer-vaapi])
28 AC_CONFIG_SRCDIR([Makefile.am])
29 AC_CANONICAL_TARGET
30 AM_INIT_AUTOMAKE
31 AM_CONFIG_HEADER([config.h])
32
33 dnl Check for __attribute__((visibility()))
34 AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
35   vaapi_cv_visibility_attribute,
36   [cat > conftest.c <<EOF
37 int foo __attribute__ ((visibility ("hidden"))) = 1;
38 int bar __attribute__ ((visibility ("protected"))) = 1;
39 EOF
40   vaapi_cv_visibility_attribute=no
41   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
42     if grep '\.hidden.*foo' conftest.s >/dev/null; then
43       if grep '\.protected.*bar' conftest.s >/dev/null; then
44         vaapi_cv_visibility_attribute=yes
45       fi
46     fi
47   fi
48   rm -f conftest.[cs]
49 ])
50 if test $vaapi_cv_visibility_attribute = yes; then
51   vaapi_cv_visibility_attribute_hidden="__attribute__((visibility(\"hidden\")))"
52 else
53   vaapi_cv_visibility_attribute_hidden=""
54 fi
55 AC_DEFINE_UNQUOTED([attribute_hidden],
56                    [$vaapi_cv_visibility_attribute_hidden],
57                    [Define the "hidden" visibility attribute])
58
59 dnl Versions for GStreamer and plugins-base
60 GST_MAJORMINOR=gst_major_minor_version
61 GST_VERSION_REQUIRED=gst_version
62 GST_PLUGINS_BASE_VERSION_REQUIRED=gst_plugins_base_version
63 AC_SUBST(GST_MAJORMINOR)
64
65 dnl Check for tools
66 AC_PROG_CC
67 AC_PROG_LIBTOOL
68
69 dnl Check for GStreamer
70 PKG_CHECK_MODULES([GST],
71     [gstreamer-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
72 )
73 AC_SUBST(GST_CFLAGS)
74 AC_SUBST(GST_LIBS)
75
76 dnl Check for GStreamer plugins-base
77 PKG_CHECK_MODULES([GST_PLUGINS_BASE],
78     [gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_PLUGINS_BASE_VERSION_REQUIRED]
79 )
80 AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
81 AC_SUBST(GST_PLUGINS_BASE_LIBS)
82
83 dnl Check for the GStreamer plugins directory
84 AC_MSG_CHECKING([for GStreamer plugins directory])
85 GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_MAJORMINOR --variable pluginsdir`
86 if test -z "$GST_PLUGINS_DIR"; then
87     echo "FAIL FAIL FAIL"
88     GST_PLUGINS_DIR="\$(libdir)/gstreamer-$GST_MAJORMINOR"
89 fi
90 AC_MSG_RESULT([$GST_PLUGINS_DIR])
91 plugindir="$GST_PLUGINS_DIR"
92 AC_SUBST(plugindir)
93
94 dnl Check for VA-API
95 PKG_CHECK_MODULES(LIBVA, [libva])
96 PKG_CHECK_MODULES(LIBVA_X11, [libva-x11])
97
98 dnl Check for SDS extensions to VA-API
99 AC_CACHE_CHECK([for VA-API],
100   ac_cv_libva_sds_extensions, [
101   saved_CFLAGS="$CFLAGS"
102   CFLAGS="$CFLAGS $LIBVA_DEPS_CFLAGS"
103   AC_TRY_COMPILE([
104     #include <va/va_version.h>
105     #if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 29
106     # if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_29)
107     #  error "VA-API version >= 0.29.0-sds$LIBVA_SDS_VERSION_0_29 is required"
108     # endif
109     #elif VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 30
110     # if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_30)
111     #  error "VA-API version >= 0.30.0-sds$LIBVA_SDS_VERSION_0_30 is required"
112     # endif
113     #elif !VA_CHECK_VERSION(0,31,0)
114     # error "VA-API version >= 0.31 is required"
115     #endif
116   ], [],
117   [ac_cv_libva_sds_extensions="yes"],
118   [ac_cv_libva_sds_extensions="no"])
119   CFLAGS="$saved_CFLAGS"
120 ])
121 VA_VERSION=`$PKG_CONFIG --modversion libva`
122 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
123 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
124 VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_MAJOR_VERSION}_${VA_MINOR_VERSION}_sds"
125 if test "$ac_cv_libva_sds_extensions" = "yes"; then
126     AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC], [Define driver entry-point])
127 else
128     AC_MSG_ERROR([Your VA-API SDK does not include SDS extensions])
129 fi
130
131 AC_OUTPUT([
132     Makefile
133     gst-libs/Makefile
134     gst-libs/gst/Makefile
135     gst-libs/gst/vaapi/Makefile
136     sys/Makefile
137     sys/vaapi/Makefile
138     tests/Makefile
139     tests/examples/Makefile
140     tests/examples/generic/Makefile
141 ])