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