Fix windows build issues
[moonshot-ui.git] / configure.ac
1 AC_PREREQ([2.66])
2 AC_INIT([Moonshot],
3         [0.0.1],
4         [BUG-REPORT-ADDRESS],
5         [moonshot])
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 PKG_PROG_PKG_CONFIG([0.24])
20
21 # Platform checks
22 AC_CANONICAL_HOST
23
24 case "$host" in
25   *-*-mingw*)
26     win32=yes
27     SERVER_IPC_MODULE="msrpc-glib2-1.0"
28     CLIENT_IPC_MODULE="msrpc-mingw-1.0"
29     ;;
30   *)
31     win32=no
32     SERVER_IPC_MODULE="dbus-glib-1"
33     CLIENT_IPC_MODULE="dbus-glib-1"
34     ;;
35 esac
36
37 AM_CONDITIONAL([OS_LINUX], [test "$win32" != "yes"])
38 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
39 AM_CONDITIONAL([IPC_MSRPC], [test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"])
40 AM_CONDITIONAL([IPC_DBUS], [test "$SERVER_IPC_MODULE" = "dbus-glib-1"])
41
42 # Checks for programs.
43 AC_PROG_CC
44 AM_PROG_CC_C_O
45 AM_PROG_VALAC([0.9])
46
47 if test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"; then
48   # MS RPC utilities
49   AC_PATH_MSRPC_MINGW([0.1.0], :,
50     AC_MSG_ERROR([
51 *** msrpc-mingw 0.1.0 or better is required.]))
52
53   AC_PATH_PROG([MIDL], [midl], no,
54                [/c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin$PATH_SEPARATOR$PATH])
55   if test "$MIDL" = "no"; then
56      AC_MSG_ERROR([
57 *** Could not find the Microsoft interface compiler MIDL.EXE.
58 *** This program is available as part of the MS Windows SDK, in
59 *** the Win32 Development Tools package. If it is not in the PATH
60 *** or its default location you may set the 'MIDL' environment
61 *** variable to point to its location and rerun configure.])
62   fi
63 fi
64
65 if test "$win32" = "yes"; then
66   # Other Windows-specific tools
67
68   # LIB.EXE from MSVC to build an MSVC-compatible import library.
69   AC_PATH_PROG([MSVC_LIB], [lib], no,
70                [/c/Program\ Files/Microsoft\ Visual\ Studio\ 9.0/VC/bin$PATH_SEPARATOR$PATH])
71
72   if test "$MSVC_LIB" = "no"; then
73      AC_MSG_WARN([
74 *** Could not find the Microsoft 'LIB.EXE' program. This is required
75 *** to build the Visual C import library for libmoonshot. Use the
76 *** MSVC_LIB environment variable to pass its location if this is
77 *** outside the PATH.])
78   fi
79
80
81   # ImageMagick for the 'make icons' target. Watch that it doesn't pick up
82   # c:/windows/system32/convert.exe, which is nothing to do with ImageMagick
83   AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
84                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR$PATH])
85
86   if test "$IMAGEMAGICK_CONVERT" = "no"; then
87      AC_MSG_WARN([
88 *** Could not find ImageMagick convert.exe. This is required for the
89 *** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
90 *** variable to pass its location if this is outside the PATH.])
91   fi
92
93
94   # Windows Installer XML tools
95   AC_PATH_PROG([WIX_CANDLE], [candle], no,
96                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
97   AC_PATH_PROG([WIX_LIGHT], [light], no,
98                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
99
100   if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
101      AC_MSG_WARN([
102 *** Could not find the Windows Installer XML tools. These are required
103 *** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
104 *** environment variables to pass their locations if they are outside
105 *** the PATH.])
106   fi
107 fi
108
109 if test "$win32" != "yes"; then
110   AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
111   if test "$UPDATE_MIME_DATABASE" = "no"; then
112     AC_MSG_ERROR([
113 *** Could not find the Freedesktop.org  mime database update tool.
114 *** Web provisioning files could not be automatically installed.])
115   fi
116   AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
117   if test "$UPDATE_DESKTOP_DATABASE" = "no"; then
118     AC_MSG_ERROR([
119 *** Could not find the Freedesktop.org desktop entry database update
120 *** tool. Web provisioning files could not be automatically installed.])
121   fi
122 fi
123
124 MOONSHOT_APP="$bindir/moonshot"
125 MOONSHOT_WEBP="$bindir/moonshot-webp"
126
127 AC_SUBST(MIDL)
128 AC_SUBST(MSVC_LIB)
129 AC_SUBST(IMAGEMAGICK_CONVERT)
130 AC_SUBST(WIX_CANDLE)
131 AC_SUBST(WIX_LIGHT)
132 AC_SUBST(UPDATE_MIME_DATABASE)
133 AC_SUBST(UPDATE_DESKTOP_DATABASE)
134 AC_SUBST(MOONSHOT_APP)
135 AC_SUBST(MOONSHOT_WEBP)
136
137 # Dependencies
138 PKG_CHECK_MODULES(moonshot,[
139         atk >= 1.20
140         glib-2.0 >= 2.24
141         gobject-2.0 >= 2.24
142         gtk+-2.0 >= 2.20
143         $SERVER_IPC_MODULE
144 ])
145
146 PKG_CHECK_MODULES(libmoonshot,[
147         $CLIENT_IPC_MODULE
148 ])
149
150 # i18n stuff
151 AM_GNU_GETTEXT([external])
152 AM_GNU_GETTEXT_VERSION([0.17])
153
154 AC_SUBST([GETTEXT_PACKAGE],[PACKAGE_TARNAME])
155 AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
156
157 AC_CONFIG_FILES([
158         Makefile
159         po/Makefile.in
160         moonshot.desktop
161         moonshot-webp.desktop
162 ])
163
164 AC_OUTPUT