X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/b3a380d027135bff7d13a08557bd7db294d18f08..803e498e869f88d9daceadf143e3360c17cb7410:/tests/libs.at diff --git a/tests/libs.at b/tests/libs.at index ab348de..cc09cea 100644 --- a/tests/libs.at +++ b/tests/libs.at @@ -85,3 +85,60 @@ AT_CHECK_UNQUOTED([cat test], [0], [no ]) AT_CLEANUP + +AT_SETUP([GLib GNU inline workaround]) + +TEST_DUMMY_PKGCONFIG([-I.], [$builddir/t/libdummy.a]) + +# This test will only work if we have a version of GCC that implements +# C99 inline semantics by default. +AT_DATA([a.c], +[[#if __GNUC__ +extern inline void my_dup_fn(void) { } +#endif +int main(void) { return 0; } +]]) +AT_DATA([b.c], +[[#if __GNUC__ +extern inline void my_dup_fn(void) { } +#endif +]]) + +AT_DATA([test.sh.in], +[[#!/bin/sh +@CC@ @CPPFLAGS@ @CFLAGS@ -c a.c || exit 77 +@CC@ @CPPFLAGS@ @CFLAGS@ -c b.c || exit 77 +@CC@ @CFLAGS@ @LDFLAGS@ a.o b.o || exit 0 +exit 77 +]]) + +AT_DATA([glib.h], +[[#define GLIB_CHECK_VERSION(x, y, z) 1 +const char *g_get_prgname(void); +]]) + +TEST_CONFIGURE_AC([[AC_CONFIG_HEADERS([config.h]) +DX_LIB_GLIB2 +AC_CONFIG_FILES([test.sh], [chmod +x test.sh]) +]]) +TEST_AUTORECONF +TEST_CONFIGURE([PKG_CONFIG=$PWD/pkg-config]) +AT_CHECK([./test.sh], [0], [ignore], [ignore]) + +AT_CHECK([grep G_INLINE_FUNC config.h], [0], +[/* #undef G_INLINE_FUNC */ +]) + +cat >>glib.h <<'EOF' +#ifndef G_INLINE_FUNC +# define G_INLINE_FUNC extern inline +#endif +G_INLINE_FUNC void break_things(void) { } +EOF + +TEST_CONFIGURE([PKG_CONFIG=$PWD/pkg-config]) +AT_CHECK([grep G_INLINE_FUNC config.h], [0], +[#define G_INLINE_FUNC static inline +]) + +AT_CLEANUP