-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgiella-macros.m4
1117 lines (999 loc) · 50.6 KB
/
giella-macros.m4
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
# gt.m4 - Macros to locate and utilise giella-core scripts and required tools
# for the Divvun and Giellatekno infrastructure. -*- Autoconf -*-
# serial 1 (gtsvn-1)
#
# Copyright © 2011 Divvun/Samediggi/UiT <bugs@divvun.no>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# the prefixes gt_*, _gt_* are reserved here for giellatekno variables and
# macros. It is the same as gettext and probably others, but I expect no
# collisions really.
################################################################################
# Define functions for checking paths and the GIELLA core environment:
################################################################################
AC_DEFUN([gt_PROG_SCRIPTS_PATHS],
[
AC_PATH_PROG([GTCORESH], [gt-core.sh], [false],
[$GIELLA_CORE/scripts$PATH_SEPARATOR$GTHOME/giella-core/scripts$PATH_SEPARATOR$PATH])
AC_ARG_WITH([giella-core],
[AS_HELP_STRING([--with-giella-core=DIRECTORY],
[set giella-core to DIRECTORY @<:@default=PATH@:>@])],
[with_giella_core=$withval],
[with_giella_core=false])
# Get the relative path from pwd to where src dir is:
MYSRCDIR=$srcdir
# Get the absolute path to the present dir:
BUILD_DIR_PATH=$(pwd)
# Combine to get the full path to the scrdir:
THIS_TOP_SRC_DIR=$BUILD_DIR_PATH/$MYSRCDIR
_giella_core_not_found_message="
GIELLA_CORE could not be set:
Could not set GIELLA_CORE and thus not find required scripts in:
\$GIELLA_CORE/scripts
\$GTHOME/giella-core/scripts
$PATH
Please do the following:
0. cd ..
1. git clone https://github.com/giellalt/giella-core.git # or similar using svn
2. cd giella-core && ./autogen.sh && ./configure && make
Then retry this script.
"
AC_MSG_CHECKING([whether we can set GIELLA_CORE])
# --with-giella-core overrides everything:
AS_IF([test "x$with_giella_core" != "xfalse" -a \
-d "$with_giella_core/scripts" ], [
GIELLA_CORE=$with_giella_core
],[
# If not, Look in the parent dir:
AS_IF([test -d "$THIS_TOP_SRC_DIR/../giella-core/scripts"], [
GIELLA_CORE=$THIS_TOP_SRC_DIR/../giella-core
], [
# If nothing else works, try pkg-config:
AS_IF([pkg-config --exists giella-core], [
GIELLA_CORE=$(pkg-config --variable=dir giella-core)
], [
AC_MSG_ERROR([${_giella_core_not_found_message}])
])
])
])
AC_MSG_RESULT([$GIELLA_CORE])
###############################################################
### This is the version of the Giella Core that we require. ###
### UPDATE AS NEEDED.
_giella_core_min_version=1.2.0
# GIELLA_CORE/GTCORE env. variable, required by the infrastructure to find scripts:
AC_ARG_VAR([GIELLA_CORE], [directory for the Giella infra core scripts and other required resources])
GTCORE=${GIELLA_CORE}
AC_ARG_VAR([GTCORE], [GTCORE = GIELLA_CORE, retained for backwards compatibility while being cleaned out])
##### Check the version of the giella-core, and stop with error message if too old:
# This is the error message:
giella_core_too_old_message="
The giella-core is too old, we require at least $_giella_core_min_version.
*** ==> PLEASE ENTER THE FOLLOWING COMMANDS: <== ***
cd $GTCORE
git pull --rebase # or: 'svn up' if you are using svn
make
Then retry.
"
# Identify the version of giella-core:
AC_PATH_PROG([GIELLA_CORE_VERSION], [gt-version.sh], [no],
[$GTCORE/scripts$PATH_SEPARATOR$GTHOME/giella-core/scripts$PATH_SEPARATOR$PATH])
AC_MSG_CHECKING([the version of the Giella Core])
AS_IF([test "x${GIELLA_CORE_VERSION}" != xno],
[_giella_core_version=$( "${GIELLA_CORE_VERSION}" )],
[AC_MSG_ERROR([gt-version.sh could not be found, installation is incomplete!])
])
AC_MSG_RESULT([$_giella_core_version])
AC_MSG_CHECKING([whether the Giella Core version is at least $_giella_core_min_version])
# Compare it to the required version, and error out if too old:
AX_COMPARE_VERSION([$_giella_core_version], [ge], [$_giella_core_min_version],
[giella_core_version_ok=yes], [giella_core_version_ok=no])
AS_IF([test "x${giella_core_version_ok}" != xno], [AC_MSG_RESULT([$giella_core_version_ok])],
[AC_MSG_ERROR([$giella_core_too_old_message])])
################################
### Some software that we either depend on or we need for certain functionality:
################
################ Weighted fst's ################
AC_PATH_PROG([BC], [bc], [false], [$PATH$PATH_SEPARATOR$with_bc])
################ YAML-based testing ################
AC_ARG_ENABLE([yamltests],
[AS_HELP_STRING([--enable-yamltests],
[enable yaml tests @<:@default=check@:>@])],
[enable_yamltests=$enableval],
[enable_yamltests=check])
AS_IF([test "x$enable_yamltests" = "xcheck"],
[AM_PATH_PYTHON([3.5],, [:])
AX_PYTHON_MODULE(yaml)
AC_MSG_CHECKING([whether to enable yaml-based test])
AS_IF([test "$PYTHON" = ":"],
[enable_yamltests=no
new_enough_python_available=no
AC_MSG_RESULT([no, python is missing or old])
],
[AS_IF([test "x$HAVE_PYMOD_YAML" != "xyes"],
[enable_yamltests=no
new_enough_python_available=yes
AC_MSG_RESULT([no, yaml is missing])
],
[enable_yamltests=yes
new_enough_python_available=yes
AC_MSG_RESULT([yes])])])])
AM_CONDITIONAL([CAN_YAML_TEST], [test "x$enable_yamltests" != xno])
################ Generated documentation ################
# Check for awk with required feature:
AC_CACHE_CHECK([for awk that supports gensub], [ac_cv_path_GAWK],
[AC_PATH_PROGS_FEATURE_CHECK([GAWK], [awk mawk nawk gawk],
[[awkout=`$ac_path_GAWK 'BEGIN{gensub(/a/,"b","g");}'; exvalue=$?; echo $exvalue`
test "x$awkout" = x0 \
&& ac_cv_path_GAWK=$ac_path_GAWK ac_path_GAWK_found=:]],
[AC_MSG_ERROR([could not find awk that supports gensub - please install GNU awk. hint: sudo port install gawk])])])
AC_SUBST([GAWK], [$ac_cv_path_GAWK])
# Check for sed with required feature:
AC_CACHE_CHECK([for sed that supports newlines and pipes], [ac_cv_path_SED],
[AC_PATH_PROGS_FEATURE_CHECK([SED], [gnused gsed sed],
[[m4out=`echo aaa | $ac_path_SED 's/a/\n/g' | wc -l | tr -d '[:space:] '`
test "x$m4out" = x4\
&& ac_cv_path_SED=$ac_path_SED ac_path_SED_found=:]],
[AC_MSG_ERROR([could not find sed that supports newlines - please install GNU sed. Hint: sudo port install gsed./c])])])
AC_SUBST([SED], [$ac_cv_path_SED])
# Check for uconv for some automated unicode recoding
AC_PATH_PROG([UCONV], [uconv], [false])
AS_IF([test x$UCONV = xfalse],
[AC_MSG_ERROR([needs uconv for unicode support
uconv is a part of ICU
on debian/ubuntu: apt install icu-devtools
on macports: port install icu
on macbrew: brew install icu4c (and follow instructions)
])])
# Check for Forrest:
AC_ARG_WITH([forrest],
[AS_HELP_STRING([--with-forrest=DIRECTORY],
[search forrest in DIRECTORY @<:@default=PATH@:>@])],
[with_forrest=$withval],
[with_forrest=no])
AC_PATH_PROG([FORREST], [forrest], [], [$PATH$PATH_SEPARATOR$with_forrest])
AC_MSG_CHECKING([whether to do forrest validation of in-source documentation])
AS_IF([test "x$GAWK" != x], [
AS_IF([test "x$JV" != xfalse], [
AS_IF([test "x$with_forrest" = xyes], [
AS_IF([test "x$FORREST" != x],
[giellalt_forrest_validation=yes],
[giellalt_forrest_validation=no])
],[giellalt_forrest_validation=no])
],[giellalt_forrest_validation=no])
],[giellalt_forrest_validation=no])
AC_MSG_RESULT([$giellalt_forrest_validation])
AM_CONDITIONAL([CAN_FORREST_VALIDATE], [test "x$giellalt_forrest_validation" != xno])
# Check for npm etc. stuff for divvunspell stats
AC_ARG_WITH([npm],
[AS_HELP_STRING([--with-npm=DIRECTORY],
[search npm in DIRECTORY @<:@default=PATH@:>@])],
[with_npm=$withval],
[with_npm=no])
AC_PATH_PROG([NPM], [npm], [], [$PATH$PATH_SEPARATOR$with_npm])
AC_PATH_PROG([R], [R], [], [$PATH$PATH_SEPARATOR$with_R])
AC_ARG_WITH([divvunspell],
[AS_HELP_STRING([--with-divvunspell=DIRECTORY],
[search divvunspell in DIRECTORY @<:@default=PATH@:>@])],
[with_divvunspell=$withval],
[with_divvunspell=no])
AC_PATH_PROG([DIVVUN_ACCURACY], [accuracy], [], [$PATH$PATH_SEPARATOR$with_divvunspell])
# Check for opennmt for neural models
AC_ARG_WITH([opennmt-py],
[AS_HELP_STRING([--with-opennmt-py=DIRECTORY],
[search opennmt in DIRECTORY @<:@default=PATH@:>@])],
[with_opennmtpy=$withval],
[with_opennmtpy=no])
AC_PATH_PROG([ONMT_BUILD_VOCAB], [onmt_build_vocab], [], [$PATH$PATH_SEPARATOR$with_opennmtpy])
AC_PATH_PROG([ONMT_TRAIN], [onmt_train], [], [$PATH$PATH_SEPARATOR$with_opennmtpy])
################ can rsync oxt template? ################
AC_PATH_PROG([RSYNC], [rsync], [no], [$PATH$PATH_SEPARATOR$with_rsync])
AC_PATH_PROG([WGET], [wget], [no], [$PATH$PATH_SEPARATOR$with_wget])
AS_IF([test "x$GIELLA_LIBS" != "xno" -a \
"x$RSYNC" != "xno" ],
[can_local_sync=yes], [
can_local_sync=no
AS_IF([test "x$WGET" != "xno" ],
[can_wget_giella_libs=yes],
[can_wget_giella_libs=no])
])
AM_CONDITIONAL([CAN_LOCALSYNC], [test "x$can_local_sync" != xno ])
AM_CONDITIONAL([CAN_REMOTE_SYNC], [test "x$can_wget_giella_libs" != xno ])
################ Look for available diff and merge tools: ################
AC_PATH_PROGS([DIFFTOOL], [opendiff kdiff3 meld diffuse kompare], [no], [$PATH$PATH_SEPARATOR$with_difftool])
case $DIFFTOOL in
*kdiff3 |\
*meld |\
*opendiff )
can_merge=yes
;;
*)
can_merge=no
;;
esac
AM_CONDITIONAL([CAN_MERGE], [test "x$can_merge" != xno ])
################ GNU Make at least 3.82 on non-OSX systems: ################
#
# Platform specific setup
#
#############################
AC_CANONICAL_HOST
# Check for which host we are on and setup a few things
# specifically based on the host
# This is the minimum GNU Make version required
_GNU_make_min_version=m4_default([$1], [3.82])
AX_CHECK_GNU_MAKE(,
[AC_MSG_WARN([GNU make will be required])])
AC_MSG_CHECKING([whether GNU make is at least $_GNU_make_min_version])
AX_COMPARE_VERSION([$ax_check_gnu_make_version], [ge],
[$_GNU_make_min_version],
[
AC_MSG_RESULT([yes])
# Reset the MAKE variable, to ensure we're using GNU make:
MAKE=$_cv_gnu_make_command
],
[AC_MSG_RESULT([no])
AC_MSG_WARN([GNU Make too old ($ax_check_gnu_make_version), please install at least $_GNU_make_min_version])
gt_need_gnu_make=yes
])
################ END of GNU Make check ################
# We need special treatment of Java paths in Cygwin:
AC_CANONICAL_HOST
case "${host}" in
*-cygwin* | *-mingw*)
CYGWINJAVAPATH='cygpath -m'
;;
*)
# Assume Unix.
CYGWINJAVAPATH=echo
;;
esac
AC_SUBST(CYGWINJAVAPATH)
# Check for SubEthaEdit/see
AC_PATH_PROG([SEE], [see], [], [$PATH$PATH_SEPARATOR$with_see])
# Check for grammar checker validation tool:
AC_PATH_PROG([DIVVUN_VALIDATE_SUGGEST], [divvun-validate-suggest], [no], [$PATH$PATH_SEPARATOR$with_divvun_validate_suggest])
# Check for grammar checker (for self-test)
AC_PATH_PROG([DIVVUN_CHECKER], [divvun-checker], [no], [$PATH$PATH_SEPARATOR$with_divvun_validate_suggest])
]) # gt_PROG_SCRIPTS_PATHS
################################################################################
# Define functions for checking the availability of the Xerox tools:
################################################################################
AC_DEFUN([gt_PROG_XFST],
[AC_ARG_WITH([xfst],
[AS_HELP_STRING([--with-xfst=DIRECTORY],
[search xfst in DIRECTORY @<:@default=PATH@:>@])],
[with_xfst=$withval],
[with_xfst=$DEFAULT_XFST])
AC_PATH_PROG([PRINTF], [printf], [echo -n])
AC_PATH_PROG([XFST], [xfst], [false], [$PATH$PATH_SEPARATOR$with_xfst])
AC_PATH_PROG([TWOLC], [twolc], [false], [$PATH$PATH_SEPARATOR$with_xfst])
AC_PATH_PROG([LEXC], [lexc], [false], [$PATH$PATH_SEPARATOR$with_xfst])
AC_PATH_PROG([LOOKUP], [lookup], [false], [$PATH$PATH_SEPARATOR$with_xfst])
AC_MSG_CHECKING([whether to enable xfst building])
AS_IF([test x$with_xfst != xno], [
AS_IF([test "x$XFST" != xfalse -a \
"x$TWOLC" != xfalse -a \
"x$LEXC" != xfalse -a \
"x$LOOKUP" != xfalse ], [gt_prog_xfst=yes],
[gt_prog_xfst=no])
], [gt_prog_xfst=no])
AC_MSG_RESULT([$gt_prog_xfst])
AM_CONDITIONAL([CAN_XFST], [test "x$gt_prog_xfst" != xno])
]) # gt_PROG_XFST
################################################################################
# Define functions for checking the availability of Voikko tools:
################################################################################
AC_DEFUN([gt_PROG_VFST],
[AC_ARG_WITH([voikko],
[AS_HELP_STRING([--with-voikko=DIRECTORY],
[search voikko in DIRECTORY @<:@default=PATH@:>@])],
[with_voikko=$withval],
[with_voikko=yes])
AC_PATH_PROG([VOIKKOSPELL], [voikkospell], [false],
[$PATH$PATH_SEPARATOR$with_voikko])
AC_PATH_PROG([VOIKKOHYPHENATE], [voikkohyphenate], [false],
[$PATH$PATH_SEPARATOR$with_voikko])
AC_PATH_PROG([VOIKKOGC], [voikkogc], [false],
[$PATH$PATH_SEPARATOR$with_voikko])
AC_PATH_PROG([VOIKKOVFSTC], [voikkovfstc], [false],
[$PATH$PATH_SEPARATOR$with_voikko])
AC_MSG_CHECKING([whether to enable voikko building])
AS_IF([test x$with_voikko != xno], [
AS_IF([test "x$VOIKKOSPELL" != xfalse -a \
"x$VOIKKOHYPHENATE" != xfalse -a \
"x$VOIKKOGC" != xfalse -a \
"x$VOIKKOVFSTC" != xfalse ], [gt_prog_voikko=yes],
[gt_prog_voikko=no])
], [gt_prog_voikko=no])
AC_MSG_RESULT([$gt_prog_voikko])
AM_CONDITIONAL([CAN_VFST], [test "x$gt_prog_voikko" != xno])
]) # gt_PROG_VFST
################################################################################
# Define functions for checking the availability of the Foma tools:
################################################################################
AC_DEFUN([gt_PROG_FOMA],
[AC_ARG_WITH([foma],
[AS_HELP_STRING([--with-foma=DIRECTORY],
[search foma in DIRECTORY @<:@default=PATH@:>@])],
[with_foma=$withval],
[with_foma=$DEFAULT_FOMA])
# If Xerox tools and Hfst are not found, assume we want Foma:
AS_IF([test x$gt_prog_xfst = xno \
-a x$gt_prog_hfst = xno \
-a "x$with_xfst" != xno \
-a "x$with_hfst" != xno ],
[
with_foma=yes
fallback_to_foma="INFO: Neither Xfst nor Hfst were found, falling back to using Foma"
])
AC_PATH_PROG([PRINTF], [printf], [echo -n])
AC_PATH_PROG([FOMA], [foma], [false], [$PATH$PATH_SEPARATOR$with_foma])
AC_PATH_PROG([FLOOKUP], [flookup], [false], [$PATH$PATH_SEPARATOR$with_foma])
AC_PATH_PROG([CGFLOOKUP], [cgflookup], [false], [$PATH$PATH_SEPARATOR$with_foma])
AC_MSG_CHECKING([whether to enable foma building])
AS_IF([test x$with_foma != xno], [
AS_IF([test "x$FOMA" != xfalse -a \
"x$FLOOKUP" != xfalse -a \
"x$CGFLOOKUP" != xfalse ], [gt_prog_foma=yes],
[gt_prog_foma=no])
], [gt_prog_foma=no])
AC_MSG_RESULT([$gt_prog_foma])
AS_IF([test x$gt_prog_foma = xyes \
-a "x$(grep 'GT_PHONOLOGY_MAIN' ${srcdir}/src/fst/Makefile*.am \
| grep 'twolc')" != "x" ],
[AC_MSG_ERROR([You only have Foma, or you requested to use Foma, but \
your main phonology file is a twolc file, which Foma can not compile. You need \
to use either Hfst or the Xerox FSM tools when compiling transducers for \
$GLANG ($GLANGUAGE).
])])
AM_CONDITIONAL([CAN_FOMA], [test "x$gt_prog_foma" != xno])
AM_CONDITIONAL([HAS_FOMA], [test "x$FOMA" != xfalse ])
]) # gt_PROG_FOMA
################################################################################
# Define functions for checking the availability of the VISLCG3 tools:
################################################################################
AC_DEFUN([gt_PROG_VISLCG3],
[AC_ARG_WITH([vislcg3],
[AS_HELP_STRING([--with-vislcg3=DIRECTORY],
[search vislcg3 in DIRECTORY @<:@default=PATH@:>@])],
[with_vislcg3=$withval],
[with_vislcg3=check])
AC_PATH_PROG([VISLCG3], [vislcg3], [no], [$PATH$PATH_SEPARATOR$with_vislcg3])
AC_PATH_PROG([VISLCG3_COMP], [cg-comp], [no], [$PATH$PATH_SEPARATOR$with_vislcg3])
AC_PATH_PROG([CG_RELABEL], [cg-relabel], [no], [$PATH$PATH_SEPARATOR$with_vislcg3])
AC_PATH_PROG([CG_MWESPLIT], [cg-mwesplit], [no], [$PATH$PATH_SEPARATOR$with_vislcg3])
AS_IF([test "x$VISLCG3" != xno], [
_giella_core_vislcg3_min_version=m4_default([$1], [1.0.0])
AC_MSG_CHECKING([whether vislcg3 is at least $_giella_core_vislcg3_min_version])
_vislcg3_version=$( ${VISLCG3} --version 2>&1 | grep -Eo '@<:@0-9@:>@+\.@<:@0-9.@:>@+' )
AX_COMPARE_VERSION([$_vislcg3_version], [ge], [$_giella_core_vislcg3_min_version],
[gt_prog_vislcg3=yes
AC_MSG_RESULT([yes - $_vislcg3_version])
], [gt_prog_vislcg3=no
AC_MSG_RESULT([no - $_vislcg3_version])
])
],
[gt_prog_vislcg3=no])
AC_MSG_CHECKING([whether we can enable vislcg3 targets])
AS_IF([test "x$gt_prog_vislcg3" != xno], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AM_CONDITIONAL([CAN_VISLCG], [test "x$gt_prog_vislcg3" != xno])
PKG_CHECK_MODULES([CG3], [cg3 > 1.4.0], [vislcg_filters=true],
[vislcg_filters=false])
AM_CONDITIONAL([HAVE_VISLCG_FILTER], [test "x$vislcg_filters" = xtrue])
]) # gt_PROG_VISLCG3
################################################################################
# Define functions for checking the availability of Saxon:
################################################################################
AC_DEFUN([gt_PROG_SAXON],
[AC_ARG_WITH([saxon],
[AS_HELP_STRING([--with-saxon=DIRECTORY],
[search saxon wrapper script in DIRECTORY @<:@default=PATH@:>@])],
[with_saxon=$withval],
[with_saxon=check])
AC_PATH_PROG([SAXON], [saxonb-xslt saxon9 saxon8 saxon], [false], [$PATH$PATH_SEPARATOR$with_saxon])
AC_PATH_PROG([JV], [java], [false])
AC_CHECK_FILE([$HOME/lib/saxon9he.jar],
AC_SUBST(SAXONJAR, [$HOME/lib/saxon9he.jar]),
[AC_CHECK_FILE([$HOME/lib/saxon9.jar],
AC_SUBST(SAXONJAR, [$HOME/lib/saxon9.jar]),
[AC_CHECK_FILE([/opt/local/share/java/saxon9he.jar],
AC_SUBST(SAXONJAR, [/opt/local/share/java/saxon9he.jar]),
[AC_CHECK_FILE([/usr/share/java/Saxon-HE.jar],
AC_SUBST(SAXONJAR, [/usr/share/java/Saxon-HE.jar]),
[AC_CHECK_FILE([/usr/share/java/saxon.jar],
AC_SUBST(SAXONJAR, [/usr/share/java/saxon.jar]),
[_saxonjar=no])
])])])]
)
AS_IF([test "x$with_saxon" != xno], [
_saxon_min_version="8.0"
_saxon_version=$( java -jar $SAXONJAR -? 2>&1 | fgrep -i 'saxon' | grep -Eo '@<:@0-9@:>@+\.@<:@0-9.@:>@+' )
AC_MSG_CHECKING([whether the Saxon JAR is at least $_saxon_min_version])
AX_COMPARE_VERSION([$_saxon_version], [ge], [$_saxon_min_version],
[_saxonjar=yes
AC_MSG_RESULT([yes - $_saxon_version])
], [_saxonjar=no
AC_MSG_RESULT([no - $_saxon_version])
])
],
[_saxonjar=no])
AC_MSG_CHECKING([whether we can enable xslt2 transformations])
AS_IF([test x$with_saxon != xno], [
AS_IF([test "x$SAXON" != xfalse], [gt_prog_saxon=yes],
[gt_prog_saxon=no])
AS_IF([test x$JV != xfalse], [gt_prog_java=yes], [gt_prog_java=no])
AS_IF([test x$gt_prog_java != xno -a x$_saxonjar != xno],
[gt_prog_xslt=yes], [gt_prog_xslt=no])
], [gt_prog_xslt=no])
AC_MSG_RESULT([$gt_prog_xslt])
AM_CONDITIONAL([CAN_SAXON], [test "x$gt_prog_saxon" != xno])
AM_CONDITIONAL([CAN_JAVA], [test "x$gt_prog_java" != xno -a "x$_saxonjar" != xno])
]) # gt_PROG_SAXON
################################################################################
# Define functions for configuration of the build targets:
################################################################################
AC_DEFUN([gt_ENABLE_TARGETS],
[
# Foma-speller requires gzip, Voikko requires zip:
AC_PATH_PROG([ZIP], [zip], [false], [$PATH$PATH_SEPARATOR$with_zip])
AC_PATH_PROG([GZIP], [gzip], [false], [$PATH$PATH_SEPARATOR$with_gzip])
AC_PATH_PROGS([TAR], [tar gtar], [false], [$PATH$PATH_SEPARATOR$with_tar])
AC_PATH_PROG([PATGEN], [patgen], [false], [$PATH$PATH_SEPARATOR$with_patgen])
AC_PATH_PROG([PERL], [perl], [false], [$PATH$PATH_SEPARATOR$with_perl])
AC_PATH_PROG([XZ], [xz], [false], [$PATH$PATH_SEPARATOR$with_xz])
AM_CONDITIONAL([CAN_XZ], [test "x$ac_cv_prog_XZ" != xfalse])
############ (Hfst) compilation optimisation: ############
# Enable hyperminimisation of the lexical transducer - default is 'no'
AC_ARG_ENABLE([hyperminimisation],
[AS_HELP_STRING([--enable-hyperminimisation],
[enable hyperminimisation of lexical fst @<:@default=$DEFAULT_HYPERMIN@:>@])],
[enable_hyperminimisation=$enableval],
[enable_hyperminimisation=$DEFAULT_HYPERMIN])
AM_CONDITIONAL([WANT_HYPERMINIMISATION], [test "x$enable_hyperminimisation" != xno])
# Enable symbol alignment of the lexical transducer - default is 'no'
AC_ARG_ENABLE([alignment],
[AS_HELP_STRING([--enable-alignment],
[enable symbol alignment when parsing lexc @<:@default=yes@:>@])],
[enable_alignment=$enableval],
[enable_alignment=yes])
AM_CONDITIONAL([WANT_LEXC_ALIGNMENT], [test "x$enable_alignment" != xno])
#enable_twostep_intersect
AC_ARG_ENABLE([twostep-intersect],
[AS_HELP_STRING([--enable-twostep-intersect],
[enable two-step compose-intersect (more correct in rare cases, might be slower) @<:@default=no@:>@])],
[enable_twostep_intersect=$enableval],
[enable_twostep_intersect=no])
AM_CONDITIONAL([WANT_TWOSTEP_INTERSECT], [test "x$enable_twostep_intersect" != xno])
#enable_reversed_intersect
AC_ARG_ENABLE([reversed-intersect],
[AS_HELP_STRING([--enable-reversed-intersect],
[enable reversed compose-intersect (faster and takes less RAM in some cases) @<:@default=$DEFAULT_REVERCI@:>@])],
[enable_reversed_intersect=$enableval],
[enable_reversed_intersect=$DEFAULT_REVERCI])
AM_CONDITIONAL([WANT_REVERSED_INTERSECT], [test "x$enable_reversed_intersect" != xno])
############ Tool switches: ############
# Enable all stable tools in one go:
AC_ARG_ENABLE([ci],
[AS_HELP_STRING([--enable-ci],
[build nothing unless explicitly enabled @<:@default=no@:>@])],
[enable_ci=$enableval],
[enable_ci=no])
# Must zero out enableval, otherwise it will carry its value to the next use,
# so you can't test whether something was enabled due to defaults or to active enabling:
enableval=''
AC_ARG_ENABLE([all_tools],
[AS_HELP_STRING([--enable-all-tools],
[build all tools (excluding unstable or experimental tools, which must be explicitly enabled with --enable-dialects, --enable-glossers, --enable-phonetic, --enable-downcaseerror, --enable-L2, --enable-pattern-hyphenators, --enable-fomaspeller) @<:@default=no@:>@])],
[enable_all_tools=$enableval],
[enable_all_tools=no])
enableval=''
# Enable morphological analysers - default is 'yes'
AC_ARG_ENABLE([analysers],
[AS_HELP_STRING([--enable-analysers],
[build morphological analysers @<:@default=yes@:>@])],
[enable_analysers=$enableval],
[AS_IF([test "x$enable_all_tools" != xno],
[enable_analysers=$enable_all_tools],
[enable_analysers=$DEFAULT_ANALYSERS])
])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_analysers=no])
AM_CONDITIONAL([WANT_MORPHOLOGY], [test "x$enable_analysers" != xno])
enableval=''
# Enable morphological generators - default is 'yes'
AC_ARG_ENABLE([generators],
[AS_HELP_STRING([--enable-generators],
[build morphological generators @<:@default=yes@:>@])],
[enable_generators=$enableval],
[AS_IF([test "x$enable_all_tools" != xno],
[enable_generators=$enable_all_tools],
[enable_generators=$DEFAULT_GENERATORS])
])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_generators=no])
AM_CONDITIONAL([WANT_GENERATION], [test "x$enable_generators" != xno])
enableval=''
# Enable TTS text processing - default is 'no' (via $enable_all_tools)
AC_ARG_ENABLE([tts],
[AS_HELP_STRING([--enable-tts],
[enable tts transcriptors @<:@default=no@:>@])],
[enable_tts=$enableval],
[enable_tts=$enable_all_tools])
AM_CONDITIONAL([WANT_TTS], [test "x$enable_tts" != xno])
enableval=''
# Enable glossing morphological analysers - default is 'no'
AC_ARG_ENABLE([glossers],
[AS_HELP_STRING([--enable-glossers],
[build glossing morphological analysers @<:@default=no@:>@])],
[enable_glossers=$enableval],
[enable_glossers=no])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_glossers=no])
AM_CONDITIONAL([WANT_GLOSSERS], [test "x$enable_glossers" != xno])
enableval=''
# Enable text transcriptors - default is 'yes'
AC_ARG_ENABLE([transcriptors],
[AS_HELP_STRING([--enable-transcriptors],
[build text transcriptors @<:@default=yes@:>@])],
[enable_transcriptors=$enableval],
[enable_transcriptors=yes])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_transcriptors=no])
AS_IF([test "x$enable_tts" != xno],[enable_transcriptors=yes])
AM_CONDITIONAL([WANT_TRANSCRIPTORS], [test "x$enable_transcriptors" != xno])
enableval=''
# Enable syntactic parsing - default is 'yes'
AC_ARG_ENABLE([syntax],
[AS_HELP_STRING([--enable-syntax],
[build syntax parsing tools @<:@default=yes@:>@])],
[enable_syntax=$enableval],
[enable_syntax=yes])
AS_IF([test "x$enable_syntax" = "xyes" -a "x$gt_prog_vislcg3" = "xno"],
[enable_syntax=no
AC_MSG_ERROR([vislcg3 tools missing or too old, please install or disable syntax tools!])])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_syntax=no])
AM_CONDITIONAL([WANT_SYNTAX], [test "x$enable_syntax" != xno])
enableval=''
# $gt_prog_vislcg3
# Enable grammar checkers - default is 'no' (via $enable_all_tools)
AC_ARG_ENABLE([grammarchecker],
[AS_HELP_STRING([--enable-grammarchecker],
[enable grammar checker @<:@default=no@:>@])],
[enable_grammarchecker=$enableval],
[enable_grammarchecker=$enable_all_tools])
AS_IF([test "x$enable_grammarchecker" = "xyes" -a "x$gt_prog_vislcg3" = "xno"],
[enable_grammarchecker=no
AC_MSG_ERROR([vislcg3 missing or too old - required for the grammar checker])],
[AS_IF([test "x$enable_grammarchecker" = "xyes" -a "x$DIVVUN_VALIDATE_SUGGEST" = "xno"],
[enable_grammarchecker=no
AC_MSG_ERROR([divvun-validate-suggest required for building grammar checkers])])]
[AS_IF([test "x$enable_grammarchecker" = "xyes" -a "x$DIVVUN_CHECKER" = "xno"],
[enable_grammarchecker=no
AC_MSG_ERROR([divvun-checker required for testing grammar checkers])])])
AS_IF([test "x$enable_ci" = "xyes" -a "x$enableval" = "x"], [enable_grammarchecker=no])
AM_CONDITIONAL([WANT_GRAMCHECK], [test "x$enable_grammarchecker" != xno])
enableval=''
################ gtgramtool for grammarchecking ################
AC_PATH_PROG([GTGRAMTOOL], [gtgramtool], [false])
AS_IF([test "x$enable_grammarchecker" != "xno"],
AX_PYTHON_MODULE(pip)
AC_MSG_CHECKING([whether we have gtgramtool])
AS_IF([test x$GTGRAMTOOL = xfalse],
[AC_MSG_ERROR([gtgramtool is needed for --enable grammarchecker.
on debian/ubuntu: sudo apt update; sudo apt install pipx; pipx ensurepath
on macbrew: brew install pipx; pipx ensurepath
then: pipx install git+https://github.com/divvun/giellaltgramtools
])]),
AC_MSG_RESULT([yes]))
_gtgramtool_min_version=0.7.0
gtgramtool_too_old_message="gtgramtool needs to be updated.
If you installed it with pipx, run:
pipx upgrade GiellaLTGramTools"
AC_MSG_CHECKING([the version of gtgramtool])
AS_IF([test "x${GTGRAMTOOL}" != xno],
[_gtgramtool_version=$( "${GTGRAMTOOL}" --version | sed -e 's/^.*version //')],
[_gtgramtool_version=0])
AC_MSG_RESULT([$_gtgramtool_version])
AC_MSG_CHECKING([whether the gtgramtool version is at least $_gtgramtool_min_version])
AX_COMPARE_VERSION([$_gtgramtool_version], [ge], [$_gtgramtool_min_version],
[gtgramtool_version_ok=yes], [gtgramtool_version_ok=no])
AC_MSG_RESULT([$gtgramtool_version_ok])
AS_IF([test "x$enable_grammarchecker" != "xno"],
AS_IF([test "x${gtgramtool_version_ok}" != xno],,
[AC_MSG_ERROR([$gtgramtool_too_old_message])]))
# Enable all spellers - default is 'no'
AC_ARG_ENABLE([spellers],
[AS_HELP_STRING([--enable-spellers],
[build any/all spellers @<:@default=no@:>@])],
[enable_spellers=$enableval],
[enable_spellers=$enable_all_tools])
AS_IF([test "x$enable_grammarchecker" != xno],[enable_spellers=yes])
AS_IF([test "x$enable_spellers" != xno -a "x$BC" = xfalse],
[AC_MSG_ERROR([counting statistics for spell-checkers requires bc, install or disable spellers])])
AM_CONDITIONAL([WANT_SPELLERS], [test "x$enable_spellers" != xno])
# Enable minimised fst-spellers by default:
AC_ARG_ENABLE([minimised-spellers],
[AS_HELP_STRING([--enable-minimised-spellers],
[minimise hfst spellers @<:@default=$DEFAULT_SPELLER_MINIMISATION@:>@])],
[enable_minimised_spellers=$enableval],
[enable_minimised_spellers=$DEFAULT_SPELLER_MINIMISATION])
AS_IF([test "x$enable_minimised_spellers" != "xyes"],
[AC_SUBST([HFST_MINIMIZE_SPELLER], ["$ac_cv_path_HFST_REMOVE_EPSILONS \$(HFST_FLAGS) \$(MORE_VERBOSITY) "])],
[AC_SUBST([HFST_MINIMIZE_SPELLER], ["$ac_cv_path_HFST_REMOVE_EPSILONS \$(HFST_FLAGS) \$(MORE_VERBOSITY) \
| $ac_cv_path_HFST_DETERMINIZE --encode-weights \$(HFST_FLAGS) \$(MORE_VERBOSITY) \
| $ac_cv_path_HFST_MINIMIZE --encode-weights \$(HFST_FLAGS) \$(MORE_VERBOSITY) "])])
# Enable Foma-based spellers, requires gzip - default is no
AC_ARG_ENABLE([fomaspeller],
[AS_HELP_STRING([--enable-fomaspeller],
[build foma speller (dependent on --enable-spellers) @<:@default=no@:>@])],
[enable_fomaspeller=$enableval],
[enable_fomaspeller=no])
AS_IF([test "x$enable_fomaspeller" = "xyes" -a "x$gt_prog_hfst" != xno],
[AS_IF([test "x$GZIP" = "xfalse"],
[enable_fomaspeller=no
AC_MSG_ERROR([gzip missing - required for foma spellers])])])
AM_CONDITIONAL([CAN_FOMA_SPELLER], [test "x$enable_fomaspeller" != xno])
# Enable hfst mobile spellers - default is 'no' (dependent on --enable-spellers)
AC_ARG_ENABLE([hfst-mobile-speller],
[AS_HELP_STRING([--enable-hfst-mobile-speller],
[build hfst mobile spellers (dependent on --enable-spellers) @<:@default=no@:>@])],
[enable_mobile_hfstspeller=$enableval],
[enable_mobile_hfstspeller=$enable_all_tools])
AS_IF([test "x$enable_spellers" = xno -o "x$gt_prog_hfst" = xno], [enable_mobile_hfstspeller=no],
[AS_IF([test "x$XZ" = "xfalse"],
[enable_mobile_hfstspeller=no
AC_MSG_ERROR([xz is missing - required for mobile zhfst spellers])])])
AM_CONDITIONAL([WANT_HFST_MOBILE_SPELLER], [test "x$enable_mobile_hfstspeller" != xno])
AC_ARG_ENABLE([neural-speller],
[AS_HELP_STRING([--enable-neural-speller],
[build neural speller with opennmt-py @<:@default=no@:>@])],
[enable_neural_speller=$enableval],
[enable_neural_speller=no])
AS_IF([test "x$enable_neural_speller" = xyes -a x$ONMT_TRAIN = xno],
[AC_MSG_ERROR([onmt_train is required for --enable-neural-speller: use pip install opennmt-py])])
AM_CONDITIONAL([WANT_NEURAL_SPELLERS], [test "x$enable_neural_speller" != xno])
## Disable Hunspell production by default:
#AC_ARG_ENABLE([hunspell],
# [AS_HELP_STRING([--enable-hunspell],
# [enable hunspell building (dependent on --enable-spellers) @<:@default=no@:>@])],
# [enable_hunspell=$enableval],
# [enable_hunspell=no])
#AS_IF([test "x$enable_spellers" = xno], [enable_hunspell=no])
#AM_CONDITIONAL([WANT_HUNSPELL], [test "x$enable_hunspell" != xno])
# Enable pattern hyphenator - default is 'no'; requires fst hyphenator
AC_ARG_ENABLE([pattern-hyphenators],
[AS_HELP_STRING([--enable-pattern-hyphenators],
[build pattern-based hyphenators (requires fst hyphenator) @<:@default=no@:>@])],
[enable_pattern_hyphenators=$enableval],
[enable_pattern_hyphenators=no])
AS_IF([test "x$enable_pattern_hyphenators" = "xyes" -a "x$PATGEN" = "xfalse"],
[enable_pattern_hyphenators=no
AC_MSG_ERROR([patgen required for building pattern hyphenators])])
# Enable fst hyphenator - default is 'no'
AC_ARG_ENABLE([fst-hyphenator],
[AS_HELP_STRING([--enable-fst-hyphenator],
[build fst-based hyphenator @<:@default=no@:>@])],
[enable_fst_hyphenator=$enableval],
[enable_fst_hyphenator=$enable_all_tools])
# Automatically enable the fst hyphenator if pattern hyphenator is enabled:
AS_IF([test "x$enable_pattern_hyphenators" = "xyes"],
[enable_fst_hyphenator=yes])
AM_CONDITIONAL([WANT_FST_HYPHENATOR], [test "x$enable_fst_hyphenator" != xno])
# Set up conditional for pattern hyphenators:
AM_CONDITIONAL([WANT_PATTERN_HYPHENATORS], [test "x$enable_pattern_hyphenators" != xno])
# Enable dictionary transducers - default is 'no'
AC_ARG_ENABLE([dicts],
[AS_HELP_STRING([--enable-dicts],
[enable dictionary transducers @<:@default=no@:>@])],
[enable_dicts=$enableval],
[enable_dicts=$enable_all_tools])
AM_CONDITIONAL([WANT_DICTIONARIES], [test "x$enable_dicts" != xno])
# Enable Oahpa transducers - default is 'no'
AC_ARG_ENABLE([oahpa],
[AS_HELP_STRING([--enable-oahpa],
[enable oahpa transducers @<:@default=no@:>@])],
[enable_oahpa=$enableval],
[enable_oahpa=$enable_all_tools])
AM_CONDITIONAL([WANT_OAHPA], [test "x$enable_oahpa" != xno])
# Enable L2 fst's for Oahpa:
AC_ARG_ENABLE([L2],
[AS_HELP_STRING([--enable-L2],
[enable L2 analyser for Oahpa @<:@default=no@:>@])],
[enable_L2=$enableval],
[enable_L2=no])
AS_IF([test x$enable_oahpa = xno], [enable_L2=no],
[AS_IF([test x$enable_L2 != xno -a \
"$(find ${srcdir}/src/fst -name "*-L2.*" | head -n 1)" = "" ],
[AC_MSG_ERROR([You asked for the L2 analyser, but no L2 files were found])])])
AM_CONDITIONAL([WANT_L2], [test "x$enable_L2" != xno])
# Enable downcasing error fst's for Oahpa:
AC_ARG_ENABLE([downcaseerror],
[AS_HELP_STRING([--enable-downcaseerror],
[enable downcaseerror analyser for Oahpa @<:@default=no@:>@])],
[enable_downcaseerror=$enableval],
[enable_downcaseerror=no])
AS_IF([test x$enable_oahpa = xno], [enable_downcaseerror=no])
AM_CONDITIONAL([WANT_DOWNCASEERROR], [test "x$enable_downcaseerror" != xno])
# Enable IPA conversion - default is 'no'
AC_ARG_ENABLE([phonetic],
[AS_HELP_STRING([--enable-phonetic],
[enable phonetic transducers @<:@default=no@:>@])],
[enable_phonetic=$enableval],
[enable_phonetic=$enable_all_tools])
AS_IF([test "x$enable_tts" != xno],[enable_phonetic=yes])
AM_CONDITIONAL([WANT_PHONETIC], [test "x$enable_phonetic" != xno])
# Enable Apertium transducers - default is 'no'
AC_ARG_ENABLE([apertium],
[AS_HELP_STRING([--enable-apertium],
[enable apertium transducers @<:@default=no@:>@])],
[enable_apertium=$enableval],
[enable_apertium=$enable_all_tools])
AS_IF([test "x$enable_apertium" = "xyes" -a "x$new_enough_python_available" = "xno"],
[enable_apertium=no
AC_MSG_ERROR([Python3 missing or too old, Python 3.5 or newer required])])
AS_IF([test "x$enable_apertium" = "xyes" -a "x$CG_RELABEL" = "xno"],
[enable_apertium=no
AC_MSG_ERROR([Apertium enabled but cg-relabel not found. Please install Vislcg3.])])
AM_CONDITIONAL([WANT_APERTIUM], [test "x$enable_apertium" != xno])
# Enable CG-based MT - default is 'no'
AC_ARG_ENABLE([cgmt],
[AS_HELP_STRING([--enable-cgmt],
[enable cg-based machine translation @<:@default=no@:>@])],
[enable_cgmt=$enableval],
[enable_cgmt=no])
AS_IF([test "x$enable_cgmt" = "xyes" -a "x$GTPRIV" = "x"],
[AC_MSG_ERROR([\$\$GTPRIV not set! CG-based MT requires access to closed-source tools in GTPRIV])])
AS_IF([test x$enable_tokenisers = xno -a x$enable_cgmt = xyes],
[AC_MSG_ERROR([You need to enable tokenisers to build CG-based MT])])
AM_CONDITIONAL([CAN_CGMT], [test "x$enable_cgmt" != xno])
# Enable building of abbr.txt:
AC_ARG_ENABLE([abbr],
[AS_HELP_STRING([--enable-abbr],
[enable generation of abbr.txt @<:@default=no@:>@])],
[enable_abbr=$enableval],
[enable_abbr=no])
AS_IF([test x$enable_abbr != xno -a \
"$(find ${srcdir}/src/fst/morphology/stems -name "abbreviations.lexc" | head -n 1)" = "" ],
[AC_MSG_ERROR([You asked for abbr.txt generation, but have no file \
src/fst/morphology/stems/abbreviations.lexc])])
AS_IF([test x$enable_abbr = xyes -a x$enable_generators = xno],
[AC_MSG_ERROR([You need to enable generators to build the abbr file])])
AM_CONDITIONAL([WANT_ABBR], [test "x$enable_abbr" != xno])
# Enable emojis in various stuffs - default is 'no' (because slow)
AC_ARG_ENABLE([emoji],
[AS_HELP_STRING([--enable-emoji],
[enable emoji @<:@default=no@:>@])],
[enable_emoji=$enableval],
[enable_emoji=no])
AS_IF([test x$enable_emoji = xyes -a x$enable_transcriptors = xno],
[AC_MSG_ERROR([You need to enable transcriptors to build emojis for spellers])])
AM_CONDITIONAL([WANT_EMOJIS], [test "x$enable_emoji" != xno])
# Enable building tokenisers - default is 'no'
AC_ARG_ENABLE([tokenisers],
[AS_HELP_STRING([--enable-tokenisers],
[enable tokenisers @<:@default=no@:>@])],
[enable_tokenisers=$enableval],
[enable_tokenisers=$enable_all_tools])
AS_IF([test x$enable_tokenisers = xyes -a x$enable_analysers = xno],
[AC_MSG_ERROR([You need to enable analysers to build tokenisers])])
AM_CONDITIONAL([WANT_TOKENISERS], [test "x$enable_tokenisers" != xno])
# Enable analyser tool - default is 'no' (via $enable_all_tools)
AC_ARG_ENABLE([analyser-tool],
[AS_HELP_STRING([--enable-analyser-tool],
[enable analyser tool @<:@default=no@:>@])],
[enable_analyser_tool=$enableval],
[enable_analyser_tool=$enable_all_tools])
AS_IF([test "x$enable_analyser_tool" = "xyes" -a "x$gt_prog_vislcg3" = "xno"],
[enable_analyser_tool=no
AC_MSG_ERROR([vislcg3 missing or too old - required for the analyser tool])])
AS_IF([test x$enable_tokenisers = xno -a x$enable_analyser_tool = xyes],
[AC_MSG_ERROR([You need to enable tokenisers to build the analyser tool])])
AM_CONDITIONAL([WANT_ANL_TOOL], [test "x$enable_analyser_tool" != xno])
# Enable building morphers - default is 'no'
AC_ARG_ENABLE([morpher],
[AS_HELP_STRING([--enable-morpher],
[enable morphological segmenter @<:@default=no@:>@])],
[enable_morpher=$enableval],
[enable_morpher=no])
AM_CONDITIONAL([WANT_MORPHER], [test "x$enable_morpher" != xno])
# Enable dialect-specific analysers and tools, such as spellers:
AC_ARG_ENABLE([dialects],
[AS_HELP_STRING([--enable-dialects],
[build dialect specific fst’s and spellers @<:@default=no@:>@])],
[enable_dialects=$enableval],
[enable_dialects=no])
AS_IF([test "x$enable_dialects" = "xyes" -a "x$DIALECTS" = "x"],
[enable_dialects=no
AC_MSG_ERROR([You have not defined any dialects. Please see the documentation.])])
AM_CONDITIONAL([WANT_DIALECTS], [test "x$enable_dialects" != xno])
# Enable alternative orthographies, OFF by default, even when defined:
AC_ARG_ENABLE([altorths],
[AS_HELP_STRING([--enable-altorths],
[build tools for alternative orthographies @<:@default=no@:>@])],
[enable_altorths=$enableval],
[enable_altorths=no])
AM_CONDITIONAL([WANT_ALT_ORTHS], [test "x$enable_altorths" != xno])
# Enable custom fst's:
AC_ARG_ENABLE([custom-fsts],
[AS_HELP_STRING([--enable-custom-fsts],
[build custom fst’s @<:@default=no@:>@])],
[enable_custom_fsts=$enableval],
[enable_custom_fsts=$DEFAULT_CUSTOM_FSTS])
AM_CONDITIONAL([WANT_CUSTOM_FSTS], [test "x$enable_custom_fsts" != xno])
]) # gt_ENABLE_TARGETS
################################################################################
# Define function to enable optional shared targets
################################################################################
# Usage: gt_USE_SHARED(NAME, SHARED REPONAME, [PKG-CONFIG NAME])
# where, NAME is used as the variable name: gt_SHARED_$NAME, and
# REPONAME is used as directory name and pkg-config name
# PKG-CONFIG NAME is pkg-config name of dependency if different from $2
AC_DEFUN([gt_USE_SHARED],
[
THIS_TOP_SRC_DIR=$BUILD_DIR_PATH/$MYSRCDIR
AC_ARG_WITH([shared-$1],
[AS_HELP_STRING([--with-shared-$1=DIRECTORY],
[search shared-$1 in DIRECTORY @<:@default=../$2@:>@])],
[with_shared_$1=$withval],
[with_shared_$1=false])
AC_MSG_CHECKING([whether we can use shared $1])
# Check in the parent directory:
AS_IF([test x$with_shared_$1 != xfalse], [
gt_SHARED_$1=$with_shared_$1
], [
AS_IF([test -d "$THIS_TOP_SRC_DIR"/../$2 ], [
gt_SHARED_$1="$THIS_TOP_SRC_DIR"/../$2
], [
_gt_pkg_name=m4_default([$3], [$2])
AS_IF([pkg-config --exists $_gt_pkg_name], [
gt_SHARED_$1="$(pkg-config --variable=dir $_gt_pkg_name)"
],
[
gt_SHARED_$1=false
AC_MSG_WARN([Could not find $2 data dir to set $1])
gt_SHARED_FAILS="$2"
])
])
])
AC_MSG_RESULT([$gt_SHARED_$1])
AC_ARG_VAR([gt_SHARED_$1], [directory for shared $1 data])
]) # gt_USE_SHARED
################################################################################
# Define function to require version for shared targets
################################################################################
# Usage: gt_USE_SHARED(NAME, SHARED REPONAME, [PKG-CONFIG NAME], VERSION)
# where, NAME is used as the variable name: gt_SHARED_$NAME, and
# REPONAME is used as directory name and pkg-config name
# PKG-CONFIG NAME is pkg-config name of dependency if different from $2
# VERSION is pkg-config atleast version spec
AC_DEFUN([gt_NEED_SHARED],[
gt_USE_SHARED([$1])
THIS_TOP_SRC_DIR=$BUILD_DIR_PATH/$MYSRCDIR
_gt_shared_$1_min_version=$4
_gt_pkg_name=m4_default([$3], [$2])
AS_IF([test -d "$THIS_TOP_SRC_DIR"/../$2],
[flub=$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$THIS_TOP_SRC_DIR/../$2:$PKG_CONFIG_PATH
PKG_CHECK_MODULES([SHARED_STUFF], [$_gt_pkg_name >= $_gt_shared_$1_min_version],
[AC_MSG_NOTICE([NB using $2 in $THIS_TOP_SRC_DIR/../$2])],
[AC_MSG_ERROR([$2 needs to be updated, cd ../$2 and git pull and build])])
export PKG_CONFIG_PATH=$flub],
[PKG_CHECK_MODULES([SHARED_STUFF], [$_gt_pkg_name >= $_gt_shared_$1_min_version],
[AC_MSG_RESULT([NB using system $2])],
[AC_MSG_ERROR([$3 needs to be updated and installed])])])
]) # gt_NEED_SHARED
################################################################################
# Define function to print the configure footer
################################################################################
AC_DEFUN([gt_PRINT_FOOTER],