Merge branch 'master' of gitorious.codethink.co.uk:moonshot-ui/moonshot-ui
[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     ;;
36     
37   *darwin*) 
38     win32=no
39     macos=yes
40     linux=no
41
42     # We require dbus-glib for the client library even if we are using GDBus
43     # in the server. The reason we can't always use dbus-glib in the server is
44     # because Vala drops support for it, but as it ships with DBus there is very
45     # little danger of it being dropped by distros any time soon.
46     CLIENT_IPC_MODULE="dbus-glib-1"
47     PKG_CHECK_MODULES([GDBUS],
48             [gio-2.0 >= 2.26],
49             [SERVER_IPC_MODULE="gio-2.0"],
50             [SERVER_IPC_MODULE="dbus-glib-1"]
51     )
52
53     ;;
54   *)
55     macos=no
56     win32=no
57     linux=yes
58
59     # We require dbus-glib for the client library even if we are using GDBus
60     # in the server. The reason we can't always use dbus-glib in the server is
61     # because Vala drops support for it, but as it ships with DBus there is very
62     # little danger of it being dropped by distros any time soon.
63     CLIENT_IPC_MODULE="dbus-glib-1"
64     PKG_CHECK_MODULES([GDBUS],
65             [gio-2.0 >= 2.26],
66             [SERVER_IPC_MODULE="gio-2.0"],
67             [SERVER_IPC_MODULE="dbus-glib-1"]
68     )
69
70     ;;
71 esac
72
73 AM_CONDITIONAL([OS_LINUX], [test "$linux" = "yes"])
74 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
75 AM_CONDITIONAL([OS_MACOS], [test "$macos" = "yes"])
76
77 AM_CONDITIONAL([IPC_MSRPC], [test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"])
78 AM_CONDITIONAL([IPC_DBUS], [test "$SERVER_IPC_MODULE" != "msrpc-glib2-1.0"])
79 AM_CONDITIONAL([IPC_DBUS_GLIB], [test "$SERVER_IPC_MODULE" = "dbus-glib-1"])
80 AM_CONDITIONAL([IPC_GDBUS], [test "$SERVER_IPC_MODULE" = "gio-2.0"])
81
82 if test "$SERVER_IPC_MODULE" = "dbus-glib-1"; then
83   AC_MSG_CHECKING([$VALAC is no greater than 0.12.1])
84   vala_version=`$VALAC --version | sed 's/Vala  *//'`
85   AS_VERSION_COMPARE([0.12.1], ["$vala_version"],
86     [vala_supports_dbus_glib="no"],
87     [vala_supports_dbus_glib="no"],
88     [vala_supports_dbus_glib="yes"])
89
90   AC_MSG_RESULT([$vala_supports_dbus_glib])
91   if test "$vala_supports_dbus_glib" = "no"; then
92     AC_MSG_ERROR([
93 *** Vala 0.12.1 or earlier is required for dbus-glib support. Newer versions
94 *** require that you have GLib 2.26 or newer (for GDBus support).])
95   fi
96 fi
97
98 if test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"; then
99   # MS RPC utilities
100   AC_PATH_MSRPC_MINGW([0.1.0], :,
101     AC_MSG_ERROR([
102 *** msrpc-mingw 0.1.0 or better is required.]))
103
104   AC_PATH_PROG([MIDL], [midl], no,
105                [/c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin$PATH_SEPARATOR$PATH])
106   if test "$MIDL" = "no"; then
107      AC_MSG_ERROR([
108 *** Could not find the Microsoft interface compiler MIDL.EXE.
109 *** This program is available as part of the MS Windows SDK, in
110 *** the Win32 Development Tools package. If it is not in the PATH
111 *** or its default location you may set the 'MIDL' environment
112 *** variable to point to its location and rerun configure.])
113   fi
114 fi
115
116 if test "$win32" = "yes"; then
117   # Other Windows-specific tools
118
119   # LIB.EXE from MSVC to build an MSVC-compatible import library.
120   AC_PATH_PROG([MSVC_LIB], [lib], no,
121                [/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])
122
123   if test "$MSVC_LIB" = "no"; then
124      AC_MSG_WARN([
125 *** Could not find the Microsoft 'LIB.EXE' program. This is required
126 *** to build the Visual C import library for libmoonshot. Use the
127 *** MSVC_LIB environment variable to pass its location if this is
128 *** outside the PATH.])
129   fi
130
131
132   # ImageMagick for the 'make icons' target. Note that
133   # c:/windows/system32/convert.exe is nothing to do with ImageMagick.
134   AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
135                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/ImageMagick$PATH_SEPARATOR$PATH])
136
137   if test "$IMAGEMAGICK_CONVERT" = "no" || test "$IMAGEMAGICK_CONVERT" = "/c/windows/system32/convert"; then
138      AC_MSG_WARN([
139 *** Could not find ImageMagick convert.exe. This is required for the
140 *** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
141 *** variable to pass its location if this is outside the PATH.])
142   fi
143
144
145   # Windows Installer XML tools
146   AC_PATH_PROG([WIX_CANDLE], [candle], no,
147                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
148   AC_PATH_PROG([WIX_LIGHT], [light], no,
149                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
150
151   if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
152      AC_MSG_WARN([
153 *** Could not find the Windows Installer XML tools. These are required
154 *** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
155 *** environment variables to pass their locations if they are outside
156 *** the PATH.])
157   fi
158 fi
159
160 if test "$linux" = "yes"; then
161   AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
162   if test "$UPDATE_MIME_DATABASE" = "no"; then
163     AC_MSG_ERROR([
164 *** Could not find the Freedesktop.org  mime database update tool.
165 *** Web provisioning files could not be automatically installed.])
166   fi
167   AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
168   if test "$UPDATE_DESKTOP_DATABASE" = "no"; then
169     AC_MSG_ERROR([
170 *** Could not find the Freedesktop.org desktop entry database update
171 *** tool. Web provisioning files could not be automatically installed.])
172   fi
173 fi
174
175 MOONSHOT_APP="$bindir/moonshot"
176 MOONSHOT_WEBP="$bindir/moonshot-webp"
177
178 AC_SUBST(MIDL)
179 AC_SUBST(MSVC_LIB)
180 AC_SUBST(IMAGEMAGICK_CONVERT)
181 AC_SUBST(WIX_CANDLE)
182 AC_SUBST(WIX_LIGHT)
183 AC_SUBST(UPDATE_MIME_DATABASE)
184 AC_SUBST(UPDATE_DESKTOP_DATABASE)
185 AC_SUBST(MOONSHOT_APP)
186 AC_SUBST(MOONSHOT_WEBP)
187
188 # Dependencies
189 PKG_CHECK_MODULES(moonshot,[
190         atk >= 1.20
191         glib-2.0 >= 2.22
192         gobject-2.0 >= 2.22
193         gtk+-2.0 >= 2.18
194         gee-1.0 > 0.6
195         $SERVER_IPC_MODULE
196 ])
197
198 PKG_CHECK_MODULES(libmoonshot,[
199         $CLIENT_IPC_MODULE
200 ])
201
202 # i18n stuff
203 AM_GNU_GETTEXT([external])
204 AM_GNU_GETTEXT_VERSION([0.17])
205
206 AC_SUBST([GETTEXT_PACKAGE],[PACKAGE_TARNAME])
207 AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
208
209 AC_CONFIG_FILES([
210         Makefile
211         po/Makefile.in
212         moonshot.desktop
213         moonshot-webp.desktop
214         moonshot-ui.spec
215 ])
216
217 AC_OUTPUT