From eaa2806843ebbf1b91f11436de196b47b20bd035 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov <lemenkov@gmail.com> Date: Fri, 16 Dec 2011 22:08:41 +0400 Subject: [PATCH 1/1] Initial autotools support Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> --- Makefile.am | 25 +++++++++ autogen.sh | 7 +++ configure.ac | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++ source/Makefile.am | 66 +++++++++++++++++++++++ source/libyuv.pc.in | 9 ++++ 5 files changed, 255 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 source/Makefile.am create mode 100644 source/libyuv.pc.in diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1127629 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,25 @@ +SUBDIRS = source + +EXTRA_DIST = AUTHORS DEPS LICENSE PATENTS README.chromium codereview.settings libyuv.gyp libyuv_test.gyp unit_test/testdata/arm_v7.txt unit_test/testdata/tegra3.txt + +if WITH_TEST + +TESTS = unittest + +noinst_PROGRAMS = $(TESTS) + +unittest_SOURCES = unit_test/compare_test.cc \ + unit_test/cpu_test.cc \ + unit_test/planar_test.cc \ + unit_test/rotate_test.cc \ + unit_test/rotate_argb_test.cc \ + unit_test/scale_argb_test.cc \ + unit_test/scale_test.cc \ + unit_test/unit_test.cc \ + unit_test/unit_test.h \ + unit_test/version_test.cc + +unittest_CXXFLAGS = $(AM_CXXFLAGS) @GTEST_CXXFLAGS@ -I$(top_srcdir)/include -I$(top_srcdir) +unittest_LDADD = @GTEST_LIBS@ $(top_builddir)/source/libyuv.la + +endif diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..bfd37d1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,7 @@ +#!/bin/sh +LIBTOOLIZE=`which libtoolize || which glibtoolize` + +$LIBTOOLIZE +aclocal +automake --add-missing --copy +autoconf diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7014cee --- /dev/null +++ b/configure.ac @@ -0,0 +1,148 @@ +AC_INIT([libyuv], [0], [http://groups.google.com/group/discuss-libyuv], [libyuv], [http://code.google.com/p/libyuv/]) + +AC_CANONICAL_TARGET + +AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip tar-ustar foreign]) + +AC_SUBST(LIBYUV_VERSION_INFO, [0:0:0]) + +AC_PROG_CXX +AC_PROG_LIBTOOL +AC_PROG_INSTALL + +AC_LANG_CPLUSPLUS + +AC_ARG_WITH([mjpeg], + AC_HELP_STRING([--with-mjpeg],[enable Motion JPEG decoder [default=yes].]), + [with_mjpeg="$withval"],[with_mjpeg="no"] + ) + +if test "$with_mjpeg" = "yes" ; then + AC_MSG_WARN([Motion JPEG decoder is enabled]) + AC_CHECK_HEADERS( + [jpeglib.h], + [], + [AC_MSG_ERROR([jpeglib.h header not found])], + [AC_INCLUDES_DEFAULT] + ) + AC_CHECK_LIB( + [jpeg], + [jpeg_read_header], + [ + CXXFLAGS="$CXXFLAGS -DHAVE_JPEG" + LIBJPEG_LIBS="-ljpeg" + AC_SUBST([LIBJPEG_LIBS]) + ], + [AC_MSG_ERROR([libjpeg or libjpeg-turbo library not found])], + [] + ) + +else + AC_MSG_WARN([Motion JPEG decoder is disabled]) +fi + + +AC_ARG_WITH([test], + AC_HELP_STRING([--with-test],[enable test suite [default=no].]), + [with_test="$withval"],[with_test="no"] + ) + +if test "$with_test" = "yes" ; then + AC_MSG_WARN([Test suite is enabled]) + AC_CHECK_HEADERS( + [gtest/gtest.h], + [], + [AC_MSG_ERROR([gtest not found])], + [] + ) + AC_PATH_PROG([GTEST_CONFIG], gtest-config, [no]) + if test "$GTEST_CONFIG" = "no" ; then + AC_MSG_ERROR([gtest-config was not found]) + fi + GTEST_CXXFLAGS=`$GTEST_CONFIG --cxxflags` + GTEST_LIBS=`$GTEST_CONFIG --libs` + AC_SUBST([GTEST_CXXFLAGS]) + AC_SUBST([GTEST_LIBS]) +else + AC_MSG_WARN([Test suite is disabled]) +fi + +case "$target_os" in + linux*) + posix="yes" + ;; + darwin*) + posix="yes" + ;; + mingw*) +# windows="yes" + posix="yes" + LDFLAGS="$LDFLAGS -no-undefined --enable-runtime-pseudo-reloc -avoid-version" + ;; + *) + AC_MSG_ERROR([No support for this target ($target) yet]) + ;; +esac + +has_neon="no" +case "$target_cpu" in + arm*) + AC_ARG_ENABLE(neon, + [ --enable-neon enable ARM NEON support], + [ + AC_MSG_CHECKING(for NEON in current arch/CFLAGS) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [[ + #include <arm_neon.h> + int32x4_t testfunc(int16_t *a, int16_t *b) + { + return vmull_s16(vld1_s16(a), vld1_s16(b)); + } + ]] + ) + ], + [has_neon=yes], + [has_neon=no] + ) + AC_MSG_RESULT($has_neon) + ] + ) + ;; + *) + ;; +esac + +AC_CONFIG_FILES([ +Makefile +source/libyuv.pc +source/Makefile +]) + +AM_CONDITIONAL(LIBYUV_POSIX, test "$posix" = "yes") +AM_CONDITIONAL(LIBYUV_WINDOWS, test "$windows" = "yes") + +AM_CONDITIONAL(WITH_MJPEG, test "$with_mjpeg" = "yes") +AM_CONDITIONAL(WITH_TEST, test "$with_test" = "yes") +AM_CONDITIONAL(ENABLE_NEON, test "$has_neon" = "yes") + +AC_OUTPUT + +AC_MSG_RESULT([ +------------------------------------------------------------------------ + $PACKAGE $VERSION configuration. + + Compiler support: + + Target CPU: ................... ${target_cpu} + Has NEON? .............. ${has_neon} + Target OS: .................... ${target_os} + Is POSIX? .............. ${posix} + + General configuration: + + Enable Motion JPEG: ............ ${with_mjpeg} + Enable test suite: . ........... ${with_test} + +------------------------------------------------------------------------ +]) diff --git a/source/Makefile.am b/source/Makefile.am new file mode 100644 index 0000000..ef46e90 --- /dev/null +++ b/source/Makefile.am @@ -0,0 +1,66 @@ +lib_LTLIBRARIES = libyuv.la + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libyuv.pc + +libyuvincludedir = $(includedir) +libyuvnobase_includedir = $(includedir)/libyuv + +if WITH_MJPEG +mjpeg_SOURCES = mjpeg_decoder.cc +mjpeg_HDRS = ../include/libyuv/mjpeg_decoder.h +endif + +if LIBYUV_POSIX +posix_SOURCES = row_posix.cc +endif + +if LIBYUV_WINDOWS +windows_SOURCES = row_win.cc +endif + +if ENABLE_NEON +neon_SOURCES = rotate_neon.cc row_neon.cc +endif + +libyuvinclude_HEADERS = ../include/libyuv.h +libyuvnobase_include_HEADERS = ../include/libyuv/basic_types.h \ + ../include/libyuv/compare.h \ + ../include/libyuv/convert.h \ + ../include/libyuv/convert_argb.h \ + ../include/libyuv/convert_from.h \ + ../include/libyuv/cpu_id.h \ + ../include/libyuv/format_conversion.h \ + ../include/libyuv/planar_functions.h \ + ../include/libyuv/rotate.h \ + ../include/libyuv/rotate_argb.h \ + ../include/libyuv/row.h \ + ../include/libyuv/scale.h \ + ../include/libyuv/scale_argb.h \ + ../include/libyuv/version.h \ + ../include/libyuv/video_common.h \ + $(mjpeg_HDRS) + +libyuv_la_SOURCES = compare.cc \ + convert.cc \ + convert_argb.cc \ + convert_from.cc \ + cpu_id.cc \ + format_conversion.cc \ + planar_functions.cc \ + rotate.cc \ + rotate_argb.cc \ + rotate_priv.h \ + row.h \ + row_common.cc \ + scale.cc \ + scale_argb.cc \ + video_common.cc \ + $(posix_SOURCES) \ + $(windows_SOURCES) \ + $(mjpeg_SOURCES) \ + $(neon_SOURCES) + +libyuv_la_CXXFLAGS = $(AM_LDFLAGS) -I$(top_srcdir)/include -I$(top_srcdir) +libyuv_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBYUV_VERSION_INFO) +libyuv_la_LIBADD = @LIBJPEG_LIBS@ diff --git a/source/libyuv.pc.in b/source/libyuv.pc.in new file mode 100644 index 0000000..d921dd5 --- /dev/null +++ b/source/libyuv.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libyuv +Description: YUV conversion and scaling functionality library +Version: @PACKAGE_VERSION@ +Libs: -lyuv -- 1.7.12.1