-dnl Copyright © 2020 Nick Bowler
+dnl Copyright © 2020, 2022-2023 Nick Bowler
dnl License GPLv2+: GNU General Public License version 2 or any later version.
dnl This is free software: you are free to change and redistribute it.
dnl There is NO WARRANTY, to the extent permitted by law.
TEST_TYPE_MODULE([$1])])
m4_define([TEST_FOOABLE_IMPL_],
-[AT_DATA([$2.gob], [[%{
+[AT_DATA([$2.gob], [[%ctop{
+#include <config.h>
+%}
+%{
#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
TEST_FOOABLE_IMPL([Test:A], [G:Object], [return 42;])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
rc = test_foo(g_object_new(TEST_TYPE_A, NULL));
printf("%d\n", rc);
if (rc < 0)
}
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-fooable.o main.o])
+TEST_LINK_GOBJECT([main], [test-a.o test-fooable.o main.o])
AT_CHECK([./main], [0], [42
])
TEST_FOOABLE_IMPL_DYN([Test:A], [G:Object], [return 54;])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL));
rc = test_foo(g_object_new(TEST_TYPE_A, NULL));
}
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-a-mod.o test-fooable.o main.o])
+TEST_LINK_GOBJECT([main], [test-a.o test-a-mod.o test-fooable.o main.o])
AT_CHECK([./main], [0], [54
])
[puts("Test:B foo called"); return 54;])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
rc = test_foo(g_object_new(TEST_TYPE_A, NULL));
printf("%d\n", rc);
if (rc < 0)
}
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-b.o test-fooable.o main.o])
+TEST_LINK_GOBJECT([main], [test-a.o test-b.o test-fooable.o main.o])
AT_CHECK([./main], [0], [Test:A foo called
42
Test:B foo called
[puts("Test:B foo called"); return 54;])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL));
rc = test_foo(g_object_new(TEST_TYPE_A, NULL));
}
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-b.o test-b-mod.o test-fooable.o main.o])
-
+TEST_LINK_GOBJECT([main],
+ [test-a.o test-b.o test-b-mod.o test-fooable.o main.o])
AT_CHECK([./main], [0], [Test:A foo called
42
Test:B foo called
[puts("Test:B foo called"); return 54;])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL));
g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL));
}
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-a-mod.o test-b.o test-b-mod.o test-fooable.o main.o])
-
+TEST_LINK_GOBJECT([main],
+ [test-a.o test-a-mod.o test-b.o test-b-mod.o test-fooable.o main.o])
AT_CHECK([./main], [0], [Test:A foo called
42
Test:B foo called
[puts("Test:C foo called"); return PARENT_HANDLER(go);])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
rc = test_foo(g_object_new(TEST_TYPE_C, NULL));
printf("%d\n", rc);
if (rc < 0)
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-b.o test-c.o test-fooable.o main.o])
+TEST_LINK_GOBJECT([main], [test-a.o test-b.o test-c.o test-fooable.o main.o])
AT_CHECK([./main], [0], [Test:C foo called
Test:B foo called
Test:A foo called
[puts("Test:C foo called"); return PARENT_HANDLER(go);])
AT_DATA([main.c],
-[[#include <stdio.h>
+[[#include <config.h>
+#include <stdio.h>
#include <stdlib.h>
#include "test-fooable.h"
#include "test-a.h"
{
int rc;
+ g_type_init();
g_type_module_use(g_object_new(TEST_TYPE_A_MOD, NULL));
g_type_module_use(g_object_new(TEST_TYPE_B_MOD, NULL));
g_type_module_use(g_object_new(TEST_TYPE_C_MOD, NULL));
]])
TEST_COMPILE_GOBJECT([main.c], [0], [], [ignore])
-
-AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main \
- test-a.o test-a-mod.o test-b.o test-b-mod.o test-c.o test-c-mod.o \
- test-fooable.o main.o])
+TEST_LINK_GOBJECT([main], m4_join([ ],
+ [test-a.o test-a-mod.o test-b.o test-b-mod.o test-c.o test-c-mod.o],
+ [test-fooable.o main.o]))
AT_CHECK([./main], [0], [Test:C foo called
Test:B foo called
Test:A foo called