forked from grisbi/grisbi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
488 lines (411 loc) · 14.6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
dnl Process this file with autoconf to produce a configure script.
m4_define(grisbi_major_version, 2)
m4_define(grisbi_minor_version, 1)
m4_define(grisbi_micro_version, 0)
m4_define(grisbi_version, grisbi_major_version.grisbi_minor_version.grisbi_micro_version)
m4_pattern_allow([AM_PROG_AR])
AC_INIT([grisbi],[grisbi_version],[https://www.grisbi.org/mantis/],[grisbi],[https://www.grisbi.org/])
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_AUX_DIR(.)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(.)
AC_DEFINE(GRISBI_MAJOR_VERSION, grisbi_major_version, [grisbi major version])
AC_SUBST(GRISBI_MAJOR_VERSION, grisbi_major_version)
AC_DEFINE(GRISBI_MINOR_VERSION, grisbi_minor_version, [grisbi minor version])
AC_SUBST(GRISBI_MINOR_VERSION, grisbi_minor_version)
AC_DEFINE(GRISBI_MICRO_VERSION, grisbi_micro_version, [grisbi micro version])
AC_SUBST(GRISBI_MICRO_VERSION, grisbi_micro_version)
# Dependencies
GLIB_REQUIRED=2.56
GTK_REQUIRED=3.22
LIBGSF_REQUIRED=1.14
# Optionnel
LIBGOFFICE_REQUIRED=0.10.0
LIBOFX_REQUIRED=0.9
LIBSSL_REQUIRED=1.0.0
LIBXML_REQUIRED=2.5.0
# last commit for package
grisbi_git_hash=GRISBI_GIT_HASH
dnl ================================================================
dnl Standard checks.
dnl ================================================================
AC_PROG_CC
AC_PROG_OBJC
AC_USE_SYSTEM_EXTENSIONS
AC_HEADER_STDC
AM_PROG_AR
dnl needed on osx
AC_PROG_OBJC
dnl Check if we have backtrace support
AC_CHECK_FUNCS(backtrace)
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2 no-dist-gzip])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl Initialize libtool
LT_INIT
LT_LIB_M
dnl GSettings
GLIB_GSETTINGS
dnl GLIB_COMPILE_RESOURCES
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
dnl new warning from ar
AR_FLAGS='cr'
AC_SUBST(AR_FLAGS)
dnl ================================================================
dnl Check for NLS support.
dnl ================================================================
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.40.0])
GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package.])
dnl ================================================================
dnl Main Grisbi libraries
dnl ================================================================
PKG_CHECK_MODULES(ZLIB, [zlib], have_zlib_pc=yes, have_zlib_pc=no)
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBGSF, libgsf-1 >= $LIBGSF_REQUIRED)
if test "$have_zlib_pc" = "no"; then
AC_CHECK_LIB([z],[gzwrite])
AC_SUBST(GRISBI_LIBS)
fi
# $LIBM courtesy of LT_LIB_M
GRISBI_LIBS="$LIBM $GRISBI_LIBS"
dnl ================================================================
dnl Defined if Grisbi is a development version
dnl ================================================================
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],[enable extra debug code]),
[enable_debug=$enableval],[enable_debug=no])
# make DEBUG = 1 for master and odd minor version
if expr ${GRISBI_MINOR_VERSION} % 2 > /dev/null; then
AC_DEFINE(DEBUG,1,[Defined if Grisbi is a developmeent version])
enable_debug=yes
fi
if test "x$enable_debug" = xyes; then
AC_DEFINE(DEBUG,1,[Defined if Grisbi is a developmeent version])
git_hash=`git rev-parse --short HEAD`
if test [ -z "$git_hash"]; then
AC_DEFINE_UNQUOTED(GIT_HASH, ["$grisbi_git_hash"], [git head short hash])
else
AC_DEFINE_UNQUOTED(GIT_HASH, ["$git_hash"], [git head short hash])
fi
fi
AC_ARG_ENABLE(early-debug,
AS_HELP_STRING([--enable-early-debug],[enable early debug code in a file]),
[enable_early_debug=$enableval],[enable_early_debug=no])
if test "x$enable_early_debug" = xyes; then
AC_DEFINE(EARLY_DEBUG,1,[Defined if Grisbi should log to a file])
fi
AM_CONDITIONAL(EARLY_DEBUG, [test "$enable_early_debug" = yes])
dnl ================================================================
dnl Defined if Grisbi use a configuration file instead of gsettings
dnl ================================================================
AC_ARG_ENABLE(config-file,
AS_HELP_STRING([--disable-config-file],[enable config file instead of gsettings (default: enabled]),
[enable_config_file=$enableval],
[enable_config_file=yes])
if test "x$enable_config_file" = xyes; then
AC_DEFINE(USE_CONFIG_FILE,1,[Defined if Grisbi use a configuration file instead of gsettings])
fi
AM_CONDITIONAL(USE_CONFIG_FILE, [test "$enable_config_file" = yes])
dnl ================================================================
dnl XML2
dnl ================================================================
AC_ARG_WITH(libxml2,
AS_HELP_STRING([--with-libxml2],[libxml2 support for the GnuCash plugin (default=auto)]),
[build_libxml2=$withval],
[build_libxml2=auto])
PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.0], have_libxml2=yes, have_libxml2=no)
if test "$build_libxml2" = yes -a "$have_libxml2" = no; then
AC_MSG_ERROR([Libxml2/GnuCash support was requested but libxml2 could not be found.])
fi
if test "$build_libxml2" != no; then
build_libxml2=$have_libxml2
else
build_libxml2=no
fi
if test "$build_libxml2" = yes; then
AC_DEFINE(HAVE_XML2, 1, [Define if libxml2 support is enabled])
fi
AM_CONDITIONAL(HAVE_XML2, [test "$build_libxml2" = yes])
dnl ================================================================
dnl OpenSSL Check
dnl ================================================================
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl],[OpenSSL support for file encryption support (default=auto)]),
[build_openssl=$withval],
[build_openssl=auto])
PKG_CHECK_MODULES(OPENSSL, [libcrypto >= $LIBSSL_REQUIRED], have_openssl=yes, have_openssl=no)
if test "$build_openssl" = yes -a "$have_openssl" = no; then
AC_MSG_ERROR([OpenSSL support was requested but libssl could not be found.])
fi
if test "$build_openssl" != no; then
build_openssl=$have_openssl
else
build_openssl=no
fi
if test "$build_openssl" = yes; then
AC_DEFINE(HAVE_SSL, 1, [Define if OpenSSL support is enabled])
fi
AM_CONDITIONAL(HAVE_SSL, [test "$build_openssl" = yes])
dnl ================================================================
dnl Check for cunit
dnl ================================================================
AC_ARG_WITH(cunit,
AS_HELP_STRING([--with-cunit],[CUnit support for unit tests (default=no)]),
[build_cunit=$withval],
[build_cunit=no])
AC_CHECK_HEADER([CUnit/Basic.h], have_cunit=yes, have_cunit=no)
if test "$build_cunit" = yes -a "$have_cunit" = no; then
AC_MSG_ERROR([CUnit support was requested but headers/library could not be found.])
fi
if test "$build_cunit" != no; then
build_cunit=$have_cunit
else
build_cunit=no
fi
if test "$build_cunit" = yes; then
CUNIT_CFLAGS="-DHAVE_CUNIT"
CUNIT_LIBS="-lcunit"
fi
AC_SUBST(CUNIT_CFLAGS)
AC_SUBST(CUNIT_LIBS)
AM_CONDITIONAL(HAVE_CUNIT, [test "$build_cunit" = yes])
dnl ================================================================
dnl Check for libofx
dnl ================================================================
AC_ARG_WITH(ofx,
AS_HELP_STRING([--with-ofx],[build grisbi with ofx support (default=auto)]),
[build_ofx=$withval],
[build_ofx=auto])
PKG_CHECK_MODULES(LIBOFX, [libofx >= $LIBOFX_REQUIRED], have_ofx=yes, have_ofx=no)
if test "$build_ofx" = yes -a "$with_ofx" = no; then
AC_MSG_ERROR([Ofx support was requested but libofx could not be found.])
fi
if test "$build_ofx" != no; then
build_ofx=$have_ofx
else
build_ofx=no
fi
if test "$build_ofx" = yes; then
AC_DEFINE(HAVE_OFX, 1, [Build with ofx support])
fi
AM_CONDITIONAL(HAVE_OFX, [test "$build_ofx" = yes])
dnl ================================================================
dnl Check for libgoffice library
dnl ================================================================
AC_ARG_WITH(goffice,
AS_HELP_STRING([--with-goffice],[GOffice support of graphics (default=auto)]),
[build_goffice=$withval],
[build_goffice=auto])
PKG_CHECK_MODULES(GOFFICE, [libgoffice-0.10 >= $LIBGOFFICE_REQUIRED], have_goffice=yes, have_goffice=no)
if test "$build_goffice" = yes -a "$have_goffice" = no; then
AC_MSG_ERROR([GOffice support was requested but goffice could not be found.])
fi
if test "$build_goffice" != no; then
build_goffice=$have_goffice
else
build_goffice=no
fi
if test "$build_goffice" = yes; then
AC_DEFINE(HAVE_GOFFICE, 1, [Define if goffice support is enabled])
fi
AM_CONDITIONAL(HAVE_GOFFICE, [test "$build_goffice" = yes])
dnl ================================================================
dnl WError support
dnl ================================================================
AC_ARG_ENABLE(werror,
[AS_HELP_STRING([--enable-werror],
[Treates warning as errors (default=no)])],,
enable_werror=no)
if test "x$enable_werror" = xyes ; then
if test "x$GCC" = "xyes" ; then
CFLAGS="$CFLAGS -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-parameter"
AC_MSG_WARN([Wall -Wextra and other flags are enabled])
else
AC_MSG_WARN([Wall -Wextra and other flags can be enabled only with gcc])
fi
fi
AC_ARG_ENABLE(real-werror,
[AS_HELP_STRING([--enable-real-werror],
[Treates warning as errors (default=no)])],,
enable_real_werror=no)
if test "x$enable_real_werror" = xyes ; then
CFLAGS="$CFLAGS -Werror"
AC_MSG_WARN([-Werror flag is enabled])
fi
dnl ================================================================
dnl NoOptim support
dnl ================================================================
AC_ARG_ENABLE(nooptim,
[AS_HELP_STRING([--enable-nooptim],
[Outputs a summary of memory usage when grisbi terminates (default=no)])],,
enable_nooptim=no)
if test "x$enable_nooptim" = xyes ; then
CFLAGS="$CFLAGS -O0"
AC_MSG_WARN([-O0 is enabled])
fi
AC_DEFINE_UNQUOTED([GSB_NOOPTIM], [${GSB_NOOPTIM}],
[define to 1 if g_no_optim support is enabled])
AC_SUBST(GSB_NOOPTIM)
dnl ================================================================
dnl basic check for msys2 platform
dnl ================================================================
AC_MSG_CHECKING([for MSYS2 platform])
case $host_os in
*msys* ) MSYS2=yes
AC_MSG_RESULT([MSYS2])
platform_win=yes
;;
*mingw32* ) MINGW32=yes
AC_MSG_RESULT([MINGW32])
platform_win=yes
;;
*)
platform_win=no
AC_MSG_RESULT([$platform_win])
;;
esac
if test "$platform_win" = "yes"; then
NSIS_BITS=64bit
NSIS_DEFAULTINSTDIR="Program Files"
if test "$MSYSTEM"x == "MINGW32"x; then
NSIS_BITS=32bit;
NSIS_DEFAULTINSTDIR="Program Files (x86)"
fi
NSIS_SRCDIR=$({ cd ${srcdir} && pwd -W; } | sed 's|/|\\|g')
NSIS_INSTDIR=$({ mkdir -p ${prefix}; cd ${prefix} && pwd -W; }| sed 's|/|\\|g')
AC_SUBST(NSIS_BITS)
AC_SUBST(NSIS_DEFAULTINSTDIR)
AC_SUBST(NSIS_SRCDIR)
AC_SUBST(NSIS_INSTDIR)
if expr ${GRISBI_MINOR_VERSION} % 2 > /dev/null; then
NSIS_DATE=$( date +'-%Y.%m.%d-%H' )
else
NSIS_DATE=""
fi
AC_SUBST(NSIS_DATE)
TOP_SRCDIR_WINBS=$({ cd ${srcdir} && pwd -W; } | sed 's|\\|\\\\|g')
AC_SUBST(TOP_SRCDIR_WINBS)
fi
AM_CONDITIONAL(WIN32, test "$platform_win" = "yes")
dnl ================================================================
dnl check for osx platform
dnl ================================================================
AC_MSG_CHECKING([for Mac OS X platform])
case "$host" in
rhapsody* | darwin[1567].*)
AC_MSG_RESULT([darwin, but too old])
AC_MSG_ERROR([This platform is not supported, please update to latest darwin])
;;
*-*-darwin*)
platform_osx=yes
;;
*)
platform_osx=no
;;
esac
AC_MSG_RESULT([$platform_osx])
AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes")
if test "x$platform_osx" = xyes; then
AC_DEFINE([OS_OSX],[1],[Defined if system is Mac OS X])
dnl check for native osx
gdk_windowing=`$PKG_CONFIG --variable=targets gdk-3.0`
AC_MSG_CHECKING([for GDK-Quartz])
if test "x$gdk_windowing" = xquartz; then
platform=darwin/quartz
AC_MSG_RESULT(yes)
AC_DEFINE(GDK_QUARTZ,[1],[Using GDK Quartz (not X11)])
PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk3, [os_osx=yes], [os_osx=no])
if test "x$os_osx" = xyes; then
AC_DEFINE([GTKOSXAPPLICATION],[1],[Defined if app is GtkOSXApplication])
AC_SUBST(GTK_MAC_LIBS)
AC_SUBST(GTK_MAC_CFLAGS)
fi
else
AC_MSG_RESULT(no)
os_osx=no
fi
else
os_osx=no
fi
dnl ================================================================
dnl french doc
dnl ================================================================
AC_ARG_ENABLE(frenchdoc,
[AS_HELP_STRING([--disable-frenchdoc],
[Install french user documentation (default=yes)])],,
enable_frenchdoc=yes)
AM_CONDITIONAL(FRENCHDOC, test "$enable_frenchdoc" = "yes")
dnl ================================================================
dnl Makefiles
dnl ================================================================
AC_CONFIG_FILES([
Makefile
help/Makefile
help/C/Makefile
help/de/Makefile
help/en/Makefile
help/fr/Makefile
help/fr/image/Makefile
help/fr/image/icon/Makefile
help/fr/image/screenshot/Makefile
pixmaps/Makefile
pixmaps/flags/Makefile
po/Makefile.in
share/Makefile
share/grisbi.nsi
share/categories/Makefile
share/categories/C/Makefile
share/categories/fr/Makefile
share/categories/fr_FR/Makefile
share/categories/de_DE/Makefile
share/categories/de_AT/Makefile
share/categories/it/Makefile
share/categories/ru/Makefile
src/Makefile
src/win-main.rc
src/images/Makefile
src/tests/Makefile
src/plugins/gnucash/Makefile
src/plugins/ofx/Makefile
src/plugins/openssl/Makefile
src/prefs/Makefile
src/widgets/Makefile
src/ui/Makefile
])
AC_OUTPUT
if test "x$enable_werror" = "xyes" ; then
echo "
werror: yes"
fi
echo "
Build with libxml2: $build_libxml2
Build with OpenSSL: $build_openssl
Build with OFX plugin: $build_ofx
Build with goffice: $build_goffice
Build win32: $platform_win
Build gtk_mac_integration: $os_osx
CUnit/unit tests support: $build_cunit
Install french user doc: $enable_frenchdoc
Enable Debug: $enable_debug
Enable Early Debug: $enable_early_debug
Enable Config file: $enable_config_file
Enable fail on error: $enable_real_werror
Enable nooptim: $enable_nooptim
Compiler flags: $CFLAGS
"
if expr ${GRISBI_MINOR_VERSION} % 2 > /dev/null; then
cat << EOF
*** IMPORTANT ***
This is an unstable version of grisbi. It is for test purposes only.
Please, DO NOT use it in a production environment. It will probably crash and you will lose your data.
If you are looking for a stable release of grisbi (1.0.x), either download it from:
http://sourceforge.net/projects/grisbi/files/grisbi%20stable/
Thanks,
The grisbi team
*** END OF WARNING ***
EOF
fi