2008-11-24 Claudio Saavedra <csaavedra@igalia.com>
[hildon] / configure.ac
1 AC_INIT([Hildon gtk widgets], [2.1.25], [hildon@projects.maemo.org], [hildon])
2 AC_CANONICAL_SYSTEM
3
4 AM_CONFIG_HEADER(config.h)
5 AC_CONFIG_SRCDIR([src/hildon-window.h])
6 AC_CONFIG_MACRO_DIR([m4])
7 AM_MAINTAINER_MODE
8
9 # define PACKAGE_VERSION_* variables
10 AS_VERSION
11
12 #define API_VERSION_MAJOR
13 API_VERSION_MAJOR=1
14 AC_SUBST(API_VERSION_MAJOR)
15
16 # set the libtool versioning
17 # Quick guide into libtool versioning:
18 # 1. Start with version information of `0:0:0' for each libtool library.
19 # 2. Update the version information only immediately before a public release of your software. 
20 #    More frequent updates are unnecessary, and only guarantee that the current interface number 
21 #    gets larger faster.
22 # 3. If the library source code has changed at all since the last update, then increment revision 
23 #    (`c:r:a' becomes `c:r+1:a').
24 # 4. If any interfaces have been added, removed, or changed since the last update, 
25 #    increment current, and set revision to 0.
26 # 5. If any interfaces have been added since the last public release, then increment age.
27 # 6. If any interfaces have been removed since the last public release, then set age to 0.  
28 AS_LIBTOOL(HILDON, 18, 4, 18)
29 AM_INIT_AUTOMAKE
30
31 AC_PROG_CC
32 AM_PROG_LIBTOOL
33 AC_PROG_INSTALL
34 AC_PROG_AWK
35
36 AC_HEADER_STDC
37
38 GTK_VERSION=2.12.9
39
40 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VERSION)
41 AC_SUBST(GTK_LIBS)
42 AC_SUBST(GTK_CFLAGS)
43 AC_SUBST(GTK_VERSION)
44
45 # libcanberra is needed for the hildon-note sounds.
46
47 PKG_CHECK_MODULES(CANBERRA, libcanberra)
48 AC_SUBST(CANBERRA_LIBS)
49 AC_SUBST(CANBERRA_CFLAGS)
50
51 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.6)
52 AC_SUBST(GCONF_CFLAGS)
53 AC_SUBST(GCONF_LIBS)
54
55 ALL_LINGUAS="en_GB"
56 AC_SUBST(ALL_LINGUAS) 
57 AM_GLIB_GNU_GETTEXT
58
59 GTK_DOC_CHECK([1.3])
60
61 localedir=${datadir}/locale
62
63 AC_SUBST(localedir)
64
65 # Disable rebuild of glib-mkenum -generated source code:
66 AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
67
68 # define a MAINT-like variable REBUILD which is set if Perl
69 # is found, so autogenerated sources can be rebuilt
70 AC_CHECK_PROGS(PERL, perl5 perl)
71
72 REBUILD=\#
73 if test "x$enable_rebuilds" = "xyes" && \
74      test -n "$PERL" && \
75      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
76   REBUILD=
77 fi
78 AC_SUBST(REBUILD)
79
80 # build examples (or not)
81 AC_ARG_WITH(examples, 
82     AC_HELP_STRING([--with-examples], [Build the examples]),
83     [
84      case "${withval}" in
85          yes) BUILD_EXAMPLES=yes ;;
86          no)  BUILD_EXAMPLES=no ;;
87          *)   AC_MSG_ERROR(bad value ${withval} for --with-examples) ;;
88      esac],
89      [BUILD_EXAMPLES=no])
90
91 AM_CONDITIONAL(BUILD_EXAMPLES, test "x$BUILD_EXAMPLES" = "xyes")
92
93 # just print out our status
94 if test x$BUILD_EXAMPLES = xyes; then
95     AC_MSG_NOTICE(Will locally build example programs)
96 else
97     AC_MSG_NOTICE(Will not build examples )
98 fi
99
100 # use maemo gtk+ specific api (or not)
101 AC_ARG_WITH(maemo-gtk, 
102     AC_HELP_STRING([--with-maemo-gtk], [Use Maemo GTK+ API]),
103     [
104      case "${withval}" in
105          yes) USE_MAEMO_GTK=yes ;;
106          no)  USE_MAEMO_GTK=no ;;
107          *)   AC_MSG_ERROR(bad value ${withval} for --with-maemo-gtk) ;;
108      esac],
109      [USE_MAEMO_GTK=yes])
110
111 AM_CONDITIONAL(USE_MAEMO_GTK, test "x$USE_MAEMO_GTK" = "xyes")
112
113 # just print out our status
114 if test x$USE_MAEMO_GTK = xyes; then
115     AC_MSG_NOTICE(Will use Maemo GTK+ specific API)
116     MAEMO_GTK="-DMAEMO_GTK"
117     AC_SUBST(MAEMO_GTK)
118     MAEMO_CHANGES="-DMAEMO_CHANGES"
119     AC_SUBST(MAEMO_CHANGES)
120 else
121     AC_MSG_NOTICE(Will not use Maemo GTK+ specific API)
122 fi
123
124 # build with assertion checks (or not)
125 AC_ARG_WITH(asserts, 
126     AC_HELP_STRING([--with-asserts], [Build with the assertion checks]),
127     [
128      case "${withval}" in
129          yes) BUILD_WITH_ASSERTS=yes ;;
130          no)  BUILD_WITH_ASSERTS=no ;;
131          *)   AC_MSG_ERROR(bad value ${withval} for --with-asserts) ;;
132      esac],
133      [BUILD_WITH_ASSERTS=no])
134
135 # just print out our status
136 if test x$BUILD_WITH_ASSERTS = xyes; then
137     AC_MSG_NOTICE(Will build with assertion checks)
138     ASSERT_CFLAGS=""
139 else
140     AC_MSG_NOTICE(Will not build with assertion checks)
141     ASSERT_CFLAGS="-DG_DISABLE_ASSERT"
142 fi
143
144 # build with relaxed flags or not
145 AC_ARG_ENABLE(fatal, 
146     AC_HELP_STRING([--enable-fatal], [Build with fatal warnings]),
147     [
148      case "${enableval}" in
149          yes) BUILD_WITH_FATAL=yes ;;
150          no)  BUILD_WITH_FATAL=no ;;
151          *)   AC_MSG_ERROR(bad value ${enableval} for --enable-fatal) ;;
152      esac],
153      [BUILD_WITH_FATAL=no])
154
155 # just print out our status
156 if test x$BUILD_WITH_FATAL = xyes; then
157     AC_MSG_NOTICE(Will build with fatal warnings)
158     FATAL_CFLAGS="-Werror"
159 else
160     AC_MSG_NOTICE(Will build with non-fatal warnings)
161     FATAL_CFLAGS=""
162 fi
163
164 # disable deprecated symbols
165 AC_ARG_ENABLE(deprecated,
166               [AC_HELP_STRING([--enable-deprecated],
167                               [enable use of deprecated symbols [default=yes]])],,
168               [enable_deprecated="yes"])
169
170 if test x$enable_deprecated = xno; then
171     DISABLE_DEPRECATED="-DHILDON_DISABLE_DEPRECATED"
172 fi
173
174 AM_CONDITIONAL([HILDON_DISABLE_DEPRECATED], test "x$enable_deprecated" = "xno")
175
176 # Check support (c unit test)
177 PKG_CHECK_MODULES(CHECK, check , [BUILD_TESTS="yes"], [BUILD_TESTS="no"])
178 AM_CONDITIONAL(BUILD_TESTS, test "x$BUILD_TESTS" = "xyes")
179
180 CFLAGS="$CFLAGS ${ASSERT_CFLAGS} -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format ${FATAL_CFLAGS}"
181 # -Wno-format due to way translation string are done
182
183 ### disable deprecated symbols
184 EXTRA_CFLAGS="$DISABLE_DEPRECATED"
185 AC_SUBST(EXTRA_CFLAGS)
186
187 ### enable MAEMO platform extensions
188 CFLAGS="$CFLAGS $MAEMO_CHANGES $MAEMO_GTK"
189
190 # HILDON_OBJ_*
191 # default vars for the examples
192 # includes all the low-level flags
193 # FIXME Add esd and gconf flags
194 HILDON_OBJ_CFLAGS="\$(CFLAGS) \$(GTK_CFLAGS) \$(CHECK_CFLAGS) \$(GCONF_CFLAGS) -I\$(top_builddir)/src/"
195 HILDON_OBJ_LIBS="\$(top_builddir)/src/libhildon-\$(API_VERSION_MAJOR).la \$(GTK_LIBS) \$(GCONF_LIBS) \$(CHECK_LIBS) `pkg-config --libs gthread-2.0`"
196 AC_SUBST(HILDON_OBJ_CFLAGS)
197 AC_SUBST(HILDON_OBJ_LIBS)
198
199 AC_CONFIG_FILES([Makefile               \
200                  src/Makefile           \
201                  src/hildon-version.h   \
202                  pkgconfig/Makefile     \
203                  examples/Makefile      \
204                  pkgconfig/hildon.pc    \
205                  tests/Makefile         \
206                  doc/Makefile           \
207                  po/POTFILES            \
208                  po/porules.mk          \
209                  po/Makefile])
210
211 AC_OUTPUT
212
213 echo "
214
215 Configuration:
216
217 - Package:...........: ${PACKAGE}
218 - Version............: ${VERSION}
219 - Api................: ${PACKAGE}-${API_VERSION_MAJOR}
220 - Compiler...........: ${CC}
221 - Enable deprecated..: ${enable_deprecated}
222 - gtk-doc support....: ${enable_gtk_doc}
223 - Build examples.....: ${BUILD_EXAMPLES}
224 - Build with asserts.: ${BUILD_WITH_ASSERTS}
225 - Build unit tests...: ${BUILD_TESTS}
226 - Fatal warnings.....: ${BUILD_WITH_FATAL}
227
228 "