]> git.0d.be Git - empathy.git/blob - configure.ac
Fail to build if --enable-gtk3 is passed but only gtk2 is available
[empathy.git] / configure.ac
1 dnl If not 1, append datestamp to the version number
2 m4_define(empathy_released, 0)
3
4 m4_define([empathy_major_version], [2])
5 m4_define([empathy_minor_version], [31])
6 m4_define([empathy_micro_version], [4])
7 m4_define([empathy_nano_version], [0])
8
9 dnl Display the nano_version only if it's not '0'
10 m4_define([empathy_base_version],
11           [empathy_major_version.empathy_minor_version.empathy_micro_version])
12 m4_define([empathy_full_version],
13           [m4_if(empathy_nano_version, 0, [empathy_base_version],
14               [empathy_base_version].[empathy_nano_version])])
15
16 m4_define(empathy_maybe_datestamp,
17           m4_esyscmd([if test x]empathy_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
18
19 m4_define(empathy_version, empathy_full_version[]empathy_maybe_datestamp)
20
21
22 AC_INIT(Empathy, empathy_version, http://bugzilla.gnome.org/browse.cgi?product=empathy)
23
24
25 AC_PREREQ(2.59)
26 AC_COPYRIGHT([
27   Copyright (C) 2003-2007 Imendio AB
28   Copyright (C) 2007-2008 Collabora Ltd.
29 ])
30
31 # Minimal version required
32
33 # Hardp deps
34 GCONF_REQUIRED=1.2.0
35 GLIB_REQUIRED=2.25.9
36 GTK_REQUIRED=2.21.2
37 KEYRING_REQUIRED=2.22
38 LIBCANBERRA_GTK_REQUIRED=0.4
39 LIBNOTIFY_REQUIRED=0.4.4
40 LIBNOTIFY_REQUIRED_GTK3=0.5.1
41 TELEPATHY_GLIB_REQUIRED=0.11.7
42 TELEPATHY_LOGGER=0.1.2
43 UNIQUE_REQUIRED=1.1.2
44
45 # Optionnal deps
46 CLUTTER_GTK_REQUIRED=0.10
47 ENCHANT_REQUIRED=1.2.0
48 GEOCLUE_REQUIRED=0.11
49 ISO_CODES_REQUIRED=0.35
50 LIBCHAMPLAIN_GTK_REQUIRED=0.4
51 LIBCHAMPLAIN_REQUIRED=0.4
52 NAUTILUS_SENDTO_REQUIRED=2.28.1
53 NAUTILUS_SENDTO_REQUIRED_GTK3=2.90.0
54 NETWORK_MANAGER_REQUIRED=0.7.0
55 WEBKIT_REQUIRED=1.1.15
56
57 # Use --enable-maintainer-mode to disable deprecated symbols,
58 # disable single include and enable GSEAL. If this is not a released empathy,
59 # maintainer mode is forced
60 ifelse(empathy_released, 1, [], [enable_maintainer_mode="yes"])
61 GNOME_MAINTAINER_MODE_DEFINES
62
63 AC_CONFIG_MACRO_DIR([m4])
64 AC_CONFIG_HEADERS([config.h])
65 AC_CONFIG_SRCDIR([configure.ac])
66 AC_CONFIG_AUX_DIR(.)
67
68 GNOME_COMMON_INIT
69
70 AM_INIT_AUTOMAKE(1.9 dist-bzip2 no-define -Wno-portability)
71
72 # Support silent build rules, requires at least automake-1.11. Disable
73 # by either passing --disable-silent-rules to configure or passing V=1
74 # to make
75 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
76
77 AC_ISC_POSIX
78 AC_PROG_CC
79 AC_HEADER_STDC
80 AM_PROG_LIBTOOL
81 AM_PROG_MKDIR_P
82 AM_PATH_GLIB_2_0
83 AC_PATH_XTRA
84 IT_PROG_INTLTOOL([0.35.0])
85 GNOME_DOC_INIT([0.17.3])
86 AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
87 GLIB_GSETTINGS
88 GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
89 AC_SUBST(GLIB_GENMARSHAL)
90 CONTROL_CENTER_EXTENSIONDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center-extension`
91 AC_SUBST(CONTROL_CENTER_EXTENSIONDIR)
92
93 AC_CHECK_PROGS([XSLTPROC], [xsltproc])
94 if test -z "$XSLTPROC"; then
95   AC_MSG_ERROR([xsltproc (from libxslt) is required])
96 fi
97 AM_PATH_PYTHON([2.3])
98
99 EMPATHY_ARG_VALGRIND
100
101
102 # -----------------------------------------------------------
103 # Error flags
104 # -----------------------------------------------------------
105 AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
106 AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
107
108 AC_ARG_ENABLE(Werror,
109   AC_HELP_STRING([--disable-Werror],[compile without -Werror (normally enabled in development builds)]),
110     werror=$enableval, :)
111
112 AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
113 AS_COMPILER_FLAG(-Wno-missing-field-initializers,
114         wno_missing_field_initializers=yes,
115         wno_missing_field_initializers=no)
116 AS_COMPILER_FLAG(-Wno-unused-parameter,
117         wno_unused_parameter=yes,
118         wno_unused_parameter=no)
119
120 ifelse(empathy_released, 1, [],
121     [
122         if test x$werror = xyes; then
123             ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
124         fi
125         if test x$wextra = xyes -a \
126             x$wno_missing_field_initializers = xyes -a \
127             x$wno_unused_parameter = xyes; then
128             ERROR_CFLAGS="$ERROR_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter"
129         fi
130     ])
131
132 AS_COMPILER_FLAG(-Wdeclaration-after-statement, ERROR_CFLAGS="$ERROR_CFLAGS -Wdeclaration-after-statement")
133 AS_COMPILER_FLAG(-Wshadow, ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow")
134 AS_COMPILER_FLAG(-Wmissing-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-prototypes")
135 AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-declarations")
136 # Disabled because some GTK+ headers (like gtkitemfactory.h) are bugged :(
137 #AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes")
138
139 AC_SUBST(ERROR_CFLAGS)
140
141 # -----------------------------------------------------------
142 # Pkg-Config dependency checks
143 # -----------------------------------------------------------
144
145 PKG_CHECK_MODULES(EMPATHY,
146 [
147    dbus-glib-1
148    farsight2-0.10
149    gconf-2.0 >= $GCONF_REQUIRED
150    gio-2.0 >= $GLIB_REQUIRED
151    gio-unix-2.0 >= $GLIB_REQUIRED
152    gnome-keyring-1 >= $KEYRING_REQUIRED
153    gobject-2.0
154    gstreamer-0.10
155    gstreamer-interfaces-0.10
156    libebook-1.2
157    libxml-2.0
158    telepathy-farsight
159    telepathy-glib >= $TELEPATHY_GLIB_REQUIRED
160    telepathy-logger-0.1 >= $TELEPATHY_LOGGER
161    x11
162 ])
163
164 # -----------------------------------------------------------
165 # GTK+
166 # -----------------------------------------------------------
167 AC_ARG_ENABLE(gtk3,
168               AS_HELP_STRING([--enable-gtk3=@<:@no/yes/auto@:>@],
169                              [build with GTK+3]), ,
170                              enable_gtk3=auto)
171
172 # Try to use GTK+3 if available
173 if test "x$enable_gtk3" != "xno"; then
174   PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= $GTK_REQUIRED],
175       have_gtk3="yes", have_gtk3="no")
176 else
177   have_gtk3="no"
178 fi
179
180 if test "x$enable_gtk3" = "xyes" -a "x$have_gtk3" != "xyes"; then
181    AC_MSG_ERROR([Couldn't find gtk3 dependencies.])
182 fi
183
184 if test "x$have_gtk3" == "xyes"; then
185   # GTK3 specific deps
186   PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED)
187   PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_GTK3)
188   PKG_CHECK_MODULES(UNIQUE, unique-3.0 >= $UNIQUE_REQUIRED)
189 else
190   PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
191
192   # GTK2 specific deps
193   PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk >= $LIBCANBERRA_GTK_REQUIRED)
194   PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
195   PKG_CHECK_MODULES(UNIQUE, unique-1.0 >= $UNIQUE_REQUIRED)
196
197   # Enable GSEAL checks if needed
198   if test $USE_MAINTAINER_MODE = yes; then
199     AC_DEFINE(GSEAL_ENABLE, [], [Seal public structs to force usage of accessors])
200   fi
201 fi
202
203 # -----------------------------------------------------------
204 # Enable debug
205 # -----------------------------------------------------------
206
207 AC_ARG_ENABLE(debug,
208   AC_HELP_STRING([--disable-debug],[compile without debug code]),
209     enable_debug=$enableval, enable_debug=yes )
210
211 if test x$enable_debug = xyes; then
212   AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code])
213 fi
214
215 # -----------------------------------------------------------
216 # Language Support
217 # -----------------------------------------------------------
218
219 GETTEXT_PACKAGE=empathy
220 AC_SUBST(GETTEXT_PACKAGE)
221 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
222
223 AM_GLIB_GNU_GETTEXT
224
225 # -----------------------------------------------------------
226 # Connectivity integration
227 # -----------------------------------------------------------
228 AC_ARG_WITH(connectivity,
229               AS_HELP_STRING([--with-connectivity=@<:@nm/connman/auto/no@:>@],
230                              [build with connectivity support]), ,
231                              with_connectivity=auto)
232
233 if test "x$with_connectivity" = "xno"; then
234    have_nm=no
235    have_connman=no
236
237 elif test "x$with_connectivity" = "xconnman"; then
238
239    PKG_CHECK_MODULES(CONNMAN,
240    [
241       dbus-glib-1
242    ], have_connman="yes", have_connman="no")
243
244    if test "x$have_connman" = "xyes"; then
245       AC_DEFINE(HAVE_CONNMAN, 1, [Define if you have connman dependencies])
246       have_nm=no
247    fi
248
249 else
250
251    PKG_CHECK_MODULES(NETWORK_MANAGER,
252    [
253       libnm_glib >= $NETWORK_MANAGER_REQUIRED
254    ], have_nm="yes", have_nm="no")
255
256    if test "x$have_nm" = "xyes"; then
257       AC_DEFINE(HAVE_NM, 1, [Define if you have libnm-glib])
258       have_connman=no
259    else
260       PKG_CHECK_MODULES(NETWORK_MANAGER,
261       [
262           libnm-glib >= $NETWORK_MANAGER_REQUIRED
263       ], have_nm="yes", have_nm="no")
264
265       if test "x$have_nm" = "xyes"; then
266       AC_DEFINE(HAVE_NM, 1, [Define if you have libnm-glib])
267       have_connman=no
268       fi
269    fi
270 fi
271
272 if test "x$with_connectivity" = "xconnman" -a "x$have_connman" != "xyes"; then
273    AC_MSG_ERROR([Couldn't find connman dependencies.])
274 fi
275
276 if test "x$with_connectivity" = "xnm" -a "x$have_nm" != "xyes"; then
277    AC_MSG_ERROR([Couldn't find libnm-glib dependencies.])
278 fi
279
280 AM_CONDITIONAL(HAVE_NM, test "x$have_nm" = "xyes")
281 AM_CONDITIONAL(HAVE_CONNMAN, test "x$have_connman" = "xyes")
282
283 # -----------------------------------------------------------
284 # Webkit
285 # -----------------------------------------------------------
286 AC_ARG_ENABLE(webkit,
287               AS_HELP_STRING([--enable-webkit=@<:@no/yes/auto@:>@],
288                              [build with webkit support]), ,
289                              enable_webkit=auto)
290
291 if test "x$enable_webkit" != "xno"; then
292
293    if test "x$have_gtk3" == "xno"; then
294       PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= $WEBKIT_REQUIRED],
295           have_webkit="yes", have_webkit="no")
296    else
297       PKG_CHECK_MODULES(WEBKIT, [webkitgtk-3.0 >= $WEBKIT_REQUIRED],
298           have_webkit="yes", have_webkit="no")
299    fi
300
301    if test "x$have_webkit" = "xyes"; then
302       AC_DEFINE(HAVE_WEBKIT, 1, [Define if you have libwebkitgtk])
303    fi
304 else
305    have_webkit=no
306 fi
307
308 if test "x$enable_webkit" = "xyes" -a "x$have_webkit" != "xyes"; then
309    AC_MSG_ERROR([Couldn't find webkit dependencies.])
310 fi
311 AM_CONDITIONAL(HAVE_WEBKIT, test "x$have_webkit" = "xyes")
312
313 # -----------------------------------------------------------
314 # spellchecking checks: enchant and iso-codes
315 # -----------------------------------------------------------
316 AC_ARG_ENABLE(spell,
317               AS_HELP_STRING([--enable-spell=@<:@no/yes/auto@:>@],
318                              [Enable spell checking]), ,
319                              enable_spell=auto)
320
321 if test "x$enable_spell" != "xno"; then
322    PKG_CHECK_MODULES(ENCHANT,
323    [
324       enchant >= $ENCHANT_REQUIRED,
325       iso-codes >= $ISO_CODES_REQUIRED
326    ], have_enchant="yes", have_enchant="no")
327
328    if test "x$have_enchant" = "xyes"; then
329       AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
330       if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
331          $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
332             AC_DEFINE_UNQUOTED(ISO_CODES_PREFIX, ["`$PKG_CONFIG --variable=prefix iso-codes`"], [ISO codes prefix])
333             AC_DEFINE(HAVE_ENCHANT, [], [Define if you have libenchant])
334             result=yes
335       else
336             result=no
337             have_enchant="no"
338       fi
339       AC_MSG_RESULT([$result])
340    fi
341 else
342    have_enchant=no
343 fi
344
345 if test "x$enable_spell" = "xyes" -a "x$have_enchant" != "xyes"; then
346    AC_MSG_ERROR([Couldn't find spell dependencies.])
347 fi
348
349 AM_CONDITIONAL(HAVE_ENCHANT, test "x$have_enchant" = "xyes")
350
351 # -----------------------------------------------------------
352 # Map view checks: libchamplain
353 # -----------------------------------------------------------
354 AC_ARG_ENABLE(map,
355               AS_HELP_STRING([--enable-map=@<:@no/yes/auto@:>@],
356                              [Enable map view]), ,
357                              enable_map=auto)
358
359 if test "x$enable_map" != "xno"; then
360
361    if test "x$have_gtk3" == "xno"; then
362       PKG_CHECK_MODULES(LIBCHAMPLAIN,
363       [
364          champlain-0.4 >= $LIBCHAMPLAIN_REQUIRED,
365          champlain-gtk-0.4 >= $LIBCHAMPLAIN_GTK_REQUIRED
366          clutter-gtk-0.10 >= $CLUTTER_GTK_REQUIRED
367       ], have_libchamplain="yes", have_libchamplain="no")
368    else
369       have_libchamplain="no"
370    fi
371
372    if test "x$have_libchamplain" = "xyes"; then
373       AC_DEFINE(HAVE_LIBCHAMPLAIN, 1, [Define if you have libchamplain])
374    fi
375 else
376    # FIXME: check deps once clutter-gtk and champlain have been ported to GTK3
377    have_libchamplain=no
378 fi
379
380 if test "x$enable_map" = "xyes" -a "x$have_libchamplain" != "xyes"; then
381    AC_MSG_ERROR([Couldn't find map view dependencies.])
382 fi
383
384 AM_CONDITIONAL(HAVE_LIBCHAMPLAIN, test "x$have_libchamplain" = "xyes")
385
386 # -----------------------------------------------------------
387 # location checks: geoclue
388 # -----------------------------------------------------------
389 AC_ARG_ENABLE(location,
390               AS_HELP_STRING([--enable-location=@<:@no/yes/auto@:>@],
391                              [Enable location awareness]), ,
392                              enable_location=auto)
393
394 if test "x$enable_location" != "xno"; then
395    PKG_CHECK_MODULES(GEOCLUE,
396    [
397       geoclue >= $GEOCLUE_REQUIRED
398    ], have_geoclue="yes", have_geoclue="no")
399
400    if test "x$have_geoclue" = "xyes"; then
401       AC_DEFINE(HAVE_GEOCLUE, 1, [Define if you have geoclue])
402    fi
403 else
404    have_geoclue="no"
405 fi
406
407 if test "x$enable_location" = "xyes" -a "x$have_geoclue" != "xyes"; then
408    AC_MSG_ERROR([Couldn't find location dependencies.])
409 fi
410
411 AM_CONDITIONAL(HAVE_GEOCLUE, test "x$have_geoclue" = "xyes")
412 AC_SUBST(GEOCLUE_CFLAGS)
413 AC_SUBST(GEOCLUE_LIBS)
414
415 # -----------------------------------------------------------
416 # meego widgets support
417 # -----------------------------------------------------------
418 AC_ARG_ENABLE(meego,
419               AS_HELP_STRING([--enable-meego=@<:no/yes@:>@],
420                              [Enable meego widgets]), ,
421                              enable_meego=no)
422
423 if test "x$enable_meego" != "xno"; then
424     PKG_CHECK_MODULES(MEEGO,
425     [
426        mx-gtk-1.0
427     ], have_meego="yes", have_meego="no")
428
429     if test "x$have_meego" = "xyes"; then
430        AC_DEFINE(HAVE_MEEGO, 1, [Define if you have meego])
431     fi
432 else
433    have_meego="no"
434 fi
435
436 if test "x$enable_meego" = "xyes" -a "x$have_meego" != "xyes"; then
437    AC_MSG_ERROR([Couldn't find meego dependencies.])
438 fi
439
440 AM_CONDITIONAL(HAVE_MEEGO, test "x$have_meego" = "xyes")
441 AC_SUBST(MEEGO_CFLAGS)
442 AC_SUBST(MEEGO_LIBS)
443
444 # -----------------------------------------------------------
445 # nautilus-sendto
446 # -----------------------------------------------------------
447 AC_ARG_ENABLE(nautilus-sendto,
448               AS_HELP_STRING([--enable-nautilus-sendto=@<:@no/yes/auto@:>@],
449                              [build nautilus-sendto plugin]), ,
450                              enable_nautilus_sendto=auto)
451
452 if test "x$enable_nautilus_sendto" != "xno"; then
453    if test "x$have_gtk3" == "xno"; then
454       # Newer NST requires GTK+3 so we can't use it
455       PKG_CHECK_MODULES(NST,[nautilus-sendto >= $NAUTILUS_SENDTO_REQUIRED
456           nautilus-sendto < 2.90.0],
457           have_nst="yes", have_nst="no")
458
459       AC_DEFINE(HAVE_OLD_NST, [], [Legacy compat mode with old nautilus-sendto] )
460    else
461       PKG_CHECK_MODULES(NST,[nautilus-sendto >= $NAUTILUS_SENDTO_REQUIRED_GTK3],
462           have_nst="yes", have_nst="no")
463    fi
464 else
465    have_nst=no
466 fi
467
468 if test "x$enable_nautilus_sendto" = "xyes" -a "x$have_nst" != "xyes"; then
469    AC_MSG_ERROR([Couldn't find nautilus-sendto dependencies.])
470 fi
471
472 AM_CONDITIONAL(HAVE_NST, test "x$have_nst" = "xyes")
473
474 # -----------------------------------------------------------
475 # new, single-window control center
476 # -----------------------------------------------------------
477 AC_ARG_ENABLE(control_center_embedding,
478               AS_HELP_STRING([--enable-control-center-embedding=@<:@no/yes/auto@:>@],
479                              [Enable support for single-window control center]),
480                              , enable_control_center_embedding=auto)
481
482 if test "x$enable_control_center_embedding" != "xno"; then
483    PKG_CHECK_MODULES(CONTROL_CENTER_EMBEDDING,
484    [
485       libgnome-control-center-extension
486    ], have_control_center_embedding="yes", have_control_center_embedding="no")
487
488    if test "x$have_control_center_embedding" = "xyes"; then
489       AC_DEFINE(HAVE_CONTROL_CENTER_EMBEDDING, 1, [Define if you have the single-window control center])
490    fi
491 else
492    have_control_center_embedding="no"
493 fi
494
495 if test "x$enable_control_center_embedding" = "xyes" -a "x$have_control_center_embedding" != "xyes"; then
496    AC_MSG_ERROR([Couldn't find single-window control center dependencies.])
497 fi
498
499 AM_CONDITIONAL(HAVE_CONTROL_CENTER_EMBEDDING, test "x$have_control_center_embedding" = "xyes")
500 AC_SUBST(CONTROL_CENTER_EMBEDDING_CFLAGS)
501 AC_SUBST(CONTROL_CENTER_EMBEDDING_LIBS)
502
503 # -----------------------------------------------------------
504 # Coding style checks
505 # -----------------------------------------------------------
506 AC_ARG_ENABLE(coding-style-checks,
507   AC_HELP_STRING([--disable-coding-style-checks],
508                  [don't check coding style using grep]),
509     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=yes])
510
511 AC_SUBST([ENABLE_CODING_STYLE_CHECKS])
512 # -----------------------------------------------------------
513
514 AC_OUTPUT([
515    Makefile
516    data/Makefile
517    data/empathy.desktop.in
518    data/empathy-accounts.desktop.in
519    data/icons/Makefile
520    extensions/Makefile
521    po/Makefile.in
522    libempathy/Makefile
523    libempathy-gtk/Makefile
524    src/Makefile
525    nautilus-sendto-plugin/Makefile
526    help/Makefile
527    tests/Makefile
528    tests/interactive/Makefile
529    tests/xml/Makefile
530    tools/Makefile
531 ])
532
533 echo "
534 Configure summary:
535
536         Compiler....................:  ${CC}
537         Compiler Flags..............:  ${CFLAGS} ${ERROR_CFLAGS}
538         Prefix......................:  ${prefix}
539         Coding style checks.........:  ${ENABLE_CODING_STYLE_CHECKS}
540         Use GTK+3...................:  ${have_gtk3}
541
542     Features:
543         Spell checking (enchant)....:  ${have_enchant}
544         Display maps (libchamplain).:  ${have_libchamplain}
545         Location awareness (Geoclue):  ${have_geoclue}
546         Adium themes (Webkit).......:  ${have_webkit}
547         Meego widgets ..............:  ${have_meego}
548         Control center embedding....:  ${have_control_center_embedding}
549
550     Connectivity:
551         NetworkManager integration..:  ${have_nm}
552         ConnMan integration.........:  ${have_connman}
553
554     Extras:
555         Nautilus-sendto plugin......:  ${have_nst}
556 "