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