windows: generate MSVC import lib when possible
[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     IPC_MODULE="msrpc-glib2-1.0"
28     ;;
29   *)
30     win32=no
31     IPC_MODULE="dbus-glib-1"
32     ;;
33 esac
34
35 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
36 AM_CONDITIONAL([IPC_MSRPC], [test "$IPC_MODULE" = "msrpc-glib2-1.0"])
37 AM_CONDITIONAL([IPC_DBUS], [test "$IPC_MODULE" = "dbus-glib-1"])
38
39 # Checks for programs.
40 AC_PROG_CC
41 AM_PROG_CC_C_O
42 AM_PROG_VALAC([0.9])
43
44 if test "$IPC_MODULE" = "msrpc-glib2-1.0"; then
45   # MS RPC utilities
46   AC_PATH_MSRPC_MINGW([0.1.0], :,
47     AC_MSG_ERROR([
48 *** msrpc-mingw 0.1.0 or better is required.]))
49
50   AC_PATH_PROG([MIDL], [midl], no,
51                [/c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin$PATH_SEPARATOR$PATH])
52   if test "$MIDL" = "no"; then
53      AC_MSG_ERROR([
54 *** Could not find the Microsoft interface compiler MIDL.EXE.
55 *** This program is available as part of the MS Windows SDK, in
56 *** the Win32 Development Tools package. If it is not in the PATH
57 *** or its default location you may set the 'MIDL' environment
58 *** variable to point to its location and rerun configure.])
59   fi
60 fi
61
62 if test "$win32" = "yes"; then
63   # Other Windows-specific tools
64
65   # LIB.EXE from MSVC to build an MSVC-compatible import library.
66   AC_PATH_PROG([MSVC_LIB], [lib], no)
67
68   if test "$MSVC_LIB" = "no"; then
69      AC_MSG_WARN([
70 *** Could not find the Microsoft 'LIB.EXE' program. This is required
71 *** to build the Visual C import library for libmoonshot. Use the
72 *** MSVC_LIB environment variable to pass its location if this is
73 *** outside the PATH.])
74   fi
75
76
77   # ImageMagick for the 'make icons' target. Watch that it doesn't pick up
78   # c:/windows/system32/convert.exe, which is nothing to do with ImageMagick
79   AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
80                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR$PATH])
81
82   if test "$IMAGEMAGICK_CONVERT" = "no"; then
83      AC_MSG_WARN([
84 *** Could not find ImageMagick convert.exe. This is required for the
85 *** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
86 *** variable to pass its location if this is outside the PATH.])
87   fi
88
89
90   # Windows Installer XML tools
91   AC_PATH_PROG([WIX_CANDLE], [candle], no,
92                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
93   AC_PATH_PROG([WIX_LIGHT], [light], no,
94                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
95
96   if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
97      AC_MSG_WARN([
98 *** Could not find the Windows Installer XML tools. These are required
99 *** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
100 *** environment variables to pass their locations if they are outside
101 *** the PATH.])
102   fi
103 fi
104
105 AC_SUBST(MIDL)
106 AC_SUBST(MSVC_LIB)
107 AC_SUBST(IMAGEMAGICK_CONVERT)
108 AC_SUBST(WIX_CANDLE)
109 AC_SUBST(WIX_LIGHT)
110
111 # Dependencies
112 PKG_CHECK_MODULES(moonshot,[
113         atk >= 1.20
114         glib-2.0 >= 2.24
115         gobject-2.0 >= 2.24
116         gtk+-2.0 >= 2.20
117         $IPC_MODULE
118 ])
119
120 PKG_CHECK_MODULES(libmoonshot,[
121         $IPC_MODULE
122 ])
123
124 # i18n stuff
125 AM_GNU_GETTEXT([external])
126 AM_GNU_GETTEXT_VERSION([0.17])
127
128 AC_SUBST([GETTEXT_PACKAGE],[PACKAGE_TARNAME])
129 AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
130
131 AC_CONFIG_FILES([
132         Makefile
133         po/Makefile.in
134 ])
135
136 AC_OUTPUT