]> git.draconx.ca Git - upkg.git/blob - configure.ac
Make GOB2 optional.
[upkg.git] / configure.ac
1 dnl Copyright © 2009-2012, 2015, 2019-2020 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AC_PREREQ(2.62)
8 AC_INIT([upkg],[0.1],[nbowler@draconx.ca])
9 AC_CONFIG_SRCDIR([src/libupkg.c])
10 AC_CONFIG_HEADER([config.h])
11 AC_CONFIG_MACRO_DIR([m4])
12
13 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects])
14 AM_SILENT_RULES([yes])
15 DX_AUTOMAKE_COMPAT
16
17 AC_PROG_CC_C99
18 gl_EARLY
19
20 LT_CONFIG_LTDL_DIR([libltdl])
21 LT_INIT([dlopen])
22 LTDL_INIT([nonrecursive])
23
24 gl_INIT
25
26 AC_CACHE_SAVE
27
28 m4_include([lib/gnulib.mk])
29
30 CHECK_GLIB_2([], [gobject])
31
32 AC_ARG_WITH([modlib],
33         [AS_HELP_STRING([--with-modlib],
34                 [specify which module decoding library to use - one of modplug, none or auto. [default=auto]]
35         )],
36         [with_modlib=$withval],
37         [with_modlib=auto])
38
39 use_modlib=none
40 AS_CASE([$with_modlib],
41   [no|none], [:],
42   [modplug], [DX_LIB_LIBMODPLUG([use_modlib=modplug])],
43   [auto], [DX_LIB_LIBMODPLUG([use_modlib=modplug], [:])],
44   [AC_MSG_ERROR([Invalid argument to --with-modlib: $with_modlib])])
45
46 AC_MSG_CHECKING([which module library to use])
47 AC_MSG_RESULT([$use_modlib])
48
49 AM_CONDITIONAL([USE_LIBMODPLUG], [test x$use_modlib = xmodplug])
50 AM_CONDITIONAL([USE_DUMMYMOD],   [test x$use_modlib = xnone])
51
52 DX_PROG_GOB2([2.0.0], [have_gob2=yes], [have_gob2=no])
53 AM_CONDITIONAL([HAVE_GOB2], [test x"$have_gob2" = x"yes"])
54
55 AS_IF([test x"$have_gob2" != x"yes"], [dx_cv_gob2_dynamic_types=no])
56 AC_CACHE_CHECK([Whether $GOB2 supports dynamic types],
57   [dx_cv_gob2_dynamic_types], [cat >conftest.gob <<'EOF'
58 class :Conftest from G:Object (dynamic)
59 {
60   public void test(void)
61   {
62   }
63 }
64 EOF
65 dx_cv_gob2_dynamic_types=no
66 AS_IF([$GOB2 conftest.gob >/dev/null 2>&1],
67 [mv conftest.c conftest.inc
68 save_CFLAGS=$CFLAGS save_LIBS=$LIBS
69 CFLAGS="$GLIB_CFLAGS $CFLAGS"
70 LIBS="$LIBS $GLIB_LIBS"
71 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#]include "conftest.inc"],
72 [conftest_register_type(0);])], [dx_cv_gob2_dynamic_types=yes])
73 CFLAGS=$save_CFLAGS LIBS=$save_LIBS])
74 ])
75 AM_CONDITIONAL([HAVE_GOB2_DYN], [test x"$dx_cv_gob2_dynamic_types" = x"yes"])
76
77 AC_CONFIG_FILES([Makefile libuobject.pc])
78 AC_OUTPUT