configure.ac 100 KB
Newer Older
1 2 3 4
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# This file is part of Tracker.

5
AC_PREREQ([2.64])
6 7 8 9 10 11 12 13

# Making releases:
#   TRACKER_MICRO_VERSION += 1;
#   TRACKER_INTERFACE_AGE += 1;
#   TRACKER_BINARY_AGE += 1;
# if any functions have been added, set TRACKER_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set TRACKER_BINARY_AGE and TRACKER_INTERFACE_AGE to 0.
Martyn Russell's avatar
Martyn Russell committed
14
m4_define([tracker_major_version], [1])
Carlos Garnacho's avatar
Carlos Garnacho committed
15
m4_define([tracker_minor_version], [10])
Carlos Garnacho's avatar
Carlos Garnacho committed
16
m4_define([tracker_micro_version], [5])
Martyn Russell's avatar
Martyn Russell committed
17
m4_define([tracker_interface_age], [0])
18 19 20 21 22
m4_define([tracker_binary_age],
          [m4_eval(100 * tracker_minor_version + tracker_micro_version)])
m4_define([tracker_version],
          [tracker_major_version.tracker_minor_version.tracker_micro_version])
# This is the X.Y used in -llibtracker-FOO-X.Y
23
m4_define([tracker_api_version], [1.0])
24

25 26 27 28 29 30 31 32 33
# libtool version related macros
m4_define([tracker_lt_release], [tracker_major_version.tracker_minor_version])
m4_define([tracker_lt_current],
          [m4_eval(100 * tracker_minor_version + tracker_micro_version - tracker_interface_age)])
m4_define([tracker_lt_revision], [tracker_interface_age])
m4_define([tracker_lt_age], [m4_eval(tracker_binary_age - tracker_interface_age)])
m4_define([tracker_lt_current_minus_age],
          [m4_eval(tracker_lt_current - tracker_lt_age)])

34 35 36 37 38 39 40
# Define a string for the earliest version that this release has
# backwards binary compatibility with for all interfaces a module
# might. Unless we add module-only API with lower stability
# guarantees, this should be unchanged until we break binary compat
# for Tracker.
#
# TRACKER_BINARY_VERSION=$TRACKER_MAJOR_VERSION.$TRACKER_MINOR_VERSION.$LT_CURRENT
41
m4_define([tracker_binary_version], [1.0.0])
42

43 44
AC_INIT([tracker],
        [tracker_version],
45
        [http://bugzilla.gnome.org/enter_bug.cgi?product=tracker],
46
        [tracker],
47
        [https://wiki.gnome.org/Projects/Tracker])
48

49
AC_CONFIG_AUX_DIR([build-aux])
50
AC_CONFIG_SRCDIR([src/tracker-store/tracker-main.vala])
51 52
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
53

54 55 56 57
# Available since autoconf 2.60, implies _GNU_SOURCE and extensions if available.
# See: https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Posix-Variants.html
AC_USE_SYSTEM_EXTENSIONS

58 59 60 61 62 63
# Adding the 'subdir-objects' Automake option here will fix some Automake
# warnings, but it will also break the build. I believe that it triggers
# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928>. That bug will
# be fixed in Automake 1.16, so we should be eventually able to use
# 'subdir-objects' (which is apparently will be on by default in Automake 2.0),
# but we'll need to require Automake 1.16 before we can do so.
64
AM_INIT_AUTOMAKE([1.11 no-define tar-ustar -Wno-portability no-dist-gzip dist-xz])
65

66 67
AC_PROG_LIBTOOL

68
AM_SILENT_RULES([yes])
69

70 71 72 73
dnl http://people.gnome.org/~walters/docs/build-api.txt
dnl We don't support srcdir != builddir.
echo \#buildapi-variable-no-builddir >/dev/null

74 75
IDT_COMPILE_WARNINGS

76 77 78 79 80 81 82 83
TRACKER_MAJOR_VERSION=tracker_major_version
TRACKER_MINOR_VERSION=tracker_minor_version
TRACKER_MICRO_VERSION=tracker_micro_version
TRACKER_INTERFACE_AGE=tracker_interface_age
TRACKER_BINARY_AGE=tracker_binary_age
TRACKER_VERSION=tracker_version
TRACKER_API_VERSION=tracker_api_version
TRACKER_BINARY_VERSION=tracker_binary_version
84

85 86 87
dnl Note: this creates TRACKER_API_VERSION_UNDERSCORES and AC_SUBST's it
AX_DOTS_TO_UNDERSCORES(TRACKER_API_VERSION, tracker_api_version)

88 89 90 91 92 93 94 95
AC_SUBST(TRACKER_MAJOR_VERSION)
AC_SUBST(TRACKER_MINOR_VERSION)
AC_SUBST(TRACKER_MICRO_VERSION)
AC_SUBST(TRACKER_INTERFACE_AGE)
AC_SUBST(TRACKER_BINARY_AGE)
AC_SUBST(TRACKER_API_VERSION)
AC_SUBST(TRACKER_VERSION)
AC_SUBST(TRACKER_BINARY_VERSION)
96

97 98 99 100 101 102 103 104 105 106
AC_DEFINE(TRACKER_MAJOR_VERSION, [tracker_major_version],
          [Define to the Tracker major version])
AC_DEFINE(TRACKER_MINOR_VERSION, [tracker_minor_version],
          [Define to the Tracker minor version])
AC_DEFINE(TRACKER_MICRO_VERSION, [tracker_micro_version],
          [Define to the Tracker micro version])
AC_DEFINE(TRACKER_INTERFACE_AGE, [tracker_interface_age],
          [Define to the Tracker interface age])
AC_DEFINE(TRACKER_BINARY_AGE, [tracker_binary_age],
          [Define to the Tracker binary age])
107

108 109 110 111 112 113 114 115 116 117 118 119
# libtool versioning
LT_RELEASE=tracker_lt_release
LT_CURRENT=tracker_lt_current
LT_REVISION=tracker_lt_revision
LT_AGE=tracker_lt_age
LT_CURRENT_MINUS_AGE=tracker_lt_current_minus_age
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_SUBST(LT_CURRENT_MINUS_AGE)

120
# Checks for programs.
121
AC_PROG_CXX
122 123 124
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
125
AC_PROG_INSTALL
126
AC_PROG_LN_S
127 128
AC_PROG_MAKE_SET

129 130 131
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])
132

133
AC_CHECK_HEADERS([fcntl.h float.h inttypes.h limits.h locale.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/statfs.h sys/statvfs.h sys/time.h unistd.h])
134

Martyn Russell's avatar
Martyn Russell committed
135
AC_CHECK_HEADER([zlib.h],
136 137
                [],
                [AC_MSG_ERROR([You must have zlib.h and zlib installed])])
138

139 140 141 142 143 144 145 146 147 148 149 150
AC_HEADER_STDC

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

151 152 153 154 155 156 157
# Can posix_fadvise be used
AC_CHECK_DECLS(posix_fadvise, [], [], [
#define _XOPEN_SOURCE 600
#include <fcntl.h>])

# Checks for functions
AC_CHECK_FUNCS([posix_fadvise])
Ralph Boehme's avatar
Ralph Boehme committed
158
AC_CHECK_FUNCS([getline strnlen])
159

160 161 162 163 164 165 166 167
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_CHECK_FUNCS([alarm ftruncate memchr memmove memset modf munmap setlocale sqrt strcasecmp strchr strcspn strndup strrchr strstr strtoul strtoull tzset])
168

169 170 171 172 173 174
# if statvfs64() is available, enable the 64-bit API extensions
AC_CHECK_FUNCS([statvfs64], [have_statvfs64=yes], [have_statvfs64=no])
if test "x$have_statvfs" = "xyes" ; then
   CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
fi

175
# Check for defines we expect
176
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
177 178
#include "stdio.h"
printf ("%s", __FUNCTION__);
179 180 181
   ]])],
   [have_function=yes],
   [have_function=no])
182 183

if test "x$have_function" = "xno" ; then
Martyn Russell's avatar
Martyn Russell committed
184 185 186
   AC_DEFINE(__FUNCTION__,
             __func__,
            [Defined for compilers not supporting __FUNCTION__])
187 188
fi

189 190 191 192 193 194 195 196 197 198 199
# Remember CFLAGS upon entering configure...
CFLAGS="$CFLAGS"

# Initialize GLib
GLIB_GSETTINGS
GLIB_TESTS

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

200 201 202
# Binary required versions
PYTHON_REQUIRED=2.6

203
# Library required versions
204
DBUS_REQUIRED=1.3.1
Sam Thursfield's avatar
Sam Thursfield committed
205
GLIB_REQUIRED=2.44.0
Carlos Garnacho's avatar
Carlos Garnacho committed
206
GTK_REQUIRED=3.0.0
207
LIBXML2_REQUIRED=2.6
208
HAL_REQUIRED=0.5
209
UPOWER_REQUIRED=0.9.0
210
MEEGOTOUCH_REQUIRED=0.20
211
POPPLER_REQUIRED=0.16.0
212
CAIRO_REQUIRED=1.0
213
LIBICU_REQUIRED=4.8.1.1
214 215 216
LIBJPEG_REQUIRED="any version"
LIBGIF_REQUIRED="any version"
LIBTIFF_REQUIRED="any version"
217
LIBVORBIS_REQUIRED=0.22
Iain Holmes's avatar
Iain Holmes committed
218
LIBFLAC_REQUIRED=1.2.1
219
LIBEXIF_REQUIRED=0.6
220
LIBGSF_REQUIRED=1.14.24
Zeeshan Ali's avatar
Zeeshan Ali committed
221
LIBOSINFO_REQUIRED=0.2.9
222
EXEMPI_REQUIRED=2.1.0
223 224 225 226
EVO_REQUIRED=2.32.0
EVO_SHELL_REQUIRED=2.32.0
EDS_REQUIRED=2.32.0
CAMEL_REQUIRED=2.32.0
Martyn Russell's avatar
Martyn Russell committed
227
GEE_REQUIRED=0.3
228
TAGLIB_REQUIRED=1.6
229
LIBGRSS_REQUIRED=0.7
230
NETWORK_MANAGER_REQUIRED=0.8
231
GSTREAMER_REQUIRED=0.10.31
232
GUPNP_DLNA_REQUIRED=0.9.4
233
LIBPNG_REQUIRED=1.2
234
LIBMEDIAART_REQUIRED=1.9.0
235

236 237 238 239
# 3.6.11 for sqlite_backup API
# 3.6.16 to fix test failures
# 3.6.17 for shared cache mode with virtual tables
# 3.7.0 for WAL
240
# 3.7.9 for FTS4 content= support
241 242
# 3.7.15 for sqlite3_errstr() support
SQLITE_REQUIRED=3.7.15
243

244 245
# Needed to generate .gir files,
# see http://live.gnome.org/GnomeGoals/AddGObjectIntrospectionSupport
246
GOBJECT_INTROSPECTION_CHECK([0.9.5])
247

248 249 250
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
AC_SUBST(GLIB_PREFIX)

Jürg Billeter's avatar
Jürg Billeter committed
251 252 253 254
# Check requirements for gvdb
GVDB_REQUIRED="glib-2.0 >= $GLIB_REQUIRED"
PKG_CHECK_MODULES(GVDB, [$GVDB_REQUIRED])

255 256
# Check requirements for libtracker-bus
LIBTRACKER_BUS_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
257
                         gio-unix-2.0 >= $GLIB_REQUIRED"
258

259 260
PKG_CHECK_MODULES(LIBTRACKER_BUS, [$LIBTRACKER_BUS_REQUIRED])

261
# Check requirements for libtracker-common
Martyn Russell's avatar
Martyn Russell committed
262
LIBTRACKER_COMMON_REQUIRED="glib-2.0        >= $GLIB_REQUIRED
263
                            gio-unix-2.0    >= $GLIB_REQUIRED"
264

265 266
PKG_CHECK_MODULES(LIBTRACKER_COMMON, [$LIBTRACKER_COMMON_REQUIRED])

267 268 269 270 271 272
case $host in
  *-*-openbsd*)
    LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS -lkvm"
    ;;
esac

273 274 275 276 277 278 279 280 281
# Check requirements for libtracker-data
LIBTRACKER_DATA_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                          gio-unix-2.0 >= $GLIB_REQUIRED
                          sqlite3      >= $SQLITE_REQUIRED
                          uuid"
PKG_CHECK_MODULES(LIBTRACKER_DATA, [$LIBTRACKER_DATA_REQUIRED])

LIBTRACKER_DATA_LIBS="$LIBTRACKER_DATA_LIBS -lz -lm"

282 283
# Check requirements for libtracker-direct
LIBTRACKER_DIRECT_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
284
                            gio-unix-2.0 >= $GLIB_REQUIRED"
285 286 287

PKG_CHECK_MODULES(LIBTRACKER_DIRECT, [$LIBTRACKER_DIRECT_REQUIRED])

288 289
# Check requirements for libtracker-extract
LIBTRACKER_EXTRACT_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
290 291
                             gio-unix-2.0 >= $GLIB_REQUIRED
			     gmodule-2.0  >= $GLIB_REQUIRED"
292 293 294

PKG_CHECK_MODULES(LIBTRACKER_EXTRACT, [$LIBTRACKER_EXTRACT_REQUIRED])

295 296 297 298 299 300 301
# Check requirements for libtracker-fts
LIBTRACKER_FTS_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                         gio-unix-2.0 >= $GLIB_REQUIRED
                         sqlite3      >= $SQLITE_REQUIRED"

PKG_CHECK_MODULES(LIBTRACKER_FTS, [$LIBTRACKER_FTS_REQUIRED])

302
# Check requirements for libtracker-miner
Martyn Russell's avatar
Martyn Russell committed
303
LIBTRACKER_MINER_REQUIRED="glib-2.0        >= $GLIB_REQUIRED
304
                           gio-unix-2.0    >= $GLIB_REQUIRED"
305 306 307

PKG_CHECK_MODULES(LIBTRACKER_MINER, [$LIBTRACKER_MINER_REQUIRED])

308 309 310 311 312 313
# Check requirements for libtracker-control
LIBTRACKER_CONTROL_REQUIRED="glib-2.0        >= $GLIB_REQUIRED
                             gio-unix-2.0    >= $GLIB_REQUIRED"

PKG_CHECK_MODULES(LIBTRACKER_CONTROL, [$LIBTRACKER_CONTROL_REQUIRED])

314 315
# Check requirements for libtracker-sparql
LIBTRACKER_SPARQL_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
316 317
                            gio-unix-2.0 >= $GLIB_REQUIRED
                            uuid"
318 319 320

PKG_CHECK_MODULES(LIBTRACKER_SPARQL, [$LIBTRACKER_SPARQL_REQUIRED])

321
# Check requirements for tracker-control
322 323 324
TRACKER_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                  gio-unix-2.0 >= $GLIB_REQUIRED
                  uuid"
325

326
PKG_CHECK_MODULES(TRACKER, [$TRACKER_REQUIRED])
327

328
# Check requirements for tracker-resdump
329
TRACKER_RESDUMP_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
330
                          gee-0.8      >= $GEE_REQUIRED"
331 332 333 334 335

PKG_CHECK_MODULES(TRACKER_RESDUMP, [$TRACKER_RESDUMP_REQUIRED],
                  [have_tracker_resdump=yes],
                  [have_tracker_resdump=no])

336 337 338 339 340 341 342 343 344 345
# Check requirements for tracker-store
TRACKER_STORE_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                        gio-unix-2.0 >= $GLIB_REQUIRED
                        gmodule-2.0  >= $GLIB_REQUIRED
                        sqlite3      >= $SQLITE_REQUIRED"

PKG_CHECK_MODULES(TRACKER_STORE, [$TRACKER_STORE_REQUIRED])

TRACKER_STORE_LIBS="$TRACKER_STORE_LIBS -lz -lm"

346
# Check requirements for tracker-extract
Martyn Russell's avatar
Martyn Russell committed
347 348
TRACKER_EXTRACT_REQUIRED="glib-2.0        >= $GLIB_REQUIRED
                          gio-unix-2.0    >= $GLIB_REQUIRED
349
                          gmodule-2.0     >= $GLIB_REQUIRED"
350 351 352

PKG_CHECK_MODULES(TRACKER_EXTRACT, [$TRACKER_EXTRACT_REQUIRED])

353 354 355 356 357 358 359 360
TRACKER_EXTRACT_MODULES_DIR="${libdir}/tracker-${TRACKER_API_VERSION}/extract-modules"
AC_SUBST(TRACKER_EXTRACT_MODULES_DIR)

# NOTE: We don't use ${TRACKER_API_VERSION} because other content like
# the ontology is installed to the same location.
TRACKER_EXTRACT_RULES_DIR="${datadir}/tracker/extract-rules"
AC_SUBST(TRACKER_EXTRACT_RULES_DIR)

361 362 363 364 365
# Check requirements for tracker-extract modules
TRACKER_EXTRACT_MODULES_REQUIRED="glib-2.0     >= $GLIB_REQUIRED"

PKG_CHECK_MODULES(TRACKER_EXTRACT_MODULES, [$TRACKER_EXTRACT_MODULES_REQUIRED])

366 367 368
# Check requirements for tracker-writeback
TRACKER_WRITEBACK_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                            gio-unix-2.0 >= $GLIB_REQUIRED
369
                            gmodule-2.0  >= $GLIB_REQUIRED"
370 371 372

PKG_CHECK_MODULES(TRACKER_WRITEBACK, [$TRACKER_WRITEBACK_REQUIRED])

373 374 375
# Check requirements for tracker-miner-fs
TRACKER_MINER_FS_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                           gio-unix-2.0 >= $GLIB_REQUIRED
376
                           gmodule-2.0  >= $GLIB_REQUIRED"
377 378 379 380 381

PKG_CHECK_MODULES(TRACKER_MINER_FS, [$TRACKER_MINER_FS_REQUIRED])

TRACKER_MINER_FS_LIBS="$TRACKER_MINER_FS_LIBS -lz -lm"

382
# Check requirements for tracker-miner-apps
383 384
TRACKER_MINER_APPS_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                             gio-unix-2.0 >= $GLIB_REQUIRED"
385 386 387

PKG_CHECK_MODULES(TRACKER_MINER_APPS, [$TRACKER_MINER_APPS_REQUIRED])

388 389
# Check requirements for tracker-miner-user-guides
TRACKER_MINER_USER_GUIDES_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
390
                                    gio-unix-2.0 >= $GLIB_REQUIRED
391 392 393
                                    libxml-2.0   >= $LIBXML2_REQUIRED"

PKG_CHECK_MODULES(TRACKER_MINER_USER_GUIDES, [$TRACKER_MINER_USER_GUIDES_REQUIRED])
394

395
# Check requirements for tracker-miner-evolution
396 397 398 399 400 401 402 403 404 405
evolution_plugin_name=""

# First test for 3_3_5
TRACKER_MINER_EVOLUTION_3_3_5_REQUIRED="glib-2.0                  >= $GLIB_REQUIRED
                                        evolution-shell-3.0       >= 3.1
                                        evolution-plugin-3.0
                                        libemail-utils
                                        libemail-engine
                                        evolution-data-server-1.2 >= $EDS_REQUIRED
                                        camel-1.2                 >= $CAMEL_REQUIRED"
406

407
PKG_CHECK_MODULES(TRACKER_MINER_EVOLUTION, [$TRACKER_MINER_EVOLUTION_3_3_5_REQUIRED],
408 409 410
                  [have_tracker_miner_evolution=yes],
                  [have_tracker_miner_evolution=no])

411
if test -z "$evolution_plugin_name" && test "x$have_tracker_miner_evolution" = "xyes"; then
412 413
   evolution_plugin_name="evolution-plugin-3.0"

414
   AC_DEFINE(EVOLUTION_SHELL_3_3_5, 1, [Use new evolution-shell API])
415
   AC_DEFINE(EVOLUTION_SHELL_3_2, 1, [Use new evolution-shell API])
416
   AC_DEFINE(EVOLUTION_SHELL_2_91, 1, [Use new evolution-shell API])
417
fi
418

419 420 421 422 423 424
# Second test for 3_2
TRACKER_MINER_EVOLUTION_3_2_REQUIRED="glib-2.0                  >= $GLIB_REQUIRED
                                      evolution-shell-3.0       >= 3.1
                                      evolution-plugin-3.0
                                      evolution-data-server-1.2 >= $EDS_REQUIRED
                                      camel-1.2                 >= $CAMEL_REQUIRED"
425

426 427 428
PKG_CHECK_MODULES(TRACKER_MINER_EVOLUTION, [$TRACKER_MINER_EVOLUTION_3_2_REQUIRED],
                  [have_tracker_miner_evolution=yes],
                  [have_tracker_miner_evolution=no])
429

430 431
if test -z "$evolution_plugin_name" && test "x$have_tracker_miner_evolution" = "xyes"; then
   evolution_plugin_name="evolution-plugin-3.0"
432

433 434 435
   AC_DEFINE(EVOLUTION_SHELL_3_2, 1, [Use new evolution-shell API])
   AC_DEFINE(EVOLUTION_SHELL_2_91, 1, [Use new evolution-shell API])
fi
436

437 438 439 440 441 442
# Third test for 2_91
TRACKER_MINER_EVOLUTION_2_91_REQUIRED="glib-2.0                  >= $GLIB_REQUIRED
                                       evolution-shell-3.0
                                       evolution-plugin-3.0
                                       evolution-data-server-1.2 >= $EDS_REQUIRED
                                       camel-1.2                 >= $CAMEL_REQUIRED"
443

444 445 446
PKG_CHECK_MODULES(TRACKER_MINER_EVOLUTION, [$TRACKER_MINER_EVOLUTION_2_91_REQUIRED],
                  [have_tracker_miner_evolution=yes],
                  [have_tracker_miner_evolution=no])
447

448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
if test -z "$evolution_plugin_name" && test "x$have_tracker_miner_evolution" = "xyes"; then
   evolution_plugin_name="evolution-plugin-3.0"
   AC_DEFINE(EVOLUTION_SHELL_2_91, 1, [Use new evolution-shell API])
fi

# Fourth test others (do we really want support for anything < 3.2)?
TRACKER_MINER_EVOLUTION_LAST_REQUIRED="glib-2.0                  >= $GLIB_REQUIRED
                                       evolution-shell           >= $EVO_SHELL_REQUIRED
                                       evolution-plugin          >= $EVO_REQUIRED
                                       evolution-data-server-1.2 >= $EDS_REQUIRED
                                       camel-1.2                 >= $CAMEL_REQUIRED"

PKG_CHECK_MODULES(TRACKER_MINER_EVOLUTION, [$TRACKER_MINER_EVOLUTION_LAST_REQUIRED],
                  [have_tracker_miner_evolution=yes],
                  [have_tracker_miner_evolution=no])

if test -z "$evolution_plugin_name" && test "x$have_tracker_miner_evolution" = "xyes"; then
   evolution_plugin_name="evolution-plugin"
466 467
fi

468 469 470 471 472 473
# Check requirements for tracker-miner-thunderbird
TRACKER_MINER_THUNDERBIRD_REQUIRED=5.0
have_tracker_miner_thunderbird="no "

AC_PATH_PROG(THUNDERBIRD, thunderbird, thunderbird)
if test -n $THUNDERBIRD; then
474
   thunderbird_version=`$THUNDERBIRD --version 2>/dev/null | awk '{print $NF}'`
475

476 477 478 479
   AX_COMPARE_VERSION([$thunderbird_version], ge, [$TRACKER_MINER_THUNDERBIRD_REQUIRED],
                      have_tracker_miner_thunderbird="yes",
                      have_tracker_miner_thunderbird="no ")
   AC_SUBST(THUNDERBIRD)
480 481
fi

482 483 484 485 486 487
# Check requirements for tracker-miner-firefox
TRACKER_MINER_FIREFOX_REQUIRED=4.0
have_tracker_miner_firefox="no "

AC_PATH_PROG(FIREFOX, firefox, firefox)
if test -n $FIREFOX; then
488
   firefox_version=`$FIREFOX --version 2>/dev/null | awk '{print $NF}'`
489 490 491 492 493 494 495

   AX_COMPARE_VERSION([$firefox_version], ge, [$TRACKER_MINER_FIREFOX_REQUIRED],
                      have_tracker_miner_firefox="yes",
                      have_tracker_miner_firefox="no ")
   AC_SUBST(FIREFOX)
fi

496
# Check requirements for tracker-miner-rss
497 498
TRACKER_MINER_RSS_REQUIRED="glib-2.0 >= $GLIB_REQUIRED
                            libgrss  >= $LIBGRSS_REQUIRED"
499 500 501 502 503

PKG_CHECK_MODULES(TRACKER_MINER_RSS, [$TRACKER_MINER_RSS_REQUIRED],
                  [have_tracker_miner_rss=yes],
                  [have_tracker_miner_rss=no])

504 505 506 507
# Check requirements for tracker-needle
TRACKER_NEEDLE_REQUIRED="glib-2.0     >= $GLIB_REQUIRED
                         gio-unix-2.0 >= $GLIB_REQUIRED
                         gmodule-2.0  >= $GLIB_REQUIRED
Carlos Garnacho's avatar
Carlos Garnacho committed
508
                         gtk+-3.0     >= $GTK_REQUIRED"
509 510 511 512 513

PKG_CHECK_MODULES(TRACKER_NEEDLE, [$TRACKER_NEEDLE_REQUIRED],
                  [have_tracker_needle=yes],
                  [have_tracker_needle=no])

514 515 516 517
# Check requirements for tracker-preferences
TRACKER_PREFERENCES_REQUIRED="glib-2.0       >= $GLIB_REQUIRED
                              gio-unix-2.0   >= $GLIB_REQUIRED
                              gmodule-2.0    >= $GLIB_REQUIRED
518
                              gtk+-3.0       >= $GTK_REQUIRED"
519 520 521 522 523

PKG_CHECK_MODULES(TRACKER_PREFERENCES, [$TRACKER_PREFERENCES_REQUIRED],
                  [have_tracker_preferences=yes],
                  [have_tracker_preferences=no])

524
# Check requirements for Nautilus extension
525
TRACKER_NAUTILUS_EXTENSION_REQUIRED="libnautilus-extension"
526 527 528 529 530

PKG_CHECK_MODULES(TRACKER_NAUTILUS_EXTENSION, [$TRACKER_NAUTILUS_EXTENSION_REQUIRED],
                  [have_tracker_nautilus_extension=yes],
                  [have_tracker_nautilus_extension=no])

531
# Check we have Vala valac command we need
532 533 534 535
VALA_MIN_VERSION=0.18.0
AM_PROG_VALAC([$VALA_MIN_VERSION])
if test "x$VALAC" = "x"; then
    AC_MSG_ERROR([Vala requested but valac >= $VALA_MIN_VERSION is not installed])
536
fi
537

538 539 540 541 542
####################################################################
# Check gettext/intltool support
####################################################################
GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
543 544
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
IT_PROG_INTLTOOL([0.40.0])
545 546 547 548 549 550 551

####################################################################
# Check if we should enable GCOV coverage reporting support
####################################################################

AC_ARG_ENABLE(gcov,
              AS_HELP_STRING([--enable-gcov],
552 553
                             [enable coverage reporting support [[default=no]]]),
              [enable_gcov=$enableval],
554 555 556 557 558 559 560
              [enable_gcov=no])
AM_CONDITIONAL(ENABLE_GCOV, test "x$enable_gcov" != "xno")

if test "x$enable_gcov" != "xno" ; then
  GCOV_VALAFLAGS="-g"
  GCOV_CFLAGS="-ftest-coverage -fprofile-arcs"
  GCOV_LIBS="-lgcov"
561
else
562 563 564
  GCOV_VALAFLAGS=
  GCOV_CFLAGS=
  GCOV_LIBS=
565 566
fi

567 568 569
AC_SUBST(GCOV_VALAFLAGS)
AC_SUBST(GCOV_CFLAGS)
AC_SUBST(GCOV_LIBS)
570

571 572
####################################################################
# General VALAFLAGS/CFLAGS/LIBS
573 574 575
#
# NOTE: BUILD_VALACFLAGS are for the sources built by Vala,
#       not for .vala files themselves.
576
####################################################################
577
BUILD_VALAFLAGS="-g --target-glib=${GLIB_REQUIRED}"
578
BUILD_VALACFLAGS="${WARN_VALACFLAGS} ${GCOV_CFLAGS} -DG_LOG_DOMAIN=\\\"Tracker\\\" -DTRACKER_COMPILATION"
579 580 581 582
BUILD_CFLAGS="${WARN_CFLAGS} ${GCOV_CFLAGS} -DG_LOG_DOMAIN=\\\"Tracker\\\" -DTRACKER_COMPILATION"
BUILD_LIBS="${GCOV_LIBS}"

AC_SUBST(BUILD_VALAFLAGS)
583
AC_SUBST(BUILD_VALACFLAGS)
584 585 586
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(BUILD_LIBS)

587
####################################################################
588 589 590 591 592 593 594 595 596 597 598 599 600 601
# Check if linker supports --enable-new-dtags
####################################################################
AC_MSG_CHECKING([whether $CC supports -Wl,--enable-new-dtags])
save_LDFLAGS=$LDFLAGS
LDFLAGS="-Wl,--enable-new-dtags $LDFLAGS"

AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
             [enable_new_dtags=yes; AC_MSG_RESULT(yes)], [enable_new_dtags=no; AC_MSG_RESULT(no)])
LDFLAGS=$save_LDFLAGS
if test "x$enable_new_dtags" = "xyes"; then
    LDFLAGS="-Wl,--enable-new-dtags $LDFLAGS"
fi

####################################################################
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
# Check for minimal
####################################################################

AC_ARG_ENABLE(minimal,
              AS_HELP_STRING([--enable-minimal],
                             [disabled EVERYTHING except the very core (tracker-store and foundation libraries) [[default=no]]]),
              [enable_minmal=$enableval],
              [enable_minmal=no])

# WE only disable the binaries we're building here, not optional
# extras for those binaries
if test "x$enable_minimal" = "xyes"; then
   AC_MSG_WARN([Building minimal configuration])

   enable_tracker_extract=no
   enable_tracker_writeback=no
   enable_miner_fs=no
   enable_miner_apps=no
   enable_miner_user_guides=no
   enable_miner_rss=no
   enable_miner_evolution=no
   enable_miner_thunderbird=no
   enable_miner_firefox=no
   enable_nautilus_extension=no
   enable_tracker_needle=no
   enable_tracker_preferences=no
fi
629

630 631 632 633 634
####################################################################
# Check for functional-test include/exclude
####################################################################
AC_ARG_ENABLE([functional-tests],
              AS_HELP_STRING([--enable-functional-tests],
635 636
                             [enable functional tests [[default=no]]]),
              [enable_functional_tests=$enableval],
637
              [enable_functional_tests=no])
Jürg Billeter's avatar
Jürg Billeter committed
638

639
if test x$enable_functional_tests != "xno"; then
640 641 642 643 644 645
   # Python check, require >= 2.6
   AC_PATH_PROG([PYTHON],[python],[:])
   AS_IF([test "$PYTHON" != ":"],
         [AM_PYTHON_CHECK_VERSION([$PYTHON],[$PYTHON_REQUIRED],[:],[PYTHON=":"])])

   if test "$PYTHON" = ":"; then
646
      AC_MSG_ERROR([Could not find Python >= $PYTHON_REQUIRED (for functional-tests, try --disable-functional-tests).])
647 648 649
   fi

   AC_DEFINE(DIST_FUNCTIONAL_TESTS, 1, [Include functional tests in the installation])
650 651
fi

652
AM_CONDITIONAL(DIST_FUNCTIONAL_TESTS, test "x$enable_functional_tests" != "xno")
653

654
####################################################################
655
# Check for gtk-doc and docbook-tools
656 657
####################################################################

658 659 660
# Check for GTK_DOC_CHECK availability. The GTK_DOC_CHECK invocation
# must be on its own line, gtkdocize relies on it
m4_ifdef([GTK_DOC_CHECK], [
661
GTK_DOC_CHECK([1.8])
662

663 664 665 666 667 668 669
# NOTE: We need to use a separate automake conditional for this
#       to make this work with the tarballs.
AM_CONDITIONAL([ENABLE_GTK_DOC], test "x$enable_gtk_doc" = xyes)
],
[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
670

671
####################################################################
672
# Check if we should install Windows specific binaries
673 674
####################################################################

675
AC_MSG_CHECKING(for WIN32)
676
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
677 678 679
   #ifndef WIN32
   #error
   #endif
680 681 682
   ]])],
   [native_win32=yes; AC_MSG_RESULT(yes)],
   [native_win32=no; AC_MSG_RESULT(no)])
683

684
AM_CONDITIONAL(OS_WIN32, test "$native_win32" = "yes")
685

686 687 688
if test "$native_win32" = "yes" ; then
   AC_DEFINE(OS_WIN32, 1, [Define if we are on win32])
fi
689

690 691 692 693 694 695 696
####################################################################
# Check if we should install Maemo/MeeGo specific ontologies
####################################################################

AC_ARG_ENABLE(maemo,
              AS_HELP_STRING([--enable-maemo],
                             [enable maemo ontology [[default=no]]]),
697 698
              [enable_maemo=$enableval],
              [enable_maemo=no])
699 700 701

AM_CONDITIONAL(HAVE_MAEMO, test "x$enable_maemo" = "xyes")

702 703 704 705
if test "x$enable_maemo" = "xyes" ; then
   AC_DEFINE(HAVE_MAEMO, 1, [Define if we enable Maemo specific features])
fi

706 707 708 709 710 711
####################################################################
# Check if we should disable the journal
####################################################################

AC_ARG_ENABLE(journal,
              AS_HELP_STRING([--enable-journal],
712
                             [enable database journal backup mechanism [[default=yes]]]),
713 714
              [enable_journal=$enableval],
              [enable_journal=yes])
715

716 717 718 719 720 721 722 723
if test "x$enable_journal" != "xno" ; then
   have_tracker_journal="yes"
else
   have_tracker_journal="no  (disabled)"
fi

AM_CONDITIONAL(DISABLE_JOURNAL, test "x$enable_journal" = "xno")

724 725 726 727
if test "x$enable_journal" = "xno" ; then
   AC_DEFINE(DISABLE_JOURNAL, 1, [Define if we disable the journal])
fi

728 729 730 731 732 733 734 735 736 737 738 739 740 741
####################################################################
# Check for SQLite
####################################################################

PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= $SQLITE_REQUIRED])
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)

# Make sure SQLite is compiled thread-safe
AX_SQLITE_THREADSAFE
if test "x$ax_cv_sqlite_threadsafe" != "xyes"; then
  AC_MSG_ERROR([sqlite3 is not compiled thread-safe])
fi

742
# Make sure we're not using versions which cause problems.
743
#
744
# Avoid versions:
745 746 747
#   3.7.10 - 3.7.13: https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
#   3.8.1:           https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
#   3.8.4.1:         https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
748
#
749 750 751 752 753 754 755
AC_MSG_CHECKING(whether SQLite3 version is safe)

PKG_CHECK_EXISTS([sqlite3 <= 3.7.9], sqlite_safe=yes, sqlite_safe=no)
if test "x$sqlite_safe" != "xyes"; then
   PKG_CHECK_EXISTS([sqlite3 >= 3.7.14], sqlite_safe=yes, sqlite_safe=no)
fi

756
if test "x$sqlite_safe" = "xyes"; then
757 758 759
   PKG_CHECK_EXISTS([sqlite3 = 3.8.1], sqlite_safe=no, sqlite_safe=yes)
fi

760 761 762 763 764
if test "x$sqlite_safe" = "xyes"; then
   PKG_CHECK_EXISTS([sqlite3 = 3.8.4.2], sqlite_safe=no, sqlite_safe=yes)
fi


765 766 767 768 769 770
if test "x$sqlite_safe" != "xyes"; then
   AC_MSG_RESULT(no)
else
   AC_MSG_RESULT(yes)
fi

771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
##################################################################
# Check for libtracker-common, make sure libstemmer exists
##################################################################

AC_ARG_ENABLE([libstemmer],
              AS_HELP_STRING([--enable-libstemmer],
                             [enable the stemming while indexing [[default=auto]]]),
              [enable_libstemmer=$enableval],
              [enable_libstemmer=auto])

if test "x$enable_libstemmer" != "xno" ; then
   AC_CHECK_LIB([stemmer], [sb_stemmer_new], [have_libstemmer=yes], [have_libstemmer=no])

   if test "x$have_libstemmer" = "xyes"; then
      AC_DEFINE(HAVE_LIBSTEMMER, [], [Define if we have libstemmer])
      LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS -lstemmer"
   fi
else
   have_libstemmer="no  (disabled)"
fi

if test "x$enable_libstemmer" = "xyes"; then
   if test "x$have_libstemmer" != "xyes"; then
794
      AC_MSG_ERROR([Could not find libstemmer.])
795 796 797 798 799
   fi
fi

AM_CONDITIONAL(HAVE_LIBSTEMMER, test "x$have_libstemmer" = "xyes")

800 801 802 803 804 805
##################################################################
# Check for tracker-fts, allow disabling FTS support
##################################################################

AC_ARG_ENABLE([tracker-fts],
              AS_HELP_STRING([--enable-tracker-fts],
806 807
                             [enable the tracker FTS [[default=auto]]]),
              [enable_tracker_fts=$enableval],
808 809
              [enable_tracker_fts=auto])

810
if test "x$enable_tracker_fts" = "xno" ; then
811
   have_tracker_fts="no  (disabled)"
812 813
else
   have_tracker_fts="yes"
814 815
fi

816 817
if test "x$have_tracker_fts" = "xyes"; then
   AC_DEFINE(HAVE_TRACKER_FTS, [1], [Define to 1 if tracker FTS is compiled])
818

Carlos Garnacho's avatar
Carlos Garnacho committed
819 820 821 822
   AX_SQLITE_BUILTIN_FTS5
   if test "x$ax_cv_sqlite_builtin_fts5" = "xyes" ; then
      have_builtin_fts5="yes"
      AC_DEFINE(HAVE_BUILTIN_FTS, [], [Defined if Sqlite has FTS5 compiled in])
823
   else
Carlos Garnacho's avatar
Carlos Garnacho committed
824
      have_builtin_fts5="no"
825 826 827 828 829 830

      # Make sure SQLite has extension loading enabled
      AX_SQLITE_AUTO_EXTENSION
      if test "x$ax_cv_sqlite_auto_extension" != "xyes"; then
        AC_MSG_ERROR([sqlite3 cannot load extensions])
      fi
831
   fi
832 833
else
   AC_DEFINE(HAVE_TRACKER_FTS, [0], [Define to 0 if tracker FTS is not compiled])
Carlos Garnacho's avatar
Carlos Garnacho committed
834
   have_builtin_fts5="disabled"
835 836
fi

Carlos Garnacho's avatar
Carlos Garnacho committed
837
AM_CONDITIONAL(HAVE_BUILTIN_FTS, test "$have_builtin_fts5" = "yes")
838
AM_CONDITIONAL(HAVE_TRACKER_FTS, test "$have_tracker_fts" = "yes")
839

840 841 842
####################################################################
# bash-completion
####################################################################
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861

AC_ARG_WITH([bash-completion-dir],
    AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
        [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
    [],
    [with_bash_completion_dir=yes])

if test "x$with_bash_completion_dir" = "xyes"; then
   PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
       [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)],
       [BASH_COMPLETION_DIR="${datadir}/bash-completion/completions"])
elif test "x$with_bash_completion_dir" != "xno"; then
   # Set with_bash_completions_dir to avoid printing path twice below
   BASH_COMPLETION_DIR="$with_bash_completion_dir"
   with_bash_completion_dir="yes"
fi

AC_SUBST([BASH_COMPLETION_DIR])
AM_CONDITIONAL([WITH_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
862

863
####################################################################
864
# Check for D-Bus requirements
865 866
####################################################################

867
# Check we are not using a different D-Bus services dir
868
AC_ARG_WITH([session_bus_services_dir],
Martyn Russell's avatar
Martyn Russell committed
869
            AS_HELP_STRING([--with-session-bus-services-dir],
870 871 872
                           [path to DBus services directory]),
            [dbus_services_dir=$withval],
            [dbus_services_dir=$datadir/dbus-1/services])
873

874
DBUS_SERVICES_DIR="$dbus_services_dir"
875 876
AC_SUBST(DBUS_SERVICES_DIR)

877 878 879 880
####################################################################
# GLib/GIO utilities
####################################################################

881 882 883
GLIB_MKENUMS=`$PKG_CONFIG glib-2.0 --variable=glib_mkenums`
AC_SUBST(GLIB_MKENUMS)

884 885 886
GDBUS_CODEGEN=`$PKG_CONFIG --variable=gdbus_codegen gio-2.0`
AC_SUBST(GDBUS_CODEGEN)

887
####################################################################
888
# Should we build GLib based unit tests
889 890 891
####################################################################

AC_ARG_ENABLE(unit_tests,
892
              AS_HELP_STRING([--enable-unit-tests],
893 894
                             [enable unit tests [[default=yes]]]),
              [enable_unit_tests=$enableval],
895
              [enable_unit_tests=yes])
896 897

if test "x$enable_unit_tests" != "xno" ; then
898 899 900 901 902 903 904
   have_unit_tests=yes

   AC_DEFINE(HAVE_UNIT_TEST, 1, [Define if we have GLib unit test framework])

   AC_PATH_PROG(gtester, gtester)
   if test -z $gtester; then
      AC_MSG_ERROR([Could not find 'gtester'])
905
   fi
906 907
else
   have_unit_tests=no
908 909 910 911
fi

AM_CONDITIONAL(HAVE_UNIT_TESTS, test "x$have_unit_tests" = "xyes")

912 913 914
##################################################################
# Check for libtracker-common: upower for battery/power support
##################################################################
915

916 917
AC_ARG_ENABLE(upower,
              AS_HELP_STRING([--disable-upower],
918 919
                             [disable UPower support for AC power detection [[default=auto]]]),
              [enable_upower=$enableval],
920
              [enable_upower=auto])
921

922
AS_IF([test "x$enable_upower" != "xno"], [
923 924 925 926
   PKG_CHECK_MODULES(UPOWER,
                     [upower-glib >= $UPOWER_REQUIRED],
                     [have_upower=yes],
                     [have_upower=no])
927

928 929
   TRACKER_MINER_FS_CFLAGS="$TRACKER_MINER_FS_CFLAGS $UPOWER_CFLAGS"
   TRACKER_MINER_FS_LIBS="$TRACKER_MINER_FS_LIBS $UPOWER_LIBS"
930 931
   save_LIBS=$LIBS
   LIBS=$UPOWER_LIBS
932
   AC_CHECK_FUNCS(up_client_get_on_low_battery)
933
   LIBS=$save_LIBS
934

935 936
   if test "x$have_upower" = "xyes"; then
      AC_DEFINE(HAVE_UPOWER, [], [Define if we have UPOWER])
937
   fi
938
], [
939
   have_upower="no  (disabled)"
940
])
Richard Hughes's avatar
Richard Hughes committed
941

942 943
if test "x$enable_upower" = "xyes"; then
   if test "x$have_upower" != "xyes"; then
944
      AC_MSG_ERROR([Could not find upower >= $UPOWER_REQUIRED.])
Richard Hughes's avatar
Richard Hughes committed
945 946 947
   fi
fi

948
AM_CONDITIONAL(HAVE_UPOWER, test "x$have_upower" = "xyes")
Richard Hughes's avatar
Richard Hughes committed
949

950
##################################################################
951
# Check for libtracker-common: hal for battery/power support (old)
952 953 954
##################################################################

AC_ARG_ENABLE(hal,
955
              AS_HELP_STRING([--disable-hal],
956 957
                             [disable HAL support for AC power detection [[default=auto]]]),
              [enable_hal=$enableval],
958
              [enable_hal=auto])
959

960
if test "x$have_upower" != "xyes" && test "x$enable_hal" != "xno"; then
961
   PKG_CHECK_MODULES(HAL,
962 963
                     [dbus-1      >= $DBUS_REQUIRED
                      hal         >= $HAL_REQUIRED],
964 965
                     [have_hal=yes] ,
                     [have_hal=no])
966

967 968
   TRACKER_MINER_FS_CFLAGS="$TRACKER_MINER_FS_CFLAGS $HAL_CFLAGS"
   TRACKER_MINER_FS_LIBS="$TRACKER_MINER_FS_LIBS $HAL_LIBS"
969 970 971 972 973 974 975 976 977

   if test "x$have_hal" = "xyes"; then
      AC_DEFINE(HAVE_HAL, [], [Define if we have HAL])
   fi
else
   have_hal="no  (disabled)"
fi

if test "x$enable_hal" = "xyes"; then
978 979
   if test "x$have_upower" = "xyes"; then
      AC_MSG_ERROR([Only one of UPower and HAL can be used.])
980
   elif test "x$have_hal" != "xyes"; then
981
      AC_MSG_ERROR([Could not find hal >= $HAL_REQUIRED.])
982 983 984 985 986
   fi
fi

AM_CONDITIONAL(HAVE_HAL, test "x$have_hal" = "xyes")

987
##################################################################
988 989 990 991 992
# Check for libtracker-data and libtracker-fts: Unicode support
#
# By default, AUTO with this order of preference:
#  1)  libunistring
#  2)  libicu
993 994
##################################################################

995 996
# Check for libunistring...
AC_CHECK_HEADER(uniwbrk.h,
997 998 999 1000
                AC_CHECK_LIB([unistring],
                             [u8_wordbreaks],
                             [have_libunistring=yes],
                             [have_libunistring=no]))
1001 1002
LIBUNISTRING_CFLAGS=""
LIBUNISTRING_LIBS="-lunistring"
1003

1004 1005
# Check for libicu...
PKG_CHECK_MODULES(LIBICU,
1006
                  [icu-i18n >= $LIBICU_REQUIRED icu-uc >= $LIBICU_REQUIRED],
1007 1008
                  [have_libicu=yes],
                  [have_libicu=no])
1009

1010 1011 1012
# Configure option
AC_ARG_WITH([unicode-support],
            AS_HELP_STRING([--with-unicode-support],
1013 1014
                           [Unicode support library? (libunistring|libicu) [[default=auto]]]),
            [with_unicode_support=$withval],
1015 1016 1017 1018
            [with_unicode_support=auto])

# If auto, decide ourselves
if test "x$with_unicode_support" = "xauto"; then
1019 1020
   if test "x$have_libicu" = "xyes"; then
      with_unicode_support=libicu
1021
   else
1022 1023
      if test "x$have_libunistring" = "xyes"; then
         with_unicode_support=libunistring
1024
      else
1025
         AC_MSG_ERROR([Could not find either libunistring or libicu])
1026
      fi
1027 1028 1029
   fi
fi

1030 1031
UNICODE_SUPPORT_CFLAGS=
UNICODE_SUPPORT_LIBS=
1032

1033 1034 1035 1036 1037 1038 1039 1040
case "x$with_unicode_support" in
     # Use libunistring
     "xlibunistring")
        UNICODE_SUPPORT_CFLAGS=$LIBUNISTRING_CFLAGS
        UNICODE_SUPPORT_LIBS=$LIBUNISTRING_LIBS
        if test "x$have_libunistring" = "xyes"; then
           AC_DEFINE(HAVE_LIBUNISTRING, [1], [libunistring Unicode support library])
        else
1041
           AC_MSG_ERROR([Could not find libunistring])
1042 1043 1044 1045 1046 1047 1048 1049 1050
        fi
     ;;
     # Use libicu
     "xlibicu")
        UNICODE_SUPPORT_CFLAGS=$LIBICU_CFLAGS
        UNICODE_SUPPORT_LIBS=$LIBICU_LIBS
        if test "x$have_libicu" = "xyes"; then
          AC_DEFINE(HAVE_LIBICU, [1], [libicu Unicode support library])
        else
1051
          AC_MSG_ERROR([Could not find libicu])
1052 1053 1054 1055 1056
        fi
     ;;
     # Invalid option value
     *) AC_MSG_ERROR([Wrong value for --with-unicode-support: $with_unicode_support]) ;;
esac
1057

1058 1059
AM_CONDITIONAL(HAVE_LIBICU, test "x$have_libicu" = "xyes")

1060 1061 1062 1063
# Add to libtracker-common
LIBTRACKER_COMMON_CFLAGS="$LIBTRACKER_COMMON_CFLAGS $UNICODE_SUPPORT_CFLAGS"
LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS $UNICODE_SUPPORT_LIBS"

1064 1065 1066
# Add to libtracker-fts
LIBTRACKER_FTS_CFLAGS="$LIBTRACKER_FTS_CFLAGS $UNICODE_SUPPORT_CFLAGS"
LIBTRACKER_FTS_LIBS="$LIBTRACKER_FTS_LIBS $UNICODE_SUPPORT_LIBS"
1067

1068 1069 1070
# Add to libtracker-data
LIBTRACKER_DATA_CFLAGS="$LIBTRACKER_DATA_CFLAGS $UNICODE_SUPPORT_CFLAGS"
LIBTRACKER_DATA_LIBS="$LIBTRACKER_DATA_LIBS $UNICODE_SUPPORT_LIBS"
1071

1072 1073 1074 1075
# Add to libtracker-extract
LIBTRACKER_EXTRACT_CFLAGS="$LIBTRACKER_EXTRACT_CFLAGS $UNICODE_SUPPORT_CFLAGS"
LIBTRACKER_EXTRACT_LIBS="$LIBTRACKER_EXTRACT_LIBS $UNICODE_SUPPORT_LIBS"

1076 1077
AM_CONDITIONAL(BUILD_LIBUNISTRING_PARSER, test "x$with_unicode_support" = "xlibunistring")
AM_CONDITIONAL(BUILD_LIBICU_PARSER, test "x$with_unicode_support" = "xlibicu")
1078 1079

##################################################################
1080
# Check for libtracker-miner: network-manager for web miners
1081 1082
##################################################################

1083 1084
AC_ARG_ENABLE(network_manager,
              AS_HELP_STRING([--enable-network-manager],
1085 1086
                             [enable NetworkManager support to detect network status [[default=auto]]]),
              [enable_network_manager=$enableval],
1087
              [enable_network_manager=auto])
1088

1089 1090 1091 1092 1093
if test "x$enable_network_manager" != "xno"; then
   PKG_CHECK_MODULES(NETWORK_MANAGER,
                     [libnm-glib >= $NETWORK_MANAGER_REQUIRED],
                     [have_network_manager=yes],
                     [have_network_manager=no])
1094

1095 1096 1097 1098 1099
   LIBTRACKER_MINER_CFLAGS="$LIBTRACKER_MINER_CFLAGS $NETWORK_MANAGER_CFLAGS"
   LIBTRACKER_MINER_LIBS="$LIBTRACKER_MINER_LIBS $NETWORK_MANAGER_LIBS"

   if test "x$have_network_manager" = "xyes"; then
      AC_DEFINE(HAVE_NETWORK_MANAGER, [], [Define if we have NetworkManager for network status detection])
1100
   fi
1101 1102
fi

1103 1104
if test "x$enable_network_manager" = "xyes"; then
   if test "x$have_network_manager" != "xyes"; then
1105
      AC_MSG_ERROR([Could not find libnm-glib >= $NETWORK_MANAGER_REQUIRED.])
1106
   fi
1107 1108
fi

1109
AM_CONDITIONAL(HAVE_NETWORK_MANAGER, test "x$have_network_manager" = "xyes")