First go at using Gtk3. Everything builds but there is stuff (Pango modules) missing...
[moonshot-ui.git] / configure.ac
1 AC_PREREQ([2.66])
2 AC_INIT([Moonshot-ui],
3         [0.1],
4         [moonshot-community@jiscmail.ac.uk],
5         [moonshot-ui])
6
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_SRCDIR([configure.ac])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_AUX_DIR([build-aux])
11
12 AM_INIT_AUTOMAKE([1.11 -Wall foreign subdir-objects tar-pax no-dist-gzip dist-xz])
13 AM_SILENT_RULES([yes])
14 AM_MAINTAINER_MODE([enable])
15
16 LT_PREREQ([2.2])
17 LT_INIT([win32-dll])
18
19 # Checks for programs.
20 PKG_PROG_PKG_CONFIG([0.23])
21 AC_PROG_CC
22 AM_PROG_CC_C_O
23 AM_PROG_VALAC([0.9])
24
25 # Platform checks
26 AC_CANONICAL_HOST
27
28 case "$host" in
29   *-*-mingw*)
30     win32=yes
31     macos=no
32     linux=no
33     SERVER_IPC_MODULE="msrpc-glib2-1.0"
34     CLIENT_IPC_MODULE="msrpc-mingw-1.0"
35     PKG_CHECK_MODULES([GTK],
36             [gtk+-2.0 >= 2.18],
37             [GTK_VERSION="gtk+-2.0"]
38     )
39     ;;
40     
41   *darwin*) 
42     win32=no
43     macos=yes
44     linux=no
45
46     # We require dbus-glib for the client library even if we are using GDBus
47     # in the server. The reason we can't always use dbus-glib in the server is
48     # because Vala drops support for it, but as it ships with DBus there is very
49     # little danger of it being dropped by distros any time soon.
50     CLIENT_IPC_MODULE="dbus-glib-1"
51     PKG_CHECK_MODULES([GDBUS],
52             [gio-2.0 >= 2.26],
53             [SERVER_IPC_MODULE="gio-2.0"],
54             [SERVER_IPC_MODULE="dbus-glib-1"]
55     )
56
57 # TODO: Move to GTK+-3
58 #            [gtk+-3.0 >= 2.0],
59 #            [GTK_VERSION="gtk+-3.0"]
60
61 #            [gtk+-2.0 >= 2.18],
62 #            [GTK_VERSION="gtk+-2.0"]
63
64     PKG_CHECK_MODULES([GTK],
65             [gtk+-3.0 >= 2.0],
66             [GTK_VERSION="gtk+-3.0"]
67     )
68
69     ;;
70   *)
71     macos=no
72     win32=no
73     linux=yes
74
75     # We require dbus-glib for the client library even if we are using GDBus
76     # in the server. The reason we can't always use dbus-glib in the server is
77     # because Vala drops support for it, but as it ships with DBus there is very
78     # little danger of it being dropped by distros any time soon.
79     CLIENT_IPC_MODULE="dbus-glib-1"
80     PKG_CHECK_MODULES([GDBUS],
81             [gio-2.0 >= 2.26],
82             [SERVER_IPC_MODULE="gio-2.0"],
83             [SERVER_IPC_MODULE="dbus-glib-1"]
84     )
85 # TODO: Move to GTK+-3
86 #            [gtk+-3.0 >= 2.0],
87 #            [GTK_VERSION="gtk+-3.0"]
88     PKG_CHECK_MODULES([GTK],
89             [gtk+-2.0 >= 2.18],
90             [GTK_VERSION="gtk+-2.0"]
91     )
92
93     ;;
94 esac
95
96 AM_CONDITIONAL([OS_LINUX], [test "$linux" = "yes"])
97 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
98 AM_CONDITIONAL([OS_MACOS], [test "$macos" = "yes"])
99
100 AM_CONDITIONAL([IPC_MSRPC], [test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"])
101 AM_CONDITIONAL([IPC_DBUS], [test "$SERVER_IPC_MODULE" != "msrpc-glib2-1.0"])
102 AM_CONDITIONAL([IPC_DBUS_GLIB], [test "$SERVER_IPC_MODULE" = "dbus-glib-1"])
103 AM_CONDITIONAL([IPC_GDBUS], [test "$SERVER_IPC_MODULE" = "gio-2.0"])
104
105 if test "$SERVER_IPC_MODULE" = "dbus-glib-1"; then
106   AC_MSG_CHECKING([$VALAC is no greater than 0.12.1])
107   vala_version=`$VALAC --version | sed 's/Vala  *//'`
108   AS_VERSION_COMPARE([0.12.1], ["$vala_version"],
109     [vala_supports_dbus_glib="no"],
110     [vala_supports_dbus_glib="no"],
111     [vala_supports_dbus_glib="yes"])
112
113   AC_MSG_RESULT([$vala_supports_dbus_glib])
114   if test "$vala_supports_dbus_glib" = "no"; then
115     AC_MSG_ERROR([
116 *** Vala 0.12.1 or earlier is required for dbus-glib support. Newer versions
117 *** require that you have GLib 2.26 or newer (for GDBus support).])
118   fi
119 fi
120
121 if test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"; then
122   # MS RPC utilities
123   AC_PATH_MSRPC_MINGW([0.1.0], :,
124     AC_MSG_ERROR([
125 *** msrpc-mingw 0.1.0 or better is required.]))
126
127   AC_PATH_PROG([MIDL], [midl], no,
128                [/c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin$PATH_SEPARATOR$PATH])
129   if test "$MIDL" = "no"; then
130      AC_MSG_ERROR([
131 *** Could not find the Microsoft interface compiler MIDL.EXE.
132 *** This program is available as part of the MS Windows SDK, in
133 *** the Win32 Development Tools package. If it is not in the PATH
134 *** or its default location you may set the 'MIDL' environment
135 *** variable to point to its location and rerun configure.])
136   fi
137 fi
138
139 if test "$win32" = "yes"; then
140   # Other Windows-specific tools
141
142   # LIB.EXE from MSVC to build an MSVC-compatible import library.
143   AC_PATH_PROG([MSVC_LIB], [lib], no,
144                [/c/Program\ Files/Microsoft\ Visual\ Studio\ 9.0/VC/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 9.0/VC/bin$PATH_SEPARATOR$PATH])
145
146   if test "$MSVC_LIB" = "no"; then
147      AC_MSG_WARN([
148 *** Could not find the Microsoft 'LIB.EXE' program. This is required
149 *** to build the Visual C import library for libmoonshot. Use the
150 *** MSVC_LIB environment variable to pass its location if this is
151 *** outside the PATH.])
152   fi
153
154
155   # ImageMagick for the 'make icons' target. Note that
156   # c:/windows/system32/convert.exe is nothing to do with ImageMagick.
157   AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
158                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/ImageMagick$PATH_SEPARATOR$PATH])
159
160   if test "$IMAGEMAGICK_CONVERT" = "no" || test "$IMAGEMAGICK_CONVERT" = "/c/windows/system32/convert"; then
161      AC_MSG_WARN([
162 *** Could not find ImageMagick convert.exe. This is required for the
163 *** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
164 *** variable to pass its location if this is outside the PATH.])
165   fi
166
167
168   # Windows Installer XML tools
169   AC_PATH_PROG([WIX_CANDLE], [candle], no,
170                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
171   AC_PATH_PROG([WIX_LIGHT], [light], no,
172                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
173
174   if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
175      AC_MSG_WARN([
176 *** Could not find the Windows Installer XML tools. These are required
177 *** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
178 *** environment variables to pass their locations if they are outside
179 *** the PATH.])
180   fi
181 fi
182
183 if test "$linux" = "yes"; then
184   AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
185   if test "$UPDATE_MIME_DATABASE" = "no"; then
186     AC_MSG_ERROR([
187 *** Could not find the Freedesktop.org  mime database update tool.
188 *** Web provisioning files could not be automatically installed.])
189   fi
190   AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
191   if test "$UPDATE_DESKTOP_DATABASE" = "no"; then
192     AC_MSG_ERROR([
193 *** Could not find the Freedesktop.org desktop entry database update
194 *** tool. Web provisioning files could not be automatically installed.])
195   fi
196 fi
197
198 MOONSHOT_APP="$bindir/moonshot"
199 MOONSHOT_WEBP="$bindir/moonshot-webp"
200
201 AC_SUBST(MIDL)
202 AC_SUBST(MSVC_LIB)
203 AC_SUBST(IMAGEMAGICK_CONVERT)
204 AC_SUBST(WIX_CANDLE)
205 AC_SUBST(WIX_LIGHT)
206 AC_SUBST(UPDATE_MIME_DATABASE)
207 AC_SUBST(UPDATE_DESKTOP_DATABASE)
208 AC_SUBST(MOONSHOT_APP)
209 AC_SUBST(MOONSHOT_WEBP)
210
211 # Dependencies
212 PKG_CHECK_MODULES(moonshot,[
213         atk >= 1.20
214         glib-2.0 >= 2.22
215         gobject-2.0 >= 2.22
216         $GTK_VERSION
217         gee-1.0 >= 0.5
218         $SERVER_IPC_MODULE
219 ])
220
221 PKG_CHECK_MODULES(libmoonshot,[
222         $CLIENT_IPC_MODULE
223 ])
224
225 # i18n stuff
226 AM_GNU_GETTEXT([external])
227 AM_GNU_GETTEXT_VERSION([0.17])
228
229 AC_SUBST([GETTEXT_PACKAGE],[PACKAGE_TARNAME])
230 AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
231
232 AC_CONFIG_FILES([
233         Makefile
234         po/Makefile.in
235         moonshot.desktop
236         moonshot-webp.desktop
237         moonshot-ui.spec
238 ])
239
240 AC_OUTPUT