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