Release 0.7.1 to include upstream copyrights
[moonshot-ui.git] / configure.ac
1 AC_PREREQ([2.63])
2 AC_INIT([Moonshot-ui],
3         [0.7.1],
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 AM_CONDITIONAL([OS_LINUX], [test "$linux" = "yes"])
98 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
99 AM_CONDITIONAL([OS_MACOS], [test "$macos" = "yes"])
100
101 AM_CONDITIONAL([IPC_MSRPC], [test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"])
102 AM_CONDITIONAL([IPC_DBUS], [test "$SERVER_IPC_MODULE" != "msrpc-glib2-1.0"])
103 AM_CONDITIONAL([IPC_DBUS_GLIB], [test "$SERVER_IPC_MODULE" = "dbus-glib-1"])
104 AM_CONDITIONAL([IPC_GDBUS], [test "$SERVER_IPC_MODULE" = "gio-2.0"])
105
106 if test "$SERVER_IPC_MODULE" = "dbus-glib-1"; then
107   AC_MSG_CHECKING([$VALAC is no greater than 0.12.1])
108   vala_version=`$VALAC --version | sed 's/Vala  *//'`
109   AS_VERSION_COMPARE([0.12.2], ["$vala_version"],
110     [vala_supports_dbus_glib="no"],
111     [vala_supports_dbus_glib="no"],
112     [vala_supports_dbus_glib="yes"])
113
114   AC_MSG_RESULT([$vala_supports_dbus_glib])
115   if test "$vala_supports_dbus_glib" = "no"; then
116     AC_MSG_ERROR([
117 *** Vala 0.12.1 or earlier is required for dbus-glib support. Newer versions
118 *** require that you have GLib 2.26 or newer (for GDBus support).])
119   fi
120 fi
121
122 if test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"; then
123   # MS RPC utilities
124   AC_PATH_MSRPC_MINGW([0.1.0], :,
125     AC_MSG_ERROR([
126 *** msrpc-mingw 0.1.0 or better is required.]))
127
128   AC_PATH_PROG([MIDL], [midl], no,
129                [/c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin$PATH_SEPARATOR$PATH])
130   if test "$MIDL" = "no"; then
131      AC_MSG_ERROR([
132 *** Could not find the Microsoft interface compiler MIDL.EXE.
133 *** This program is available as part of the MS Windows SDK, in
134 *** the Win32 Development Tools package. If it is not in the PATH
135 *** or its default location you may set the 'MIDL' environment
136 *** variable to point to its location and rerun configure.])
137   fi
138 fi
139
140 if test "$win32" = "yes"; then
141   # Other Windows-specific tools
142
143   # LIB.EXE from MSVC to build an MSVC-compatible import library.
144   AC_PATH_PROG([MSVC_LIB], [lib], no,
145                [/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])
146
147   if test "$MSVC_LIB" = "no"; then
148      AC_MSG_WARN([
149 *** Could not find the Microsoft 'LIB.EXE' program. This is required
150 *** to build the Visual C import library for libmoonshot. Use the
151 *** MSVC_LIB environment variable to pass its location if this is
152 *** outside the PATH.])
153   fi
154
155
156   # ImageMagick for the 'make icons' target. Note that
157   # c:/windows/system32/convert.exe is nothing to do with ImageMagick.
158   AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
159                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/ImageMagick$PATH_SEPARATOR$PATH])
160
161   if test "$IMAGEMAGICK_CONVERT" = "no" || test "$IMAGEMAGICK_CONVERT" = "/c/windows/system32/convert"; then
162      AC_MSG_WARN([
163 *** Could not find ImageMagick convert.exe. This is required for the
164 *** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
165 *** variable to pass its location if this is outside the PATH.])
166   fi
167
168
169   # Windows Installer XML tools
170   AC_PATH_PROG([WIX_CANDLE], [candle], no,
171                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
172   AC_PATH_PROG([WIX_LIGHT], [light], no,
173                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR/c/Program\ Files\ \(x86\)/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
174
175   if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
176      AC_MSG_WARN([
177 *** Could not find the Windows Installer XML tools. These are required
178 *** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
179 *** environment variables to pass their locations if they are outside
180 *** the PATH.])
181   fi
182 fi
183
184 if test "$linux" = "yes"; then
185   AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
186   if test "$UPDATE_MIME_DATABASE" = "no"; then
187     AC_MSG_ERROR([
188 *** Could not find the Freedesktop.org  mime database update tool.
189 *** Web provisioning files could not be automatically installed.])
190   fi
191   AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
192   if test "$UPDATE_DESKTOP_DATABASE" = "no"; then
193     AC_MSG_ERROR([
194 *** Could not find the Freedesktop.org desktop entry database update
195 *** tool. Web provisioning files could not be automatically installed.])
196   fi
197 fi
198
199 MOONSHOT_APP="$bindir/moonshot"
200 MOONSHOT_WEBP="$bindir/moonshot-webp"
201
202 AC_SUBST(MIDL)
203 AC_SUBST(MSVC_LIB)
204 AC_SUBST(IMAGEMAGICK_CONVERT)
205 AC_SUBST(WIX_CANDLE)
206 AC_SUBST(WIX_LIGHT)
207 AC_SUBST(UPDATE_MIME_DATABASE)
208 AC_SUBST(UPDATE_DESKTOP_DATABASE)
209 AC_SUBST(MOONSHOT_APP)
210 AC_SUBST(MOONSHOT_WEBP)
211
212 # Dependencies
213 PKG_CHECK_MODULES(moonshot,[
214         atk >= 1.20
215         glib-2.0 >= 2.22
216         gobject-2.0 >= 2.22
217         $GTK_VERSION
218         gee-1.0 >= 0.5
219         $SERVER_IPC_MODULE
220                 $MAC
221 ])
222
223 PKG_CHECK_MODULES(libmoonshot,[
224         $CLIENT_IPC_MODULE
225 ])
226
227 # i18n stuff
228 AM_GNU_GETTEXT([external])
229 AM_GNU_GETTEXT_VERSION([0.17])
230
231 AC_SUBST([GETTEXT_PACKAGE],[PACKAGE_TARNAME])
232 AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
233
234 AC_CONFIG_FILES([
235         Makefile
236         po/Makefile.in
237         moonshot.desktop
238         moonshot-webp.desktop
239         moonshot-ui.spec
240 ])
241
242 AC_OUTPUT