Define autoconf/automake rules to build libgtest.la
as a convenience library.

Add --enable-tests configure option (default:no).

Signed-off-by: U. Artie Eoff <[email protected]>
---
 Makefile.am      |  5 +++++
 configure.ac     | 11 ++++++++++-
 test/Makefile.am | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 test/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 093adef83d78..37ef353faabe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,11 @@ AUTOMAKE_OPTIONS = foreign
 
 SUBDIRS = debian.upstream src
 
+if ENABLE_TESTS
+SUBDIRS += test
+endif
+
+
 # Extra clean files so that maintainer-clean removes *everything*
 MAINTAINERCLEANFILES = \
        aclocal.m4 compile config.guess config.sub \
diff --git a/configure.ac b/configure.ac
index f12f8a69ed35..7b4fd0a0d5c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,11 +61,16 @@ AC_ARG_ENABLE([hybrid-codec],
                     [build with hybrid codec support @<:@default=no@:>@])],
     [], [enable_hybrid_codec="no"])
 
+AC_ARG_ENABLE([tests],
+    [AC_HELP_STRING([--enable-tests],
+                    [build tests @<:@default=no@:>@])],
+    [], [enable_tests="no"])
+
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 AC_PROG_CC
 AM_PROG_CC_C_O
-
+AC_PROG_CXX
 AC_C_BIGENDIAN
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
@@ -116,6 +121,8 @@ if test "$enable_hybrid_codec" = "yes"; then
     AC_DEFINE([HAVE_HYBRID_CODEC], [1], [Defined to 1 if hybrid codec is 
needed])
 fi
 
+AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" = "yes")
+
 VA_VERSION=`$PKG_CONFIG --modversion libva`
 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
@@ -207,6 +214,7 @@ AC_OUTPUT([
     src/shaders/render/Makefile
     src/shaders/utils/Makefile
     src/shaders/vme/Makefile
+    test/Makefile
 ])
 
 dnl Print summary
@@ -221,4 +229,5 @@ echo
 echo VA-API version ................... : $VA_VERSION_STR
 echo VA-API drivers path .............. : $LIBVA_DRIVERS_PATH
 echo Windowing systems ................ : $BACKENDS
+echo Build tests ...................... : $enable_tests
 echo
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 000000000000..aa797032829d
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,38 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
+AM_CXXFLAGS =                                                          \
+       -I$(top_srcdir)/test/gtest/include                              \
+       $(NULL)
+
+AM_CPPFLAGS =                                                          \
+       -DGTEST_HAS_PTHREAD=1                                           \
+       -DGTEST_USE_OWN_TR1_TUPLE=0                                     \
+       -DGTEST_LANG_CXX11=1                                            \
+       -DGTEST_HAS_TR1_TUPLE=1                                         \
+       -std=c++11                                                      \
+       $(NULL)
+
+AM_LDFLAGS =                                                           \
+       -pthread                                                        \
+       $(NULL)
+
+noinst_LTLIBRARIES = libgtest.la
+
+libgtest_la_SOURCES =                                                  \
+       gtest/src/gtest-all.cc                                          \
+       gtest/src/gtest_main.cc                                         \
+       $(NULL)
+
+libgtest_la_CXXFLAGS =                                                 \
+       -I$(top_srcdir)/test/gtest                                      \
+       $(AM_CXXFLAGS)                                                  \
+       $(NULL)
+
+EXTRA_DIST =                                                           \
+       gtest/docs                                                      \
+       gtest/include                                                   \
+       gtest/src/*.cc                                                  \
+       gtest/src/*.h                                                   \
+       gtest/README.md                                                 \
+       gtest/LICENSE                                                   \
+       $(NULL)
-- 
2.4.11

_______________________________________________
Libva mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to