configure.ac 45.3 KB
Newer Older
1
dnl Evolution Versions
2
m4_define([evo_major_version], [3])
3 4
m4_define([evo_minor_version], [13])
m4_define([evo_micro_version], [1])
Matthew Barnes's avatar
Matthew Barnes committed
5
m4_define([evo_version],
6
	[evo_major_version.evo_minor_version.evo_micro_version])
Matthew Barnes's avatar
Matthew Barnes committed
7
m4_define([evo_stable_version],
8 9 10 11 12 13 14 15
	[m4_if(m4_eval(evo_minor_version % 2), [1],
	[evo_major_version.m4_eval(evo_minor_version - 1)],
	[evo_version])])

dnl Base Version: This is for API/version tracking for things like
dnl Bonobo server files.  This should always be the major/minor of
dnl the stable version or stable version to be.  Note, this is set
dnl the way it is so that GETTEXT_PACKAGE will be parsed correctly.
16 17
BASE_VERSION=3.14
m4_define([base_version], [3.14])
H.Habighorst's avatar
H.Habighorst committed
18

19
dnl Autoconf / Automake Initialization
20
AC_PREREQ([2.64])
21
AC_INIT([evolution],[evo_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution],[evolution],[http://wiki.gnome.org/Apps/Evolution/])
22
AM_INIT_AUTOMAKE([1.10 dist-xz no-dist-gzip -Wall -Wno-portability foreign])
23
AC_CONFIG_MACRO_DIR([m4])
24
AC_CONFIG_HEADERS(config.h)
25 26
AC_CONFIG_SRCDIR(README)

27 28 29
dnl This is for the autoconf tests only - it set's the language we use
AC_LANG(C)

30
dnl Automake 1.11 - Silent Build Rules
31 32
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

33
dnl Required Packages
34 35

dnl Keep these two definitions in agreement.
36 37
m4_define([glib_minimum_version], [2.36.0])
m4_define([glib_encoded_version], [GLIB_VERSION_2_36])
38 39

dnl Keep these two definitions in agreement.
40
m4_define([gdk_minimum_version], [3.8.0])
41 42
m4_define([gdk_encoded_version], [GDK_VERSION_3_4])

43
dnl Keep these two definitions in agreement.
44 45
m4_define([soup_minimum_version], [2.42])
m4_define([soup_encoded_version], [SOUP_VERSION_2_42])
46

47
m4_define([eds_minimum_version], [evo_version])
48
m4_define([gtkhtml_minimum_version], [4.5.2])
49
m4_define([gdk_pixbuf_minimum_version], [2.24.0])
50
m4_define([gcr_minimum_version], [3.4])
51
m4_define([gnome_desktop_minimum_version], [2.91.3])
52
m4_define([gnome_icon_theme_minimum_version], [2.30.2.1])
53
m4_define([gsettings_desktop_schemas_minimum_version], [2.91.92])
54
m4_define([webkitgtk_minimum_version], [2.0.1])
55
m4_define([libgdata_minimum_version], [0.10])
56
m4_define([libxml_minimum_version], [2.7.3])
Matthew Barnes's avatar
Matthew Barnes committed
57
m4_define([shared_mime_info_minimum_version], [0.22])
58
m4_define([libpst_minimum_version], [0.6.54])
59

60
dnl Optional Packages
61
m4_define([champlain_minimum_version], [0.12])
62
m4_define([clutter_gtk_minimum_version], [0.90])
63
m4_define([geoclue_minimum_version], [0.12.0])
64
m4_define([geocode_glib_minimum_version], [3.10])
65
m4_define([gladeui_minimum_version], [3.10.0])
66
m4_define([gweather_minimum_version], [3.8])
67
m4_define([libcanberra_gtk_minimum_version], [0.25])
68
m4_define([libnotify_minimum_version], [0.7])
69

70
dnl ******************************
71
dnl Compiler Warning Flags
72
dnl ******************************
73
AS_COMPILER_FLAGS(WARNING_FLAGS,
74
	"-Wall -Wextra
75
	-Wdeprecated-declarations
76 77 78 79 80
	-Wno-missing-field-initializers
	-Wno-sign-compare
	-Wno-unused-parameter
	-Wdeclaration-after-statement
	-Werror-implicit-function-declaration
81
	-Wformat-security -Winit-self
82 83 84 85 86
	-Wmissing-declarations -Wmissing-include-dirs
	-Wmissing-noreturn -Wnested-externs -Wpointer-arith
	-Wredundant-decls -Wundef -Wwrite-strings")
AC_SUBST(WARNING_FLAGS)

87 88 89
dnl Need to stop using e-passwords.h before we can restore
dnl -DEDS_DISABLE_DEPRECATED

90
dnl Other useful compiler warnings for test builds only.
91 92 93
dnl These may produce warnings we have no control over,
dnl or false positives we don't always want to see.
dnl
94 95 96
dnl	-Wmissing-format-attribute
dnl	-Wshadow
dnl	-Wformat-nonliteral
97
dnl	-Wstrict-aliasing=2
98

99
AM_CPPFLAGS="$WARNING_FLAGS -fno-strict-aliasing"
100

101
dnl Warn about API usage that violates our minimum requirements.
102 103
AM_CPPFLAGS="$AM_CPPFLAGS -DGLIB_VERSION_MAX_ALLOWED=glib_encoded_version"
AM_CPPFLAGS="$AM_CPPFLAGS -DGDK_VERSION_MAX_ALLOWED=gdk_encoded_version"
104
AM_CPPFLAGS="$AM_CPPFLAGS -DSOUP_VERSION_MAX_ALLOWED=soup_encoded_version"
105 106 107 108 109 110

dnl These will suppress warnings about newly-deprecated symbols.  Ideally
dnl these settings should match our minimum requirements and we will clean
dnl up any new deprecation warnings after bumping our minimum requirements.
dnl But if the warnings get to be overwhelming, use fixed versions instead.
AM_CPPFLAGS="$AM_CPPFLAGS -DGLIB_VERSION_MIN_REQUIRED=glib_encoded_version"
111
AM_CPPFLAGS="$AM_CPPFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_2"
112
AM_CPPFLAGS="$AM_CPPFLAGS -DSOUP_VERSION_MIN_REQUIRED=soup_encoded_version"
113

114 115
AC_SUBST(AM_CPPFLAGS)

116 117 118 119
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(VERSION_COMMENT, "", [Define if you want a comment appended to the version number])

dnl This must stay after AC_CANONICAL_HOST, which defines $host.
120 121 122 123 124 125 126 127
case "$host" in
*openbsd*|*freebsd*)
	dnl Do not set '-Wl,--no-undefined' on freebsd/openbsd
	;;
*)
	LDFLAGS="$LDFLAGS -Wl,--no-undefined"
	;;
esac
128

129

130
dnl *************************************
131
dnl Put the ACLOCAL flags in the Makefile
132
dnl *************************************
133 134
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

135
dnl ******************************
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
136
dnl Initialize maintainer mode
137
dnl ******************************
138
AM_MAINTAINER_MODE([enable])
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
139

Matthew Barnes's avatar
Matthew Barnes committed
140
if test "$evo_version" != "$evo_stable_version"; then
141 142
	AC_DEFINE(STABLE_VERSION, ["evo_stable_version"],
		[Define to the latest stable version if this version is unstable])
Matthew Barnes's avatar
Matthew Barnes committed
143 144
fi

145
AC_SUBST([BASE_VERSION], [base_version])
146
AC_DEFINE_UNQUOTED(BASE_VERSION, ["$BASE_VERSION"], [Base version (Major.Minor)])
147

148 149 150 151
AC_SUBST([EVO_MAJOR_VERSION], [evo_major_version])
AC_SUBST([EVO_MINOR_VERSION], [evo_minor_version])
AC_SUBST([EVO_MICRO_VERSION], [evo_micro_version])

Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
152
AC_PROG_CC
153
AC_C_INLINE
154
AC_PROG_CPP
155
AM_PROG_CC_C_O
156 157 158
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
159
AC_PROG_AWK
160 161 162
AC_PATH_PROG([PERL], [perl])
AC_SUBST(PERL)

Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
163
AC_ARG_PROGRAM
Dan Winship's avatar
Dan Winship committed
164

165 166 167 168 169 170 171 172 173 174 175
dnl GCC 4.4 got more aggressive in its aliasing optimizations, changing
dnl behavior that -- according to the C99 standard -- is supposed to be
dnl undefined.  We may still have aliasing abuses lying around that rely
dnl on GCC's previous "undefined" behavior, so disable strict-aliasing
dnl optimzation until we can find and fix all the abuses.
dnl (AC_PROG_CC must run first to set the GCC variable.)
dnl XXX This really belongs in AM_CFLAGS.
if test "x${GCC}" = "xyes"; then
	CFLAGS="$CFLAGS -fno-strict-aliasing"
fi

176 177
GLIB_GSETTINGS

178
dnl ******************************
179
dnl I18N stuff
180
dnl ******************************
181
IT_PROG_INTLTOOL([0.40.0])
Dan Winship's avatar
Dan Winship committed
182

183
GETTEXT_PACKAGE=evolution-$BASE_VERSION
Dan Winship's avatar
Dan Winship committed
184
AC_SUBST(GETTEXT_PACKAGE)
185
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
Dan Winship's avatar
Dan Winship committed
186

187
dnl ******************************
188
dnl Initialize libtool
189
dnl ******************************
190 191
LT_PREREQ(2.2)
LT_INIT(disable-static win32-dll)
192

193 194
PKG_PROG_PKG_CONFIG

195 196
GNOME_CODE_COVERAGE

197 198 199
dnl ********************************************
dnl User / Developer Documentation
dnl ********************************************
200
YELP_HELP_INIT
201
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
202

203
dnl ******************************
204
dnl Win32
205
dnl ******************************
206 207 208
AC_MSG_CHECKING([for Win32])
case "$host" in
*-mingw*)
209 210 211 212 213
	os_win32=yes
	NO_UNDEFINED='-no-undefined'
	SOEXT='.dll'
	DL_LIB=''
	SOFTOKN3_LIB=''
214 215
	CHAMPLAIN_REQUIREMENT=''
	GEOCLUE_REQUIREMENT=''
216
	;;
217 218 219 220 221 222 223 224 225
*openbsd*|*freebsd*)
	os_win32=no
	NO_UNDEFINED=''
	SOEXT='.so'
	SA_JUNK_PLUGIN=sa-junk-plugin
	BF_JUNK_PLUGIN=bogo-junk-plugin
	DL_LIB=''
	SOFTOKN3_LIB='-lsoftokn3'
	;;
226 227
*)
	os_win32=no
228
	NO_UNDEFINED='-no-undefined'
229 230 231 232
	SOEXT='.so'
	DL_LIB='-ldl'
	SOFTOKN3_LIB='-lsoftokn3'
	;;
233 234 235 236 237 238
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
AC_SUBST(NO_UNDEFINED)
AC_SUBST(SOEXT)

239 240 241
MATH_LIB="-lm"
AC_SUBST(MATH_LIB)

242
if test "$os_win32" = "yes"; then
243
	AC_CHECK_TOOL(WINDRES, windres, :)
244
else
245
	WINDRES=":"
246 247 248 249 250 251
fi

AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")

AC_SUBST(WINDRES)

252 253 254 255 256 257 258 259 260 261
dnl **********************************
dnl Check for functions
dnl **********************************
AC_CHECK_FUNCS(nl_langinfo)

dnl **********************************
dnl Check for nl_langinfo features
dnl **********************************
EVO_CHECK_LANGINFO([_NL_MEASUREMENT_MEASUREMENT])

262
dnl **********************************
263
dnl Check for base dependencies early.
264
dnl **********************************
265
PKG_CHECK_MODULES([GNOME_PLATFORM],
266
	[gio-2.0 >= glib_minimum_version
267
	 gmodule-2.0 >= glib_minimum_version
268
	 cairo-gobject
269 270
	 gtk+-3.0 >= gdk_minimum_version
	 gail-3.0 >= gdk_minimum_version
271
	 gdk-pixbuf-2.0 >= gdk_pixbuf_minimum_version
272
	 gcr-3 >= gcr_minimum_version
273 274
	 libxml-2.0 >= libxml_minimum_version
	 shared-mime-info >= shared_mime_info_minimum_version
275
	 gnome-desktop-3.0 >= gnome_desktop_minimum_version
276
	 gsettings-desktop-schemas >= gsettings_desktop_schemas_minimum_version
277
	 webkitgtk-3.0 >= webkitgtk_minimum_version])
278 279 280
AC_SUBST(GNOME_PLATFORM_CFLAGS)
AC_SUBST(GNOME_PLATFORM_LIBS)

281
PKG_CHECK_MODULES([EVOLUTION_DATA_SERVER],
282 283
	[camel-1.2 >= eds_minimum_version
	 libebook-1.2 >= eds_minimum_version
284 285
	 libecal-1.2 >= eds_minimum_version
	 libedataserver-1.2 >= eds_minimum_version
286
	 libebackend-1.2 >= eds_minimum_version])
287 288
AC_SUBST(EVOLUTION_DATA_SERVER_CFLAGS)
AC_SUBST(EVOLUTION_DATA_SERVER_LIBS)
289

290 291 292
dnl ******************************
dnl Canberra / Canberra-GTK Sound
dnl ******************************
293 294 295 296 297 298
AC_ARG_ENABLE([canberra],
	[AS_HELP_STRING([--enable-canberra],
	[Enable Canberra and Canberra-GTK sound @<:@default=yes@:>@])],
	[enable_canberra="$enableval"], [enable_canberra=yes])

if test $enable_canberra = yes; then
299 300 301 302 303 304 305
	PKG_CHECK_MODULES(
		[CANBERRA],
		[libcanberra-gtk3 >= libcanberra_gtk_minimum_version],,
		[AC_MSG_ERROR([

	libcanberra-gtk3 not found (or version < libcanberra_gtk_minimum_version)

306
	If you want to disable support for event sounds,
307 308 309 310
	please append --disable-canberra to configure.

	])])

311 312
	AC_DEFINE(HAVE_CANBERRA, 1, [Define if using Canberra and Canberra-GTK for sound])
fi
313 314
AC_SUBST(CANBERRA_CFLAGS)
AC_SUBST(CANBERRA_LIBS)
315

316
dnl ******************
317
dnl User Documentation
318 319 320
dnl ******************
AC_MSG_CHECKING([whether to build user documentation])
AC_ARG_WITH([help],
321
	[AS_HELP_STRING([--with-help],
322
	[Build user documentation [default=yes]])],
323
	[with_help="$withval"],[with_help="yes"])
324
AM_CONDITIONAL(WITH_HELP, test "x$with_help" != "xno")
325
AC_MSG_RESULT([$with_help])
326

327 328 329 330 331
dnl ******************************
dnl iconv checking
dnl ******************************
have_iconv=no
save_LIBS="$LIBS"
332
LIBS="$LIBS -liconv"
333 334 335 336 337 338
AC_CACHE_CHECK([for iconv in -liconv], [ac_cv_libiconv],
	AC_LINK_IFELSE([AC_LANG_PROGRAM(
	[[
		#include <iconv.h>
		#include <stdlib.h>
	]],
339 340
	[[	iconv_t cd;
		cd = iconv_open ("UTF-8", "ISO-8859-1");
341 342
	]]
	)],[ac_cv_libiconv=yes],[ac_cv_libiconv=no]))
343

344
if test $ac_cv_libiconv = yes; then
345
	ICONV_LIBS="-liconv"
346
	if test $os_win32 = yes; then
347 348
		dnl Don't pointlessly auto-export the global symbols
		dnl from a potentially static libiconv.a
349 350
		ICONV_LIBS="$ICONV_LIBS -Wl,--exclude-libs=libiconv.a"
	fi
351
	have_iconv=yes
352
else
353 354
	LIBS="$save_LIBS"
	AC_CHECK_FUNC(iconv, have_iconv=yes, have_iconv=no)
355 356 357
fi

if test $have_iconv = yes; then
358 359 360
	if test $ac_cv_libiconv = no; then
		AC_CHECK_FUNCS(gnu_get_libc_version)
	fi
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
AC_CACHE_CHECK([if iconv() handles UTF-8], [ac_cv_libiconv_utf8],
	AC_RUN_IFELSE([AC_LANG_SOURCE([[
		#include <iconv.h>
		#include <stdlib.h>
		#include <string.h>
		#ifdef HAVE_GNU_GET_LIBC_VERSION
		#include <gnu/libc-version.h>
		#endif
		int main() {
			char *jp = "\x1B\x24\x42\x46\x7C\x4B\x5C\x38\x6C";
			char *utf8 = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E";
			char *transbuf = malloc (10), *trans = transbuf;
			iconv_t cd;
			size_t jp_len = strlen (jp), utf8_len = 10;
			size_t utf8_real_len = strlen (utf8);
376

377 378 379 380 381
			#ifdef HAVE_GNU_GET_LIBC_VERSION
			/* glibc 2.1.2's iconv is broken in hard to test ways. */
			if (!strcmp (gnu_get_libc_version (), "2.1.2"))
				exit (1);
			#endif
382

383 384 385 386 387 388 389 390 391 392
			cd = iconv_open ("UTF-8", "ISO-2022-JP");
			if (cd == (iconv_t) -1)
				exit (1);
			if (iconv (cd, &jp, &jp_len, &trans, &utf8_len) == -1 || jp_len != 0)
				exit (1);
			if (memcmp (utf8, transbuf, utf8_real_len) != 0)
				exit (1);
			return (0);}
		]])
	],[ac_cv_libiconv_utf8=yes],[ac_cv_libiconv_utf8=no; have_iconv=no],[ac_cv_libiconv_utf8=hopefully]))
393 394 395
fi

if test "$have_iconv" = no; then
396
	AC_MSG_ERROR([You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv])
397 398 399
fi
AC_SUBST(ICONV_LIBS)

400
save_CFLAGS="$CFLAGS"
401 402
CFLAGS="$CFLAGS -I$srcdir"

403
AC_MSG_CHECKING([preferred charset name formats for system iconv])
404 405 406 407 408 409 410 411 412 413 414 415 416 417
AC_RUN_IFELSE([AC_LANG_SOURCE([[
	#define CONFIGURE_IN
	#include "iconv-detect.c"
	]])],
	[AC_MSG_RESULT([found])],
	[AC_MSG_RESULT([not found])
		AC_MSG_WARN([
		*** The iconv-detect program was unable to determine the
		*** preferred charset name formats recognized by your
		*** iconv library. It is suggested that you install a
		*** working iconv library such as the one found at
		*** ftp://ftp.gnu.org/pub/gnu/libiconv
	])],
	[if test x$os_win32 = xyes; then
418 419 420 421 422 423 424
		AC_MSG_RESULT([using known win32 result])
		echo '/* This is an auto-generated header, DO NOT EDIT! */' > iconv-detect.h
		echo  >>iconv-detect.h
		echo '#define ICONV_ISO_D_FORMAT "iso-%d-%d"' >>iconv-detect.h
		echo '#define ICONV_ISO_S_FORMAT "iso-%d-%s"' >>iconv-detect.h
		echo '#define ICONV_10646 "UCS-4BE"' >>iconv-detect.h
	else
425
		AC_MSG_RESULT([unknown])
426 427 428 429 430
		AC_MSG_WARN([
		*** We can't determine the preferred charset name formats
		*** recognized by your iconv library. You are
		*** cross-compiling and supposed to know what you are doing.
		*** Please construct the iconv-detect.h file manually.
431 432
		])
	fi
433 434 435 436 437
])

CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"

438
dnl **************
439
dnl waitpid() etc
440
dnl **************
441
AC_HEADER_SYS_WAIT
442

443
dnl ***************
444
dnl Purify support
445
dnl ***************
446
EVO_PURIFY_SUPPORT
447

Dan Winship's avatar
Dan Winship committed
448 449 450
dnl ***************
dnl Timezone checks
dnl ***************
451 452 453 454
AC_CACHE_CHECK(for tm_gmtoff in struct tm, [ac_cv_struct_tm_gmtoff],
	AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
	[[	#include <time.h>	]],
	[[
Dan Winship's avatar
Dan Winship committed
455 456
		struct tm tm;
		tm.tm_gmtoff = 1;
457 458
	]]
	)],[ac_cv_struct_tm_gmtoff=yes],[ac_cv_struct_tm_gmtoff=no]))
Dan Winship's avatar
Dan Winship committed
459
if test $ac_cv_struct_tm_gmtoff = yes; then
460
	AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
Dan Winship's avatar
Dan Winship committed
461
else
462 463 464 465 466
	AC_CACHE_CHECK(for timezone variable, [ac_cv_var_timezone],
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
		[[	#include <time.h> ]],
		[[	timezone = 1;	]]
		)],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no]))
Dan Winship's avatar
Dan Winship committed
467
	if test $ac_cv_var_timezone = yes; then
468
		AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
469 470 471 472 473
		AC_CACHE_CHECK(for altzone variable, [ac_cv_var_altzone],
			AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
			[[	#include <time.h>	]],
			[[	altzone = 1; ]]
			)],[ac_cv_var_altzone=yes],[ac_cv_var_altzone=no]))
Dan Winship's avatar
Dan Winship committed
474
		if test $ac_cv_var_altzone = yes; then
475
			AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
Dan Winship's avatar
Dan Winship committed
476 477
		fi
	else
478
		AC_MSG_ERROR([unable to find a way to determine timezone])
Dan Winship's avatar
Dan Winship committed
479 480 481
	fi
fi

482

483
AC_CHECK_FUNCS(mkdtemp)
Not Zed's avatar
Not Zed committed
484

485
dnl **************************************************
486
dnl Gnome Icon Theme
487
dnl **************************************************
488
PKG_CHECK_MODULES([GIT], [gnome-icon-theme >= gnome_icon_theme_minimum_version])
489

490
dnl **************************************************
491
dnl Accessibility support
492
dnl **************************************************
493
PKG_CHECK_MODULES([A11Y], [atk])
494 495 496
AC_SUBST(A11Y_CFLAGS)
AC_SUBST(A11Y_LIBS)

Chris Toshok's avatar
Chris Toshok committed
497
dnl **************************************************
498
dnl XF86 multimedia keys support
499 500
dnl **************************************************
have_xfree=no
501 502 503
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
	[[ #include <X11/XF86keysym.h> ]],[[]])],
	[have_xfree=yes]
504
)
505
AC_MSG_CHECKING([for X11 XFree86 headers])
506 507 508 509 510 511
AC_MSG_RESULT([$have_xfree])
if test x"$have_xfree" = "xyes" ; then
	AC_DEFINE(HAVE_XFREE, 1, [defined if you have X11/XF86keysym.h])
fi

dnl **************************************************
512
dnl LDAP support.
Chris Toshok's avatar
Chris Toshok committed
513
dnl **************************************************
514
if test "$os_win32" != yes; then
515 516 517 518
	EVO_LDAP_CHECK(no)
	case $with_openldap in
	no)
		msg_ldap=no
519 520
		;;
	*)
521 522 523
		case $with_static_ldap in
		yes)
			msg_ldap="yes (static)"
524
		;;
525 526 527 528
		*)
			msg_ldap="yes (dynamic)"
			;;
		esac
529
	esac
530

531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
	SAVE_CFLAGS="$CFLAGS"
	SAVE_LIBS="$LIBS"
	LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
	CFLAGS="$CFLAGS $LDAP_CFLAGS"
	LIBS="$LIBS $LDAP_LIBS"
	AC_CHECK_FUNCS(ldap_ntlm_bind)
	CFLAGS="$SAVE_CFLAGS"
	LIBS="$SAVE_LIBS"
dnl Win32 support
else
	LDAP_CFLAGS="-DLDAP_DEPRECATED"
	LDAP_LIBS="-lwldap32"
	AC_SUBST(LDAP_CFLAGS)
	AC_SUBST(LDAP_LIBS)
	AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
	AM_CONDITIONAL(ENABLE_LDAP, true)
	msg_ldap="yes"
fi
549

simon.zheng's avatar
simon.zheng committed
550 551 552 553 554 555 556
dnl **************************************************
dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
dnl **************************************************
if test "$with_openldap" = no ; then
	EVO_SUNLDAP_CHECK(no)
	case $with_sunldap in
	no)
557 558 559 560 561 562 563 564 565 566 567 568
		msg_ldap=no
		;;
	*)
		case $with_static_sunldap in
		yes)
			msg_ldap="$with_sunldap (static)"
			;;
		*)
			msg_ldap="$with_sunldap (dynamic)"
			;;
		esac
	esac
simon.zheng's avatar
simon.zheng committed
569
else
570
	with_sunldap=no
simon.zheng's avatar
simon.zheng committed
571
fi
572
AM_CONDITIONAL(SUNLDAP, [test x$with_sunldap != xno])
simon.zheng's avatar
simon.zheng committed
573

574 575
AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [Define it once memory returned by libical is free'ed properly])

576 577
dnl *************************
dnl GTKHTML check
578
dnl XXX Drop the version from the package name?
579
dnl *************************
580 581 582
PKG_CHECK_MODULES([GTKHTML],
	[libgtkhtml-4.0 >= gtkhtml_minimum_version
	 gtkhtml-editor-4.0])
583 584
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
585

586 587 588
dnl ********************************************************************************
dnl security extension support (SSL and S/MIME)
dnl
589
dnl The following voodoo does detection of mozilla libraries (nspr and nss)
590 591 592 593
dnl needed by Camel (SSL and S/MIME).
dnl
dnl The Evolution security extensions are only built if these libraries are found
dnl ********************************************************************************
594
msg_ssl="no"
595
msg_smime="no"
596 597 598

dnl these 2 enable's are inverses of each other

599
AC_ARG_ENABLE([nss],
600 601 602
	AS_HELP_STRING([--enable-nss=@<:@yes/no/static@:>@],
	[Attempt to use Mozilla libnss for SSL support.]),
	[enable_nss=$enableval],[enable_nss=yes])
603

604
AC_ARG_ENABLE([smime],
605 606 607
	AS_HELP_STRING([--enable-smime],
	[Attempt to use Mozilla libnss for SMIME support (this requires --enable-nss)]),
	[enable_smime=$enableval],[enable_smime=yes])
608

609
AC_ARG_WITH([nspr-includes],
610 611
	AS_HELP_STRING([--with-nspr-includes=PATH],
	[Location of Mozilla nspr4 includes.]))
612

613
AC_ARG_WITH([nspr-libs],
614 615
	AS_HELP_STRING([--with-nspr-libs=PATH],
	[Location of Mozilla nspr4 libs.]))
616

617
AC_ARG_WITH([nss-includes],
618 619
	AS_HELP_STRING([--with-nss-includes=PATH],
	[Location of Mozilla nss3 includes.]))
620

621
AC_ARG_WITH([nss-libs],
622 623
	AS_HELP_STRING([--with-nss-libs=PATH],
	[Location of Mozilla nss3 libs.]))
624

625
if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
626
	if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}" || test "x${enable_nss}" = "xstatic"; then
627 628 629 630
		check_manually="yes"
	else
		check_manually="no"
	fi
631

632
	if test "x${check_manually}" = "xno"; then
633
		AC_MSG_CHECKING([Mozilla NSPR pkg-config module name])
634
		mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
635 636
		for pc in $mozilla_nspr_pcs; do
			if $PKG_CONFIG --exists $pc; then
637
				AC_MSG_RESULT([$pc])
638 639 640 641
				mozilla_nspr=$pc
				break;
			fi
		done
642

643
		AC_MSG_CHECKING([Mozilla NSS pkg-config module name])
644
		mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
645 646
		for pc in $mozilla_nss_pcs; do
			if $PKG_CONFIG --exists $pc; then
647
				AC_MSG_RESULT([$pc])
648 649 650 651
				mozilla_nss=$pc
				break;
			fi
		done
652

653
		if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
654
			msg_ssl="yes (Mozilla NSS)"
655
			if test "x$enable_smime" = "xyes"; then
656 657
				AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
				msg_smime="yes (Mozilla NSS)"
658
			fi
659 660
			AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
			AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
661
			AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"`$PKG_CONFIG --variable=libdir $mozilla_nss`",[Define to the full path of mozilla nss library])
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
662 663 664 665
			MANUAL_NSPR_CFLAGS=""
			MANUAL_NSPR_LIBS=""
			MANUAL_NSS_CFLAGS=""
			MANUAL_NSS_LIBS=""
666 667
		else
			check_manually="yes"
668 669
			mozilla_nspr=""
			mozilla_nss=""
670 671
		fi
	fi
672

673 674 675 676 677
	if test "x${check_manually}" = "xyes"; then
		mozilla_nss=""
		have_nspr_includes="no"
		if test "x${with_nspr_includes}" != "xno"; then
			CPPFLAGS_save="$CPPFLAGS"
678

679 680
			AC_MSG_CHECKING([for Mozilla nspr4 includes in $with_nspr_includes])
			AC_MSG_RESULT([""])
681

682
			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
683 684 685 686 687 688 689
			AC_CHECK_HEADERS([nspr.h prio.h],[ moz_nspr_includes="yes" ],,
			[[
				#if HAVE_NSPR_H
				#include <nspr.h>
				#include <prio.h>
				#endif
			]])
690
			CPPFLAGS="$CPPFLAGS_save"
691

692 693
			if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then
				have_nspr_includes="yes"
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
694
				MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
695 696
			fi
		else
697 698
			AC_MSG_CHECKING([for Mozilla nspr4 includes])
			AC_MSG_RESULT([no])
699
		fi
700

701 702 703 704
		have_nspr_libs="no"
		if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then
			CFLAGS_save="$CFLAGS"
			LDFLAGS_save="$LDFLAGS"
705

706 707 708
			if test "$enable_nss" = "static"; then
				if test -z "${with_nspr_libs}"; then
					AC_MSG_ERROR([Static linkage requested, but path to nspr libraries not set.]
709 710 711
					[Please specify the path to libnspr4.a]
					[Example: --with-nspr-libs=/usr/lib])
				else
712
					nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a"
713 714
				fi
			else
715
				nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
716
			fi
717

718
			AC_CACHE_CHECK([for Mozilla nspr libraries], [ac_cv_moz_nspr_libs],
719
			[
720
				LIBS_save="$LIBS"
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
721
				CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
722

723
				if test "x${with_nspr_libs}" != "x"; then
724 725
					LIBS="$nsprlibs"
					LDFLAGS="$LDFLAGS -L$with_nspr_libs"
726
				else
727 728
					LIBS="$nsprlibs"
					LDFLAGS="$LDFLAGS"
729
				fi
730

731 732
				AC_LINK_IFELSE([AC_LANG_CALL([], [PR_Init])],
				[ac_cv_moz_nspr_libs="yes"], [ac_cv_moz_nspr_libs="no"])
733 734
				CFLAGS="$CFLAGS_save"
				LDFLAGS="$LDFLAGS_save"
735
				LIBS="$LIBS_save"
736
			])
737
			if test "x$ac_cv_moz_nspr_libs" != "xno"; then
738
				have_nspr_libs="yes"
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
739
				MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
740
			else
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
741
				MANUAL_NSPR_CLFAGS=""
742 743
			fi
		else
744 745
			AC_MSG_CHECKING([for Mozilla nspr4 libraries])
			AC_MSG_RESULT([no])
746
		fi
747

748 749
		if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then
			CPPFLAGS_save="$CPPFLAGS"
750

751 752
			AC_MSG_CHECKING([for Mozilla nss3 includes in $with_nss_includes])
			AC_MSG_RESULT([""])
753

754 755 756 757 758
			if test "x${with_nspr_includes}" != "x"; then
				CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
			else
				CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
			fi
759

760
			AC_CHECK_HEADERS(nss.h ssl.h smime.h,
761
				[ have_nss_includes="yes" ],
762 763 764 765 766 767 768 769
				[ have_nss_includes="no" ],
				[
					#if HAVE_NSPR_H
					#include <nss.h>
					#include <ssl.h>
					#include <smime.h>
					#endif
				])
770

771
			CPPFLAGS="$CPPFLAGS_save"
772 773

			if test "x${have_nss_includes}" = "xyes"; then
774
				have_nss_includes="yes"
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
775
				MANUAL_NSS_CFLAGS="-I$with_nss_includes"
776
			else
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
777 778
				MANUAL_NSPR_CFLAGS=""
				MANUAL_NSPR_LIBS=""
779 780
			fi
		else
781 782
			AC_MSG_CHECKING([for Mozilla nss3 includes])
			AC_MSG_RESULT([no])
783
		fi
784

785 786
		if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then
			LDFLAGS_save="$LDFLAGS"
787

788
			if test "$enable_nss" = "static"; then
789
				if test -z "${with_nss_libs}"; then
790
					AC_MSG_ERROR([Static linkage requested, but path to nss libraries not set.]
791 792
					[Please specify the path to libnss3.a]
					[Example: --with-nspr-libs=/usr/lib/mozilla])
793 794 795 796 797 798 799 800 801
				else
					nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a"
					case "$host" in
						*solaris*)
						nsslibs="$nsslibs $with_nss_libs/libfreebl.a"
					;;
					esac
				fi
			else
802
				nsslibs="-lssl3 -lsmime3 -lnss3"
803 804
			fi

805
			AC_CACHE_CHECK([for Mozilla nss libraries], [ac_cv_moz_nss_libs],
806
			[
807
				LIBS_save="$LIBS"
808
				LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
809
				LIBS="$nsslibs $nsprlibs"
810 811
				AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])],
				[ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"])
812
				if test "$ac_cv_moz_nss_libs" = no; then
813
					nsslibs="-lssl3 -lsmime3 -lnss3"
814
					LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
815 816
					AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])],
					[ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"])
817 818
				fi
				LDFLAGS="$LDFLAGS_save"
819
				LIBS="$LIBS_save"
820
			])
821
			if test "$ac_cv_moz_nss_libs" != no; then
822 823
				AC_DEFINE(HAVE_NSS)
				AC_DEFINE(HAVE_SSL)
824
				AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"$with_nss_libs", [Define to the full path of mozilla nss library])
825 826
				if test "$enable_nss" = "static"; then
					msg_ssl="yes (Mozilla NSS:static)"
827
				else
828
					msg_ssl="yes (Mozilla NSS)"
829 830
				fi
				dnl static_nss
831 832 833 834
				if test "$enable_smime" = "yes"; then
					AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
					msg_smime="yes (Mozilla NSS)"
				fi
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
835
				MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
836
			else
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
837 838 839
				MANUAL_NSS_CFLAGS=""
				MANUAL_NSPR_CFLAGS=""
				MANUAL_NSPR_LIBS=""
840 841
			fi
		else
842 843
			AC_MSG_CHECKING([for Mozilla nss libraries])
			AC_MSG_RESULT([no])
844
		fi
845

Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
846 847
		MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
		MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
848 849
	fi
fi
850

851
AM_CONDITIONAL(ENABLE_SMIME, [test "x$msg_smime" != "xno"])
852

Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
853 854 855 856
AC_SUBST(MANUAL_NSPR_CFLAGS)
AC_SUBST(MANUAL_NSPR_LIBS)
AC_SUBST(MANUAL_NSS_CFLAGS)
AC_SUBST(MANUAL_NSS_LIBS)
857

858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885
dnl ******************************
dnl libcryptui, aka Seahorse
dnl ******************************
AC_ARG_ENABLE([libcryptui],
	[AS_HELP_STRING([--enable-libcryptui],
	[Enable libcryptui usage @<:@default=yes@:>@])],
	[enable_libcryptui="$enableval"], [enable_libcryptui=yes])

if test "x$enable_libcryptui" = "xyes"; then
	PKG_CHECK_MODULES(
		[LIBCRYPTUI],
		[cryptui-0.0],,
		[AC_MSG_ERROR([

	cryptui-0.0 not found

	If you want to disable support libcryptui usage,
	please append --disable-libcryptui to configure.

	])])

	AC_DEFINE(HAVE_LIBCRYPTUI, 1, [Define if using libcryptui])
else
	enable_libcryptui=no
fi
AC_SUBST(LIBCRYPTUI_CFLAGS)
AC_SUBST(LIBCRYPTUI_LIBS)

886 887 888 889
dnl *****************
dnl killall or pkill?
dnl *****************

890 891
case "$host" in
*solaris*)
892
	KILL_PROCESS_CMD="/usr/bin/pkill -x"
893 894 895 896 897
	;;
*)
	AC_PATH_PROGS(KILL_PROCESS_CMD, killall pkill)
	;;
esac
898 899
if test -z "$KILL_PROCESS_CMD"; then
	AC_MSG_WARN([Could not find a command to kill a process by name])
900
else
901 902
	AC_DEFINE_UNQUOTED([KILL_PROCESS_CMD], "$KILL_PROCESS_CMD",
		[Command to kill processes by name])
903 904
fi

905 906 907 908 909
dnl *******************
dnl GObject marshalling
dnl *******************
AM_PATH_GLIB_2_0

910
dnl *****************************************************************
911
dnl Utility macro to set compiler flags for a specific lib.
912
dnl EVO_SET_COMPILE_FLAGS(VAR-PREFIX, DEPS, EXTRA-CFLAGS, EXTRA-LIBS)
913
dnl *****************************************************************
914 915
AC_DEFUN([EVO_SET_COMPILE_FLAGS], [
	PKG_CHECK_MODULES([$1], [$2])
916
	$1_CFLAGS="[$]$1_CFLAGS $3"
917
	$1_LIBS="[$]$1_LIBS $4"
918 919
])

920 921 922
dnl ******************************
dnl TNEF implementation
dnl ******************************
923
AC_MSG_CHECKING([for yTNEF])
924 925 926 927 928 929 930
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
	[[
		#include <stdio.h>
		#include <ytnef.h>
	]],
	[[	TNEFStruct *tnef;	]]
	)],	[tnef_ok=yes], [tnef_ok=no])
931 932
if test "$tnef_ok" = "yes"; then
	AC_MSG_RESULT([yes])
933
	TNEF_CFLAGS="-DHAVE_YTNEF_H"
934 935
	AC_DEFINE(ENABLE_TNEF,1,[Define if TNEF attachments parser should be built])
	
936
else
937 938 939 940 941 942 943
	AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
	[[
		#include <stdio.h>
		#include <libytnef/ytnef.h>
	]],
	[[	TNEFStruct *tnef;	]]
	)], [tnef_ok=yes], [tnef_ok=no])
944 945 946
	if test "$tnef_ok" = "yes"; then
		AC_MSG_RESULT([yes])
		TNEF_CFLAGS="-DHAVE_LIBYTNEF_YTNEF_H"
947
		AC_DEFINE(ENABLE_TNEF,1,[Define if TNEF attachments parser should be built])		
948
	else
949
		AC_MSG_RESULT([no])
950 951
		TNEF_CFLAGS=""
	fi
952
fi
953
AM_CONDITIONAL([ENABLE_TNEF], [test "$tnef_ok" = "yes"])
954
AC_SUBST(TNEF_CFLAGS)
955

956
if test "x$mozilla_nss" != "x"; then
957 958
	EVO_SET_COMPILE_FLAGS(MOZILLA_NSS, $mozilla_nss)
	MOZILLA_L_DIR=`${PKG_CONFIG} --libs-only-L $mozilla_nss`
959 960
else
	if test "x$MOZILLA_MANUAL_LIBS" != "x"; then
961
		MOZILLA_L_DIR="-L$with_nss_lib"
962 963 964
	fi
fi

965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
dnl **********************************
dnl Check for Bogofilter (spam filter)
dnl **********************************
AC_ARG_ENABLE([bogofilter],
	[AS_HELP_STRING([--enable-bogofilter],
	[enable spam filtering using Bogofilter (default=yes)])],
	[enable_bogofilter=$enableval], [enable_bogofilter=yes])
AC_MSG_CHECKING([if Bogofilter support is enabled])
AC_MSG_RESULT([$enable_bogofilter])
msg_bogofilter="$enable_bogofilter"
if test "x$enable_bogofilter" = "xyes"; then
	AC_ARG_VAR([BOGOFILTER], [Bogofilter spam filtering program])
	AC_PATH_PROG([BOGOFILTER], [bogofilter])
	if test "x$BOGOFILTER" == "x"; then
		AC_MSG_ERROR([

	Bogofilter spam filtering program not found.

	If you want to disable spam filtering using Bogofilter,
984 985 986
	please append --disable-bogofilter to configure.

	])
987 988 989 990 991 992 993 994
	fi
	AC_DEFINE_UNQUOTED(
		BOGOFILTER_COMMAND, "$BOGOFILTER",
		[Bogofilter spam filtering program])
	msg_bogofilter="$msg_bogofilter ($BOGOFILTER)"
fi
AM_CONDITIONAL([ENABLE_BOGOFILTER], [test "x$enable_bogofilter" = "xyes"])

995 996 997 998 999 1000
dnl ************************************
dnl Check for SpamAssassin (spam filter)
dnl ************************************
AC_ARG_ENABLE([spamassassin],
	[AS_HELP_STRING([--enable-spamassassin],
	[enable spam filtering using SpamAssassin (default=yes)])],
1001
	[enable_spamassassin=$enableval], [enable_spamassassin=yes])
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
AC_MSG_CHECKING([if SpamAssassin support is enabled])
AC_MSG_RESULT([$enable_spamassassin])
msg_spamassassin="$enable_spamassassin"
if test "x$enable_spamassassin" = "xyes"; then
	AC_ARG_VAR([SPAMASSASSIN], [SpamAssassin spam filtering program])
	AC_PATH_PROG([SPAMASSASSIN], [spamassassin])
	if test "x$SPAMASSASSIN" == "x"; then
		AC_MSG_ERROR([

	SpamAssassin spam filtering program not found.

	If you want to disable spam filtering using SpamAssassin,
1014 1015 1016
	please append --disable-spamassassin to configure.

	])
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
	fi
	AC_DEFINE_UNQUOTED(
		SPAMASSASSIN_COMMAND, "$SPAMASSASSIN",
		[SpamAssassin spam filtering program])

	AC_ARG_VAR([SA_LEARN], [SpamAssassin spam training program])
	AC_PATH_PROG([SA_LEARN], [sa-learn])
	if test "x$SA_LEARN" = "x"; then
		AC_MSG_ERROR([

	SpamAssassin training program (sa-learn) not found.

	If you want to disable spam filtering using SpamAssassin,
1030 1031 1032
	please append --disable-spamassassin to configure.

	])
1033 1034 1035 1036 1037 1038 1039 1040 1041
	fi
	AC_DEFINE_UNQUOTED(
		SA_LEARN_COMMAND, "$SA_LEARN",
		[SpamAssassin spam training program])

	msg_spamassassin="$msg_spamassassin ($SPAMASSASSIN)"
fi
AM_CONDITIONAL([ENABLE_SPAMASSASSIN], [test "x$enable_spamassassin" = "xyes"])

1042 1043 1044
dnl ******************************
dnl CERT_UI Flags
dnl ******************************
1045 1046 1047 1048 1049 1050 1051
dnl
dnl Here we want the Mozilla flags to go *before* the other ones,
dnl especially the mozilla-nss -I flags to go before the gnutls ones
dnl (which are dragged in through libedataserverui), as both
dnl gnutls and mozilla-nss have a header called "pkcs12.h" which is
dnl included in smime/lib/e-pkcs12.c. It wants the Mozilla NSS one.
dnl
1052 1053
CERT_UI_CFLAGS="$MANUAL_NSS_CFLAGS $MOZILLA_NSS_CFLAGS"
CERT_UI_LIBS="$MOZILLA_L_DIR $MANUAL_NSS_LIBS $MOZILLA_NSS_LIBS"
1054 1055 1056
AC_SUBST(CERT_UI_CFLAGS)
AC_SUBST(CERT_UI_LIBS)

1057 1058 1059
dnl ***************
dnl Libnotify Flags
dnl ***************
1060 1061
LIBNOTIFY_CFLAGS=
LIBNOTIFY_LIBS=
1062
PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= libnotify_minimum_version], [HAVE_LIBNOTIFY="yes"], [HAVE_LIBNOTIFY="no"])
1063
if test "x$HAVE_LIBNOTIFY" = "xyes"; then
1064
	AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if you have libnotify])
1065 1066 1067 1068 1069 1070 1071
	libnotify="libnotify"
else
	libnotify=""
fi
AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)

1072 1073 1074
dnl **************
dnl Calendar Flags
dnl **************
1075
PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= soup_minimum_version])
1076 1077
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
1078

1079
PKG_CHECK_MODULES([GDATA], [libgdata >= libgdata_minimum_version])
1080 1081 1082
AC_SUBST(GDATA_CFLAGS)
AC_SUBST(GDATA_LIBS)

1083 1084 1085 1086
dnl ****************************
dnl Check for ical_set_unknown_token_handling_setting function
dnl ****************************
AC_MSG_CHECKING([ical_set_unknown_token_handling_setting function])
1087 1088
save_cflags=$CFLAGS; CFLAGS="$EVOLUTION_DATA_SERVER_CFLAGS"
save_libs=$LIBS; LIBS="$EVOLUTION_DATA_SERVER_LIBS"
1089 1090 1091 1092 1093 1094 1095 1096
AC_LINK_IFELSE([AC_LANG_PROGRAM(
	[[#include <libical/ical.h>]],
	[[ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN)]])],
	[AC_DEFINE(HAVE_ICAL_UNKNOWN_TOKEN_HANDLING, 1, [libical provides ical_set_unknown_token_handling_setting function]) ac_cv_have_iuth=yes],[ac_cv_have_iuth=no])
CFLAGS=$save_cflags
LIBS=$save_libs
AC_MSG_RESULT([$ac_cv_have_iuth])

1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
dnl ****************************
dnl Check for gtkspell
dnl ****************************
AC_ARG_ENABLE([gtkspell],
	[AS_HELP_STRING([--enable-gtkspell],
	[Enable gtkspell @<:@default=yes@:>@])],
	[enable_gtkspell="$enableval"], [enable_gtkspell="yes"])

if test "x$enable_gtkspell" = "xyes"; then
	PKG_CHECK_MODULES(
		[GTKSPELL],
		[gtkspell3-3.0],,
		[AC_MSG_ERROR([

	gtkspell3-3.0 not found

	If you want to disable the gtkspell feature,
	please append --disable-gtkspell to configure.

	])])

	AC_DEFINE(WITH_GTKSPELL, 1, [When defined spell checking is enabled])
fi

1121 1122 1123 1124
dnl *******************
dnl Special directories
dnl *******************

1125 1126
dnl If you add something here, consider whether or not you also need to add it to one or more .pc.in
dnl files (for Connector, etc)
1127

1128
privlibdir='${libdir}'/evolution/$BASE_VERSION
1129 1130
AC_SUBST(privlibdir)

1131
privlibexecdir='${libexecdir}'/evolution/$BASE_VERSION
1132 1133
AC_SUBST(privlibexecdir)

1134 1135 1136 1137 1138 1139
privdatadir='${datadir}'/evolution/$BASE_VERSION
AC_SUBST(privdatadir)

privincludedir='${includedir}'/evolution-$BASE_VERSION
AC_SUBST(privincludedir)

1140 1141 1142
moduledir="$privlibdir/modules"
AC_SUBST(moduledir)

1143 1144
uidir="$privdatadir/ui"
AC_SUBST(uidir)
1145

1146 1147 1148
evolutionhelpdir="$privdatadir/help"
AC_SUBST(evolutionhelpdir)

1149 1150 1151
icondir="$privdatadir/icons"
AC_SUBST(icondir)

1152 1153 1154
imagesdir="$privdatadir/images"
AC_SUBST(imagesdir)

1155
if test "$os_win32" = yes; then
1156 1157 1158 1159 1160 1161
	dnl On Win32 there is no "rpath" mechanism. We install the private
	dnl shared libraries in $libdir, meaning the DLLs will actually be in
	dnl $bindir. This means just having $bindir in PATH will be enough. This
	dnl also means gnome_win32_get_prefixes() will be able to deduce the
	dnl installation folder correctly.
	privsolibdir=$libdir
1162
else
1163
	privsolibdir=$privlibdir
1164 1165
fi
AC_SUBST(privsolibdir)
1166 1167 1168 1169 1170 1171 1172 1173 1174

soundsdir="$privdatadir/sounds"
AC_SUBST(soundsdir)

etspecdir="$privdatadir/etspec"
AC_SUBST(etspecdir)

viewsdir="$privdatadir/views"
AC_SUBST(viewsdir)
1175

1176 1177 1178
dnl For evolution-alarm-notify.desktop
AS_AC_EXPAND(PRIVLIBEXECDIR, "$privlibexecdir")

JP Rosevear's avatar
JP Rosevear committed
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188
dnl ************************
dnl Plugins
dnl ************************

plugindir="$privlibdir/plugins"
AC_SUBST(plugindir)

EVO_PLUGIN_RULE=$srcdir/plugin.mk
AC_SUBST_FILE(EVO_PLUGIN_RULE)

1189
AC_ARG_ENABLE([plugins],
1190
	AS_HELP_STRING([--enable-plugins=[no/base/all]],
1191 1192
	[Enable plugins.]),
	[enable_plugins="$enableval"],[enable_plugins=all])
JP Rosevear's avatar
JP Rosevear committed
1193 1194

dnl Add any new plugins here
1195
plugins_base_always="publish-calendar"
1196

1197
plugins_base="$plugins_base_always"
1198
dist_plugins_base="$plugins_base_always"
1199

1200
plugins_standard_always="bbdb save-calendar mail-to-task mailing-list-actions mail-notification attachment-reminder email-custom-header face templates dbx-import external-editor"
1201

1202
plugins_standard="$plugins_standard_always"
Milan Crha's avatar
Milan Crha committed
1203
dist_plugins_standard="$plugins_standard pst-import"
JP Rosevear's avatar
JP Rosevear committed
1204

1205 1206 1207 1208 1209
dnl ******************************************************************
dnl The following plugins have additional library dependencies.
dnl They must be explicitly disabled if the libraries are not present.
dnl ******************************************************************

1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227
dnl **************************************************
dnl text-highlight plugins requires highlight utility
dnl **************************************************
AC_ARG_ENABLE([text-highlight],
	[AS_HELP_STRING([--enable-text-highlight],
	[Enable text-highlight plugin (default=yes)])],
	[enable_text_highlight="$enableval"], [enable_text_highlight=yes])
AC_MSG_CHECKING([if source code highlighting support is enabled])
AC_MSG_RESULT([$enable_text_highlight])
msg_text_highlight="$enable_text_highlight"
if test "x$enable_text_highlight" = "xyes"; then
	AC_ARG_VAR([HIGHLIGHT], [Source code highlighting utility])
	AC_PATH_PROG([HIGHLIGHT], [highlight])
	if test "x$HIGHLIGHT" == "x"; then
		AC_MSG_ERROR([

	Highlight utility not found.

1228 1229 1230 1231
	If you want to disable syntax highlighting in emails,
	please append --disable-text-highlight to configure.

	])
1232 1233 1234 1235 1236 1237 1238 1239 1240
	fi
	AC_DEFINE_UNQUOTED(
		HIGHLIGHT_COMMAND, "$HIGHLIGHT",
		[Source code highlighting utility])

	msg_text_highlight="$msg_text_highlight ($HIGHLIGHT)"
fi
AM_CONDITIONAL([ENABLE_TEXT_HIGHLIGHT], [test "x$enable_text_highlight" = "xyes"])

1241 1242 1243
dnl **************************************
dnl Weather calendars require gweather-3.0
dnl **************************************
1244 1245
AC_ARG_ENABLE([weather],
	[AS_HELP_STRING([--enable-weather],
1246
	[Enable weather calendars @<:@default=yes@:>@])],
1247 1248
	[enable_weather="$enableval"],[enable_weather=yes])

1249
if test "x$enable_weather" != "xno"; then
1250 1251 1252
	PKG_CHECK_MODULES(
		[GWEATHER], [gweather-3.0 >= gweather_minimum_version],,
		[AC_MSG_ERROR([
1253

1254 1255 1256 1257 1258 1259
	gweather-3.0 not found (or version < gweather_minimum_version)

	If you want to disable weather calendar support,
	please append --disable-weather to configure.

	])])
1260
fi
1261
AM_CONDITIONAL(ENABLE_WEATHER, [test "x$enable_weather" != "xno"])
1262

1263 1264 1265 1266 1267 1268 1269 1270 1271
dnl ********************************************************************
dnl maps in contacts preview requires champlain-gtk, geoclue and clutter
dnl ********************************************************************
AC_ARG_ENABLE([contact-maps],
	[AS_HELP_STRING([--enable-contact-maps],
	[Enable contact maps @<:@default=no@:>@])],
	[enable_contact_maps="$enableval"], [enable_contact_maps="no"])

if test "x$enable_contact_maps" = "xyes"; then
1272 1273 1274 1275
	PKG_CHECK_MODULES(
		[CHAMPLAIN],
		[champlain-gtk-0.12 >= champlain_minimum_version],,
		[AC_MSG_ERROR([
1276

1277
	champlain-gtk-0.12 not found.
1278 1279 1280

	If you want to disable the contact maps feature,
	please append --disable-contact-maps to configure.
1281 1282

	])])
1283

1284 1285
	PKG_CHECK_MODULES(
		[GEO],
1286
		[geoclue >= geoclue_minimum_version
1287
		 geocode-glib-1.0 >= geocode_glib_minimum_version],,
1288
		[AC_MSG_ERROR([
1289

1290
	geoclue and/or geocode-glib not found.
1291 1292 1293

	If you want to disable the contact maps feature,
	please append --disable-contact-maps to configure.
1294

1295
	])])
1296

1297 1298 1299 1300
	PKG_CHECK_MODULES(
		[CLUTTER_GTK],
		[clutter-gtk-1.0 >= clutter_gtk_minimum_version],,
		[AC_MSG_ERROR([
1301

1302
	clutter-gtk-1.0 not found (or version < clutter_gtk_minimum_version)
1303 1304 1305

	If you want to disable the contact maps feature,
	please append --disable-contact-maps to configure.
1306 1307

	])])
1308 1309

	AC_DEFINE(WITH_CONTACT_MAPS, 1, [When defined contacts preview will contain maps])
1310 1311
fi

1312 1313 1314 1315
dnl *********************************
dnl pst-import plugin requires libpst
dnl *********************************
AC_ARG_ENABLE([pst-import],
1316 1317
	[AS_HELP_STRING([--enable-pst-import],
	[Enable pst-import plugin @<:@default=yes@:>@])],
1318 1319 1320
	[enable_pst="$enableval"], [enable_pst=yes])

if test "x$enable_pst" = "xyes"; then
1321
	PKG_CHECK_MODULES(LIBPST, libpst >= libpst_minimum_version, have_pst=yes, have_pst=no)
1322 1323 1324 1325
	AC_SUBST(LIBPST_CFLAGS)
	AC_SUBST(LIBPST_LIBS)

	if test "x$have_pst" = "xyes"; then
1326
		plugins_standard="$plugins_standard pst-import"