forked from Gnucash/gnucash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1958 lines (1750 loc) · 66.5 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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
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
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
## -*-m4-*-
dnl Process this file with autoconf to produce a configure script.
# FILE:
# configure.in
#
# FUNCTION:
# implements checks for a variety of system-specific functions
#
# Contents:
# Headers - Autoconf header stuff
# Variables - Hardcoded variables
# Programs - Check for programs binaries
# Functions - Check for functions
# With - Check for --with/without options
# Enable - Check for --enable/disable options
# Libraries - Check for libraries
# Footer - Autoconf footer stuff
# Autoconf initialization
AC_PREREQ(2.60)
AC_INIT([GnuCash], [2.6.99], [[email protected]])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/engine/Transaction.h)
AC_CONFIG_MACRO_DIR([macros])
#Change this in development versions when changing anything that
#affects stored data structures. Reset to zero when bumping version.
GNUCASH_NANO_VERSION=0
#This should be the earliest version in the form XXMMUUNN (XX=MAJOR,
#MM=MINOR, UU=MICRO, NN=NANO) or SVN revision if before 2.4.1 which is
#storage-compatible with the current version. See the comments in
#src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
GNUCASH_RESAVE_VERSION=19920
# Initialize automake -- make sure we have at least version 1.9 Note:
# Automake 1.14 & 1.15 issue a ton of warnings about subdir-objects, which
# will become the default in automake 2.0; unfortunately this option
# is broken and prevents building without passing
# --disable-dependency-tracking to configure, which make-distcheck
# doesn't do. Fixes are in git and expected in Automake-1.16. See
# http://lists.gnu.org/archive/html/automake/2014-04/msg00002.html and
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928 for details.
# In the meantime the best option is to use Automake 1.13 or earlier.
AM_INIT_AUTOMAKE([1.9 dist-bzip2])
# Parse out the version number
GNUCASH_VERSION_STRING=AC_PACKAGE_VERSION
GNUCASH_MAJOR_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\([^.]*\)\.\(.*\)$/\1/' ]`
GNUCASH_MINOR_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\([^.]*\)\.\(.*\)$/\2/' ]`
GNUCASH_MICRO_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\([^.]*\)\.\(.*\)$/\3/' ]`
GNUCASH_LATEST_STABLE_SERIES=$GNUCASH_MAJOR_VERSION.$(($GNUCASH_MINOR_VERSION-($GNUCASH_MINOR_VERSION%2)))
# save any user/environment optimization flags before we muck with them in
# --enable-debug:
USER_OPTIMIZATION=""
for flag in $CFLAGS; do
tmp_flag=`echo $flag | sed -e 's,-O.,,'`
if test -z "$tmp_flag"; then
USER_OPTIMIZATION="$USER_OPTIMIZATION ${flag}"
fi
done
## Do this first, because the other tests depend on it:
# Check for gcc and intltool (somehow breaks the suggested content
# order, doesn't it? Whatever.)
AC_PROG_CC
AM_PROG_CC_C_O
AC_GNU_SOURCE
AC_PROG_INTLTOOL
# Ensure the compiler supports C++ 11:
AX_CXX_COMPILE_STDCXX_11(noext)
AC_PROG_CC_C99
AC_SUBST(GNUCASH_MAJOR_VERSION)
AC_SUBST(GNUCASH_MINOR_VERSION)
AC_SUBST(GNUCASH_MICRO_VERSION)
AC_SUBST(GNUCASH_NANO_VERSION)
AC_SUBST(GNUCASH_LATEST_STABLE_SERIES)
AC_DEFINE_UNQUOTED(GNUCASH_MAJOR_VERSION, $GNUCASH_MAJOR_VERSION,
[GnuCash Major version number])
AC_DEFINE_UNQUOTED(GNUCASH_MINOR_VERSION, $GNUCASH_MINOR_VERSION,
[GnuCash Minor version number])
AC_DEFINE_UNQUOTED(GNUCASH_MICRO_VERSION, $GNUCASH_MICRO_VERSION,
[GnuCash Micro version number])
AC_DEFINE_UNQUOTED(GNUCASH_NANO_VERSION, $GNUCASH_NANO_VERSION,
[GnuCash Nano version number])
AC_DEFINE_UNQUOTED(GNUCASH_RESAVE_VERSION, $GNUCASH_RESAVE_VERSION,
[GnuCash earliest compatible databaseversion number])
AC_DEFINE_UNQUOTED(GNUCASH_LATEST_STABLE_SERIES, "$GNUCASH_LATEST_STABLE_SERIES",
[Most recent stable GnuCash series])
dnl Set of available languages.
TP_LINGUAS="az ca cs da eu fa ja nl rw sk sr sv tr uk zh_CN"
dnl already marked as external at TP:
GC_LINGUAS="ar bg de el en_GB es fi fr gu he hi hu it kn ko lt lv mr nb ne pl pt pt_BR ro ru ta te ur vi zh_TW "
dnl not marked or no TP team:
NEW_LINGUAS="as brx doi es_NI kok kok@latin ks mai mni mni@bengali"
ALL_LINGUAS="$TP_LINGUAS $GC_LINGUAS $NEW_LINGUAS"
GETTEXT_PACKAGE=gnucash
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[GetText version number])
AM_GLIB_GNU_GETTEXT
# Enable only when we have autoconf --version >= 2.59
# on all platforms. Note that AC_PREREQ(2.59) may be
# insufficient to actually use v2.59 on OSX
#AC_CONFIG_MACRO_DIR(macros)
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
dnl clang wants to check file encodings, and we need to tell it not to
dnl because of the unicode currency symbols. But older versions of GCC
dnl don't like the warning suppression option, so we need to set it only
dnl with clang.
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[ac_cv_CLANG=yes], [ac_cv_CLANG=no])
AC_MSG_RESULT([$ac_cv_CLANG])
AM_CONDITIONAL([CLANG], [test "x$ac_cv_CLANG" = "xyes"])
###--------------------------------------------------------
### Begin C++ dependencies
###--------------------------------------------------------
AX_BOOST_BASE([1.53.0], [ac_cv_BOOST=yes], [ac_cv_BOOST=no])
if test x$ac_cv_BOOST != xyes; then
AC_MSG_ERROR([Boost 1.53.0 or later was not found and is required to build GnuCash])
fi
###--------------------------------------------------------
### Optionally enable gtkmm plugin (requires c++ compiler)
###--------------------------------------------------------
enable_GTKMM=false
AC_ARG_ENABLE(gtkmm,
[AS_HELP_STRING([--enable-gtkmm],[enable gtkmm gui])],
[case "${enableval}" in
yes) enable_GTKMM=true ;;
no) enable_GTKMM=false ;;
*) enable_GTKMM=false ;;
esac]
)
AS_IF([test x${enable_GTKMM} = "xtrue"],
[
# We require gtkmm, of course
PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.24)
# and also the c++ compiler
AC_PROG_CXXCPP
AC_PROG_CXX
_COMPONENTS="$_COMPONENTS gtkmm"
])
AM_CONDITIONAL([WITH_GTKMM], [test x${enable_GTKMM} = "xtrue"])
# This section must come before AC_PROG_LIBTOOL because libtool
# must know about the c++ compiler.
###--------------------------------------------------------
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_ISC_POSIX
AC_C_BIGENDIAN
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h sys/wait.h pow.h)
oldcflags="$CFLAGS"
CFLAGS=
AC_LANG_PUSH([C++])
oldcxxflags="$CXXFLAGS"
CXXFLAGS="-Werror -std=c++11 $BOOST_CPPFLAGS"
AC_MSG_CHECKING([boost/date_time/local_time/custom_time_zone.hpp])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#include <boost/date_time/local_time/local_time.hpp>
using duration = boost::posix_time::time_duration;
using time_zone = boost::local_time::custom_time_zone;
using dst_offsets = boost::local_time::dst_adjustment_offsets;
using TZ_Ptr = boost::local_time::time_zone_ptr;
using time_zone_names = boost::local_time::time_zone_names;
struct TTInfo
{
int32_t gmtoff;
uint8_t isdst;
uint8_t abbrind;
};
struct TZInfo
{
TTInfo info;
std::string name;
bool isstd;
bool isgmt;
};
static TZ_Ptr
zone_no_dst(int year, TZInfo *std_info)
{
time_zone_names names(std_info->name, std_info->name, "", "");
duration std_off(0, 0, std_info->info.gmtoff);
dst_offsets offsets({0, 0, 0}, {0, 0, 0}, {0, 0, 0});
boost::local_time::dst_calc_rule_ptr calc_rule(nullptr);
TZ_Ptr tz(new time_zone(names, std_off, offsets, calc_rule));
return tz;
}
])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([
Boost Header Fails to compile with C++11. To fix this, open
date_time/local_time/custom_time_zone.hpp, perhaps as root,
in your boost include directory (/usr/include/boost in most cases)
and change line 67 to
return (bool) dst_calc_rules_; //if calc_rule is set the tz has dst
])])
CXXFLAGS="$oldcxxflags"
AC_LANG_POP([C++])
oldldflags="$LDFLAGS"
LDFLAGS=
AC_CHECK_FUNCS(stpcpy memcpy timegm towupper)
AC_CHECK_FUNCS(setenv,,[
AC_CHECK_FUNCS(putenv,,[
AC_MSG_ERROR([Must have one of the setenv or putenv functions.])
])
])
CFLAGS="$oldcflags"
LDFLAGS="$oldldflags"
STRUCT_TM_GMTOFF_CHECK
cflags_save=${CFLAGS}
CFLAGS="${CFLAGS} -Wall -Werror"
SCANF_LLD_CHECK
if test x$am_cv_scanf_lld = "xno"; then
SCANF_QD_CHECK
if test x$am_cv_scanf_qd = "xno"; then
SCANF_I64D_CHECK
if test x$am_cv_scanf_i64d = "xno"; then
AC_MSG_ERROR([Cannot continue, no long long conversion support in scanf.])
fi
fi
fi
CFLAGS="${cflags_save}"
# test whether we are building directly from svn/svk/git/bzr
AC_MSG_CHECKING(if building from an scm managed directory)
"$srcdir/util/gnc-vcs-info" -r "$srcdir" >/dev/null 2>&1
if test $? = 0 -o "x${BUILDING_FROM_VCS}" = "xyes" ; then
BUILDING_FROM_VCS=yes
VCS_TYPE=$("$srcdir/util/gnc-vcs-info" -t "$srcdir")
AC_MSG_RESULT($VCS_TYPE)
if test "x${VCS_TYPE}" = "xgit"; then
AC_MSG_CHECKING(git command to use due to detected git repo)
# The windows build uses environment variable $GIT_CMD to invoke git (adding git
# to the PATH in Windows results in a build failure).
# So for platform independence, use GIT_CMD for all
if test -z "${GIT_CMD}" ; then
GIT_CMD=git
fi
AC_MSG_RESULT(${GIT_CMD})
fi
else
AC_MSG_RESULT(no)
BUILDING_FROM_VCS=no
VCS_TYPE=
# Make sure we've got swig-runtime.h and gnc-vcs-info.h
AC_CHECK_FILE(${srcdir}/src/swig-runtime.h, [],
[AC_MSG_ERROR([
It looks like you are NOT building from Subversion, svk, git or bzr
but I cannot find swig-runtime.h. Check your PATH and make sure
we can find gnc-vcs-info in your PATH!
Either that or contact [email protected] because
the tarball you downloaded is broken.
])])
AC_CHECK_FILE(${srcdir}/src/core-utils/gnc-vcs-info.h, [],
[AC_MSG_ERROR([
It looks like you are NOT building from Subversion, svk, git or bzr
but I cannot find gnc-vcs-info.h. Check your PATH and make sure
we can find gnc-vcs-info in your PATH!
Either that or contact [email protected] because
the tarball you downloaded is broken.
])])
fi
AM_CONDITIONAL(BUILDING_FROM_VCS, test "x$BUILDING_FROM_VCS" = "xyes")
AC_SUBST(VCS_TYPE)
AC_SUBST(GIT_CMD)
# Build dir adjustments
AM_CONDITIONAL(GNUCASH_SEPARATE_BUILDDIR, test "x${srcdir}" != "x.")
# Init binreloc
AM_BINRELOC
### --------------------------------------------------------------------------
### Glib checks.
# We require glib >= 2.28, released together with gtk-2.24;
# We first check for other versions due to required C standard and deprecations.
# 2.44 requires C11.
# 2.36 deprecated g_type_init
# 2.32 deprecated some gthread functions
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.36 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0)
])
])
])
])
AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
GLIB_GSETTINGS
# I'm sure we (used to?) require this in various places, so don't remove
# this test unless you've done sufficient code review/testing.
AC_MSG_CHECKING(if unsigned long is at least as big as guint32)
GNC_OLDCFLAGS="$CFLAGS"
GNC_OLDLDFLAGS="$LDFLAGS"
CFLAGS="${CFLAGS} ${GLIB_CFLAGS}"
LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"
AC_TRY_RUN([
#include <glib.h>
int main(int argc, char *argv[]) {
return(!(sizeof(unsigned long) >= sizeof(guint32)));
}
],[
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR(cannot continue, size of unsigned long too small.)
],[
AC_MSG_RESULT(assuming yes)
])
dnl Check for redefinition of typedef GListStore, briefly in GLib 2.44.
dnl Redefinition of typdefs is a C11 feature.
dnl Note that We use gnu99 or gnu11 because strdup is a gnu extension in gcc.
CFLAGS="${CFLAGS} -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <gio/gio.h>
])], [ac_cv_cstd=gnu99], [ac_cv_cstd=gnu11])
CFLAGS="$GNC_OLDCFLAGS"
LDFLAGS="$GNC_OLDLDFLAGS"
dnl First remove any existing -std= setting from CFLAGS then add the one we want.
CFLAGS=`echo ${CFLAGS} | sed -E -e "s,-std=[[a-z0-9]]+,,g"`
CFLAGS="${CFLAGS} -std=${ac_cv_cstd}"
# Gnucash replaced dlopen/dlsym by the g_module functions; dlsym
# is needed optionally in one place for BSD linkers, though.
DL_LIB=
AC_CHECK_FUNCS(dlsym,,[
AC_CHECK_LIB(dl, dlsym, DL_LIB="-ldl",[
AC_CHECK_LIB(dld, shl_load, DL_LIB="-ldld",[
AC_CHECK_FUNCS(dlsym, DL_LIB="")
])
])
])
oLIBS="$LIBS"
LIBS="$LIBS $DL_LIB"
AC_CHECK_FUNCS(dlerror,,)
LIBS="$oLIBS"
AC_SUBST(DL_LIB)
##################################################
# OS dependent checks
##################################################
AC_SUBST(SED)
# Set some defaults, they may be overridden below
REGEX_LIBS=""
GCC_VERSION=`${CC} -dumpversion`
AC_MSG_CHECKING(operating system)
#NOUNDEF for use with mingw
NOUNDEF=""
case $host_os 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=darwin
AC_DEFINE(GNC_PLATFORM_OSX, 1,[Running on OSX, either X11 or Quartz])
AC_DEFINE(GNC_PLATFORM_POSIX, 1, [POSIX-compliant OS])
AC_DEFINE(GNC_PLATFORM_DARWIN, 1, [Darwin-based OS])
AC_MSG_RESULT($platform)
AC_MSG_CHECKING(For GDK-Quartz)
platform=osx
_gdk_tgt=`$PKG_CONFIG --variable=target gdk-2.0`
if test "x$_gdk_tgt" = xquartz; then
platform=darwin/quartz
AC_DEFINE(GNC_PLATFORM_COCOA, 1, [Cocoa/Nexstep/GnuStep framework])
AC_MSG_RESULT(yes)
AC_DEFINE(GDK_QUARTZ,,[Using GDK Quartz (not X11)])
PKG_CHECK_MODULES([GTK_MAC], gtk-mac-integration-gtk2,
[_gtk_mac=yes], [_gtk_mac=no])
if test "x$_gtk_mac" = xyes; then
GTK_MAC_LIBS="${GTK_MAC_LIBS} -lobjc -framework Cocoa"
GTK_MAC_CFLAGS="${GTK_MAC_CFLAGS} -xobjective-c"
if test "`echo ${GCC_VERSION} | cut -d. -f1`" -eq 4; then
if test "`echo ${GCC_VERSION} | cut -d. -f2`" -ge 8; then
# This is gcc >= 4.8.x
GTK_MAC_CFLAGS="${GTK_MAC_CFLAGS} -fobjc-exceptions"
fi
fi
fi
AC_MSG_RESULT(${_gtk_mac})
AC_SUBST(GTK_MAC_LIBS)
AC_SUBST(GTK_MAC_CFLAGS)
else
AC_MSG_RESULT(no)
fi
;;
mingw*|cygwin*)
platform=win32
AC_MSG_RESULT($platform)
AC_DEFINE(GNC_PLATFORM_WINDOWS, 1, [Microsoft Windows OS])
LT_PROG_RC
AC_MSG_CHECKING(for native win32)
case $host_os in
mingw*)
native_win32=yes
AC_MSG_RESULT(yes)
HTMLHELP_LIBS=
AC_MSG_CHECKING(for HtmlHelpW)
saved_LIBS="${LIBS}"
LIBS="${LIBS} -lhtmlhelp"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <windows.h>
#include <htmlhelp.h>]],
[HtmlHelpW(0, (wchar_t*)"", HH_HELP_CONTEXT, 0);])],
[AC_MSG_RESULT(yes)
HTMLHELP_LIBS=-lhtmlhelp
AC_DEFINE(HAVE_HTMLHELPW,1,[System has HtmlHelpW])
], [AC_MSG_RESULT(no)])
LIBS="${saved_LIBS}"
AC_SUBST(HTMLHELP_LIBS)
;;
*)
AC_MSG_RESULT(no)
;;
esac
REGEX_LIBS="-lregex"
# Adjust CFLAGS and LDFLAGS on Windows
CFLAGS="${CFLAGS} -mms-bitfields"
# NOUNDEF will be added to ldflags for the makefiles but not the configures
# This fixes a problem with libtool and gcc 4.8
NOUNDEF="-no-undefined"
LDFLAGS="${LDFLAGS} -mwindows"
;;
*)
platform=linux/other
AC_DEFINE(GNC_PLATFORM_POSIX, 1, [POSIX-compliant OS])
AC_MSG_RESULT($platform)
;;
esac
AC_SUBST(REGEX_LIBS)
AM_CONDITIONAL(PLATFORM_LINUX, test "x$platform" = "xlinux/other")
AM_CONDITIONAL(PLATFORM_OSX, test "x$platform" = "xdarwin")
AM_CONDITIONAL(PLATFORM_OSX_QUARTZ, test "x$platform" = "xdarwin/quartz")
AM_CONDITIONAL(PLATFORM_WIN32, test "x$platform" = "xwin32")
AM_CONDITIONAL(OS_WIN32, test "x$native_win32" = "xyes")
# These are unavailable on windows/mingw32 and X11 isn't desired or
# required for MacOSX Quartz
if test "x$_gdk_tgt" = xquartz;
then
AC_CHECK_HEADERS(glob.h)
else
AC_CHECK_HEADERS(X11/Xlib.h glob.h)
fi
AM_CONDITIONAL(HAVE_X11_XLIB_H, test "x$ac_cv_header_X11_Xlib_h" = "xyes")
AC_CHECK_FUNCS(chown gethostname getppid getuid gettimeofday gmtime_r)
AC_CHECK_FUNCS(gethostid link)
##################################################
### --------------------------------------------------------------------------
### Guile version checks
GUILE_EFFECTIVE_VERSION=0
# - check minimum version
# - determine GUILE_CFLAGS and GUILE_LIBS
AC_ARG_WITH([guile],
AS_HELP_STRING([--with-guile=1.8|2.0|auto],
[which guile version to compile against @<:@default: auto@:>@]),
[],
[with_guile=auto]
)
AS_IF([test "$with_guile" = "2.0"],
[PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0],
[GUILE_EFFECTIVE_VERSION=2.0
AC_PATH_PROG([GUILD], guild)])],
[test "$with_guile" = "1.8"],
[PKG_CHECK_MODULES(GUILE, [guile-1.8 >= 1.8.5],
[GUILE_EFFECTIVE_VERSION=1.8])],
[test "$with_guile" = "auto"],
[PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0],
[GUILE_EFFECTIVE_VERSION=2.0
AC_PATH_PROG([GUILD], guild)],
[PKG_CHECK_MODULES(GUILE, [guile-1.8 >= 1.8.5],
[GUILE_EFFECTIVE_VERSION=1.8],
[GUILE_EFFECTIVE_VERSION=0])
])],
# else
[AC_MSG_ERROR([invalid guile version specified])]
)
AS_IF([test "$GUILE_EFFECTIVE_VERSION" = "0"],
[AC_MSG_ERROR([
guile does not appear to be installed correctly, or is not in the
correct version range. Perhaps you have not installed the guile
development packages? Gnucash requires at least version 1.8.5 to build.
])]
)
AM_CONDITIONAL(GNC_HAVE_GUILE_2, [test "$GUILE_EFFECTIVE_VERSION" = "2.0"])
AC_SUBST(GUILE_EFFECTIVE_VERSION)
AC_SUBST(GUILE, [`pwd`/gnc-guile])
AC_CHECK_HEADERS(ltdl.h,
[],
[AC_MSG_ERROR([ltdl.h not found. Perhaps you need to install
the libtool(-ltdl) development package?])])
### --------------------------------------------------------------------------
### SWIG version checks (only when building from SCM)
#
# In order to build against guile 2 or build the dist we need at least
# version 2.0.10 of SWIG, because that's the first version that supports
# guile 2.
#
# For a guile 1.8 build we accept an older version, but won't allow you
# to build the dist because we need to apply a patch to the swig
# generated files that needs to go into the release tarball. At that
# point we don't know yet which version of guile will be used together
# with that tarball so we have to prepare the tarball for guile 2
# compatibility.
#
if test "${BUILDING_FROM_VCS}" = yes
then
AX_PKG_SWIG(2.0.10, [gnc_have_swig_2_0_10=yes], [gnc_have_swig_2_0_10=no])
if test "${GUILE_EFFECTIVE_VERSION}" = "2.0"
then
if test "${gnc_have_swig_2_0_10}" = no
then
AC_MSG_ERROR([
You are building from ${VCS_TYPE} but swig was not found or too old.
To build gnucash you need at least swig version 2.0.10.
])
fi
else # using guile 1.8
if test "${gnc_have_swig_2_0_10}" = no
then
AX_PKG_SWIG(1.3.31, [],
[AC_MSG_ERROR([
You are building from ${VCS_TYPE} but swig was not found or too old.
To build gnucash with guile 1.8 you need at least swig version 1.3.31.
])])
fi
fi
# If we get here then we have an okay version to build locally.
# Check if we can build dist (which always requires swig 2.0.10)
if test "${gnc_have_swig_2_0_10}" = no
then
AC_MSG_WARN([You don't have SWIG 2.0.10 so you will not be able to "make dist"])
fi
AM_CONDITIONAL([SWIG_DIST_FAIL], test "${gnc_have_swig_2_0_10}" != yes)
else
# When building from tarball, all the prerequisites to build dist are already
# met so make sure it's allowed
AM_CONDITIONAL([SWIG_DIST_FAIL], test yes != yes)
fi
### --------------------------------------------------------------------------
### LIBXML -- GNOME_XML_LIB is defined by GNOME_XML_CHECK
LIBXML2_REQUIRED=2.5.10
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_LIBS)
oLIBS="$LIBS"
LIBS="$LIBS $LIBXML2_LIBS"
# Compile a test program to verify that the xml2 library works.
AC_CHECK_LIB(xml2, xmlElemDump, [:], [
AC_MSG_ERROR([libxml2 is required for GnuCash])
])
LIBS="$oLIBS"
### --------------------------------------------------------------------------
### LIBXSLT
PKG_CHECK_MODULES(LIBXSLT, libxslt)
AC_SUBST(LIBXSLT_CFLAGS)
AC_SUBST(LIBXSLT_LIBS)
# xsltproc is not included in libxslt on all distributions
# so check for it separately
AC_PATH_PROG(XSLTPROC, xsltproc, [""])
if test -z "$XSLTPROC"; then
AC_MSG_ERROR([xsltproc is required to build GnuCash])
fi
### --------------------------------------------------------------------------
### Zlib
ZLIB_LIBS=-lz
AC_SUBST(ZLIB_LIBS)
oLIBS="$LIBS"
LIBS="$LIBS $ZLIB_LIBS"
AC_CHECK_LIB(z, gzopen, [:], [
AC_MSG_ERROR([zlib is required for GnuCash])
])
LIBS="$oLIBS"
### --------------------------------------------------------------------------
### Internal code part which is called "qof"
LIBQOF_LIBRARY_VERSION=1:4:0
AC_SUBST(LIBQOF_LIBRARY_VERSION)
QOF_CFLAGS='-I${top_builddir}/src/libqof/qof -I${top_srcdir}/src/libqof/qof'
QOF_LIBS='${top_builddir}/src/libqof/qof/libgnc-qof.la'
AC_SUBST(QOF_CFLAGS)
AC_SUBST(QOF_LIBS)
### ----------------------
### LIBDBI
AC_ARG_ENABLE(dbi,
[AS_HELP_STRING([--disable-dbi],[don't build with the libdbi backend])],
[case "${enableval}" in
yes) want_dbi=true ;;
no) want_dbi=false ;;
*) want_dbi=false ;;
esac],
[want_dbi=true])
if test x${want_dbi} = xtrue
then
EXTRA_SEARCH_LIBS=""
AC_CHECK_HEADERS(dbi/dbi.h)
if test "x$ac_cv_header_dbi_dbi_h" != xno; then
save_libs=$LIBS
AC_ARG_WITH( dbi-dbd-dir,
[AS_HELP_STRING([--with-dbi-dbd-dir=PATH],[specify location of libdbi drivers @<:@default=${libdir}/dbd@:>@])],
[[GNC_DBD_DIR="$with_dbi_dbd_dir"
EXTRA_SEARCH_LIBS=$GNC_DBD_DIR]],
[[GNC_DBD_DIR=""
# pkg-config is new in libdbi 0.9. Use it if available
# Otherwise fall back to our previous hard coded values
pkg-config --exists dbi
if test $? -eq 0; then
EXTRA_SEARCH_LIBS="$(pkg-config --variable=libdir dbi)/dbd"
else
EXTRA_SEARCH_LIBS="/usr/lib/dbd:/usr/lib64/dbd:${libdir}/dbd:${prefix}/lib/dbd"
fi]]
)
case $host_os in
win32*|mingw*)
LDINC="#include <windows.h>"
LDFUNCARGS=""
LDEXT=dll
;;
*)
LDINC="#include <dlfcn.h>"
LDFUNCARGS=", RTLD_NOW"
LDEXT=so
export LIBS="$lt_cv_dlopen_libs $LIBS"
;;
esac
old_ld_library_path="$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$EXTRA_SEARCH_LIBS"
AC_MSG_NOTICE([Search Path $LD_LIBRARY_PATH])
AC_MSG_CHECKING([Looking for at least one supported DBD module])
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
[[if (!$lt_cv_dlopen("libdbdsqlite3.$LDEXT"$LDFUNCARGS)) return -1;
]])],AC_MSG_RESULT([SQLite3]),
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
[[if (!$lt_cv_dlopen("libdbdmysql.$LDEXT"$LDFUNCARGS)) return -1;
]])],AC_MSG_RESULT([MySql]),
AC_RUN_IFELSE([AC_LANG_PROGRAM([$LDINC],
[[if (!$lt_cv_dlopen("libdbdpgsql.$LDEXT"$LDFUNCARGS)) return -1;
]])],AC_MSG_RESULT([Postgresql]),
AC_MSG_ERROR([
Unable to find any of the supported dbd modules
(libdbdsqlite3, libdbdmysql, or libdbdpgsql) needed to actually use the SQL
backend.
If you do have them installed the problem is either that dlopen cannot
find them or that dlopen itself is not getting linked. Check config.log
to find out which. You can add the option --with-dbi-dbd-dir pointing to
the directory in which they are located.
If you do not actually want to build with libdi add --disable-dbi
to the configure argument list and run it again.
]))))
LIBDBI_LIBS=-ldbi
_COMPONENTS="$_COMPONENTS dbi"
LIBS=$saved_libs
export LD_LIBRARY_PATH="$old_ld_library_path"
else
AC_MSG_ERROR([
Unable to find <dbi/dbi.h>. Either install the libdbi development
package (such as libdbi0-dev), or switch off the database backend of
gnucash by --disable-dbi.
Note: If you install libdbi, you should also install its database
drivers (such as libdbd-sqlite3 libdbd-mysql libdbd-pgsql).
])
fi
fi
AC_SUBST(LIBDBI_LIBS)
AC_SUBST(GNC_DBD_DIR)
AM_CONDITIONAL(CUSTOM_GNC_DBD_DIR, [test x"$GNC_DBD_DIR" != "x"])
AM_CONDITIONAL(WITH_DBI, [test "x$ac_cv_header_dbi_dbi_h" = xyes])
### --------------------------------------------------------------------------
### Variables
### Set up all the initial variable values...
GNC_CONFIGDIR='${sysconfdir}/gnucash'
GNC_DOC_INSTALL_DIR='${docdir}'
GNC_INCLUDE_DIR='${includedir}/gnucash'
GNC_SCM_INSTALL_DIR='${pkgdatadir}/scm'
GNC_SHAREDIR='${pkgdatadir}'
GNC_LIBEXECDIR='${libexecdir}/gnucash'
GNC_ACCOUNTS_DIR='${GNC_SHAREDIR}/accounts'
GNC_CHECKS_DIR='${GNC_SHAREDIR}/checks'
GNC_GTKBUILDER_DIR='${GNC_SHAREDIR}/gtkbuilder'
GNC_UI_DIR='${GNC_SHAREDIR}/ui'
GNC_PIXMAP_DIR='${GNC_SHAREDIR}/pixmaps'
AC_SUBST(GNC_ACCOUNTS_DIR)
AC_SUBST(GNC_CHECKS_DIR)
AC_SUBST(GNC_CONFIGDIR)
AC_SUBST(GNC_DOC_INSTALL_DIR)
AC_SUBST(GNC_GTKBUILDER_DIR)
AC_SUBST(GNC_UI_DIR)
AC_SUBST(GNC_INCLUDE_DIR)
AC_SUBST(GNC_PIXMAP_DIR)
AC_SUBST(GNC_SCM_INSTALL_DIR)
AC_SUBST(GNC_SHAREDIR)
AC_SUBST(GNC_LIBEXECDIR)
AC_ARG_ENABLE( debug,
[AS_HELP_STRING([--enable-debug],[compile with debugging flags set])],
[
if test x$enableval = xyes; then
# remove any optimization flags...
CFLAGS=`echo ${CFLAGS} | sed -e 's,-O.,,g'`
# ...except for those the user wants.
CFLAGS="${CFLAGS} -g ${USER_OPTIMIZATION}"
# Do the same for C++
CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's,-O.,,g'`
CXXFLAGS="${CXXFLAGS} -g ${USER_OPTIMIZATION}"
LDFLAGS="${LDFLAGS} -g"
fi
])
AC_ARG_ENABLE( profile,
[AS_HELP_STRING([--enable-profile],[compile with profiling set])],
if test x$enableval = xyes; then
AM_CFLAGS="${AM_CFLAGS} -pg"
AM_CXXFLAGS="${AM_CXXFLAGS} -pg"
AM_LDFLAGS="${AM_LDFLAGS} -pg"
fi)
###---------------------------------------------------------------------------
### Google Profiler Support: https://code.google.com/p/gperftools/
###---------------------------------------------------------------------------
enable_google_profile=no
AC_ARG_ENABLE( google-profiler,
[AS_HELP_STRING([--enable-google-profiler], [link in Google Performance Tools profiler; allows enabling profiling by setting $CPUPROFILE=/path/to/logfile.])],
[AC_MSG_CHECKING([Google PerfTools Profiler])
AC_CHECK_LIB([profiler], [ProfilerEnable], [enable_google_profile=yes],
[AC_MSG_WARN([Google Profiling Enabled but the library was not found.])])
])
AM_CONDITIONAL(WITH_GOOGLE_PROFILER, [test x$enable_google_profile = xyes])
###---------------------------------------------------------------------------
### Google Test and Mock Support: https://code.google.com/p/googletest/ and
### https://code.google.com/p/googlemock/
### ---------------------------------------------------------------------------
ac_cv_gmock_root=""
ac_cv_gmock_headers=""
ac_cv_gtest_root=""
ac_cv_gtest_headers=""
ac_cv_gtest_libs=""
ac_cv_gmock_libs=""
AC_ARG_ENABLE( google-test,
[AS_HELP_STRING([--disable-google-test], [do not build the Google Test and Google Mock static libraries and enable C++ Unit Tests])],,[enable_google_test=yes])
if test x$enable_google_test != xno; then
AC_CHECK_LIB([gtest_main], [main],
[AC_CHECK_FILES([/usr/src/gmock/gmock-all.cc
/usr/include/gtest/gtest.h
/usr/include/gmock/gmock.h
/usr/src/gmock/src/gmock-all.cc
/usr/src/gtest/src/gtest-all.cc],
[ac_cv_gtest_system_install=yes] [ac_cv_have_gtest_libs=yes],
[ac_cv_gtest_system_install=no])],
[AC_CHECK_FILES([/usr/src/gtest/src/gtest-all.cc
/usr/src/gtest/gtest-main.cc
/usr/src/gmock/src/gmock-all.cc
/usr/include/gtest/gtest.h
/usr/include/gmock/gmock.h],
[ac_cv_gtest_system_install=yes] [ac_cv_have_gtest_libs=no],
[ac_cv_gtest_system_install=no])]
)
fi
if test x$ac_cv_file__usr_include_gmock_gmock_h = xyes -a x$ac_cv_file__usr_include_gtest_gtest_h = xyes; then
if test x$ac_cv_file__usr_src_gmock_src_gmock_all_cc = xyes -a x$ac_cv_file__usr_src_gtest_src_gtest_all_cc = xyes; then
ac_cv_gtest_system_install=yes
elif test "x$ac_cv_have_gtest_libs" = xyes; then
ac_cv_gtest_system_install=yes
else
ac_cv_gtest_system_install=no
fi
fi
AC_ARG_WITH([gtest-root],
[AS_HELP_STRING([--with-gtest-root=PATH], [location of the google test sources])],
[ac_cv_gtest_root="$with_gtest_root"])
AC_ARG_WITH([gtest-headers],
[AS_HELP_STRING([--with-gtest-headers=PATH], [location of the google test header files if not in gtest-root])],
[ac_cv_gtest_headers="$with_gtest_headers"])
AC_ARG_WITH([gmock-root],
[AS_HELP_STRING([--with-gmock-root=PATH], [location of the google mock sources])],
[ac_cv_gmock_root="$with_gmock_root"])
AC_ARG_WITH([gmock-headers],
[AS_HELP_STRING([--with-gmock-headers=PATH], [location of the google test header files if not in gmock-root])],
[ac_cv_gmock_headers="$with_gmock_headers"])
if test x$enable_google_test = xyes; then
AC_MSG_CHECKING([whether Google Test is available])
if test -n "$ac_cv_gtest_root" -a -r "$ac_cv_gtest_root/src/gtest-all.cc"; then
AC_MSG_WARN([Skipped setting ac_cv_gtest_root, value $ac_cv_gtest_root])
else
if test -n "${GTEST_ROOT}" -a -r "${GTEST_ROOT}/src/gtest-all.cc"; then
ac_cv_gtest_root=${GTEST_ROOT}
elif test "x$ac_cv_gtest_system_install" = "xyes"; then
ac_cv_gtest_root="/usr/src/gtest"
else
ac_cv_gtest_root=""
fi
fi
if test -z "$ac_cv_gtest_root" -a -z "$ac_cv_gtest_libs"; then
AC_MSG_RESULT([No gtest-root])
enable_google_test=no
else
if test ! -r "$ac_cv_gtest_root/include/gtest/gtest.h"; then
if test -n "$ac_cv_gtest_headers" -a -r "$ac_cv_gtest_headers/gtest/gtest.h"; then
AC_MSG_WARN([Skipped setting ac_cv_gtest_headers, value $ac_cv_gtest_headers])
else
if test -n "${GTEST_HEADERS}" -a -r "${GTEST_HEADERS}/gtest/gtest.h"; then
ac_cv_gtest_headers=${GTEST_HEADERS}
elif test "x$ac_cv_gtest_system_install" = "xyes"; then
ac_cv_gtest_headers="/usr/include"
else
ac_cv_gtest_headers=""
fi
fi
if test -z "$ac_cv_gtest_headers"; then
AC_MSG_RESULT([No gtest-headers])
enable_google_test=no
fi
else
ac_cv_gtest_headers=$ac_cv_gtest_root/include
fi
fi
if test -n "$ac_cv_gmock_root" -a -r "$ac_cv_gmock_root/gmock-all.cc"; then
ac_cv_gmock_src_path="$ac_cv_gmock_root"
AC_MSG_WARN([Skipped setting ac_cv_gmock_root, value $ac_cv_gmock_root])
elif test -n "$ac_cv_gmock_root" -a -r "$ac_cv_gmock_root/src/gmock-all.cc"; then
ac_cv_gmock_src_path="$ac_cv_gmock_root/src"
AC_MSG_WARN([Skipped setting ac_cv_gmock_root, value $ac_cv_gmock_root])
else
if test -n "${GMOCK_ROOT}" -a -r "${GMOCK_ROOT}/src/gmock-all.cc"; then
ac_cv_gmock_src_path=${GMOCK_ROOT}/src
ac_cv_gmock_root=${GMOCK_ROOT}
elif test "x$ac_cv_gtest_system_install" = "xyes"; then
if test "x$ac_cv_file__usr_src_gmock_src_gmock_all_cc" = xyes; then
ac_cv_gmock_src_path="/usr/src/gmock/src"
elif test "x$ac_cv_file__usr_src_gmock_gmock_all_cc" = xyes; then
ac_cv_gmock_src_path="/usr/src/gmock"
else
ac_cv_gmock_src_path=""
fi
ac_cv_gmock_root="/usr/src/gmock"
else
ac_cv_gmock_root=""
fi
fi
if test -z "$ac_cv_gmock_root"; then
AC_MSG_RESULT([No gmock-root])
enable_google_test=no
else
if test ! -r "$ac_cv_gmock_root/include/gmock/gmock.h"; then
if test -n "$ac_cv_gmock_headers" -a -r "$ac_cv_gmock_headers/gmock/gmock.h"; then
AC_MSG_WARN([Skipped setting ac_cv_gmock_headers, value $ac_cv_gmock_headers])
else
if test -n "${GMOCK_HEADERS}" -a -r "${GMOCK_HEADERS}/gmock/gmock.h"; then
ac_cv_gmock_headers=${GMOCK_HEADERS}
elif test "x$ac_cv_gtest_system_install" = "xyes"; then
ac_cv_gmock_headers="/usr/include"
else
ac_cv_gmock_headers=""
fi
fi
if test -z "$ac_cv_gmock_headers"; then
AC_MSG_RESULT([No gmock-headers])
enable_google_test=no
fi
else
ac_cv_gmock_headers="$ac_cv_gmock_root/include"
fi
fi
if test "x$enable_google_test" = "xyes"; then
AC_MSG_RESULT([Yes])
fi
fi
if test "x$ac_cv_have_gtest_libs" = xyes; then
ac_cv_gtest_libs="-lgtest -lgtest_main"
else