+AC_ARG_WITH([modlib],
+ [AS_HELP_STRING([--with-modlib],
+ [specify which module decoding library to use - one of modplug, none or auto. [default=auto]]
+ )],
+ [with_modlib=$withval],
+ [with_modlib=auto])
+
+use_modlib=none
+AS_CASE([$with_modlib],
+ [no|none], [:],
+ [modplug], [DX_LIB_LIBMODPLUG([use_modlib=modplug])],
+ [auto], [DX_LIB_LIBMODPLUG([use_modlib=modplug], [:])],
+ [AC_MSG_ERROR([Invalid argument to --with-modlib: $with_modlib])])
+
+AC_MSG_CHECKING([which module library to use])
+AC_MSG_RESULT([$use_modlib])
+
+AM_CONDITIONAL([USE_LIBMODPLUG], [test x$use_modlib = xmodplug])
+AM_CONDITIONAL([USE_DUMMYMOD], [test x$use_modlib = xnone])
+
+DX_PROG_GOB2([2.0.0], [have_gob2=yes], [have_gob2=no])
+AM_CONDITIONAL([HAVE_GOB2], [test x"$have_gob2" = x"yes"])
+
+AS_IF([test x"$have_gob2" != x"yes"], [dx_cv_gob2_dynamic_types=no])
+AC_CACHE_CHECK([Whether $GOB2 supports dynamic types],
+ [dx_cv_gob2_dynamic_types], [cat >conftest.gob <<'EOF'
+class :Conftest from G:Object (dynamic)
+{
+ public void test(void)
+ {
+ }
+}
+EOF
+dx_cv_gob2_dynamic_types=no
+AS_IF([$GOB2 conftest.gob >/dev/null 2>&1],
+[mv conftest.c conftest.inc
+save_CFLAGS=$CFLAGS save_LIBS=$LIBS
+CFLAGS="$GLIB_CFLAGS $CFLAGS"
+LIBS="$LIBS $GLIB_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#]include "conftest.inc"],
+[conftest_register_type(0);])], [dx_cv_gob2_dynamic_types=yes])
+CFLAGS=$save_CFLAGS LIBS=$save_LIBS])