check: use private copy of check for libgstcheck
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 6 Aug 2009 16:27:12 +0000 (17:27 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 6 Aug 2009 16:27:12 +0000 (17:27 +0100)
See #577275. Seems to work fine, but doesn't distcheck yet.

Makefile.am
autogen.sh
check-checks.m4 [new file with mode: 0644]
configure.ac
docs/libs/gstreamer-libs-sections.txt
libs/gst/check/.gitignore
libs/gst/check/Makefile.am
libs/gst/check/gstcheck.h
libs/gst/check/libcheck/Makefile.am
pkgconfig/gstreamer-check-uninstalled.pc.in
pkgconfig/gstreamer-check.pc.in

index d15bc92..6cb5819 100644 (file)
@@ -5,7 +5,8 @@ all-local: gst-element-check-@GST_MAJORMINOR@.m4
 gst-element-check-@GST_MAJORMINOR@.m4: gst-element-check.m4
        cp gst-element-check.m4 gst-element-check-@GST_MAJORMINOR@.m4
 
-ACLOCAL_AMFLAGS = -I common/m4
+# note: keep in sync with configure.ac
+ACLOCAL_AMFLAGS = -I common/m4 -I .
 
 aclocaldir = $(datadir)/aclocal
 aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
index 4864187..b29b7c8 100755 (executable)
@@ -82,7 +82,7 @@ patch -p0 < common/gettext.patch
 if test -f acinclude.m4; then rm acinclude.m4; fi
 
 tool_run "$libtoolize" "--copy --force"
-tool_run "$aclocal" "-I common/m4 $ACLOCAL_FLAGS"
+tool_run "$aclocal" "-I common/m4 -I. $ACLOCAL_FLAGS"
 tool_run "$autoheader"
 
 # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
diff --git a/check-checks.m4 b/check-checks.m4
new file mode 100644 (file)
index 0000000..f9ddc34
--- /dev/null
@@ -0,0 +1,45 @@
+dnl Check for things that check needs/wants and that we don't check for already
+dnl AM_GST_CHECK_CHECKS()
+
+AC_DEFUN([AG_GST_CHECK_CHECKS],
+[
+AC_MSG_NOTICE([Running check unit test framework checks now...])
+
+CHECK_MAJOR_VERSION=0
+CHECK_MINOR_VERSION=9
+CHECK_MICRO_VERSION=6
+CHECK_VERSION=$CHECK_MAJOR_VERSION.$CHECK_MINOR_VERSION.$CHECK_MICRO_VERSION
+
+AC_SUBST(CHECK_MAJOR_VERSION)
+AC_SUBST(CHECK_MINOR_VERSION)
+AC_SUBST(CHECK_MICRO_VERSION)
+AC_SUBST(CHECK_VERSION)
+
+# Checks for programs.
+AC_PROG_AWK
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS_ONCE([unistd.h fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_STRUCT_TM
+
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(long, 4)
+
+# Checks for library functions.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([alarm gettimeofday localtime_r memmove memset putenv setenv strdup strerror strrchr strstr])
+AC_REPLACE_FUNCS([strsignal])
+])
index 49bfff9..2611100 100644 (file)
@@ -58,8 +58,8 @@ dnl *** autotools stuff ****
 dnl allow for different autotools
 AS_AUTOTOOLS_ALTERNATE
 
-dnl Add parameters for aclocal
-AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4")
+dnl Add parameters for aclocal (keep in sync with Makefile.am)
+AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4 -I .")
 
 dnl set up gettext
 dnl the version check needs to stay here because autopoint greps for it
@@ -503,22 +503,21 @@ else
 fi
 AC_SUBST(GST_DISABLE_XML_DEFINE)
 
-dnl check for "check", unit testing library/header
-if test "$cross_compiling" != yes; then
-  AM_PATH_CHECK(0.9.2,
-      HAVE_CHECK=yes,
-      HAVE_CHECK=no)
-else
-  HAVE_CHECK=no
-fi
-AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
+dnl building of unit test libraries
+AC_ARG_ENABLE(check,
+  AC_HELP_STRING([--disable-check], [disable building unit test libraries]),
+  [
+    case "${enableval}" in
+      yes) BUILD_CHECK=yes ;;
+      no)  BUILD_CHECK=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --disable-check) ;;
+    esac
+  ],
+[BUILD_CHECK=yes]) dnl Default value
+dnl bit of a misnomer, but keep the conditional named like this so we don't
+dnl have to change too much elsewhere
+AM_CONDITIONAL(HAVE_CHECK, test "x$BUILD_CHECK" = "xyes")
 
-dnl pkg-config check that for libcheck that works for cross-compiling
-dnl but not normal compilation on Fedora & Ubuntu:
-dnl PKG_CHECK_MODULES(CHECK, check >= 0.9.2,
-dnl   AM_CONDITIONAL(HAVE_CHECK, true),
-dnl   AM_CONDITIONAL(HAVE_CHECK, false)
-dnl )
 
 dnl *** set variables based on configure arguments
 
@@ -606,13 +605,6 @@ dnl linker flags shared by all libraries
 dnl LDFLAGS modifier defining exported symbols from built libraries
 GST_LIB_LDFLAGS="-export-symbols-regex \^[_]*\(gst_\|Gst\|GST_\).*"
 AC_SUBST(GST_LIB_LDFLAGS)
-dnl Version of the linker flags specifically for libgstcheck to support the boonky extra symbols it exports.
-GST_CHECK_LIB_LDFLAGS="-export-symbols-regex \^\([_]*\(gst_\|Gst\|GST_\).*\|check_\(debug\|mutex\|cond\)\|buffers\|mutex\|start_cond\|sync_cond\|thread_list\)$"
-dnl HACK: add non-portable --export-dynamic if we have GNU ld (needed on my debian stable, tpm)
-if test "x$ac_cv_prog_gnu_ld" = "xyes" -o "x$acl_cv_prog_gnu_ld" = "xyes" ; then
-  GST_CHECK_LIB_LDFLAGS="-Wl,--export-dynamic $GST_CHECK_LIB_LDFLAGS"
-fi
-AC_SUBST(GST_CHECK_LIB_LDFLAGS)
 
 dnl GST_OBJ_*
 dnl default vars for all internal objects built on libgstreamer
@@ -629,6 +621,11 @@ AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")
 
 SHAVE_INIT([common],[enable])
 
+dnl things for our internal libcheck
+if test "x$BUILD_CHECK" = "xyes"; then
+  AG_GST_CHECK_CHECKS()
+fi
+
 AC_CONFIG_FILES(
 Makefile
 common/shave
@@ -641,6 +638,8 @@ libs/Makefile
 libs/gst/Makefile
 libs/gst/base/Makefile
 libs/gst/check/Makefile
+libs/gst/check/libcheck/Makefile
+libs/gst/check/libcheck/check.h
 libs/gst/controller/Makefile
 libs/gst/dataprotocol/Makefile
 libs/gst/net/Makefile
@@ -767,6 +766,7 @@ Configuration
        Plugin registry            : ${enable_registry}
        Plugin support             : ${enable_plugin}
        Network support            : ${enable_net}
+       Unit testing support       : ${BUILD_CHECK}
 
        Debug                      : ${USE_DEBUG}
        Profiling                  : ${USE_PROFILING}
index 5a2b67a..bf03050 100644 (file)
@@ -697,6 +697,92 @@ gst_check_abi_list
 buffers
 check_cond
 check_mutex
+
+CHECK_MAJOR_VERSION
+CHECK_MICRO_VERSION
+CHECK_MINOR_VERSION
+CK_ATTRIBUTE_UNUSED
+CK_CPPEND
+CK_CPPSTART
+CK_EXPORT
+END_TEST
+GCC_VERSION_AT_LEAST
+LFun
+List
+Log
+NULL
+SFun
+SRunner
+START_TEST
+Suite
+TCase
+TF
+TFun
+TestResult
+TestStats
+check_list_create
+ck_abort
+ck_abort_msg
+ck_assert
+ck_assert_int_eq
+ck_assert_int_ne
+ck_assert_msg
+ck_assert_str_eq
+ck_assert_str_ne
+ck_strdup_printf
+cur_fork_status
+emalloc
+eprintf
+erealloc
+fail
+fail_if
+fail_unless
+get_env_printmode
+lfile_lfun
+list_add_end
+list_add_front
+list_advance
+list_apply
+list_at_end
+list_free
+list_front
+list_val
+log_srunner_end
+log_srunner_start
+log_suite_end
+log_suite_start
+log_test_end
+mark_point
+pack
+ppack
+punpack
+rcvmsg_free
+receive_test_result
+send_ctx_info
+send_failure_info
+send_loc_info
+set_fork_status
+setup_messaging
+sr_stat_str
+srunner_end_logging
+srunner_fprint
+srunner_init_logging
+srunner_open_lfile
+srunner_open_xmlfile
+srunner_register_lfun
+stdout_lfun
+tcase_add_loop_test
+tcase_add_loop_test_raise_signal
+tcase_add_test
+tcase_add_test_raise_signal
+teardown_messaging
+tr_create
+tr_fprint
+tr_reset
+tr_str
+tr_xmlprint
+upack
+xml_lfun
 </SECTION>
 
 <SECTION>
index 9fb9d19..b887a81 100644 (file)
@@ -3,3 +3,6 @@
 *.o
 *.lo
 *.la
+internal-check.h
+exports.sym
+libcheck/check.h
index c436406..31e301a 100644 (file)
@@ -1,28 +1,78 @@
 lib_LTLIBRARIES = libgstcheck-@GST_MAJORMINOR@.la
 
+SYMBOLS_FILE = exports.sym
+
 libgstcheck_@GST_MAJORMINOR@_la_DEPENDENCIES = \
-       $(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la
+       $(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la \
+       $(SYMBOLS_FILE)
 libgstcheck_@GST_MAJORMINOR@_la_SOURCES =      \
        gstbufferstraw.c                        \
        gstcheck.c                              \
        gstconsistencychecker.c
 
-libgstcheck_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
-libgstcheck_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) $(LIBM)
-libgstcheck_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_CHECK_LIB_LDFLAGS) \
-        $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
+libgstcheck_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) \
+       -I$(top_builddir)/libs/gst/check \
+       -I$(top_builddir)/libs/gst/check/libcheck
+libgstcheck_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) \
+       $(top_builddir)/libs/gst/check/libcheck/libcheckinternal.la \
+       $(LIBM)
+libgstcheck_@GST_MAJORMINOR@_la_LDFLAGS = \
+       -exports $(SYMBOLS_FILE) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
 
 libgstcheck_@GST_MAJORMINOR@includedir =               \
        $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/check
 
 libgstcheck_@GST_MAJORMINOR@include_HEADERS =  \
+       internal-check.h                        \
        gstbufferstraw.h                        \
        gstcheck.h                              \
        gstconsistencychecker.h
 
-CLEANFILES = *.gcno *.gcda *.gcov
+CLEANFILES = *.gcno *.gcda *.gcov internal-check.h $(SYMBOLS_FILE)
+
+internal-check.h: $(top_builddir)/libs/gst/check/libcheck/check.h
+       cp $(top_builddir)/libs/gst/check/libcheck/check.h internal-check.h
 
 %.c.gcov: .libs/libgstcheck_@GST_MAJORMINOR@_la-%.gcda %.c
        $(GCOV) -b -f -o $^ > $@.out
 
 gcov: $(libgstcheck_@GST_MAJORMINOR@_la_SOURCES:=.gcov)
+
+SUBDIRS = libcheck
+
+LIBGSTCHECK_EXPORTED_SYMBOLS = \
+       _gst_check_debug \
+       _gst_check_expecting_log \
+       _gst_check_raised_critical \
+       _gst_check_raised_warning \
+       _gst_check_run_test_func \
+       _gst_check_threads_running \
+       gst_buffer_straw_get_buffer \
+       gst_buffer_straw_start_pipeline \
+       gst_buffer_straw_stop_pipeline \
+       gst_check_abi_list \
+       gst_check_caps_equal \
+       gst_check_chain_func \
+       gst_check_drop_buffers \
+       gst_check_element_push_buffer \
+       gst_check_element_push_buffer_list \
+       gst_check_init \
+       gst_check_message_error \
+       gst_check_run_suite \
+       gst_check_setup_element \
+       gst_check_setup_sink_pad \
+       gst_check_setup_sink_pad_by_name \
+       gst_check_setup_src_pad \
+       gst_check_setup_src_pad_by_name \
+       gst_check_teardown_element \
+       gst_check_teardown_pad_by_name \
+       gst_check_teardown_sink_pad \
+       gst_check_teardown_src_pad
+
+$(SYMBOLS_FILE):
+       CHECK_SYMS=`sed -n -e 's/^..*CK_EXPORT[[:space:]][[:space:]]*\([[:alnum:]_][[:alnum:]_]*\)..*$$/\1/p' @top_srcdir@/libs/gst/check/libcheck/check.h.in` ; \
+       rm -f $(SYMBOLS_FILE) 2>/dev/null; \
+       for s in $(LIBGSTCHECK_EXPORTED_SYMBOLS) $$CHECK_SYMS; do \
+         echo $$s >> $(SYMBOLS_FILE); \
+       done
+
index ec1313b..ab3c0f0 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <math.h>
 
-#include <check.h>
+#include <gst/check/internal-check.h>
 
 #include <gst/gst.h>
 
index d522f33..57bf1cf 100644 (file)
@@ -1,6 +1,6 @@
 noinst_LTLIBRARIES     = libcheckinternal.la
 
-EXTRA_DIST             = check.h.in
+EXTRA_DIST = check.h.in
 
 CFILES =\
        check.c         \
@@ -26,13 +26,6 @@ HFILES =\
 
 noinst_HEADERS = $(HFILES)
 
-EXPORT_SYM     = exported.sym
-$(EXPORT_SYM): check.h.in
-       sed -n -e 's/^..*CK_EXPORT[[:space:]][[:space:]]*\([[:alnum:]_][[:alnum:]_]*\)..*$$/\1/p' @top_srcdir@/src/check.h.in > $@
-
 libcheckinternal_la_SOURCES    = $(CFILES) $(HFILES)
 libcheckinternal_la_LIBADD     = 
 
-
-CLEANFILES     = $(EXPORT_SYM)
-
index 875fb49..2f5e6d3 100644 (file)
@@ -9,5 +9,5 @@ Description: Unit testing helper library for GStreamer modules, Not Installed
 Requires: gstreamer-@GST_MAJORMINOR@ = @VERSION@
 Version: @VERSION@
 
-Libs: ${libdir}/libgstcheck-@GST_MAJORMINOR@.la @CHECK_LIBS@ -lm
-Cflags: -I${includedir} -I@srcdir@/.. @CHECK_CFLAGS@
+Libs: ${libdir}/libgstcheck-@GST_MAJORMINOR@.la -lm
+Cflags: -I${includedir} -I@srcdir@/..
index f96d1d4..69f3e4e 100644 (file)
@@ -7,5 +7,5 @@ Name: GStreamer check unit testing
 Description: Unit testing helper library for GStreamer modules
 Requires: gstreamer-@GST_MAJORMINOR@
 Version: @VERSION@
-Libs: -L${libdir} -lgstcheck-@GST_MAJORMINOR@ @CHECK_LIBS@ -lm
-Cflags: -I${includedir} @CHECK_CFLAGS@
+Libs: -L${libdir} -lgstcheck-@GST_MAJORMINOR@ -lm
+Cflags: -I${includedir}