-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
1533 lines (1336 loc) · 47.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
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.59)
AC_INIT([GnuCash], [2.3.15], [[email protected]])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/engine/Transaction.h)
# Initialize automake -- make sure we have at least version 1.9
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 ${tmp_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
AM_GCONF_SOURCE_2
# Override gconf default install locations. The default is to always
# put them into /etc. This change puts them into $(prefix)/etc.
if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
GCONF_SCHEMA_CONFIG_SOURCE="xml::${sysconfdir}/gconf/gconf.xml.defaults"
fi
GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY=`echo $GCONF_SCHEMA_CONFIG_SOURCE | cut -d ':' -f 3`
AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY)
AC_SUBST(GNUCASH_MAJOR_VERSION)
AC_SUBST(GNUCASH_MINOR_VERSION)
AC_SUBST(GNUCASH_MICRO_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_LATEST_STABLE_SERIES, "$GNUCASH_LATEST_STABLE_SERIES",
[Most recent stable GnuCash series])
dnl Set of available languages.
ALL_LINGUAS="bg ca cs da de el en_GB es_NI es eu fa fi fr he hu it ja ko lt lv nb ne nl pl pt_BR pt ro ru rw sk sv ta tr uk vi zh_CN zh_TW"
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
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)
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.])
])
])
STRUCT_TM_GMTOFF_CHECK
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
# test whether we are building directly from SVN/SVK
${srcdir}/util/gnc-svnversion ${srcdir} >/dev/null 2>&1
if test $? = 0 -o "x${BUILDING_FROM_SVN}" = "xyes" ; then
BUILDING_FROM_SVN=yes
# We need at least version 1.3.31 of SWIG because
# that's when SWIG doesn't barf on the "inline" keyword in C headers anymore
AC_PROG_SWIG(1.3.31)
else
BUILDING_FROM_SVN=no
# Make sure we've got swig-runtime.h and gnc-svninfo.h
AC_CHECK_FILE(${srcdir}/src/swig-runtime.h, [],
[AC_MSG_ERROR([
It looks like you are NOT building from Subversion
but I cannot find swig-runtime.h. Check your PATH
and make sure we can find svnversion in your PATH!
Either that or contact [email protected] because
the tarball you downloaded is broken.
])])
AC_CHECK_FILE(${srcdir}/src/gnome-utils/gnc-svninfo.h, [],
[AC_MSG_ERROR([
It looks like you are NOT building from Subversion
but I cannot find gnc-svninfo.h. Check your PATH
and make sure we can find svnversion in your PATH!
Either that or contact [email protected] because
the tarball you downloaded is broken.
])])
fi
AM_CONDITIONAL(BUILDING_FROM_SVN, test "x$BUILDING_FROM_SVN" = "xyes")
# Build dir adjustments
AM_CONDITIONAL(GNUCASH_SEPARATE_BUILDDIR, test "x${srcdir}" != "x.")
# Init binreloc
AM_BINRELOC
### --------------------------------------------------------------------------
### See if we have pkg-config
AC_PATH_PROG(PKG_CONFIG,pkg-config)
if test "x$PKG_CONFIG" = x; then
# @*%&$ Ximian programmers renamed this application
AC_PATH_PROG(PKG_CONFIG,pkgconfig)
if test "x$PKG_CONFIG" = x; then
AC_MSG_ERROR([Could not find the pkg-config (or pkgconfig) program.],)
fi
fi
### --------------------------------------------------------------------------
### Glib checks..
AM_PATH_GLIB_2_0(2.12.0,,AC_MSG_ERROR([
*** GLIB >= 2.12 is required to build Gnucash; please make sure you have the
*** development headers installed. The latest version of GLIB is
*** always available at ftp://ftp.gnome.org/pub/gnome/sources/glib/.]),
gthread gobject gmodule)
AC_MSG_CHECKING([for untested GLIB versions (glib >= 2.13.0)])
if $PKG_CONFIG 'glib-2.0 >= 2.13.0'
then
AC_MSG_RESULT(yes)
HAVE_UNTESTED_GLIB=yes
else
AC_MSG_RESULT(no)
fi
AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
# 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=""
AC_MSG_CHECKING(operating system)
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_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_MSG_RESULT(yes)
AC_DEFINE(GDK_QUARTZ,,[Using GDK Quartz (not X11)])
PKG_CHECK_MODULES([IGE_MAC], ige-mac-integration,
[_ige_mac=yes], [_ige_mac=no])
if test "x$_ige_mac" = xyes; then
IGE_MAC_LIBS="${IGE_MAC_LIBS} -lobjc"
IGE_MAC_CFLAGS="${IGE_MAC_CFLAGS} -xobjective-c"
fi
AC_MSG_RESULT(${_ige_mac})
AC_SUBST(IGE_MAC_LIBS)
AC_SUBST(IGE_MAC_CFLAGS)
else
AC_MSG_RESULT(no)
fi
;;
mingw*|cygwin*)
platform=win32
AC_MSG_RESULT($platform)
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"
LDFLAGS="${LDFLAGS} -no-undefined -mwindows"
;;
*)
platform=linux/other
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 (should this be something other than the Gnome check?)
# If the user has given these values, cache them to override the
# detected values.
if test "x$GUILE_LIBS" != x; then
saved_GUILE_LIBS="$GUILE_LIBS"
fi
if test "x$GUILE_INCS" != x; then
saved_GUILE_INCS="$GUILE_INCS"
fi
GUILE_LIBS=""
GNOME_CHECK_GUILE
if test "x$saved_GUILE_LIBS" != x; then
GUILE_LIBS="$saved_GUILE_LIBS"
fi
if test "x$saved_GUILE_INCS" != x; then
GUILE_INCS="$saved_GUILE_INCS"
fi
AS_SCRUB_INCLUDE(GUILE_INCS)
AC_SUBST(GUILE_LIBS)
AM_GUILE_VERSION_CHECK(1.6.7, , , [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.6.7 to build.
])])
AC_SUBST(GUILE)
AC_DEFINE_UNQUOTED(GNC_GUILE_MAJOR_VERSION, ${guile_major_version},
[Guile Major version number])
AC_DEFINE_UNQUOTED(GNC_GUILE_MINOR_VERSION, ${guile_minor_version},
[Guile Minor version number])
AC_DEFINE_UNQUOTED(GNC_GUILE_MICRO_VERSION, ${guile_micro_version},
[Guile Micro version number])
AM_GUILE_VERSION_CHECK(1.8.0, , [
AC_DEFINE(HAVE_GUILE18,1,[System has guile 1.8 or better])
], )
AS_SCRUB_INCLUDE(CFLAGS)
AC_MSG_CHECKING([for SLIB support])
if ${GUILE} -c "(use-modules (ice-9 slib)) (require 'printf)" > /dev/null 2>&1
then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([
Cannot find SLIB. Are you sure you have it installed?
See http://bugzilla.gnome.org/show_bug.cgi?id=347922
and http://bugzilla.gnome.org/show_bug.cgi?id=483631
])
fi
### Check size of long_long - some guile's are broken.
AC_MSG_CHECKING(if guile long_long is at least as big as gint64)
GNC_OLDCFLAGS="$CFLAGS"
GNC_OLDLDFLAGS="$LDFLAGS"
CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"
AC_TRY_RUN([
#include <glib.h>
#include <libguile/__scm.h>
int main(int argc, char *argv[]) {
return(!(sizeof(long_long) >= sizeof(gint64)));
}
],[
AC_MSG_RESULT(yes)
AC_CHECK_LIB(guile, scm_long_long2num,
AC_DEFINE(GUILE_LONG_LONG_OK,1,is sizeof(long_long) >= sizeof(gint64)))
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(assuming yes)
AC_CHECK_LIB(guile, scm_long_long2num,
AC_DEFINE(GUILE_LONG_LONG_OK,1,is sizeof(long_long) >= sizeof(gint64)))
])
CFLAGS="$GNC_OLDCFLAGS"
LDFLAGS="$GNC_OLDLDFLAGS"
# One of the places this is critical is in gnc_scm_to_gint64 and inverse.
# However, I'm sure we require this elsewhere, 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="${GNOME_CFLAGS} ${GUILE_INCS} ${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)
])
CFLAGS="$GNC_OLDCFLAGS"
LDFLAGS="$GNC_OLDLDFLAGS"
### --------------------------------------------------------------------------
### See if we need guile-www
gnc_have_guile_www=no
AC_MSG_CHECKING([if guile needs our copy of (guile www)])
GUILE_MODULE_AVAILABLE(gnc_have_guile_www,[(www main)])
AM_CONDITIONAL(GNC_HAVE_GUILE_WWW, test "${gnc_have_guile_www}" = yes)
### --------------------------------------------------------------------------
### look for gconf
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= "2.0")
# Look up gconftool-2
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AC_SUBST(GCONFTOOL)
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GCONF_LIBS)
### --------------------------------------------------------------------------
### LIBXML -- GNOME_XML_LIB is defined by GNOME_XML_CHECK
LIBXML2_REQUIRED=2.5.10
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
LIBXML_VERSION=`$PKG_CONFIG --version xml`
AS_SCRUB_INCLUDE(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML_VERSION)
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"
### --------------------------------------------------------------------------
### 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"
### --------------------------------------------------------------------------
### QOF, the Query Object Framework. Check if there is a native version.
dnl XXX: FIXME: RELEASE HACK
dnl This makes sure that we default to using internal QOF for SVN.
dnl Make sure to enable this to be the default for stable releases!
AC_ARG_ENABLE(qof,
[AS_HELP_STRING([--enable-qof],[enable the search for an external QOF library (disabled)])],
[AC_MSG_ERROR([GnuCash has disabled use of external QOF.])
case "${enableval}" in
yes) gnc_enable_qof=true ;;
no) gnc_enable_qof=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-qof) ;;
esac],
[gnc_enable_qof=false])
AC_ARG_WITH(qof, [AS_HELP_STRING([--with-qof=path],[prefix for Query Object Framework - QOF (auto)])],
[gnc_with_qof=$withval], [gnc_with_qof=yes])
AC_ARG_WITH(qt3_wizard_package,
[AS_HELP_STRING([--with-qt3-wizard-package=name],[name of package containing qt3-wizard (aqbanking)])],
[QT3_WIZARD_PACKAGE=$withval], [QT3_WIZARD_PACKAGE=aqbanking])
AC_DEFINE_UNQUOTED([QT3_WIZARD_PACKAGE],["$QT3_WIZARD_PACKAGE"],[Name of package containing qt3-wizard.])
# GnuCash builds without deprecated QOF code so needs latest version.
QOF_REQUIRED=0.6.4
# Can't use external qof until it supports "alternate dirty mode"
QOF_REQUIRED=99.99.99
if test "$gnc_enable_qof" = true ; then
AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED])
if test "$gnc_with_qof" != "yes"; then
QOF=`$PKG_CONFIG --silence-errors --exists '$gnc_with_qof/lib/pkgconfig/qof-1.pc >= $QOF_REQUIRED'`
QOF_LIBS=`$PKG_CONFIG --silence-errors --libs $gnc_with_qof/lib/pkgconfig/qof-1.pc`
QOF_CFLAGS=`$PKG_CONFIG --silence-errors --cflags $gnc_with_qof/lib/pkgconfig/qof-1.pc`
QOF_VERSION=`$PKG_CONFIG --silence-errors --modversion $gnc_with_qof/lib/pkgconfig/qof-1.pc`
QOF_PREFIX=`$PKG_CONFIG --silence-errors --variable=prefix $gnc_with_qof/lib/pkgconfig/qof-1.pc`
QOF_LIB_DIR=`$PKG_CONFIG --silence-errors --variable=libdir $gnc_with_qof/lib/pkgconfig/qof-1.pc`
QOF_XML_DIR=`$PKG_CONFIG --silence-errors --variable=xmldir $gnc_with_qof/lib/pkgconfig/qof-1.pc`
else
QOF=`$PKG_CONFIG --silence-errors --exists 'qof-1 >= $QOF_REQUIRED'`
QOF_LIBS=`$PKG_CONFIG --silence-errors --libs qof-1`
QOF_CFLAGS=`$PKG_CONFIG --silence-errors --cflags qof-1`
QOF_VERSION=`$PKG_CONFIG --silence-errors --modversion qof-1`
QOF_PREFIX=`$PKG_CONFIG --silence-errors --variable=prefix qof-1`
QOF_LIB_DIR=`$PKG_CONFIG --silence-errors --variable=libdir qof-1`
QOF_XML_DIR=`$PKG_CONFIG --silence-errors --variable=xmldir qof-1`
fi
if test x$QOF_XML_DIR = x; then
AC_MSG_RESULT([no, will use internal QOF code])
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_NOTICE([External QOF Disabled. Using Internal QOF Code.])
fi
if test x$QOF_XML_DIR = x; then
QOF_LIB_DIR='${pkglibdir}'
QOF_CFLAGS='-I${top_builddir}/src/libqof/qof -I${top_srcdir}/src/libqof/qof'
QOF_LIBS='${top_builddir}/src/libqof/qof/libgnc-qof.la'
QOF_VERSION="internal"
QOF_PREFIX="internal"
LIBQOF_LIBRARY_VERSION=1:4:0
AC_SUBST(LIBQOF_LIBRARY_VERSION)
AC_DEFINE(HAVE_LIBQOF,,[We will use the internal QOF code])
HAVE_LIBQOF="use_internal"
fi
AM_CONDITIONAL(USE_LIBQOF, [test x$HAVE_LIBQOF != x])
AM_CONDITIONAL(USE_LIBQOF, [test "$HAVE_LIBQOF" = "use_internal"])
AC_SUBST(USE_LIBQOF)
AC_SUBST(QOF_CFLAGS)
AC_SUBST(QOF_LIBS)
AS_SCRUB_INCLUDE(QOF_PREFIX)
AC_SUBST(QOF_PREFIX)
AC_SUBST(QOF_LIB_DIR)
AC_DEFINE(QOF_DISABLE_DEPRECATED,1, [Don't use deprecated qof functions])
### ----------------------
### 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
AC_CHECK_HEADERS(dbi/dbi.h)
if test "x$ac_cv_header_dbi_dbi_h" != xno; then
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",
GNC_DBD_DIR="")
LIBDBI_LIBS=-ldbi
DBI_DIR=dbi
else
AC_MSG_ERROR( Unable to find dbi/dbi.h )
fi
fi
AC_SUBST(LIBDBI_LIBS)
AC_SUBST(DBI_DIR)
AC_SUBST(GNC_DBD_DIR)
AM_CONDITIONAL(CUSTOM_GNC_DBD_DIR, [test x"$GNC_DBD_DIR" != "x"])
### --------------------------------------------------------------------------
### Variables
### Set up all the initial variable values...
GNC_CONFIGDIR='${sysconfdir}/gnucash'
GNC_DOC_INSTALL_DIR='${pkgdatadir}/doc'
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_GLADE_DIR='${GNC_SHAREDIR}/glade'
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_GLADE_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])],
[
# remove any optimization flags...
CFLAGS=`echo ${CFLAGS} | sed -e 's,-O.,,g'`
# ...except for those the user wants.
CFLAGS="${CFLAGS} -g ${USER_OPTIMIZATION}"
LDFLAGS="${LDFLAGS} -g"
AC_DEFINE(DEBUG_MEMORY,1,[Enable debug memory])
AC_DEFINE(DEBUG_MEMORY,0,[Enable debug memory])
])
AC_ARG_ENABLE( profile,
[AS_HELP_STRING([--enable-profile],[compile with profiling set])],
CFLAGS="${CFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg")
AC_ARG_ENABLE( ref-counts-dumps,
[AS_HELP_STRING([--enable-ref-counts-dumps],[compile with ref count dumps])],
AC_DEFINE(DEBUG_REFERENCE_COUNTING,1,[Enable reference count dumps])
AC_DEFINE(DEBUG_REFERENCE_COUNTING,0,[Enable reference count dumps]) )
### --------------------------------------------------------------------------
### OFX
want_ofx=auto
AC_ARG_ENABLE( ofx,
[AS_HELP_STRING([--enable-ofx],[compile with ofx support (needs LibOFX)])],
[ case "$enableval" in
yes) want_ofx=yes ;;
no) want_ofx=no ;;
esac[]dnl
] )
AC_MSG_CHECKING(whether to use OFX)
case "${want_ofx}" in
yes) AC_MSG_RESULT(yes -- failure is fatal) ;;
no) AC_MSG_RESULT(no) ;;
auto) AC_MSG_RESULT(yes -- automatic test) ;;
esac
if test x${want_ofx} != xno ;
then
AC_ARG_WITH( ofx-prefix,
[AS_HELP_STRING([--with-ofx-prefix=DIR],[specify where to look for libOFX])],
OFXPREFIX="$with_ofx_prefix" )
if test x${OFXPREFIX} != x ; then
LIBOFX_LIBS="-L${OFXPREFIX}/lib"
LIBOFX_CFLAGS="-I${OFXPREFIX}/include"
fi
if test "x${want_ofx}" != xno ; then
# Version number verified. Now check header files.
AC_MSG_CHECKING(for libofx/libofx.h)
AS_SCRUB_INCLUDE(LIBOFX_CFLAGS)
save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LIBOFX_CFLAGS}"
AC_TRY_CPP( [#include <libofx/libofx.h>], AC_MSG_RESULT(yes),
OFXfound=no )
if test x${OFXPREFIX} = x -a x${OFXfound} = no ; then
LIBOFX_LIBS="-L$/usr/local/lib"
LIBOFX_CFLAGS="-I$/usr/local/include"
AS_SCRUB_INCLUDE(LIBOFX_CFLAGS)
CPPFLAGS="${CPPFLAGS} ${LIBOFX_CFLAGS}"
AC_TRY_CPP( [#include <libofx/libofx.h>],
AC_MSG_RESULT([yes (in /usr/local)]),
[ if test "x${want_ofx}" = xyes ; then
AC_MSG_ERROR([cannot find libofx header, needed for OFX support.])
else
AC_MSG_RESULT([cannot find libofx header, needed for OFX support.])
want_ofx=no
fi
] )
fi
if test "x${want_ofx}" != xno ; then
LIBOFX_LIBS="${LIBOFX_LIBS} -lofx"
AC_MSG_CHECKING(for libofx)
save_LIBS="${LIBS}"
LIBS="${LIBS} ${LIBOFX_LIBS}"
AC_TRY_LINK( [#include <libofx/libofx.h>],
[ LibofxContextPtr libofx_context = libofx_get_new_context();
libofx_free_context(libofx_context);
], AC_MSG_RESULT(yes),
[ if test "x${want_ofx}" = xyes ; then
AC_MSG_ERROR([*** Cannot compile test program for libofx library. Please check config.log for the exact error.])
else
AC_MSG_RESULT([*** Cannot compile test program for libofx library. Please check config.log for the exact error.])
want_ofx=no
fi
] )
LIBS="${save_LIBS}"
CPPFLAGS="${save_CPPFLAGS}"
AC_SUBST(LIBOFX_CFLAGS)
AC_SUBST(LIBOFX_LIBS)
fi
fi
fi
if test "x${want_ofx}" != xno ; then
OFX_DIR=ofx
fi
AC_SUBST(OFX_DIR)
### --------------------------------------------------------------------------
### MT940
AC_ARG_ENABLE( mt940,
[AS_HELP_STRING([--enable-mt940],[obsolete, included in --enable-aqbanking])],
if test "x$enableval" != "xno" ; then
AC_MSG_ERROR([--enable-mt940 is obsolete -- all functionality is already included in --enable-aqbanking])
fi)
### --------------------------------------------------------------------------
### AqBanking
AC_ARG_ENABLE( aqbanking,
[AS_HELP_STRING([--enable-aqbanking],[compile with AqBanking support])],
if test "x$enableval" != "xno" ; then
want_aqbanking=yes
fi)
AC_ARG_ENABLE( hbci,
[AS_HELP_STRING([--enable-hbci],[an alias for --enable-aqbanking])],
if test "x$enableval" != "xno" ; then
want_aqbanking=yes
fi)
if test x${want_aqbanking} = xyes ;
then
# Check for Aqbanking library
# aqbanking-1.6.1 was released on 2005-11-04; aqbanking ships with
# a pkg-config file since 1.6.1.
PKG_CHECK_MODULES(AQBANKING, aqbanking >= 3.0.0 gwenhywfar, [AQBANKING_DIR=aqbanking], [
PKG_CHECK_MODULES(AQBANKING, aqbanking >= 1.6.1 aqbanking < 2.9.0 gwenhywfar, [AQBANKING_DIR=hbci], [
AC_MSG_ERROR([Could not find aqbanking > 1.6.0. If you use --enable-aqbanking or --enable-hbci, you *have* to have aqbanking installed!])
])
])
# For libgwenhywfar > 3.99.20, look for its library gwengui-gtk2.
PKG_CHECK_MODULES([GWENGUI_GTK2], [gwengui-gtk2 gwenhywfar], [has_gwengui_gtk2=1], [has_gwengui_gtk2=0])
# also check for ktoblzcheck
AC_CHECK_HEADERS(ktoblzcheck.h)
if test "x$ac_cv_header_ktoblzcheck_h" != xno; then
AQBANKING_LIBS="${AQBANKING_LIBS} -lktoblzcheck"
fi
AS_SCRUB_INCLUDE(AQBANKING_CFLAGS)
AC_SUBST(AQBANKING_LIBS)
AC_SUBST(AQBANKING_CFLAGS)
fi
AC_SUBST(AQBANKING_DIR)
### --------------------------------------------------------------------------
### i18n
# This variable is set by GLIB_WITH_NLS, called through
# AM_GLIB_GNU_GETTEXT above. Usually it is "share", but on some
# platforms it is "lib". Make sure it is set.
if test "x$DATADIRNAME" = "x"; then
DATADIRNAME="share"
AC_SUBST(DATADIRNAME)
fi
dnl check for nl_langinfo(D_FMT) which is missing on FreeBSD
LANGINFO_D_FMT_CHECK
dnl Enable locale-specific tax-related information in the accounts
AC_ARG_ENABLE( locale-specific-tax,
[AS_HELP_STRING([--enable-locale-specific-tax],[enable localized tax categories (experimental)])],
AC_DEFINE(LOCALE_SPECIFIC_TAX,1,Enable the experimental locale-specific tax categories) )
dnl Make sure we have a proper gettext installed
AC_MSG_CHECKING(for a valid gettext/gmsgfmt installation)
if test "$gt_cv_have_gettext" != "yes" || test "x$GMSGFMT" = "x"; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot find Glib Gettext. Maybe you need to install the gettext package?])
else
AC_MSG_RESULT(yes - $GMSGFMT)
fi
# -------------------------------------------------------------------------
# URLs for MySQL and PostgreSQL testing
AC_ARG_WITH(test-mysql-url,
AS_HELP_STRING([--with-test-mysql-url=URL],
[MySQL database URL for testing [default=none]]),
[],[with_test_mysql_url=""])
TEST_MYSQL_URL=$with_test_mysql_url
AC_SUBST(TEST_MYSQL_URL)
AC_ARG_WITH(test-pgsql-url,
AS_HELP_STRING([--with-test-pgsql-url=URL],
[PgSQL database URL for testing [default=none]]),
[],[with_test_pgsql_url=""])
TEST_PGSQL_URL=$with_test_pgsql_url
AC_SUBST(TEST_PGSQL_URL)
### --------------------------------------------------------------------------
### help files
# Used to initialize doc-path.
AC_ARG_WITH( help-prefix,
[AS_HELP_STRING([--with-help-prefix=PATH],[specify where to store the help files])],
GNC_HELPDIR="$with_help_prefix",
GNC_HELPDIR="\${datadir}")
AC_SUBST(GNC_HELPDIR)
### --------------------------------------------------------------------------
### Check for etags
AC_ARG_ENABLE( etags,
[AS_HELP_STRING([--enable-etags],[enable automatic create of TAGS file])],
if test x$enableval = xyes; then
USE_ETAGS=1
fi,
USE_ETAGS=0)
if test x${USE_ETAGS} = x1; then
AC_CHECK_PROG(GNC_ETAGS_FILE, etags, TAGS)
fi
AM_CONDITIONAL(GNC_ETAGS_FILE, test x${GNC_ETAGS_FILE} = xTAGS)
### --------------------------------------------------------------------------
### Check for ctags
AC_ARG_ENABLE( ctags,
[AS_HELP_STRING([--enable-ctags],[enable automatic create of tags file])],
if test x$enableval = xyes; then
USE_CTAGS=1
fi,
USE_CTAGS=0)
if test x${USE_CTAGS} = x1; then
AC_CHECK_PROG(GNC_CTAGS_FILE, ctags, tags)
fi
AM_CONDITIONAL(GNC_CTAGS_FILE, test x${GNC_CTAGS_FILE} = xtags)
### --------------------------------------------------------------------------
### Check for perl
# Check for perl, force version 5
AC_ARG_WITH(perl,
[AS_HELP_STRING([--with-perl=FILE],[which perl executable to use])],
PERL="${with_perl}")
# If the user didn't specify a perl, then go fetch.
if test x"$PERL" = x;
then
AC_PATH_PROG(PERL, perl)
fi
# Make sure Perl was found
if test x"$PERL" = x; then
AC_MSG_ERROR([Cannot find Perl. Try using the --with-perl flag.])
fi
# Make sure it's version 5 or later
if "$PERL" -e 'exit 1 if $] < 5.0'; then
:
else
AC_MSG_ERROR([Found ${PERL} reports version ]
[`${PERL} -e 'print $]'`, need version 5.*])
fi
AC_SUBST(PERL)
### ----------------------------------------------------------------------------
### Check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
AC_DEFUN([BB_ENABLE_DOXYGEN],
[
AC_ARG_ENABLE(doxygen, [AS_HELP_STRING([--enable-doxygen],[enable documentation generation with doxygen (auto)])])
AC_ARG_ENABLE(dot, [AS_HELP_STRING([--enable-dot],[use 'dot' to generate graphs in doxygen (auto)])])
AC_ARG_ENABLE(html-docs, [AS_HELP_STRING([--enable-html-docs],[enable HTML generation with doxygen (yes)])], [], [ enable_html_docs=yes])
AC_ARG_ENABLE(latex-docs, [AS_HELP_STRING([--enable-latex-docs],[enable LaTeX documentation generation with doxygen (no)])], [], [ enable_latex_docs=no])
if test "x$enable_doxygen" = xno; then
enable_doc=no
else
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
if test x$DOXYGEN = x; then
if test "x$enable_doxygen" = xyes; then
AC_MSG_ERROR([could not find doxygen])
fi
enable_doc=no
else
enable_doc=yes
AC_PATH_PROG(DOT, dot, , $PATH)
fi
fi
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
if test x$DOT = x; then
if test "x$enable_dot" = xyes; then
AC_MSG_ERROR([could not find dot])
fi
enable_dot=no
else
enable_dot=yes
fi
AM_CONDITIONAL(ENABLE_DOXYGEN, test x$enable_doc = xtrue)
AC_SUBST(enable_dot)
AC_SUBST(enable_html_docs)
AC_SUBST(enable_latex_docs)
])
# check for doxygen
BB_ENABLE_DOXYGEN
### --------------------------------------------------------------------------
### Libraries
LIBS="$LIBS -lm"
### --------------------------------------------------------------------------
### Whether or not to build the GTK GUI components.
### When disabled, we don't even need to check for them!
### --------------------------------------------------------------------------
AC_ARG_ENABLE(gui,
[AS_HELP_STRING([--disable-gui],[build without the GNOME GUI components of Gnucash])],
[case "${enableval}" in
yes) gnc_build_gui=true ;;
no) gnc_build_gui=false ;;
*) gnc_build_gui=true ;;
esac],
[gnc_build_gui=true])
AM_CONDITIONAL(GNUCASH_ENABLE_GUI, test x${gnc_build_gui} = xtrue)
### --------------------------------------------------------------------------
### GNOME gui components -- built by default, but not if --enable-gui=no
### or --disable-gui is passed to autogen
### --------------------------------------------------------------------------
if test x${gnc_build_gui} = xtrue ;
then
if test x${enable_compile_warnings} = x ;
then
enable_compile_warnings="yes"
fi
GNOME_COMPILE_WARNINGS
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10)
AS_SCRUB_INCLUDE(GTK_CFLAGS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_MSG_CHECKING([for untested GTK versions (gtk > 2.11.0)])
if $PKG_CONFIG 'gtk+-2.0 > 2.11.0'
then
AC_MSG_RESULT(yes)
HAVE_UNTESTED_GTK=yes
fi
AC_MSG_CHECKING([for GTK >= 2.12.0])
if $PKG_CONFIG 'gtk+-2.0 >= 2.12.0'
then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GTK_2_12,1,[System has gtk 2.12.0 or better])
HAVE_GTK_2_12=yes
fi
PKG_CHECK_MODULES(GNOME, libgnomeui-2.0 >= 2.4)
AS_SCRUB_INCLUDE(GNOME_CFLAGS)
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
AC_MSG_CHECKING([for untested GNOME versions (libgnome >= 2.19.0)])
if $PKG_CONFIG 'libgnome-2.0 >= 2.19.0'
then
AC_MSG_RESULT(yes)
HAVE_UNTESTED_GNOME=yes
else
AC_MSG_RESULT(no)