configure.ac 16.4 KB
Newer Older
David King's avatar
David King committed
1
## Copyright (c) 2009, 2010  Openismus GmbH  <http://www.openismus.com/>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##
## This file is part of Glom.
##
## Glom is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 2 of the License,
## or (at your option) any later version.
##
## Glom is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.

Murray Cumming's avatar
1.29.4    
Murray Cumming committed
18
AC_INIT([Glom],[1.29.4],[http://bugzilla.gnome.org/enter_bug.cgi?product=Glom],[glom])
David King's avatar
David King committed
19
AC_PREREQ(2.63)
Murray Cumming's avatar
Murray Cumming committed
20

21
22
AC_CONFIG_SRCDIR([glom/main.cc])
AC_CONFIG_MACRO_DIR([macros])
23
AC_CONFIG_HEADERS([config.h glom/libglom/libglom_config.h])
Murray Cumming's avatar
Murray Cumming committed
24

25
AM_INIT_AUTOMAKE([1.10 -Wno-portability no-define nostdinc tar-ustar])
26
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
27
AM_MAINTAINER_MODE
28
AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
Murray Cumming's avatar
Murray Cumming committed
29
30

AC_PROG_CC
31
AM_PROG_CC_C_O
Murray Cumming's avatar
Murray Cumming committed
32
AC_PROG_CXX
33

34
35
LT_PREREQ([2.2.0])
LT_INIT([disable-static win32-dll])
36
37
38
39

# Used for the install directories for headers.  The same number is used in
# the library name, which must be kept in sync, but variables can't be used
# with that.
40
AC_SUBST([GLOM_ABI_VERSION], [1.30])
41
42
AC_DEFINE_UNQUOTED([GLOM_ABI_VERSION], ["$GLOM_ABI_VERSION"],
		   [Define to the Glom ABI version string.])
Murray Cumming's avatar
Murray Cumming committed
43

44
# Python modules can't be called glom-1.x, so we use underlines.
Murray Cumming's avatar
Murray Cumming committed
45
AC_SUBST([GLOM_ABI_VERSION_UNDERLINED], ["AS_TR_SH([$GLOM_ABI_VERSION])"])
46
AC_DEFINE_UNQUOTED([GLOM_ABI_VERSION_UNDERLINED], ["$GLOM_ABI_VERSION_UNDERLINED"],
47
48
                   [Define to the Glom ABI version with '.' replaced by '_'.])

Murray Cumming's avatar
Murray Cumming committed
49
50
51
52
53
54
55
56
57
58
59
60
61

# libgettext-po changed its API, changing the error handler struct
# from po_error_handler to po_xerror_handler:
AC_CACHE_CHECK([for po_xerror_handler], [glom_cv_has_po_xerror_handler],
       [AC_CHECK_MEMBER([struct po_xerror_handler.xerror],
                        [glom_cv_has_po_xerror_handler=yes],
                        [glom_cv_has_po_xerror_handler=no],
                        [#include <gettext-po.h>])])

AS_IF([test "x$glom_cv_has_po_xerror_handler" = xyes],
  [AC_DEFINE([HAVE_GETTEXTPO_XERROR], [1],
  [Define if libgettextpo provides the new po_xerror_handler struct.])])

62

63
# i18n
64
IT_PROG_INTLTOOL([0.35])
65
66
67
68

AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])

69
70
AC_SUBST([GETTEXT_PACKAGE], [glom])
AC_DEFINE([GETTEXT_PACKAGE], [PACKAGE_TARNAME], [Define to the gettext package name.])
71

72
73
# Linking with libdl isn't needed on various non-Linux platforms,
# eventhough they do provide dlopen(3).
74
AC_CHECK_LIB([dl], [dlopen], AC_SUBST([DL_LIB], ["-ldl"]))
75

76
77
78
AC_MSG_CHECKING([whether to enable Windows specific options])
AS_CASE([$host_os], [mingw*], [glom_host_win32=yes], [glom_host_win32=no])
AC_MSG_RESULT([$glom_host_win32])
Murray Cumming's avatar
Murray Cumming committed
79

80
81
AS_IF([test "x$glom_host_win32" = xyes],
      [AC_CHECK_TOOL([WINDRES], [windres])])
82

83
AM_CONDITIONAL([HOST_WIN32], [test "x$glom_host_win32" = xyes])
84

85
86
AC_ARG_ENABLE([glom-ui],
              [AS_HELP_STRING([--enable-glom-ui],
Murray Cumming's avatar
Murray Cumming committed
87
                              [build the glom UI application instead of just libglom. The command-line utilities are always built. [default=yes]])],
88
89
90
              [glom_enable_ui=$enableval],
              [glom_enable_ui=yes])
AM_CONDITIONAL([GLOM_ENABLE_UI], [test "x$glom_enable_ui" = xyes])
91

92

93
94
95
96
AC_ARG_ENABLE([client-only],
              [AS_HELP_STRING([--enable-client-only],
                              [build without developer mode and self-hosting])],
              [glom_enable_client_only=$enableval],
Murray Cumming's avatar
Murray Cumming committed
97
              [glom_enable_client_only=no])
98

99

100
AM_CONDITIONAL([GLOM_ENABLE_CLIENT_ONLY], [test "x$glom_enable_client_only" = xyes])
101

102
AS_IF([test "x$glom_enable_client_only" = xyes],
Murray Cumming's avatar
Murray Cumming committed
103
         AC_DEFINE([GLOM_ENABLE_CLIENT_ONLY], [1],
104
                 [Define to disable support for self-hosting and developer mode.])])
105

Murray Cumming's avatar
Murray Cumming committed
106
107
108
109
110
111
112
AC_ARG_ENABLE([ui-tests],
              [AS_HELP_STRING([--enable-ui-tests],
                              [Run UI tests during make check. [default=yes]])],
              [glom_enable_ui_tests=$enableval],
              [glom_enable_ui_tests=yes])
AM_CONDITIONAL([GLOM_ENABLE_UI_TESTS], [test "x$glom_enable_ui_tests" = xyes])

Murray Cumming's avatar
Murray Cumming committed
113
114

# SQLite support:
115
AC_ARG_ENABLE([sqlite],
116
117
118
119
120
121
122
              [AS_HELP_STRING([--enable-sqlite],
                              [Allow creation of SQLite databases and opening
                               of documents using SQLite databases. This
                               disables some functionality and is intended
                               only for embedded use.])],
              [glom_enable_sqlite=$enableval],
              [glom_enable_sqlite=no])
123

124
AM_CONDITIONAL([GLOM_ENABLE_SQLITE], [test "x$glom_enable_sqlite" = xyes])
125

126
AS_IF([test "x$glom_enable_sqlite" = xyes],
127
128
      [AC_DEFINE([GLOM_ENABLE_SQLITE], [1],
                 [Whether to enable support for SQLite databases.])])
129

Murray Cumming's avatar
Murray Cumming committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

# MySQL support:
AC_ARG_ENABLE([mysql],
              [AS_HELP_STRING([--disable-mysql],
                              [do not build with support for MySQL databases])],
              [glom_enable_mysql=$enableval],
              [glom_enable_mysql=no])

AM_CONDITIONAL([GLOM_ENABLE_MYSQL], [test "x$glom_enable_mysql" = xyes])

AS_IF([test "x$glom_enable_mysql" = xyes],
      [AC_DEFINE([GLOM_ENABLE_MYSQL], [1],
                 [Whether to enable support for MySQL databases.])])


# PostgreSQL support:
146
AC_ARG_ENABLE([postgresql],
147
148
149
150
              [AS_HELP_STRING([--disable-postgresql],
                              [do not build with support for PostgreSQL databases])],
              [glom_enable_postgresql=$enableval],
              [glom_enable_postgresql=yes])
151

152
AM_CONDITIONAL([GLOM_ENABLE_POSTGRESQL], [test "x$glom_enable_postgresql" = xyes])
153

154
155
156
AS_IF([test "x$glom_enable_postgresql" = xyes],
      [AC_DEFINE([GLOM_ENABLE_POSTGRESQL], [1],
                 [Whether to enable support for PostgreSQL databases.])])
157

Murray Cumming's avatar
Murray Cumming committed
158

159
# Libraries used by libglom:
160
REQUIRED_LIBGLOM_LIBS='giomm-2.4 >= 2.43.1 libxml++-2.6 >= 2.23.1 libxslt >= 1.1.10 pygobject-3.0 >= 2.29.0 libgdamm-5.0 >= 4.99.8 libgda-5.0 >= 5.2.1 libgda-postgres-5.0 libgda-postgres-5.0 libgda-mysql-5.0 libarchive >= 3.0'
161
162

AS_IF([test "x$glom_host_win32" != xyes],
Murray Cumming's avatar
Murray Cumming committed
163
      [REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS libepc-1.0 >= 0.4.0"])
164

165
# Libraries used by Glom:
Murray Cumming's avatar
1.28.1    
Murray Cumming committed
166
REQUIRED_GLOM_LIBS="$REQUIRED_LIBGLOM_LIBS gtkmm-3.0 >= 3.15.2 goocanvasmm-2.0 >= 1.90.8 goocanvas-2.0 >= 2.0.1 evince-view-3.0"
167

168
169
170
171
172
173
# Do not require iso-codes in client-only mode, or on Windows:
# TODO: Package iso-codes for Windows?
AS_IF([test "x$glom_enable_client_only" != xyes && test "x$glom_host_win32" != xyes],
      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS iso-codes"])

# Do not require gtksourceviewmm in client only mode
174
AS_IF([test "x$glom_enable_client_only" != xyes],
Murray Cumming's avatar
1.19.4    
Murray Cumming committed
175
      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtksourceviewmm-3.0 >= 3.0.0"])
176

177
AS_IF([test "x$glom_enable_sqlite" = xyes],
178
      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS libgda-sqlite-5.0"])
179

180
#TODO: Remove this check, because we checked again later anyway,
181
#because we add REQUIRED_LIBGLOM_LIBS to REQUIRED_GLOM_LIBS?
182
183
PKG_CHECK_MODULES([LIBGLOM], [$REQUIRED_LIBGLOM_LIBS])

184
#Disable the checks for UI dependencies if not building the UI:
Murray Cumming's avatar
Murray Cumming committed
185
AS_IF([test "x$glom_enable_ui" = xno],
186
187
188
      [REQUIRED_GLOM_LIBS="$REQUIRED_LIBGLOM_LIBS"])

PKG_CHECK_MODULES([GLOM], [$REQUIRED_GLOM_LIBS])
189

190
191
192
193
194
195
196
MM_PKG_CONFIG_SUBST([GLIB_GENMARSHAL], [--variable=glib_genmarshal glib-2.0])

# Get the location of the ISO-Codes (currencies, languages) files:
MM_PKG_CONFIG_SUBST([ISO_CODES_PREFIX], [--variable=prefix iso-codes])
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX], ["$ISO_CODES_PREFIX"],
                   [Define to the installation prefix of the iso-codes module.])

197
198
# This is used in one test:
PKG_CHECK_MODULES([GDKMM], [gdkmm-3.0 >= 3.4.0])
199

200
201
# Allow use of mm-common macros for the warnings option and for installing developer documentation.
MM_PREREQ([0.9.5])
202
MM_INIT_MODULE([libglom-1.26])
203
204
205
206
207
208

# Copy the mm-common .pl scripts into docs/,
# and use them from there,
# so we can dist them to avoid a tarball-build dependency.
MM_CONFIG_DOCTOOL_DIR([docs/libglom_reference])

209

210
# Evaluate the --enable-warnings=level option.
211
212
213

# We don't use -pedantic with the C sources, to avoid these warnings in eggmarshalers.c:
# "ISO C forbids conversion of object pointer to function pointer type"
214
AC_LANG([C])
215
216
MM_ARG_ENABLE_WARNINGS([GLOM_WFLAGS],
                       [-Wall],
217
                       [-Wall -Wextra -Wformat-security -Wno-missing-field-initializers -DGSEAL_ENABLE],
218
                       [G GDK GDK_PIXBUF CAIRO PANGO GTK GDA])
219
220

# We use  -Wno-long-long because the Python headers use long long (at least in Python 2.7).
221
AC_LANG([C++])
222
223
MM_ARG_ENABLE_WARNINGS([GLOM_WXXFLAGS],
                       [-Wall],
224
                       [-pedantic -Wall -Wextra -Wformat-security -Wno-long-long -Wno-missing-field-initializers -DGSEAL_ENABLE],
225
                       [G GDK GDK_PIXBUF GTK GDA GLIBMM GDKMM CAIROMM PANGOMM GTKMM SIGCXX LIBGDAMM])
226

227
AC_CHECK_FUNCS([strptime])
Murray Cumming's avatar
Murray Cumming committed
228

229
230
231
232
# Get the path to python, to define pyexecdir,
# so we can use pyexec_LTLIBRARIES in the .am files:
AM_PATH_PYTHON

Murray Cumming's avatar
Murray Cumming committed
233
# Get the compiler and linker flags for embedding Python.
234
235
236
237
238
239
# To specify a particular python version you must set an environment variable.
# For instance:
#   export PYTHON=python3.3
# When using jhbuild, note that you will need to do that before starting jhbuild,
# so that jhbuild sets PYTHONPATH correctly.
# 
240
# See http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
241
242
# TODO: Use AX_PYTHON_DEVEL(>= '3.0.0') when we can make the build use the python3 version of boost-python by default.
AX_PYTHON_DEVEL
243

244
# Get the CFLAGS and LIBS for boost::python.
245
# To use a non-default Boost::Python library, for instance to use
246
# the version for Python3, if you already have set, for instance, PYTHON=python3.3,
247
248
249
250
# you'll need to pass something like this to configure to make it
# link to the correct library (Yes, this is tedious).
#   --with-boost-python=boost_python-mt-py33
#
251
252
253
254
# See http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
AX_BOOST_BASE
# See http://www.gnu.org/software/autoconf-archive/ax_boost_python.html
AX_BOOST_PYTHON
255

256
257
258
259
# Check that ax_boost_python.m4 found something.
# It also defines HAVE_BOOST_PYTHON, but only as a C define for 
AS_IF([test -z "$BOOST_PYTHON_LIB"],
  [AC_MSG_ERROR([Cannot find the Boost::Python library.])])
260

261
262
263
264
265
266
267
268
269
AC_ARG_ENABLE([update-mime-database],
              [AS_HELP_STRING([--disable-update-mime-database],
                              [do not run the update-mime-database utility
                               (mainly useful to package maintainers)])],
              [glom_update_mime_database=$enableval],
              [glom_update_mime_database=yes])

AM_CONDITIONAL([UPDATE_MIME_DATABASE], [test "x$glom_update_mime_database" != xno])

Murray Cumming's avatar
Murray Cumming committed
270
271
272

# Locate the directory containing the PostgreSQL utilities, such as the
# postmaster executable, so we can self-host PostgreSQL databases.
273
274
275
276
277
278
279
280
281
AC_ARG_WITH([postgres-utils],
            [AS_HELP_STRING([--with-postgres-utils=DIR],
                            [path to PostgreSQL utilities (overriding pg_config)])],
            [POSTGRES_UTILS_PATH=$withval])

# Path not needed on Windows
AS_IF([test "x$glom_host_win32" != xyes && test "x$glom_enable_client_only" != xyes],
      [AS_CASE([$POSTGRES_UTILS_PATH], [""|no|yes],
[
282
283
284
285
286
  # For instance, this is in libpq-dev in Ubuntu:
  AC_CHECK_PROG([PG_CONFIG], [pg_config], [yes], [no])
  AS_IF([test "$PG_CONFIG" = no],
    [AC_MSG_ERROR([The PostgreSQL pg_config utility was not found. Glom needs this to find the other PostgreSQL utilities.])])

287
288
289
  POSTGRES_UTILS_PATH=`pg_config --bindir 2>&AS_MESSAGE_LOG_FD`
  AS_IF(["$POSTGRES_UTILS_PATH/pg_ctl" --version >/dev/null 2>&AS_MESSAGE_LOG_FD],,
        [AC_MSG_ERROR([[
Murray Cumming's avatar
Murray Cumming committed
290
291
The PostgreSQL utilities could not be found. They are needed for
self-hosting of Glom databases. Please make sure that PostgreSQL
292
293
294
295
296
297
298
299
is installed, and if necessary specify the correct directory
explicitly with the --with-postgres-utils option.
]])])])])
AC_DEFINE_UNQUOTED([POSTGRES_UTILS_PATH], ["$POSTGRES_UTILS_PATH"],
                   [Define to the location of the PostgreSQL utilities.])
AC_DEFINE_UNQUOTED([EXEEXT], ["$EXEEXT"],
                   [Define to the file extension of executables on the target.])

Murray Cumming's avatar
Murray Cumming committed
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318

# Locate the directory containing the MySQL utilities, such as the
# postmaster executable, so we can self-host MySQL databases.
AC_ARG_WITH([mysql-utils],
            [AS_HELP_STRING([--with-mysql-utils=DIR],
                            [path to MySQL utilities.])],
            [MYSQL_UTILS_PATH=$withval])
# Path not needed on Windows
AS_IF([test "x$glom_host_win32" != xyes && test "x$glom_enable_client_only" != xyes],
      [AS_CASE([$MYSQL_UTILS_PATH], [""|no|yes],
[
  # TODO: Check properly instead of hard-coding /usr/bin
  MYSQL_UTILS_PATH="/usr/bin"
])])

AC_DEFINE_UNQUOTED([MYSQL_UTILS_PATH], ["$MYSQL_UTILS_PATH"],
                   [Define to the location of the MySQL utilities.])


319
YELP_HELP_INIT
320

321
322
323
324
325
326
327
MM_ARG_ENABLE_DOCUMENTATION
MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++])
MM_ARG_WITH_TAGFILE_DOC([libsigc++-2.0.tag], [sigc++-2.0])
MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4])
MM_ARG_WITH_TAGFILE_DOC([cairomm-1.0.tag], [cairomm-1.0])
MM_ARG_WITH_TAGFILE_DOC([pangomm-1.4.tag], [pangomm-1.4])

328
AC_ARG_VAR([SPHINX_BUILD], [path to sphinx-build utility])
329
AS_IF([test "x$ENABLE_DOCUMENTATION" != xno],
330
331
332
333
  [AC_PATH_PROG([SPHINX_BUILD], [sphinx-build], [sphinx-build])
   AS_IF([test "x$SPHINX_BUILD" != xsphinx-build],
     [],
     [AC_MSG_ERROR([The documentation build is enabled, but the sphinx-build tool could not be found.])])])
Murray Cumming's avatar
Murray Cumming committed
334

David King's avatar
David King committed
335
336
337
338
339
340
# Check for tar and gzip (used by tar via -z) because we use these when
# creating backups.
# TODO: This lets us provide a path via a configure option, but we just use
# Glib::find_program_in_path(), ignoring that.
# TODO: This should check for GNU tar, as GNU tar features are used during the
# backup process.
341
AC_CHECK_PROG([GLOM_TAR], [tar], [yes], [no])
David King's avatar
David King committed
342
343
AS_IF([test "$GLOM_TAR" = no],
  [AC_MSG_ERROR([tar not found. Glom needs this to create backup files.])])
344
345

AC_CHECK_PROG([GLOM_GZIP], [gzip], [yes], [no])
David King's avatar
David King committed
346
347
AS_IF([test "$GLOM_GZIP" = no],
  [AC_MSG_ERROR([gzip not found. Glom needs this to create backup files.])])
348

349
350
351
352
353
AC_PATH_PROG([GLOM_MSGFMT], [msgfmt], [no])
AS_IF([test "$GLOM_MSGFMT" = no],
  [AC_MSG_ERROR([msgfmt not found. Glom needs this to test exported .po (gettext) files.])])
AC_DEFINE_UNQUOTED([GLOM_MSGFMT], ["$GLOM_MSGFMT"],
                   [Define to the location of the msgfmt gettext utility.])
354
355
356
357
358
359

# Code testing coverage with gcov
AC_MSG_CHECKING(whether to build with gcov testing)
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [Whether to enable gcov testing]),, enable_gcov=no)
			
if test "x$enable_gcov" = "xyes"; then
Murray Cumming's avatar
Murray Cumming committed
360
361
362
  if test "$GCC" = "no"; then
    AC_MSG_ERROR(not compiling with gcc, which is required for gcov testing)
  fi
363

Murray Cumming's avatar
Murray Cumming committed
364
365
366
367
368
  AC_PATH_PROG(GCOV, [gcov], [no])
  if test "x$GCOV" = "xno"; then
    AC_MSG_ERROR([gcov was enabled but gcov was not found.])
  fi
  AC_SUBST(GCOV)
369

370
371
372
373
374
375
376
377
378
379
380
381
  AC_PATH_PROG(LCOV, [lcov], [no])
  if test "x$LCOV" = "xno"; then
    AC_MSG_ERROR([gcov was enabled but lcov was not found.])
  fi
  AC_SUBST(LCOV)

  AC_PATH_PROG(GENHTML, [genhtml], [no])
  if test "x$GENHTML" = "xno"; then
    AC_MSG_ERROR([gcov was enabled but lcov's genhtml was not found.])
  fi
  AC_SUBST(GENHTML)

Murray Cumming's avatar
Murray Cumming committed
382
383
384
385
386
  GCOV_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
  GCOV_LIBS="-lgcov"

  AC_SUBST(GCOV_CFLAGS)
  AC_SUBST(GCOV_LIBS)
387
388
389
390
391
fi

AM_CONDITIONAL(GCOV_ENABLED, test x$enable_gcov = xyes)
AC_MSG_RESULT($enable_gcov)

392
393
394
# GResources
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
395

396
397
398
AC_CONFIG_FILES([Makefile
                 po/Makefile.in
                 glom.desktop.in
David King's avatar
David King committed
399
                 glom/libglom/glom-${GLOM_ABI_VERSION}.pc:glom/libglom/glom.pc.in
400
                 docs/user-guide/Makefile
401
402
403
                 docs/libglom_reference/Makefile
                 docs/libglom_reference/Doxyfile
                 docs/pyglom_reference/Makefile
Murray Cumming's avatar
Murray Cumming committed
404
405
                 docs/pyglom_reference/conf.py
                 docs/pyglom_reference/index.rst
406
                 win32/glom.iss])
407
408

AC_CONFIG_FILES([tests/test_glom_date_in_locales.sh], [chmod u+x tests/test_glom_date_in_locales.sh])
409
AC_CONFIG_FILES([tests/test_glom_date_in_locales_lc_time.sh], [chmod u+x tests/test_glom_date_in_locales_lc_time.sh])
410

411
AC_OUTPUT