-
Notifications
You must be signed in to change notification settings - Fork 32
/
configure.ac
1238 lines (1091 loc) · 34.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_define([abi_version_major], [3])
m4_define([abi_version_minor], [1])
m4_define([abi_version_micro], [0])
m4_define([abi_series], [abi_version_major.abi_version_minor])
m4_define([abi_version], [abi_version_major.abi_version_minor.abi_version_micro])
AC_INIT([abiword],[abi_version],[http://www.abisource.com/])
AC_CANONICAL_HOST
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2 subdir-objects])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
dnl we use AM_MAINTAINER_MODE and enable it to allow to disable it.
dnl very usefull to build in scratchbox where the maintainer mode is used for the PC
dnl build but the embedded build just use pregenerated one (with a different version)
AM_MAINTAINER_MODE([enable])
#
# Dependency requirements
#
#
# versions requested.
#
GTK_VERSION_REQ=3.24.0
GTK_ENCODED_VERSION="GDK_VERSION_3_24"
# This check MUST be done early.
#
# We define EMBEDDED_TARGET to a numerical value so that we can do like
# #if EMBEDDED_TARGET = EMBEDDED_TARGET_POKY
#
# The following have to be defined unconditionally, because we want
# EMBEDDED_TARGET to be undefined if not building for embedded so that we
# can use #ifdef and #ifndef on it (two undefined symbols will return
# true if tested for equality in #if construct)
AC_DEFINE([EMBEDDED_TARGET_GENERIC], [1], [Generic embedded platform])
AC_DEFINE([EMBEDDED_TARGET_POKY], [3], [Poky embedded platform])
AC_ARG_ENABLE([embedded],
[AS_HELP_STRING([--enable-embedded], [=generic|poky, (Gtk+ only), build for embedded platform])],
[
abi_cv_embedded_platform="$enableval"
case "$enableval" in
poky)
abi_cv_embedded_target=EMBEDDED_TARGET_POKY ;;
generic)
abi_cv_embedded_target=EMBEDDED_TARGET_GENERIC ;;
yes)
abi_cv_embedded_target=EMBEDDED_TARGET_GENERIC
abi_cv_embedded_platform="generic" ;;
no)
;;
*)
AC_MSG_ERROR(bad value $enableval for --enable-embedded) ;;
esac
],[
abi_cv_embedded_platform="no"
abi_cv_embedded_target="no"
])
AC_ARG_ENABLE([qt],
[AS_HELP_STRING([--enable-qt], [Build using Qt4])],
[
abi_cv_qt="yes"
],
[
abi_cv_qt="no"
])
#
# setting the deps requirement is done further down
#
# cross platform deps
fribidi_req='fribidi >= 0.10.4'
glib_req='glib-2.0 >= 2.6.0 gthread-2.0 >= 2.6.0 gobject-2.0 >= 2.6.0'
gsf_req='libgsf-1 >= 1.14.26'
wv_req='wv-1.0 >= 1.2.0'
dnl Do NOT get goffice on Qt
dnl It will link Gtk+ 3 but Qt will dlopen Gtk+ 2
dnl This cause kaboom.
if test "x$abi_cv_qt" = "xno"; then
goffice_req='libgoffice-0.10 >= 0.10.12'
fi
xslt_req='libxslt'
xp_pkgs="
${fribidi_req}
${glib_req}
${gsf_req}
${wv_req}
${xslt_req}
"
# optional deps
enchant_req='enchant-2'
gio_req='gio-2.0'
dnl libosso-gsf-1'
# placeholder for accumulated optional deps
opt_pkgs=''
# gtk deps
cairo_req='cairo-pdf cairo-ps pangocairo'
#
gtk_req="gtk+-3.0 >= $GTK_VERSION_REQ gtk+-unix-print-3.0 librsvg-2.0 >= 2.32.0"
dnl cairo-fc is needed but only available on cairo > 1.10
dnl http://bugzilla.abisource.com/show_bug.cgi?id=13265
PKG_CHECK_EXISTS(cairo >= 1.10, [gtk_req="$gtk_req cairo-fc"],[])
gtk_pkgs="
${cairo_req}
${gtk_req}
${goffice_req}
"
# qt5 deps
qt_pkgs="Qt5Gui Qt5Widgets ${cairo_req}"
# cocoa deps
cocoa_pkgs="$enchant_req $cairo_req gmodule-2.0 ${goffice_req}"
# win32 deps
win_pkgs="$enchant_req"
#
# System tests
#
AC_PROG_CC
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
#AC_PROG_OBJC
AC_PROG_INSTALL
# For libtool 1.5.x compatability (AC_PROG_LIBTOOL is deprecated version of LT_INIT)
m4_ifdef([LT_INIT], [LT_INIT([disable-static win32-dll])], [AC_LIBTOOL_WIN32_DLL])
m4_ifdef([LT_INIT], [], [AC_PROG_LIBTOOL])
AC_PROG_LN_S
AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
if test "x$HAVE_PERL" = "xno"; then
AC_MSG_ERROR([*** perl program not found])
fi
AC_MSG_CHECKING([for platform and toolkit])
case ${host_os} in
*darwin*)
PLATFORM="unix"
TOOLKIT="cocoa"
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
;;
*mingw*)
PLATFORM="win"
TOOLKIT="win"
;;
*)
PLATFORM="unix"
if test "x$abi_cv_qt" = "xyes"; then
TOOLKIT="qt"
else
TOOLKIT="gtk"
fi
;;
esac
AC_MSG_RESULT([$PLATFORM / $TOOLKIT])
AC_SUBST([PLATFORM])
AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM", The platform that is compiled for)
AC_SUBST([TOOLKIT])
AC_DEFINE_UNQUOTED(TOOLKIT, "$TOOLKIT", The toolkit that is used)
# Platform-specific tests
function_err='Your operating system or setup seems to be missing one or more required functions'
header_err='Your operating system or setup seems to be missing one or more required header files'
cocoa_funcs='floor mkdir'
unix_funcs='alarm gettimeofday'
win_funcs=
xp_funcs='localeconv strcspn strncasecmp strtoul' # "sqrt" test fails, hmm
funcs=
if test "$PLATFORM" = "cocoa"; then
funcs="$cocoa_funcs $xp_funcs"
elif test "$PLATFORM" = "unix"; then
AC_CHECK_HEADERS([sys/time.h], [], [$header_err])
AC_FUNC_STRTOD
AC_TYPE_UINT32_T
funcs="$unix_funcs $xp_funcs"
elif test "$PLATFORM" = "win"; then
funcs="$win_funcs $xp_funcs"
fi
AC_CHECK_FUNCS([ $funcs ],
[], [
AC_MSG_ERROR([$function_err])
])
#
# Features
#
AC_ARG_ENABLE([default-plugins],
[AS_HELP_STRING([--disable-default-plugins], [do not build any plugins by default])],
[
if test "$enableval" = "no"; then
abi_cv_disable_default_plugins="yes"
fi
])
m4_define([plugin_list], m4_include([m4/plugin-list.m4]))
AC_ARG_ENABLE([plugins],
[AS_HELP_STRING([--enable-plugins], [="foo bar baz", list of plugins to build. Use --disable-plugins to disable plugin loading support, resulting in a smaller binary size. The list of plugins : ]m4_n([plugin_list]))],
[
if test "$enableval" = "no"; then
abi_cv_disable_exports="yes"
abi_cv_disable_default_plugins="yes"
abi_cv_plugins=""
elif test "$enableval" = "yes"; then
# auto-detect which plugins can be built
abi_cv_plugins="auto"
else
# custom plugins list
abi_cv_plugins="$enableval"
fi
])
AC_ARG_ENABLE([builtin-plugins],
[AS_HELP_STRING([--enable-builtin-plugins], [="foo bar baz", list of plugins to link statically])],
[
if test "$enableval" = "no"; then
abi_cv_builtin_plugins=""
elif test "$enableval" = "yes"; then
# just build default plugins
abi_cv_builtin_plugins=""
else
# custom plugins list
abi_cv_builtin_plugins="$enableval"
fi
])
AC_ARG_ENABLE([menubutton],
[AS_HELP_STRING([--enable-menubutton], [(Gtk+ only) menu-button instead of menu-bar])],
[
abi_cv_menubutton="$enableval"
],[
abi_cv_menubutton="no"
])
AC_ARG_ENABLE([print],
[AS_HELP_STRING([--disable-print], [(Gtk+ only) do not include printing support])],
[
abi_cv_print="$enableval"
],[
abi_cv_print="yes"
])
if test "$abi_cv_print" = "yes" &&
test "$TOOLKIT" = "gtk"; then
opt_pkgs="$opt_pkgs"
fi
AC_ARG_ENABLE([spell],
[AS_HELP_STRING([--disable-spell], [(Gtk+ only) do not include spell checking support])],
[
abi_cv_spell="$enableval"
],[
# autodetect
if test "$PLATFORM" = "unix"; then
PKG_CHECK_EXISTS([ $enchant_req ],
[
abi_cv_spell="yes"
], [
abi_cv_spell="no"
])
else
abi_cv_spell="yes"
fi
])
if test "$abi_cv_spell" = "yes"; then
opt_pkgs="$opt_pkgs $enchant_req"
fi
AC_ARG_ENABLE([statusbar],
[AS_HELP_STRING([--disable-statusbar], [(Gtk+ only) do not include status bar])],
[
abi_cv_statusbar="$enableval"
],[
# on by default
abi_cv_statusbar="yes"
])
AC_ARG_ENABLE([emacs-keybinding],
[AS_HELP_STRING([--enable-emacs-keybinding], [Enable the use of emacs-compatible keyboard commands])],
[
abi_cv_emacs_keybinding="$enableval"
], [
abi_cv_emacs_keybinding="yes"
])
AC_ARG_ENABLE([vi-keybinding],
[AS_HELP_STRING([--enable-vi-keybinding], [Enable the use of vi-compatible keyboard commands])],
[
abi_cv_vi_keybinding="$enableval"
], [
abi_cv_vi_keybinding="yes"
])
AC_ARG_ENABLE([clipart],
[AS_HELP_STRING([--enable-clipart], [Install clipart])],
[
abi_cv_clipart="$enableval"
], [
abi_cv_clipart="no"
])
AC_ARG_ENABLE([templates],
[AS_HELP_STRING([--enable-templates], [Install additional templates])],
[
abi_cv_templates="$enableval"
], [
abi_cv_templates="no"
])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debugging functionality, verbose terminal output])],
[
if test "$enableval" = "yes"; then
abi_cv_debug="yes"
fi
], [
abi_cv_debug="no"
])
#
# Optional packages
#
AC_ARG_WITH([gio],
[AS_HELP_STRING([--with-gio], [use GIO library])],
[
abi_cv_gio="$withval"
],[
# use gio if detected
PKG_CHECK_EXISTS([ $gio_req ],
[
abi_cv_gio="yes"
], [
abi_cv_gio="no"
])
])
if test "$abi_cv_gio" = "yes"; then
opt_pkgs="$opt_pkgs $gio_req"
fi
AC_ARG_WITH([darwinports],
[AS_HELP_STRING([--with-darwinports], [(Mac OSX only) add `/opt/local' prefix to CPP/LDFLAGS])],
[
if test "x$withval" != "xno"; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -headerpad_max_install_names -L/opt/local/lib"
fi
])
AC_ARG_WITH([fink],
[AS_HELP_STRING([--with-fink], [(Mac OSX only) add `/sw' prefix to CPP/LDFLAGS])],
[
if test "x$withval" != "xno"; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
fi
])
AC_ARG_WITH([abisdk],
[AS_HELP_STRING([--with-abisdk], [(Mac OSX only) use the AbiSDK])],
[
if test "x$withval" = "x"; then
AC_MSG_ERROR([The AbiSDK path must be specified.])
fi
if test "x$withval" != "xno"; then
PKG_CONFIG=/opt/abi/bin/pkg-config
PKG_CONFIG_PATH=/usr/lib/pkgconfig ; export PKG_CONFIG_PATH
CPPFLAGS="$CPPFLAGS -mmacosx-version-min=10.4 -isysroot $withval -I/opt/abi/include"
LDFLAGS="$LDFLAGS -mmacosx-version-min=10.4 -isysroot $withval -L/opt/abi/lib"
fi
])
redland_req='redland >= 1.0.10 rasqal >= 0.9.17'
AC_ARG_WITH([redland],
[AS_HELP_STRING([--with-redland], [use redland and raptor libraries])],
[
abi_cv_redland="$withval"
],[
# use redland if detected
PKG_CHECK_EXISTS([ $redland_req ],
[
abi_cv_redland="yes"
], [
abi_cv_redland="no"
])
])
if test "$abi_cv_redland" = "yes"; then
opt_pkgs="$opt_pkgs $redland_req"
AC_DEFINE([WITH_REDLAND], [1], [Using redland])
fi
AM_CONDITIONAL([WITH_REDLAND], test "$abi_cv_redland" = "yes")
AM_CONDITIONAL([HAVE_REDLAND], test "$abi_cv_redland" = "yes")
evolution_data_server_req='libebook-1.2 >= 3.6'
AC_ARG_WITH([evolution_data_server],
[AS_HELP_STRING([--with-evolution-data-server], [Use Evolution Data Server to get at contact information])],
[
abi_cv_evolution_data_server="$withval"
],[
# use evolution_data_server if detected
PKG_CHECK_EXISTS([ $evolution_data_server_req ],
[
abi_cv_evolution_data_server="yes"
], [
abi_cv_evolution_data_server="no"
])
])
if test "$abi_cv_evolution_data_server" = "yes"; then
opt_pkgs="$opt_pkgs $evolution_data_server_req"
AC_DEFINE([WITH_EVOLUTION_DATA_SERVER], [1], [Using evolution_data_server])
fi
AM_CONDITIONAL([WITH_EVOLUTION_DATA_SERVER], test "$abi_cv_evolution_data_server" = "yes")
AM_CONDITIONAL([HAVE_EVOLUTION_DATA_SERVER], test "$abi_cv_evolution_data_server" = "yes")
libical_req=' libical >= 0.46 '
AC_ARG_WITH([libical],
[AS_HELP_STRING([--with-libical], [use libical and raptor libraries])],
[
abi_cv_libical="$withval"
],[
# use libical if detected
PKG_CHECK_EXISTS([ $libical_req ],
[
abi_cv_libical="yes"
], [
abi_cv_libical="no"
])
])
if test "$abi_cv_libical" = "yes"; then
opt_pkgs="$opt_pkgs $libical_req"
AC_DEFINE([WITH_LIBICAL], [1], [Using libical])
fi
AM_CONDITIONAL([WITH_LIBICAL], test "$abi_cv_libical" = "yes")
AM_CONDITIONAL([HAVE_LIBICAL], test "$abi_cv_libical" = "yes")
champlain_req=' champlain-gtk-0.12 '
AC_ARG_WITH([champlain],
[AS_HELP_STRING([--with-champlain], [use champlain to display maps])],
,[with_champlain="check"])
if test "$TOOLKIT" = "qt"; then
with_champlain=no
fi
if test "x$with_champlain" != "xno"; then
PKG_CHECK_MODULES(CHAMPLAIN, [ $champlain_req ],,
[if test "x$with_champlain" = "xyes"; then
AC_MSG_FAILURE([--with-champlain was given, but test for champlain failed])
fi])
abi_cv_champlain=yes
if test "$pkg_failed" = "no"; then
#
# try to make sure that champlain-gtk through pkg-config and
# the GTK+ version that the user wants abiword to directly
# link with match on major number.
#
# The test is simple, make sure that a little client using the
# GTK+ that champlain natively uses is using the GTK+ version
# that we want to link with.
#
AC_LANG_PUSH(C++)
CXXFLAGS_cache=$CXXFLAGS
CXXFLAGS=" $CHAMPLAIN_CFLAGS "
LDFLAGS_cache=$LDFLAGS
LDFLAGS=" $CHAMPLAIN_LIBS "
if test "x$abi_cv_gtk2" = "xyes"; then
echo -n "checking whether CHAMPLAIN uses GTK+2... "
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <champlain-gtk/champlain-gtk.h>],[
#if GTK_MAJOR_VERSION > 2
#error bad
#endif
])], gtk_matches=yes, gtk_matches=no)
else
echo -n "checking whether CHAMPLAIN uses GTK+3... "
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <champlain-gtk/champlain-gtk.h>],[
#if GTK_MAJOR_VERSION < 3
#error bad
#endif
])], gtk_matches=yes, gtk_matches=no)
fi
echo "$gtk_matches"
LDFLAGS=$LDFLAGS_cache
CXXFLAGS=$CXXFLAGS_cache
AC_LANG_POP
# Don't do mapping if their libchamplain is not using the right GTK+
if test "$gtk_matches" = "no"; then
if test "x$with_champlain" = "xyes"; then
AC_MSG_FAILURE([--with-champlain was given, but champlain does not use the correct gtk version])
fi
abi_cv_champlain=no
CHAMPLAIN_CFLAGS=
CHAMPLAIN_LIBS=
fi
else
abi_cv_champlain=no
fi
else
abi_cv_champlain=no
fi
if test "$abi_cv_champlain" = "yes"; then
dnl opt_pkgs="$opt_pkgs $champlain_req"
AC_DEFINE([WITH_CHAMPLAIN], [1], [Using champlain])
fi
AC_SUBST([CHAMPLAIN_CFLAGS])
AC_SUBST([CHAMPLAIN_LIBS])
AM_CONDITIONAL([WITH_CHAMPLAIN], test "$abi_cv_champlain" = "yes")
AM_CONDITIONAL([HAVE_CHAMPLAIN], test "$abi_cv_champlain" = "yes")
AC_ARG_WITH([icondir],
[AS_HELP_STRING([--with-icondir=DIR], [install icon in DIR instead of PREFIX/share/icons/THEME/SIZE/apps])],
[
abi_cv_icondir="$withval"
])
if test "$abi_cv_icondir" = "" -o \
"$abi_cv_icondir" = "yes" -o \
"$abi_cv_icondir" = "no"; then
abi_cv_prefix="$prefix"
test "$abi_cv_prefix" = "NONE" && abi_cv_prefix="$ac_default_prefix"
abi_cv_icondir="${abi_cv_prefix}/share/icons"
fi
AC_SUBST(ABIWORD_ICONDIR, "$abi_cv_icondir")
dnl ***********************************************************************
dnl GCC/Clang sanitizer support
dnl ***********************************************************************
AC_ARG_WITH([sanitizer],
[AS_HELP_STRING([--with-sanitizer=@<:@address/undefined/no@:>@],
[Use specific GCC/Clang analyzer])],
[with_sanitizer=$withval],
[with_sanitizer=no])
AS_IF([test "x$with_sanitizer" != "xno"],[
AX_CHECK_COMPILE_FLAG([-fsanitize=$withval],
[CFLAGS="$CFLAGS -fsanitize=$withval"
CXXFLAGS="$CXXFLAGS -fsanitize=$withval"],
[AC_MSG_ERROR([-fsanitize=$withval is not supported])])
AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer])
AC_LANG_PUSH(C++)
AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer])
AC_LANG_POP
])
dnl ***************************************************************
dnl Excessive warnings
dnl ***************************************************************
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option], [
ax_compiler_flags_test="-Werror=unknown-warning-option"
], [
ax_compiler_flags_test=""
])
dnl XXX enable these
dnl -Wformat-nonliteral
AX_APPEND_COMPILE_FLAGS([ \
-Wcast-align \
-Wchar-subscripts \
-Wconst-qual \
-Wextra \
-Wformat \
-Wformat-security \
-Wformat-overflow=2 \
-Wheader-guard \
-Wimplicit-fallthrough=2 \
-Wlogical-not-parentheses \
-Wlogical-op \
-Wmisleading-indentation \
-Wmissing-noreturn \
-Wno-overloaded-virtual \
-Wparentheses-equality \
-Wpointer-arith \
-Wpointer-bool-conversion \
-Wredundant-decls \
-Wshadow \
-Wsign-compare \
-Wsuggest-override \
-Wunreachable-code \
-Wunreachable-code-loop-increment \
-Wunused \
-Wunused-const-variable \
-Wunused-label \
-Wunused-local-typedef \
-Wunused-private-field \
-Wunused-value \
-Wunused-variable \
-Wwrite-strings \
-Wzero-as-null-pointer-constant \
], [], [$ax_compiler_flags_test])
AC_LANG_POP
#
# Dependency tests
#
# We need libpng
for l in libpng libpng16 libpng14 libpng12; do
AC_MSG_CHECKING(for $l)
if $PKG_CONFIG --exists $l ; then
AC_MSG_RESULT(yes)
PKG_CHECK_MODULES(PNG, $l, [abi_cv_png=yes],[abi_cv_png=no])
break
else
AC_MSG_RESULT(no)
fi
done
if test x$abi_cv_png != xyes; then
AC_CHECK_HEADER([png.h], [],
[
AC_MSG_ERROR([`png.h' not found, install libpng or specify CPPFLAGS to include custom locations])
])
PNG_CFLAGS=
PNG_LIBS=-lpng
fi
# We need ljpeg
AC_CHECK_HEADER(jpeglib.h,[
AC_CHECK_LIB(jpeg,jpeg_read_header,
[],
[
AC_MSG_ERROR([libjpeg not found])
])
],[
AC_MSG_ERROR([jpeg.h not found])
])
# TODO need to check for libz too, at least on win32
AC_CHECK_HEADER([zlib.h], [],
[
AC_MSG_ERROR([`zlib.h' not found, install zlib or specify CPPFLAGS to include custom locations])
])
AX_BOOST_BASE([1.40.0],,[AC_MSG_ERROR([`boost' not found.])])
deps_pkgs="$xp_pkgs $opt_pkgs"
SYSTEM_LIBS=
SYSTEM_CFLAGS=
if test "$TOOLKIT" = "win"; then
deps_pkgs="$deps_pkgs $win_pkgs"
# nonstandard dlls go below the blank line
SYSTEM_LIBS="-ladvapi32 -lcomctl32 -lcomdlg32 -lgdi32 -lkernel32 -lole32 -loleaut32 -lshell32 -luser32 -luuid -lversion -lwinspool \
$PNG_LIBS -lz -ljpeg"
SYSTEM_CFLAGS="-mthreads"
elif test "$TOOLKIT" = "cocoa"; then
deps_pkgs="$deps_pkgs $cocoa_pkgs"
SYSTEM_CLFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_11"
SYSTEM_LIBS="-framework Cocoa"
AC_CHECK_PROG([CONVERT], [convert], convert, AC_MSG_ERROR(Cannot find ImageMagick convert))
elif test "$TOOLKIT" = "qt"; then
deps_pkgs="$deps_pkgs $qt_pkgs"
else
SYSTEM_CFLAGS=$PNG_CFLAGS
SYSTEM_LIBS="$PNG_LIBS -ljpeg"
deps_pkgs="$deps_pkgs $gtk_pkgs x11"
fi
PKG_CHECK_MODULES(DEPS,[$deps_pkgs])
if test "$TOOLKIT" = "gtk"; then
DEPS_CFLAGS="$DEPS_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION -DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"
fi
dnl make that for all.
if test "$TOOLKIT" = "gtk" -o "$TOOLKIT" = "qt"; then
dnl move away
AC_DEFINE([WITH_CAIRO], [1], [Using Cairo])
WITH_CAIRO=1
fi
AM_CONDITIONAL([WITH_CAIRO], test "$WITH_CAIRO" = "1")
MOC=moc
if test "$TOOLKIT" = qt; then
MOC=`pkg-config Qt5 --variable=moc`
fi
AC_SUBST([MOC])
AC_SUBST([DEPS_CFLAGS])
DEPS_LIBS="$SYSTEM_LIBS $DEPS_LIBS"
AC_SUBST([DEPS_LIBS])
BASE_CPPFLAGS_='
${DEPS_CFLAGS}
${BOOST_CPPFLAGS}
-I${top_srcdir}
${GOFFICE_BUILTIN_CPPFLAGS}'
BASE_CPPFLAGS="$SYSTEM_CFLAGS"
for f in $(echo $BASE_CPPFLAGS_); do BASE_CPPFLAGS="$BASE_CPPFLAGS $f"; done
AC_SUBST([BASE_CPPFLAGS])
AF_CPPFLAGS_='
${BASE_CPPFLAGS}
-I${top_srcdir}/src/af/ev/${TOOLKIT}
-I${top_srcdir}/src/af/ev/xp
-I${top_srcdir}/src/af/gr/${TOOLKIT}
-I${top_srcdir}/src/af/gr/xp
-I${top_srcdir}/src/af/util/${PLATFORM}
-I${top_srcdir}/src/af/util/xp
-I${top_srcdir}/src/af/xap/${TOOLKIT}
-I${top_srcdir}/src/af/xap/xp'
AF_CPPFLAGS=
for f in $(echo $AF_CPPFLAGS_); do AF_CPPFLAGS="$AF_CPPFLAGS $f"; done
AC_SUBST([AF_CPPFLAGS])
AF_TEST_CPPFLAGS_='
${AF_CPPFLAGS}
-I${top_srcdir}/src/af/tf/xp'
AF_TEST_CPPFLAGS=
for f in $(echo $AF_TEST_CPPFLAGS_); do AF_TEST_CPPFLAGS="$AF_TEST_CPPFLAGS $f"; done
AC_SUBST([AF_TEST_CPPFLAGS])
TEXT_CPPFLAGS_='
${AF_CPPFLAGS}
-I${top_srcdir}/src/text/fmt/${TOOLKIT}
-I${top_srcdir}/src/text/fmt/xp
-I${top_srcdir}/src/text/ptbl/xp'
TEXT_CPPFLAGS=
for f in $(echo $TEXT_CPPFLAGS_); do TEXT_CPPFLAGS="$TEXT_CPPFLAGS $f"; done
AC_SUBST([TEXT_CPPFLAGS])
TEXT_TEST_CPPFLAGS_='
${TEXT_CPPFLAGS}
-I${top_srcdir}/src/af/tf/xp'
TEXT_TEST_CPPFLAGS=
for f in $(echo $TEXT_TEST_CPPFLAGS_); do TEXT_TEST_CPPFLAGS="$TEXT_TEST_CPPFLAGS $f"; done
AC_SUBST([TEXT_TEST_CPPFLAGS])
IMPEXP_CPPFLAGS_='
${TEXT_CPPFLAGS}
-I${top_srcdir}/src/wp/impexp/${TOOLKIT}
-I${top_srcdir}/src/wp/impexp/xp'
IMPEXP_CPPFLAGS=
for f in $(echo $IMPEXP_CPPFLAGS_); do IMPEXP_CPPFLAGS="$IMPEXP_CPPFLAGS $f"; done
AC_SUBST([IMPEXP_CPPFLAGS])
IMPEXP_TEST_CPPFLAGS_='
${IMPEXP_CPPFLAGS}
-I${top_srcdir}/src/af/tf/xp'
IMPEXP_TEST_CPPFLAGS=
for f in $(echo $IMPEXP_TEST_CPPFLAGS_); do IMPEXP_TEST_CPPFLAGS="$IMPEXP_TEST_CPPFLAGS $f"; done
AC_SUBST([IMPEXP_TEST_CPPFLAGS])
WP_CPPFLAGS_='
${IMPEXP_CPPFLAGS}
-I${top_srcdir}/src/wp/ap/${TOOLKIT}
-I${top_srcdir}/src/wp/ap/xp
-I${top_srcdir}/src/plugins'
WP_CPPFLAGS=
for f in $(echo $WP_CPPFLAGS_); do WP_CPPFLAGS="$WP_CPPFLAGS $f"; done
AC_SUBST([WP_CPPFLAGS])
#
# Settings
#
ABIWORD_SERIES="abi_series"
AC_DEFINE_UNQUOTED([ABIWORD_SERIES], [ "$ABIWORD_SERIES" ], [major.minor])
AC_SUBST(ABIWORD_SERIES)
AC_SUBST(ABIWORD_HEADERSDIR, "${includedir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
if test "$TOOLKIT" = "cocoa"; then
AC_SUBST(ABIWORD_CONTENTSDIR, "/AbiWord.app/Contents")
AC_SUBST(ABIWORD_DATADIR, "${ABIWORD_CONTENTSDIR}/Resources")
AC_SUBST(ABIWORD_UIDIR, "${ABIWORD_CONTENTSDIR}/Resources")
AC_SUBST(ABIWORD_MACOSDIR, "${ABIWORD_CONTENTSDIR}/MacOS")
AC_SUBST(ABIWORD_PLUGINSDIR, "${ABIWORD_CONTENTSDIR}/PlugIns")
AC_SUBST(ABIWORD_LIBDIR, "${ABIWORD_CONTENTSDIR}/Frameworks")
else
AC_SUBST(ABIWORD_DATADIR, "${datadir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
AC_SUBST(ABIWORD_UIDIR, "${ABIWORD_DATADIR}/ui")
AC_SUBST(ABIWORD_LIBDIR, "${libdir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
AC_SUBST(ABIWORD_PLUGINSDIR, "${ABIWORD_LIBDIR}/plugins")
fi
# maybe just switch on TOOLKIT instead of the fancy TARGET defines
AM_CONDITIONAL([TOOLKIT_COCOA], test "$TOOLKIT" = "cocoa")
AM_CONDITIONAL([TOOLKIT_GTK], test "$TOOLKIT" = "gtk")
AM_CONDITIONAL([TOOLKIT_QT], test "$TOOLKIT" = "qt")
AM_CONDITIONAL([TOOLKIT_WIN], test "$TOOLKIT" = "win")
if test "$enable_shared" = ""; then
enable_shared="no"
fi
if test "$enable_static" = ""; then
enable_static="no"
fi
if test "$TOOLKIT" = "win"; then
AC_DEFINE([TOOLKIT_WIN], [1], [Build win32 user interface])
case ${host} in
*-w64-mingw*)
AC_DEFINE([UNICODE], [1], [Build a full unicode AbiWord])
;;
*)
dnl on Mingw32 it is defined.
AC_DEFINE([_WIN32_IE], [0x0501], [minimal comctl.dll v4.70 for toolbars])
AC_DEFINE([_WIN32_WINNT], [0x0500], [support collaboration plugin in Windows 2000 or higher])
;;
esac
elif test "$TOOLKIT" = "cocoa"; then
AC_DEFINE([TOOLKIT_COCOA], [1], [Build cocoa user interface])
AC_DEFINE([XAP_DONTUSE_XOR], [1], [do not use XOR drawing functions])
# override static/shared, on cocoa. shared only
enable_shared="yes"
enable_static="no"
elif test "$TOOLKIT" = "gtk"; then
AC_DEFINE([TOOLKIT_GTK], [1], [Build gtk+ user interface])
AC_DEFINE([TOOLKIT_GTK_ALL], [1], [Build gtk+ user interface])
dnl We have no reason to mess with that.
dnl # build static binary by default
dnl if test "$enable_shared" = "no" && \
dnl test "$enable_static" = "no"; then
dnl enable_shared="no"
dnl enable_static="yes"
dnl fi
elif test "$TOOLKIT" = "qt"; then
AC_DEFINE([TOOLKIT_QT], [1], [Build using Qt5])
fi
AM_CONDITIONAL([ENABLE_DYNAMIC], test "$enable_shared" = "yes")
AM_CONDITIONAL([ENABLE_STATIC], test "$enable_static" = "yes")
PKG_CHECK_MODULES(PLUGIN,[$glib_req])
PLUGIN_CFLAGS="$PLUGIN_CFLAGS "'${WP_CPPFLAGS} -DABI_DLL'
if test "$TOOLKIT" = "gtk" || test "$TOOLKIT" = "qt" &&
test "$enable_shared" = "yes"; then
# link plugins to work around gcc visibility issue with
# derived classes in dlopened modules
PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
elif test "$TOOLKIT" = "win"; then
PLUGIN_CFLAGS="$PLUGIN_CFLAGS "'-D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0500'
PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
elif test "$TOOLKIT" = "cocoa" ; then
PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
fi
AC_SUBST([PLUGIN_CFLAGS])
AC_SUBST([PLUGIN_LIBS])
if test "$abi_cv_disable_exports" = "yes"; then
AC_DEFINE([DISABLE_EXPORTS], [1], [Define to prevent symbols from being exported dynamically])
fi
if test "$abi_cv_menubutton" = "yes"; then
AC_DEFINE([ENABLE_MENUBUTTON], [1], [Define if building menu button support])
fi
AM_CONDITIONAL([ENABLE_MENUBUTTON], test "$abi_cv_menubutton" = "yes")
if test "$abi_cv_print" = "yes"; then
AC_DEFINE([ENABLE_PRINT], [1], [Define if building printing support])
fi
AM_CONDITIONAL([ENABLE_PRINT], test "$abi_cv_print" = "yes")
if test "$abi_cv_spell" = "yes"; then
AC_DEFINE([ENABLE_SPELL], [1], [Define if building spell checking support])
# TODO get rid of this after all platforms are using enchant exclusively
AC_DEFINE([WITH_ENCHANT], [1], [use Dom's enchanting spell checker abstraction library])
fi
AM_CONDITIONAL([ENABLE_SPELL], test "$abi_cv_spell" = "yes")
if test "$abi_cv_statusbar" = "yes"; then
AC_DEFINE([ENABLE_STATUSBAR], [1], [Define if building status bar])
fi
AM_CONDITIONAL([ENABLE_STATUSBAR], test "$abi_cv_statusbar" = "yes")
if test "$abi_cv_embedded_target" != "no"; then
AC_DEFINE_UNQUOTED(EMBEDDED_TARGET, $abi_cv_embedded_target, [Whether we are building for embedded device])
fi
if test "$abi_cv_emacs_keybinding" = "yes"; then
AC_DEFINE([ENABLE_EMACS_KEYBINDING], [1], [Define to enable include emacs-compatible keyboard commands])
fi
AM_CONDITIONAL(ENABLE_EMACS_KEYBINDING, test "$abi_cv_emacs_keybinding" = "yes")
if test "$abi_cv_vi_keybinding" = "yes"; then
AC_DEFINE([ENABLE_VI_KEYBINDING], [1], [Define to enable include vi-compatible keyboard commands])
fi
AM_CONDITIONAL(ENABLE_VI_KEYBINDING, test "$abi_cv_vi_keybinding" = "yes")
AM_CONDITIONAL(ENABLE_CLIPART, test "$abi_cv_clipart" = "yes")
AM_CONDITIONAL(ENABLE_TEMPLATES, test "$abi_cv_templates" = "yes")
if test "$abi_cv_debug" = "yes"; then
AC_DEFINE([DEBUG], [1], [Define to enable debugging functionality])
else
AC_DEFINE([NDEBUG], [1], [Define to disable debugging functionality])
fi
AM_CONDITIONAL(DEBUG, test "$abi_cv_debug" = "yes")
#
# Optional dependencies handling
#
AM_PATH_LIBGCRYPT( 1.4.5,
[
abi_cv_gcrypt=no
AC_DEFINE([HAVE_GCRYPT], [1], [Use gcrypt for the cryptos])
],
[
abi_cv_gcrypt=yes
] )
AM_CONDITIONAL(HAVE_GCRYPT, test "$abi_cv_gcrypt" = "yes")
if test "$abi_cv_gio" = "yes"; then
AC_DEFINE([WITH_GIO], [1], [Define if using GIO])
fi
dnl It's always on with goffice.
AC_DEFINE([HAVE_GO_MATH_EDITOR_NEW], [1], [Always defined to goffice])
AM_CONDITIONAL([TOOLKIT_GTK_ALL], test "$TOOLKIT" = "gtk")
ALL_PLUGINS_="\
m4_n([plugin_list])"
# strip trailing newline from the included file, it messes up sed on windows
ALL_PLUGINS=
for p in $(echo $ALL_PLUGINS_); do ALL_PLUGINS="$ALL_PLUGINS $p"; done
AC_SUBST([ALL_PLUGINS])
PLUGINS=
if test "$abi_cv_plugins" = "auto"; then
# which plugins to auto-enable
# this creates variables like "enable_wordperfect=auto"
for plugin in `echo $ALL_PLUGINS`; do
eval $(echo "enable_$plugin")="auto"
done
else
default_plugins="opendocument openxml"
if test "$abi_cv_disable_default_plugins" != "yes"; then
PLUGINS="$default_plugins"
fi
for i in $abi_cv_plugins; do
if test -d "plugins/$i"; then
PLUGINS="$PLUGINS $i"
else
AC_MSG_WARN([Plugin $i does not exist.])
fi
done
# which plugins to enable
# this creates variables like "enable_wordperfect=yes"
for plugin in `echo $PLUGINS`; do
eval $(echo "enable_$plugin")="yes"
done
fi
# enable the plugins we want to link statically
# this creates variables like "enable_wordperfect=yes"
BUILTIN_PLUGINS="$abi_cv_builtin_plugins"
for plugin in `echo $BUILTIN_PLUGINS`; do
eval $(echo "enable_$plugin")="yes"
done
# which plugins to build in
# this creates variables like "enable_wordperfect_builtin=yes"
for plugin in `echo $BUILTIN_PLUGINS`; do
variable="enable_"$plugin"_builtin"
eval $(echo $variable)="yes"
done
# this creates the list of .la files to link statically
# used in src/plugins/Makefile.am
BUILTIN_PLUGINS_LA=
for plugin in `echo $BUILTIN_PLUGINS`; do