| 1 |
# check_search_lm.m4 - Macro to locate textcat.lm files. -*- Autoconf -*- |
| 2 |
# serial 1 |
| 3 |
# |
| 4 |
# Copyright © 2022 Ko van der Sloot <[email protected]> |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This program is distributed in the hope that it will be useful, but |
| 12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
# General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
# |
| 20 |
# As a special exception to the GNU General Public License, if you |
| 21 |
# distribute this file as part of a program that contains a |
| 22 |
# configuration script generated by Autoconf, you may include it under |
| 23 |
# the same distribution terms that you use for the rest of that program. |
| 24 |
|
| 25 |
# AC_SEARCH_LM() |
| 26 |
# ---------------------------------- |
| 27 |
AC_DEFUN([AC_SEARCH_LM], |
| 28 |
[tcdirs="/usr/share/libtextcat /usr/share/libexttextcat /usr/local/share/libtextcat /usr/local/share/libexttextcat /usr/local/Cellar/libtextcat/2.2/share/LM /opt/homebrew/Cellar/libtextcat/2.2/share/LM " |
| 29 |
for d in $tcdirs |
| 30 |
do |
| 31 |
if test -f ${d}/nl.lm |
| 32 |
then |
| 33 |
MODULE_PREFIX=$d |
| 34 |
AC_SUBST([MODULE_PREFIX]) |
| 35 |
nl_found=false |
| 36 |
break |
| 37 |
fi |
| 38 |
done |
| 39 |
|
| 40 |
if test "x$MODULE_PREFIX" = "x" |
| 41 |
then |
| 42 |
for d in $tcdirs |
| 43 |
do |
| 44 |
if test -f ${d}/dutch.lm |
| 45 |
then |
| 46 |
MODULE_PREFIX=$d |
| 47 |
AC_SUBST([MODULE_PREFIX]) |
| 48 |
nl_found=true |
| 49 |
break |
| 50 |
fi |
| 51 |
done |
| 52 |
fi |
| 53 |
if test "x$MODULE_PREFIX" = "x" |
| 54 |
then |
| 55 |
AC_MSG_NOTICE([textcat Language Model files not found. Textcat disabled.]) |
| 56 |
else |
| 57 |
TEXTCAT_FOUND=1 |
| 58 |
fi |
| 59 |
AM_CONDITIONAL([OLD_LM], [test x$nl_found = xtrue]) |
| 60 |
]) |