Remove the acclerator mask
[mim] / configure.ac
1 dnl This is the rtcom-messaging-ui configure script template
2 AC_PREREQ([2.59])
3 AC_INIT(mim-pinyin, 0.0.1)
4 AM_INIT_AUTOMAKE([foreign 1.9])
5 AM_CONFIG_HEADER(config.h)
6
7 AC_ISC_POSIX
8 AC_PROG_CC
9 AM_PROG_CC_STDC
10 AC_HEADER_STDC
11 AM_PROG_LIBTOOL
12 AC_CHECK_PROGS([GTK_QUERY_IMMODULES], [gtk-query-immodules-2.0])
13
14 AC_CONFIG_MACRO_DIR(m4)
15
16 dnl Debugging options to enable debug macros and dmalloc
17 DEBUG_FLAGS=
18 LD_DMALLOC_FLAGS=
19 AC_ARG_ENABLE(debug,        [  --enable-debug           compile with DEBUG],,enable_debug=no)
20 AC_ARG_ENABLE(stdout,       [  --enable-stdout          compile with DEBUG to stdout],,enable_stdout=no)
21 AC_ARG_ENABLE(stderr,       [  --enable-stderr          compile with DEBUG to stderr],,enable_stderr=no)
22 AC_ARG_ENABLE(dmalloc,      [  --enable-dmalloc         compile with DMALLOC],,enable_dmalloc=no)
23 AC_ARG_ENABLE(profiling,    [  --enable-profiling       compile with profiling],,enable_profiling=no)
24 AC_ARG_ENABLE(coverage,     [  --enable-coverage        compile with coverage info],,enable_coverage=no)
25 AC_ARG_ENABLE(maemo_launcher, [  --enable-maemo-launcher        compile with maemo-launcher],,enable_maemo_launcher=no)
26 AC_ARG_ENABLE(tests,         [  --enable-tests          compile with tests support],,enable_tests=no)
27
28 if test "x$enable_debug" = "xyes"; then
29         DEBUG_FLAGS="-DDEBUG"
30 fi
31 if test "x$enable_stdout" = "xyes"; then
32         DEBUG_FLAGS="-DDEBUG -DOSSOLOG_STDOUT"
33 fi
34 if test "x$enable_stderr" = "xyes"; then
35         DEBUG_FLAGS="-DDEBUG -DOSSOLOG_STDERR"
36 fi
37 if test "x$enable_dmalloc" = "xyes"; then
38         DEBUG_FLAGS="$DEBUG_FLAGS -DDMALLOC"
39         LD_DMALLOC_FLAGS="-ldmallocth"
40 fi
41 if test "x$enable_profiling" = "xyes"; then
42         DEBUG_FLAGS="$DEBUG_FLAGS -pg"
43         PACKAGE_LDFLAGS="$PACKAGE_LDFLAGS -pg"
44 fi
45 if test "x$enable_coverage" = "xyes"; then
46         DEBUG_FLAGS="$DEBUG_FLAGS -g -fprofile-arcs -ftest-coverage"
47         PACKAGE_LDFLAGS="$PACKAGE_LDFLAGS -fprofile-arcs -ftest-coverage"
48 fi
49
50 dnl Check for debug flags
51 AC_MSG_CHECKING([for debug flags])
52 if test "x$DEBUG_FLAGS" = "x"; then
53         AC_MSG_RESULT(none)
54 else
55         AC_MSG_RESULT($DEBUG_FLAGS)
56 fi
57
58 dnl Check for dmalloc flags
59 AC_MSG_CHECKING([for dmalloc flags])
60 if test "x$LD_DMALLOC_FLAGS" = "x"; then
61         AC_MSG_RESULT(none)
62 else
63         AC_MSG_RESULT($LD_DMALLOC_FLAGS)
64 fi
65 dnl Turn off -Werror, prevent gtkimmodule global function missing warning  to error
66 dnl CFLAGS="$CFLAGS -DGCONF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -Wall -Werror -Wmissing-declarations -Wmissing-prototypes"
67 CFLAGS="$CFLAGS -DGCONF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -Wall -Wno-error -Wmissing-declarations -Wmissing-prototypes"
68
69 GTK_DOC_CHECK(1.5)
70
71 dnl Check for tests
72 AC_MSG_CHECKING([for tests])
73 if test "x$enable_tests" = "xyes"; then
74         AC_MSG_RESULT(yes)
75         PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [have_check=yes], [have_check=no])
76         AC_SUBST(CHECK_CFLAGS)
77         AC_SUBST(CHECK_LDFLAGS)
78         AC_SUBST(CHECK_LIBS)
79 else
80         AC_MSG_RESULT(no)
81 fi      
82 AM_CONDITIONAL(HAVE_CHECK, test x$have_check != xno && test x$enable_tests != xno)
83
84 dnl Localisation support
85 GETTEXT_PACKAGE=$PACKAGE
86 AC_SUBST(GETTEXT_PACKAGE)
87 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Define gettext package])
88
89 dnl Supported languages below
90 dnl ALL_LINGUAS="en_GB"
91 AM_GLIB_GNU_GETTEXT
92
93 dnl Set PACKAGE_LOCALE_DIR in config.h
94 if test "x${prefix}" = "xNONE"; then
95         AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], ["${ac_default_prefix}/${DATADIRNAME}/locale"],[Locale directory])
96 else
97         AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], ["${prefix}/${DATADIRNAME}/locale"], [Locale directory])
98 fi
99
100 dnl MIME-type registration check (2.6 / 2.8 version)
101 dnl AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database, no)
102 dnl AM_CONDITIONAL(HAVE_26_MIME, test x$UPDATE_MIME_DATABASE != xno)
103
104 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database, no)
105 AM_CONDITIONAL(HAVE_28_MIME, test x$UPDATE_DESKTOP_DATABASE != xno)
106
107 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
108 AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test x$GCONFTOOL != xno)
109
110 if test x"$GCONFTOOL" = xno; then
111         AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
112 fi
113 AM_GCONF_SOURCE_2
114
115 if test "x${prefix}" = "xNONE"; then
116         PACKAGE_HTML_DIR="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/html"
117         AC_DEFINE_UNQUOTED([PACKAGE_HTML_DIR], ["${PACKAGE_HTML_DIR}"],[HTML directory])
118 else
119         PACKAGE_HTML_DIR="${prefix}/${DATADIRNAME}/${PACKAGE}/html"
120         AC_DEFINE_UNQUOTED([PACKAGE_HTML_DIR], ["${PACKAGE_HTML_DIR}"], [HTML directory])
121 fi
122
123 dnl Check that we have the libtime dev package installed
124 AC_CHECK_HEADERS([time.h clockd/libtime.h], [], [],
125      [[#ifdef HAVE_TIME_H
126      #include <time.h>
127      #endif
128      ]])
129
130 dnl Packages and versions to be checked
131 PKG_CHECK_MODULES(PACKAGE, [
132         dbus-glib-1 >= 0.61
133         hildon-1
134         gconf-2.0
135 ])
136 PKG_CHECK_MODULES(GTK, [gtk+-2.0 pango])
137
138 dnl hildonmime
139 PKG_CHECK_MODULES(HILDONMIME, [
140         libhildonmime
141 ])
142
143 dnl Maemo launcher
144 AC_MSG_CHECKING([for maemo-launcher usage])
145 if test "x$enable_maemo_launcher" = "xyes"; then
146         PKG_CHECK_MODULES(MAEMO_LAUNCHER, [maemo-launcher-app])
147         AC_SUBST(MAEMO_LAUNCHER_CFLAGS)
148         AC_SUBST(MAEMO_LAUNCHER_LDFLAGS)
149         AC_SUBST(MAEMO_LAUNCHER_LIBS)
150 else
151         AC_MSG_RESULT(no)
152 fi
153
154 dnl "Export" flags
155 AC_SUBST(DEBUG_FLAGS)
156 AC_SUBST(LD_MALLOC_FLAGS)
157
158 dnl Export package wide parameters
159 AC_SUBST(PACKAGE_CFLAGS)
160 AC_SUBST(PACKAGE_LIBS)
161 AC_SUBST(PACKAGE_LDFLAGS)
162 AC_SUBST(PACKAGE_HTML_DIR)
163
164 AC_OUTPUT([
165         mim-pinyin.pc
166         Makefile
167         m4/Makefile
168         src/Makefile
169         src/mim/Makefile
170         src/ui/Makefile
171         util/Makefile
172         data/Makefile
173         data/org.ifanr.MiM.service
174         test/Makefile
175         docs/Makefile
176 ])