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