Fix build with older glib
This commit is contained in:
parent
3935af1c0d
commit
e6a5b88c01
|
@ -39,7 +39,7 @@ fi
|
||||||
|
|
||||||
dnl ==========================================================================
|
dnl ==========================================================================
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GLIB, glib-2.0, have_glib=true, have_glib=false)
|
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
|
||||||
if $have_glib; then
|
if $have_glib; then
|
||||||
AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
|
AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -123,9 +123,20 @@ hb_test_normalize_path (const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION(2,25,12)
|
||||||
|
typedef GTestFunc hb_test_func_t;
|
||||||
|
typedef GTestDataFunc hb_test_data_func_t;
|
||||||
|
typedef GTestFixtureFunc hb_test_fixture_func_t;
|
||||||
|
#else
|
||||||
|
typedef void (*hb_test_func_t) (void);
|
||||||
|
typedef void (*hb_test_data_func_t) (gconstpointer user_data);
|
||||||
|
typedef void (*hb_test_fixture_func_t) (gpointer fixture,
|
||||||
|
gconstpointer user_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
hb_test_add_func (const char *test_path,
|
hb_test_add_func (const char *test_path,
|
||||||
GTestFunc test_func)
|
hb_test_func_t test_func)
|
||||||
{
|
{
|
||||||
char *normal_path = hb_test_normalize_path (test_path);
|
char *normal_path = hb_test_normalize_path (test_path);
|
||||||
g_test_add_func (normal_path, test_func);
|
g_test_add_func (normal_path, test_func);
|
||||||
|
@ -136,7 +147,7 @@ hb_test_add_func (const char *test_path,
|
||||||
static inline void
|
static inline void
|
||||||
hb_test_add_func_flavor (const char *test_path,
|
hb_test_add_func_flavor (const char *test_path,
|
||||||
const char *flavor,
|
const char *flavor,
|
||||||
GTestFunc test_func)
|
hb_test_func_t test_func)
|
||||||
{
|
{
|
||||||
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
||||||
hb_test_add_func (path, test_func);
|
hb_test_add_func (path, test_func);
|
||||||
|
@ -147,7 +158,7 @@ hb_test_add_func_flavor (const char *test_path,
|
||||||
static inline void
|
static inline void
|
||||||
hb_test_add_data_func (const char *test_path,
|
hb_test_add_data_func (const char *test_path,
|
||||||
gconstpointer test_data,
|
gconstpointer test_data,
|
||||||
GTestDataFunc test_func)
|
hb_test_data_func_t test_func)
|
||||||
{
|
{
|
||||||
char *normal_path = hb_test_normalize_path (test_path);
|
char *normal_path = hb_test_normalize_path (test_path);
|
||||||
g_test_add_data_func (normal_path, test_data, test_func);
|
g_test_add_data_func (normal_path, test_data, test_func);
|
||||||
|
@ -159,7 +170,7 @@ static inline void
|
||||||
hb_test_add_data_func_flavor (const char *test_path,
|
hb_test_add_data_func_flavor (const char *test_path,
|
||||||
const char *flavor,
|
const char *flavor,
|
||||||
gconstpointer test_data,
|
gconstpointer test_data,
|
||||||
GTestDataFunc test_func)
|
hb_test_data_func_t test_func)
|
||||||
{
|
{
|
||||||
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
||||||
hb_test_add_data_func (path, test_data, test_func);
|
hb_test_add_data_func (path, test_data, test_func);
|
||||||
|
@ -172,9 +183,9 @@ static inline void
|
||||||
hb_test_add_vtable (const char *test_path,
|
hb_test_add_vtable (const char *test_path,
|
||||||
gsize data_size,
|
gsize data_size,
|
||||||
gconstpointer test_data,
|
gconstpointer test_data,
|
||||||
GTestFixtureFunc data_setup,
|
hb_test_fixture_func_t data_setup,
|
||||||
GTestFixtureFunc data_test,
|
hb_test_fixture_func_t data_test,
|
||||||
GTestFixtureFunc data_teardown)
|
hb_test_fixture_func_t data_teardown)
|
||||||
{
|
{
|
||||||
char *normal_path = hb_test_normalize_path (test_path);
|
char *normal_path = hb_test_normalize_path (test_path);
|
||||||
g_test_add_vtable (normal_path, data_size, test_data, data_setup, data_test, data_teardown);
|
g_test_add_vtable (normal_path, data_size, test_data, data_setup, data_test, data_teardown);
|
||||||
|
@ -200,9 +211,9 @@ hb_test_add_vtable_flavor (const char *test_path,
|
||||||
const char *flavor,
|
const char *flavor,
|
||||||
gsize data_size,
|
gsize data_size,
|
||||||
gconstpointer test_data,
|
gconstpointer test_data,
|
||||||
GTestFixtureFunc data_setup,
|
hb_test_fixture_func_t data_setup,
|
||||||
GTestFixtureFunc data_test,
|
hb_test_fixture_func_t data_test,
|
||||||
GTestFixtureFunc data_teardown)
|
hb_test_fixture_func_t data_teardown)
|
||||||
{
|
{
|
||||||
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
char *path = g_strdup_printf ("%s/%s", test_path, flavor);
|
||||||
hb_test_add_vtable (path, data_size, test_data, data_setup, data_test, data_teardown);
|
hb_test_add_vtable (path, data_size, test_data, data_setup, data_test, data_teardown);
|
||||||
|
|
Loading…
Reference in New Issue