diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 22ea2abb071d53cce2c0d989789c475aca920313..0000000000000000000000000000000000000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -sudo: required -dist: trusty -language: cpp - -addons: - apt: - packages: - - libxml++2.6-dev - - libarchive-dev - -script: - - autoreconf -fi - - ./configure --disable-static --enable-zhfst - - make -j3 - - make -j1 check diff --git a/ChangeLog b/ChangeLog index 5d7b7cadae6fd5c640f9ae70dc2576870840f326..0951df44d0e0c262113a24bd16c966b327b10c64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -678d45d (HEAD -> master, origin/master, origin/HEAD) Treat all tests as XFAIL_TESTS if zhfst support is disabled. +a949408 (HEAD -> master, origin/master, origin/HEAD) ICU is namespaced in newer versions (fixes #42) +e272cd2 Change correction finding order (issue #28); Require C++1y (C++14) +0521ea9 (tag: v0.5.0) Copyright extends to 2018. +e16dcbb Ready for release 0.5.0. +678d45d Treat all tests as XFAIL_TESTS if zhfst support is disabled. a3f39d9 Merge pull request #31 from hfst/configure-explicit-error bc1c9ea Separate counters (fixes #37, closes #38) a4aeae0 Post-case-mangling unique test diff --git a/ChangeLog.old b/ChangeLog.old index 34083830864664d62da35f8f86d40703073b8f8a..5d7b7cadae6fd5c640f9ae70dc2576870840f326 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -1,4 +1,21 @@ -4f2026c (HEAD -> master, origin/master, origin/HEAD) Add missing files to dist. +678d45d (HEAD -> master, origin/master, origin/HEAD) Treat all tests as XFAIL_TESTS if zhfst support is disabled. +a3f39d9 Merge pull request #31 from hfst/configure-explicit-error +bc1c9ea Separate counters (fixes #37, closes #38) +a4aeae0 Post-case-mangling unique test +1d088e1 Avoid shadowing multicharacter ascii-beginning symbols +69ab95d Merge pull request #35 from unhammer/renamespace-hfst_ol +d39b93c rename hfst_ol namespace to hfst_ospell to avoid conflicts +eccbd6f Bump actual version; Modernize for() loops +a9919f4 Merge pull request #33 from unhammer/analysisSymbols +f36de02 bump minor version because of new API function +019f303 New API fn analyseSymbols giving unconcatenated vector<string>'s +da508b7 Dirty hack to parse XML a bit better; ToDo: use actual portable XML library +dad7c5c Minimal XML parsing to get locale, title, and description for Voikko and other frontends +f40d4b5 (origin/configure-explicit-error) let './configure --enable-zhfst' fail if no libarchive found +a737b52 When using help2man remember -n description +1fc3fca Update copyright and authors listing +d791a41 (tag: v0.4.5) Release 0.4.5. +4f2026c Add missing files to dist. bae21c3 Forgot to commit configure.ac... Update hfst-ospell manual and add man pages to dist. 7c8690a (tag: v0.4.4) Ready for release 0.4.4. 671efe6 Trusty has C++11 diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 5458714e1e2cb289572992ad92eceffc848f64d6..0000000000000000000000000000000000000000 --- a/INSTALL +++ /dev/null @@ -1,234 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Makefile.am b/Makefile.am index 251482a9303d79004ac9c7220b928e3e5f24dbc5..922cefcba2e7248522d9f2814af54f11443af97a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,7 @@ endif libhfstospell_la_SOURCES=hfst-ol.cc ospell.cc \ ZHfstOspeller.cc ZHfstOspellerXmlMetadata.cc libhfstospell_la_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) $(PKG_CXXFLAGS) -libhfstospell_la_LDFLAGS=-no-undefined -version-info 10:0:0 \ +libhfstospell_la_LDFLAGS=-no-undefined -version-info 11:0:0 \ $(PKG_LIBS) # link sample program against library here diff --git a/NEWS b/NEWS index 5504f47e02ef69dcf4d099528c5377aaae5c2efc..d31cb6e0d44894ea98fca54d51a935f7767563e2 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,13 @@ NEWS for hfst-ospell This file contains all noteworthy changes in HFST-ospell development between releases. For full listing of changes see ChangeLog. +Noteworthy changes in 0.5.1 +--------------------------- + +* change correction finding order (fixes issue #28) +* require C++1y (C++14) +* observe ICU namespacing (fixes issue #42) + Noteworthy changes in 0.5.0 --------------------------- diff --git a/ZHfstOspeller.cc b/ZHfstOspeller.cc index 0a39e3d48effd93d2da06517c5900d888428c193..b5b4886889b5715abb95e1196ed5822f765653fd 100644 --- a/ZHfstOspeller.cc +++ b/ZHfstOspeller.cc @@ -37,6 +37,12 @@ using std::map; #include "hfst-ol.h" #include "ZHfstOspeller.h" +#ifdef WIN32 +#include <io.h> +#include <fcntl.h> +#include <windows.h> +#endif + namespace hfst_ospell { @@ -85,19 +91,30 @@ inline Transducer* transducer_to_mem(archive* ar, archive_entry* entry) { } inline char* extract_to_tmp_dir(archive* ar) { - char* rv = strdup("/tmp/zhfstospellXXXXXXXX"); +#ifdef WIN32 + char rv[MAX_PATH+1]; + if (!GetTempPathA(MAX_PATH, rv)) { + throw ZHfstZipReadingError("Could not get temporary path"); + } + strcat(rv, "zhfstospellXXXXXX"); + mktemp(rv); + int temp_fd = open(rv, _O_CREAT | _O_TRUNC | _O_RDWR); +#else + char rv[] = "/tmp/zhfstospellXXXXXXXX"; int temp_fd = mkstemp(rv); +#endif int rr = archive_read_data_into_fd(ar, temp_fd); if ((rr != ARCHIVE_EOF) && (rr != ARCHIVE_OK)) { throw ZHfstZipReadingError("Archive not EOF'd or OK'd"); } close(temp_fd); - return rv; + return strdup(rv); } inline Transducer* transducer_to_tmp_dir(archive* ar) { char *filename = extract_to_tmp_dir(ar); FILE* f = fopen(filename, "rb"); + free(filename); if (f == nullptr) { throw ZHfstTemporaryWritingError("reading acceptor back from temp file"); } @@ -397,6 +414,7 @@ ZHfstOspeller::read_zhfst(const string& filename) catch (...) { char* temporary = extract_to_tmp_dir(ar); metadata_.read_xml(temporary); + free(temporary); } } else diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index f006c5c520ec13961417b80e9171bb30f24c5063..0000000000000000000000000000000000000000 --- a/autogen.sh +++ /dev/null @@ -1,1491 +0,0 @@ -#!/bin/sh -# a u t o g e n . s h -# -# Copyright (c) 2005-2007 United States Government as represented by -# the U.S. Army Research Laboratory. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -### -# -# Script for automatically preparing the sources for compilation by -# performing the myrid of necessary steps. The script attempts to -# detect proper version support, and outputs warnings about particular -# systems that have autotool peculiarities. -# -# Basically, if everything is set up and installed correctly, the -# script will validate that minimum versions of the GNU Build System -# tools are installed, account for several common configuration -# issues, and then simply run autoreconf for you. -# -# If autoreconf fails, which can happen for many valid configurations, -# this script proceeds to run manual preparation steps effectively -# providing a POSIX shell script (mostly complete) reimplementation of -# autoreconf. -# -# The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER -# environment variables and corresponding _OPTIONS variables (e.g. -# AUTORECONF_OPTIONS) may be used to override the default automatic -# detection behaviors. Similarly the _VERSION variables will override -# the minimum required version numbers. -# -# Examples: -# -# To obtain help on usage: -# ./autogen.sh --help -# -# To obtain verbose output: -# ./autogen.sh --verbose -# -# To skip autoreconf and prepare manually: -# AUTORECONF=false ./autogen.sh -# -# To verbosely try running with an older (unsupported) autoconf: -# AUTOCONF_VERSION=2.50 ./autogen.sh --verbose -# -# Author: Christopher Sean Morrison <morrison@brlcad.org> -# -###################################################################### - -# set to minimum acceptible version of autoconf -if [ "x$AUTOCONF_VERSION" = "x" ] ; then - AUTOCONF_VERSION=2.52 -fi -# set to minimum acceptible version of automake -if [ "x$AUTOMAKE_VERSION" = "x" ] ; then - AUTOMAKE_VERSION=1.6.0 -fi -# set to minimum acceptible version of libtool -if [ "x$LIBTOOL_VERSION" = "x" ] ; then - LIBTOOL_VERSION=1.4.2 -fi - - -################## -# ident function # -################## -ident ( ) { - # extract copyright from header - __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`" - if [ "x$__copyright" = "x" ] ; then - __copyright="`date +%Y`" - fi - - # extract version from CVS Id string - __id="$Id$" - __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`" - if [ "x$__version" = "x" ] ; then - __version="" - fi - - echo "autogen.sh build preparation script by Christopher Sean Morrison" - echo "revised 3-clause BSD-style license, copyright (c) $__copyright" - echo "script version $__version, ISO/IEC 9945 POSIX shell script" -} - - -################## -# USAGE FUNCTION # -################## -usage ( ) { - echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [--version]" - echo " --help Help on $NAME_OF_AUTOGEN usage" - echo " --verbose Verbose progress output" - echo " --quiet Quiet suppressed progress output" - echo " --version Only perform GNU Build System version checks" - echo - echo "Description: This script will validate that minimum versions of the" - echo "GNU Build System tools are installed and then run autoreconf for you." - echo "Should autoreconf fail, manual preparation steps will be run" - echo "potentially accounting for several common preparation issues. The" - - echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER," - echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS" - echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the" - echo "default automatic detection behavior." - echo - - ident - - return 0 -} - - -########################## -# VERSION_ERROR FUNCTION # -########################## -version_error ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided a version" - exit 1 - fi - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided an application name" - exit 1 - fi - $ECHO - $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch," - $ECHO " at least version $1 of $2 must be installed." - $ECHO - $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will" - $ECHO "run configure or make. Either the GNU Autotools will need to be installed" - $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source" - $ECHO "code on another system and then transferred to here. -- Cheers!" - $ECHO -} - -########################## -# VERSION_CHECK FUNCTION # -########################## -version_check ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_check was not provided a minimum version" - exit 1 - fi - _min="$1" - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version check was not provided a comparison version" - exit 1 - fi - _cur="$2" - - # needed to handle versions like 1.10 and 1.4-p6 - _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - - _min_major="`echo $_min | cut -d. -f1`" - _min_minor="`echo $_min | cut -d. -f2`" - _min_patch="`echo $_min | cut -d. -f3`" - - _cur_major="`echo $_cur | cut -d. -f1`" - _cur_minor="`echo $_cur | cut -d. -f2`" - _cur_patch="`echo $_cur | cut -d. -f3`" - - if [ "x$_min_major" = "x" ] ; then - _min_major=0 - fi - if [ "x$_min_minor" = "x" ] ; then - _min_minor=0 - fi - if [ "x$_min_patch" = "x" ] ; then - _min_patch=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_major=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_minor=0 - fi - if [ "x$_cur_patch" = "x" ] ; then - _cur_patch=0 - fi - - $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}" - - if [ $_min_major -lt $_cur_major ] ; then - return 0 - elif [ $_min_major -eq $_cur_major ] ; then - if [ $_min_minor -lt $_cur_minor ] ; then - return 0 - elif [ $_min_minor -eq $_cur_minor ] ; then - if [ $_min_patch -lt $_cur_patch ] ; then - return 0 - elif [ $_min_patch -eq $_cur_patch ] ; then - return 0 - fi - fi - fi - return 1 -} - - -###################################### -# LOCATE_CONFIGURE_TEMPLATE FUNCTION # -###################################### -locate_configure_template ( ) { - _pwd="`pwd`" - if test -f "./configure.ac" ; then - echo "./configure.ac" - elif test -f "./configure.in" ; then - echo "./configure.in" - elif test -f "$_pwd/configure.ac" ; then - echo "$_pwd/configure.ac" - elif test -f "$_pwd/configure.in" ; then - echo "$_pwd/configure.in" - elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then - echo "$PATH_TO_AUTOGEN/configure.ac" - elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then - echo "$PATH_TO_AUTOGEN/configure.in" - fi -} - - -################## -# argument check # -################## -ARGS="$*" -PATH_TO_AUTOGEN="`dirname $0`" -NAME_OF_AUTOGEN="`basename $0`" -AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN" - -LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4" - -if [ "x$HELP" = "x" ] ; then - HELP=no -fi -if [ "x$QUIET" = "x" ] ; then - QUIET=no -fi -if [ "x$VERBOSE" = "x" ] ; then - VERBOSE=no -fi -if [ "x$VERSION_ONLY" = "x" ] ; then - VERSION_ONLY=no -fi -if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then - AUTORECONF_OPTIONS="-i -f" -fi -if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then - AUTOCONF_OPTIONS="-f" -fi -if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then - AUTOMAKE_OPTIONS="-a -c -f" -fi -ALT_AUTOMAKE_OPTIONS="-a -c" -if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then - LIBTOOLIZE_OPTIONS="--automake -c -f" -fi -ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force" -if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then - ACLOCAL_OPTIONS="" -fi -if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then - AUTOHEADER_OPTIONS="" -fi -for arg in $ARGS ; do - case "x$arg" in - x--help) HELP=yes ;; - x-[hH]) HELP=yes ;; - x--quiet) QUIET=yes ;; - x-[qQ]) QUIET=yes ;; - x--verbose) VERBOSE=yes ;; - x-[vV]) VERBOSE=yes ;; - x--version) VERSION_ONLY=yes ;; - *) - echo "Unknown option: $arg" - echo - usage - exit 1 - ;; - esac -done - - -##################### -# environment check # -##################### - -# sanity check before recursions potentially begin -if [ ! -f "$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: $AUTOGEN_SH does not exist" - if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH" - fi - exit 1 -fi - -# force locale setting to C so things like date output as expected -LC_ALL=C - -# commands that this script expects -for __cmd in echo head tail pwd ; do - echo "test" | $__cmd > /dev/null 2>&1 - if [ $? != 0 ] ; then - echo "INTERNAL ERROR: '${__cmd}' command is required" - exit 2 - fi -done -echo "test" | grep "test" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: grep command is required" - exit 1 -fi -echo "test" | sed "s/test/test/" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: sed command is required" - exit 1 -fi - - -# determine the behavior of echo -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -# determine the behavior of head -case "x`echo 'head' | head -n 1 2>&1`" in - *xhead*) HEAD_N="n " ;; - *) HEAD_N="" ;; -esac - -# determine the behavior of tail -case "x`echo 'tail' | tail -n 1 2>&1`" in - *xtail*) TAIL_N="n " ;; - *) TAIL_N="" ;; -esac - -VERBOSE_ECHO=: -ECHO=: -if [ "x$QUIET" = "xyes" ] ; then - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output quelled by quiet option. Further output disabled." - fi -else - ECHO=echo - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output enabled" - VERBOSE_ECHO=echo - fi -fi - - -# allow a recursive run to disable further recursions -if [ "x$RUN_RECURSIVE" = "x" ] ; then - RUN_RECURSIVE=yes -fi - - -################################################ -# check for help arg and bypass version checks # -################################################ -if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then - HELP=yes -fi -if [ "x$HELP" = "xyes" ] ; then - usage - $ECHO "---" - $ECHO "Help was requested. No preparation or configuration will be performed." - exit 0 -fi - - -####################### -# set up signal traps # -####################### -untrap_abnormal ( ) { - for sig in 1 2 13 15; do - trap - $sig - done -} - -# do this cleanup whenever we exit. -trap ' - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # restore/delete backup files - if test "x$PFC_INIT" = "x1" ; then - recursive_restore - fi -' 0 - -# trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15) -for sig in 1 2 13 15; do - trap ' - $ECHO "" - $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'" - - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # clean up on abnormal exit - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - - if test -f "acinclude.m4.$$.backup" ; then - $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4" - chmod u+w acinclude.m4 - cat acinclude.m4.$$.backup > acinclude.m4 - - $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup" - rm -f acinclude.m4.$$.backup - fi - - { (exit 1); exit 1; } -' $sig -done - - -############################# -# look for a configure file # -############################# -if [ "x$CONFIGURE" = "x" ] ; then - CONFIGURE="`locate_configure_template`" - if [ ! "x$CONFIGURE" = "x" ] ; then - $VERBOSE_ECHO "Found a configure template: $CONFIGURE" - fi -else - $ECHO "Using CONFIGURE environment variable override: $CONFIGURE" -fi -if [ "x$CONFIGURE" = "x" ] ; then - if [ "x$VERSION_ONLY" = "xyes" ] ; then - CONFIGURE=/dev/null - else - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi -fi - -#################### -# get project name # -#################### -if [ "x$PROJECT" = "x" ] ; then - PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if [ "x$PROJECT" = "xAC_INIT" ] ; then - # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead - PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - fi - if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then - PROJECT="project" - fi - if [ "x$PROJECT" = "x" ] ; then - PROJECT="project" - fi -else - $ECHO "Using PROJECT environment variable override: $PROJECT" -fi -$ECHO "Preparing the $PROJECT build system...please wait" -$ECHO - - -######################## -# check for autoreconf # -######################## -HAVE_AUTORECONF=no -if [ "x$AUTORECONF" = "x" ] ; then - for AUTORECONF in autoreconf ; do - $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version" - $AUTORECONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - HAVE_AUTORECONF=yes - break - fi - done -else - HAVE_AUTORECONF=yes - $ECHO "Using AUTORECONF environment variable override: $AUTORECONF" -fi - - -########################## -# autoconf version check # -########################## -_acfound=no -if [ "x$AUTOCONF" = "x" ] ; then - for AUTOCONF in autoconf ; do - $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version" - $AUTOCONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _acfound=yes - break - fi - done -else - _acfound=yes - $ECHO "Using AUTOCONF environment variable override: $AUTOCONF" -fi - -_report_error=no -if [ ! "x$_acfound" = "xyes" ] ; then - $ECHO "ERROR: Unable to locate GNU Autoconf." - _report_error=yes -else - _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Autoconf version $_version" - version_check "$AUTOCONF_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOCONF_VERSION" "GNU Autoconf" - exit 1 -fi - - -########################## -# automake version check # -########################## -_amfound=no -if [ "x$AUTOMAKE" = "x" ] ; then - for AUTOMAKE in automake ; do - $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version" - $AUTOMAKE --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _amfound=yes - break - fi - done -else - _amfound=yes - $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE" -fi - - -_report_error=no -if [ ! "x$_amfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Automake." - _report_error=yes -else - _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Automake version $_version" - version_check "$AUTOMAKE_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOMAKE_VERSION" "GNU Automake" - exit 1 -fi - - -######################## -# check for libtoolize # -######################## -HAVE_LIBTOOLIZE=yes -HAVE_ALT_LIBTOOLIZE=no -_ltfound=no -if [ "x$LIBTOOLIZE" = "x" ] ; then - LIBTOOLIZE=libtoolize - $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version" - $LIBTOOLIZE --version > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - HAVE_LIBTOOLIZE=no - $ECHO - if [ "x$HAVE_AUTORECONF" = "xno" ] ; then - $ECHO "Warning: libtoolize does not appear to be available." - else - $ECHO "Warning: libtoolize does not appear to be available. This means that" - $ECHO "the automatic build preparation via autoreconf will probably not work." - $ECHO "Preparing the build by running each step individually, however, should" - $ECHO "work and will be done automatically for you if autoreconf fails." - fi - - # look for some alternates - for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do - $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version" - _glibtoolize="`$tool --version > /dev/null 2>&1`" - if [ $? = 0 ] ; then - $VERBOSE_ECHO "Found $tool --version" - _glti="`which $tool`" - if [ "x$_glti" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool with which" - continue; - fi - if test ! -f "$_glti" ; then - $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file" - continue; - fi - _gltidir="`dirname $_glti`" - if [ "x$_gltidir" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti" - continue; - fi - if test ! -d "$_gltidir" ; then - $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory" - continue; - fi - HAVE_ALT_LIBTOOLIZE=yes - LIBTOOLIZE="$tool" - $ECHO - $ECHO "Fortunately, $tool was found which means that your system may simply" - $ECHO "have a non-standard or incomplete GNU Autotools install. If you have" - $ECHO "sufficient system access, it may be possible to quell this warning by" - $ECHO "running:" - $ECHO - sudo -V > /dev/null 2>&1 - if [ $? = 0 ] ; then - $ECHO " sudo ln -s $_glti $_gltidir/libtoolize" - $ECHO - else - $ECHO " ln -s $_glti $_gltidir/libtoolize" - $ECHO - $ECHO "Run that as root or with proper permissions to the $_gltidir directory" - $ECHO - fi - _ltfound=yes - break - fi - done - else - _ltfound=yes - fi -else - _ltfound=yes - $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE" -fi - - -############################ -# libtoolize version check # -############################ -_report_error=no -if [ ! "x$_ltfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Libtool." - _report_error=yes -else - _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Libtool version $_version" - version_check "$LIBTOOL_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$LIBTOOL_VERSION" "GNU Libtool" - exit 1 -fi - - -##################### -# check for aclocal # -##################### -if [ "x$ACLOCAL" = "x" ] ; then - for ACLOCAL in aclocal ; do - $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version" - $ACLOCAL --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using ACLOCAL environment variable override: $ACLOCAL" -fi - - -######################## -# check for autoheader # -######################## -if [ "x$AUTOHEADER" = "x" ] ; then - for AUTOHEADER in autoheader ; do - $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version" - $AUTOHEADER --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER" -fi - - -######################### -# check if version only # -######################### -$VERBOSE_ECHO "Checking whether to only output version information" -if [ "x$VERSION_ONLY" = "xyes" ] ; then - $ECHO - ident - $ECHO "---" - $ECHO "Version requested. No preparation or configuration will be performed." - exit 0 -fi - - -################################# -# PROTECT_FROM_CLOBBER FUNCTION # -################################# -protect_from_clobber ( ) { - PFC_INIT=1 - - # protect COPYING & INSTALL from overwrite by automake. the - # automake force option will (inappropriately) ignore the existing - # contents of a COPYING and/or INSTALL files (depending on the - # version) instead of just forcing *missing* files like it does - # for AUTHORS, NEWS, and README. this is broken but extremely - # prevalent behavior, so we protect against it by keeping a backup - # of the file that can later be restored. - - if test -f COPYING ; then - if test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up COPYING in `pwd`" - else - $VERBOSE_ECHO "Backing up COPYING in `pwd`" - $VERBOSE_ECHO "cp -p COPYING COPYING.$$.protect_from_automake.backup" - cp -p COPYING COPYING.$$.protect_from_automake.backup - fi - fi - if test -f INSTALL ; then - if test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up INSTALL in `pwd`" - else - $VERBOSE_ECHO "Backing up INSTALL in `pwd`" - $VERBOSE_ECHO "cp -p INSTALL INSTALL.$$.protect_from_automake.backup" - cp -p INSTALL INSTALL.$$.protect_from_automake.backup - fi - fi -} - - -############################## -# RECURSIVE_PROTECT FUNCTION # -############################## -recursive_protect ( ) { - - # for projects using recursive configure, run the build - # preparation steps for the subdirectories. this function assumes - # START_PATH was set to pwd before recursion begins so that - # relative paths work. - - # git 'r done, protect COPYING and INSTALL from being clobbered - protect_from_clobber - - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure" - - # look for subdirs - # $VERBOSE_ECHO "Looking for subdirs in `pwd`" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Protecting files from automake in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r done - recursive_protect - done - fi -} # end of recursive_protect - - -############################# -# RESTORE_CLOBBERED FUNCION # -############################# -restore_clobbered ( ) { - - # The automake (and autoreconf by extension) -f/--force-missing - # option may overwrite COPYING and INSTALL even if they do exist. - # Here we restore the files if necessary. - - spacer=no - - # COPYING - if test -f COPYING.$$.protect_from_automake.backup ; then - if test -f COPYING ; then - # compare entire content, restore if needed - if test "x`cat COPYING`" != "x`cat COPYING.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring COPYING from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f COPYING" - rm -f COPYING - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # check contents - elif test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # -f COPYING - - # just in case - $VERBOSE_ECHO "rm -f COPYING.$$.protect_from_automake.backup" - rm -f COPYING.$$.protect_from_automake.backup - fi # -f COPYING.$$.protect_from_automake.backup - - # INSTALL - if test -f INSTALL.$$.protect_from_automake.backup ; then - if test -f INSTALL ; then - # compare entire content, restore if needed - if test "x`cat INSTALL`" != "x`cat INSTALL.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring INSTALL from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f INSTALL" - rm -f INSTALL - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # check contents - elif test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # -f INSTALL - - # just in case - $VERBOSE_ECHO "rm -f INSTALL.$$.protect_from_automake.backup" - rm -f INSTALL.$$.protect_from_automake.backup - fi # -f INSTALL.$$.protect_from_automake.backup - - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - return - fi - - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - fi - - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\"" - rm -f "${_aux_dir}/${file}.backup" - fi - done -} # end of restore_clobbered - - -############################## -# RECURSIVE_RESTORE FUNCTION # -############################## -recursive_restore ( ) { - - # restore COPYING and INSTALL from backup if they were clobbered - # for each directory recursively. - - # git 'r undone - restore_clobbered - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - - # look for subdirs - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Checking files for automake damage in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r undone - recursive_restore - done - fi -} # end of recursive_restore - - -####################### -# INITIALIZE FUNCTION # -####################### -initialize ( ) { - - # this routine performs a variety of directory-specific - # initializations. some are sanity checks, some are preventive, - # and some are necessary setup detection. - # - # this function sets: - # CONFIGURE - # SEARCH_DIRS - # CONFIG_SUBDIRS - - ################################## - # check for a configure template # - ################################## - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi - - ##################### - # detect an aux dir # - ##################### - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - else - $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir" - fi - - ################################ - # detect a recursive configure # - ################################ - CONFIG_SUBDIRS="" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir" - CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir" - fi - done - - ########################################## - # make sure certain required files exist # - ########################################## - for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do - if test ! -f $file ; then - $VERBOSE_ECHO "Touching ${file} since it does not exist" - touch $file - fi - done - - ################################################## - # make sure certain generated files do not exist # - ################################################## - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\"" - mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup" - fi - done - - ############################ - # search alternate m4 dirs # - ############################ - SEARCH_DIRS="" - for dir in m4 ; do - if [ -d $dir ] ; then - $VERBOSE_ECHO "Found extra aclocal search directory: $dir" - SEARCH_DIRS="$SEARCH_DIRS -I $dir" - fi - done - - ###################################### - # remove any previous build products # - ###################################### - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi -# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it -# if test -f aclocal.m4 ; then -# $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it" -# $VERBOSE_ECHO "rm -f aclocal.m4" -# rm -f aclocal.m4 -# fi - -} # end of initialize() - - -############## -# initialize # -############## - -# stash path -START_PATH="`pwd`" - -# Before running autoreconf or manual steps, some prep detection work -# is necessary or useful. Only needs to occur once per directory, but -# does need to traverse the entire subconfigure hierarchy to protect -# files from being clobbered even by autoreconf. -recursive_protect - -# start from where we started -cd "$START_PATH" - -# get ready to process -initialize - - -############################################ -# prepare build via autoreconf or manually # -############################################ -reconfigure_manually=no -if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then - $ECHO - $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C" - - $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS" - autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoreconf_output" - - if [ ! $ret = 0 ] ; then - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then - $ECHO - $ECHO "Warning: autoreconf failed but due to what is usually a common libtool" - $ECHO "misconfiguration issue. This problem is encountered on systems that" - $ECHO "have installed libtoolize under a different name without providing a" - $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable." - $ECHO - $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE" - - export LIBTOOLIZE - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi - - $ECHO "Warning: $AUTORECONF failed" - - if test -f ltmain.sh ; then - $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should" - fi - - $ECHO "Attempting to run the preparation steps individually" - reconfigure_manually=yes - fi -else - reconfigure_manually=yes -fi - - -############################ -# LIBTOOL_FAILURE FUNCTION # -############################ -libtool_failure ( ) { - - # libtool is rather error-prone in comparison to the other - # autotools and this routine attempts to compensate for some - # common failures. the output after a libtoolize failure is - # parsed for an error related to AC_PROG_LIBTOOL and if found, we - # attempt to inject a project-provided libtool.m4 file. - - _autoconf_output="$1" - - if [ "x$RUN_RECURSIVE" = "xno" ] ; then - # we already tried the libtool.m4, don't try again - return 1 - fi - - if test -f "$LIBTOOL_M4" ; then - found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`" - if test ! "x$found_libtool" = "x" ; then - if test -f acinclude.m4 ; then - rm -f acinclude.m4.$$.backup - $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup" - cat acinclude.m4 > acinclude.m4.$$.backup - fi - $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4" - chmod u+w acinclude.m4 - cat "$LIBTOOL_M4" >> acinclude.m4 - - # don't keep doing this - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $ECHO - $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4" - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi -} - - -########################### -# MANUAL_AUTOGEN FUNCTION # -########################### -manual_autogen ( ) { - - ################################################## - # Manual preparation steps taken are as follows: # - # aclocal [-I m4] # - # libtoolize --automake -c -f # - # aclocal [-I m4] # - # autoconf -f # - # autoheader # - # automake -a -c -f # - ################################################## - - ########### - # aclocal # - ########### - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi - - ############## - # libtoolize # - ############## - need_libtoolize=no - for feature in AC_PROG_LIBTOOL LT_INIT ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_libtoolize=yes - break - fi - done - if [ "x$need_libtoolize" = "xyes" ] ; then - if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - else - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - fi - fi - - ########### - # aclocal # - ########### - # re-run again as instructed by libtoolize - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - - # libtoolize might put ltmain.sh in the wrong place - if test -f ltmain.sh ; then - if test ! -f "${_aux_dir}/ltmain.sh" ; then - $ECHO - $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory" - $ECHO - $ECHO "Fortunately, the problem can be worked around by simply copying the" - $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you." - $ECHO - $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\"" - cp -p ltmain.sh "${_aux_dir}/ltmain.sh" - $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" - fi - fi # ltmain.sh - fi # need_libtoolize - - ############ - # autoconf # - ############ - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS" - autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # retry without the -f and check for usage of macros that are too new - ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE" - ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE" - ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T" - - macros_to_search="" - ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`" - ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`" - - if [ $ac_major -lt 2 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - else - if [ $ac_minor -lt 54 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - elif [ $ac_minor -lt 55 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros" - elif [ $ac_minor -lt 59 ] ; then - macros_to_search="$ac2_59_macros" - fi - fi - - configure_ac_macros=__none__ - for feature in $macros_to_search ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - if [ "x$configure_ac_macros" = "x__none__" ] ; then - configure_ac_macros="$feature" - else - configure_ac_macros="$feature $configure_ac_macros" - fi - fi - done - if [ ! "x$configure_ac_macros" = "x__none__" ] ; then - $ECHO - $ECHO "Warning: Unsupported macros were found in $CONFIGURE" - $ECHO - $ECHO "The `echo $CONFIGURE | basename` file was scanned in order to determine if any" - $ECHO "unsupported macros are used that exceed the minimum version" - $ECHO "settings specified within this file. As such, the following macros" - $ECHO "should be removed from configure.ac or the version numbers in this" - $ECHO "file should be increased:" - $ECHO - $ECHO "$configure_ac_macros" - $ECHO - $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C" - fi - - ################### - # autoconf, retry # - ################### - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF" - autoconf_output="`$AUTOCONF 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # test if libtool is busted - libtool_failure "$autoconf_output" - - # let the user know what went wrong - cat <<EOF -$autoconf_output -EOF - $ECHO "ERROR: $AUTOCONF failed" - exit 2 - else - # autoconf sans -f and possibly sans unsupported options succeed so warn verbosely - $ECHO - $ECHO "Warning: autoconf seems to have succeeded by removing the following options:" - $ECHO " AUTOCONF_OPTIONS=\"$AUTOCONF_OPTIONS\"" - $ECHO - $ECHO "Removing those options should not be necessary and indicate some other" - $ECHO "problem with the build system. The build preparation is highly suspect" - $ECHO "and may result in configuration or compilation errors. Consider" - if [ "x$VERBOSE_ECHO" = "x:" ] ; then - $ECHO "rerunning the build preparation with verbose output enabled." - $ECHO " $AUTOGEN_SH --verbose" - else - $ECHO "reviewing the minimum GNU Autotools version settings contained in" - $ECHO "this script along with the macros being used in your `echo $CONFIGURE | basename` file." - fi - $ECHO - $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" - fi # autoconf ret = 0 - fi # autoconf ret = 0 - - ############## - # autoheader # - ############## - need_autoheader=no - for feature in AM_CONFIG_HEADER AC_CONFIG_HEADER ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_autoheader=yes - break - fi - done - if [ "x$need_autoheader" = "xyes" ] ; then - $VERBOSE_ECHO "$AUTOHEADER $AUTOHEADER_OPTIONS" - autoheader_output="`$AUTOHEADER $AUTOHEADER_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoheader_output" - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $AUTOHEADER failed" && exit 2 ; fi - fi # need_autoheader - - ############ - # automake # - ############ - need_automake=no - for feature in AM_INIT_AUTOMAKE ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_automake=yes - break - fi - done - - if [ "x$need_automake" = "xyes" ] ; then - $VERBOSE_ECHO "$AUTOMAKE $AUTOMAKE_OPTIONS" - automake_output="`$AUTOMAKE $AUTOMAKE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$automake_output" - - if [ ! $ret = 0 ] ; then - - ################### - # automake, retry # - ################### - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOMAKE $ALT_AUTOMAKE_OPTIONS" - # retry without the -f - automake_output="`$AUTOMAKE $ALT_AUTOMAKE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$automake_output" - - if [ ! $ret = 0 ] ; then - # test if libtool is busted - libtool_failure "$automake_output" - - # let the user know what went wrong - cat <<EOF -$automake_output -EOF - $ECHO "ERROR: $AUTOMAKE failed" - exit 2 - fi # automake retry - fi # automake ret = 0 - fi # need_automake -} # end of manual_autogen - - -##################################### -# RECURSIVE_MANUAL_AUTOGEN FUNCTION # -##################################### -recursive_manual_autogen ( ) { - - # run the build preparation steps manually for this directory - manual_autogen - - # for projects using recursive configure, run the build - # preparation steps for the subdirectories. - if [ ! "x$CONFIG_SUBDIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively configuring the following directories:" - $VERBOSE_ECHO " $CONFIG_SUBDIRS" - for dir in $CONFIG_SUBDIRS ; do - $VERBOSE_ECHO "Processing recursive configure in $dir" - cd "$START_PATH" - cd "$dir" - - # new directory, prepare - initialize - - # run manual steps for the subdir and any others below - recursive_manual_autogen - done - fi -} - - -################################ -# run manual preparation steps # -################################ -if [ "x$reconfigure_manually" = "xyes" ] ; then - $ECHO - $ECHO $ECHO_N "Preparing build ... $ECHO_C" - - recursive_manual_autogen -fi - - -######################### -# restore and summarize # -######################### -cd "$START_PATH" - -# restore COPYING and INSTALL from backup if necessary -recursive_restore - -# make sure we end up with a configure script -config_ac="`locate_configure_template`" -config="`echo $config_ac | sed 's/\.ac$//' | sed 's/\.in$//'`" -if [ "x$config" = "x" ] ; then - $VERBOSE_ECHO "Could not locate the configure template (from `pwd`)" -fi - -# summarize -$ECHO "done" -$ECHO -if test "x$config" = "x" -o ! -f "$config" ; then - $ECHO "WARNING: The $PROJECT build system should now be prepared but there" - $ECHO "does not seem to be a resulting configure file. This is unexpected" - $ECHO "and likely the result of an error. You should run $NAME_OF_AUTOGEN" - $ECHO "with the --verbose option to get more details on a potential" - $ECHO "misconfiguration." -else - $ECHO "The $PROJECT build system is now prepared. To build here, run:" - $ECHO " $config" - $ECHO " make" -fi - - -# Local Variables: -# mode: sh -# tab-width: 8 -# sh-basic-offset: 4 -# sh-indentation: 4 -# indent-tabs-mode: t -# End: -# ex: shiftwidth=4 tabstop=8 diff --git a/configure.ac b/configure.ac index 71fadab63998bd94b52a96fe76cdcca510ee8418..44ae27dd693a694264cd2a53887eebe97f65b657 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ # autoconf requirements AC_PREREQ([2.62]) -AC_INIT([hfstospell], [0.5.0], [hfst-bugs@helsinki.fi], [hfstospell], [http://hfst.github.io]) +AC_INIT([hfstospell], [0.5.2], [hfst-bugs@helsinki.fi], [hfstospell], [http://hfst.github.io]) LT_PREREQ([2.2.6]) @@ -34,16 +34,14 @@ AC_CONFIG_HEADERS([config.h]) HFSTOSPELL_NAME=hfstospell HFSTOSPELL_MAJOR=0 HFSTOSPELL_MINOR=5 -HFSTOSPELL_EXTENSION=.0 +HFSTOSPELL_EXTENSION=.2 HFSTOSPELL_VERSION=$HFSTOSPELL_MAJOR.$HFSTOSPELL_MINOR$HFSTOSPELL_EXTENSION AC_SUBST(HFSTOSPELL_MAJOR) AC_SUBST(HFSTOSPELL_MINOR) AC_SUBST(HFSTOSPELL_VERSION) AC_SUBST(HFSTOSPELL_NAME) -# Check for pkg-config first - the configuration won't work if it isn't available: -AC_PATH_PROG([PKGCONFIG], [pkg-config], [no]) -AS_IF([test "x$PKGCONFIG" = xno], [AC_MSG_ERROR([pkg-config is required - please install])]) +PKG_PROG_PKG_CONFIG AC_PATH_PROG([DOXYGEN], [doxygen], [false]) AM_CONDITIONAL([CAN_DOXYGEN], [test "x$DOXYGEN" != xfalse]) @@ -143,18 +141,19 @@ AC_TYPE_SIZE_T AC_C_BIGENDIAN # Checks for library functions -AC_FUNC_MALLOC AC_CHECK_FUNCS([strndup error]) # Checks for system services -# Checks for highest supported C++ standard +# Require highest supported C++ standard AC_LANG(C++) -AX_CHECK_COMPILE_FLAG([-std=c++17], [CXXFLAGS="$CXXFLAGS -std=c++17"], [ - AX_CHECK_COMPILE_FLAG([-std=c++1z], [CXXFLAGS="$CXXFLAGS -std=c++1z"], [ - AX_CHECK_COMPILE_FLAG([-std=c++14], [CXXFLAGS="$CXXFLAGS -std=c++14"], [ - AX_CHECK_COMPILE_FLAG([-std=c++1y], [CXXFLAGS="$CXXFLAGS -std=c++1y"], [ - AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS="$CXXFLAGS -std=c++11"], [ - AC_MSG_ERROR([could not enable C++11 or newer]) +AX_CHECK_COMPILE_FLAG([-std=c++20], [CXXFLAGS="$CXXFLAGS -std=c++20"], [ + AX_CHECK_COMPILE_FLAG([-std=c++2a], [CXXFLAGS="$CXXFLAGS -std=c++2a"], [ + AX_CHECK_COMPILE_FLAG([-std=c++17], [CXXFLAGS="$CXXFLAGS -std=c++17"], [ + AX_CHECK_COMPILE_FLAG([-std=c++1z], [CXXFLAGS="$CXXFLAGS -std=c++1z"], [ + AX_CHECK_COMPILE_FLAG([-std=c++14], [CXXFLAGS="$CXXFLAGS -std=c++14"], [ + AX_CHECK_COMPILE_FLAG([-std=c++1y], [CXXFLAGS="$CXXFLAGS -std=c++1y"], [ + AC_MSG_ERROR([Could not enable at least C++1y (C++14) - upgrade your compiler]) + ]) ]) ]) ]) diff --git a/hfst-ospell-office.1 b/hfst-ospell-office.1 index ec04093df3bba386445bcb4ea26ebf3693ddf965..0e31663c6fef4ce94e8f2d18df0d4d266901f6f8 100644 --- a/hfst-ospell-office.1 +++ b/hfst-ospell-office.1 @@ -1,4 +1,4 @@ -.TH HFST-OSPELL-OFFICE "5" "March 2018" "hfst-ospell-office " "User Commands" +.TH HFST-OSPELL-OFFICE "1" "March 2018" "hfst-ospell-office " "User Commands" .SH NAME hfst-ospell-office \- Spell checker tool based on HFST .SH SYNOPSIS diff --git a/hfst-ospell.1 b/hfst-ospell.1 index db829cf191aedc40129842b2a5c8b571cca5e347..bc6bca90a22a3b5f33d884b2858d554fe99ddf62 100644 --- a/hfst-ospell.1 +++ b/hfst-ospell.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4. -.TH HFST-OSPELL "5" "March 2018" "hfst-ospell " "User Commands" +.TH HFST-OSPELL "1" "March 2018" "hfst-ospell " "User Commands" .SH NAME hfst-ospell \- Spell checker tool based on HFST .SH SYNOPSIS diff --git a/main.cc b/main.cc index abecf46775b59df63025f291ac55fcb9f85c656b..e4fd676243b8b39989f12f3646694601c9e2fecf 100644 --- a/main.cc +++ b/main.cc @@ -61,7 +61,7 @@ static bool suggest_reals = false; #ifdef WINDOWS static std::string wide_string_to_string(const std::wstring & wstr) { - int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)§wstr.size(), NULL, 0, NULL, NULL); + int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); std::string str( size_needed, 0 ); WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], size_needed, NULL, NULL); return str; diff --git a/office.cc b/office.cc index a859436021b00517d65eddf31af20acf1988ea3f..822e55ac7f8eb096296a0862ec13480e75d3cc23 100644 --- a/office.cc +++ b/office.cc @@ -49,6 +49,7 @@ #include <unicode/uloc.h> #include <unicode/uchar.h> #include <unicode/unistr.h> +using namespace icu; #include "ZHfstOspeller.h" @@ -64,6 +65,7 @@ struct word_t { }; std::vector<word_t> words(16); std::string buffer; +std::vector<std::string> alts; std::unordered_set<std::string> outputs; UnicodeString ubuffer, uc_buffer; size_t cw; @@ -74,24 +76,24 @@ bool uc_all = true; bool find_alternatives(ZHfstOspeller& speller, size_t suggs) { outputs.clear(); + alts.clear(); - for (size_t k=1 ; k <= cw ; ++k) { + // Gather corrections from all the tried variants, starting with verbatim and increasing mangling from there + for (size_t k=0 ; k < cw && alts.size()<suggs ; ++k) { buffer.clear(); - words[cw-k].buffer.toUTF8String(buffer); + words[k].buffer.toUTF8String(buffer); hfst_ospell::CorrectionQueue corrections = speller.suggest(buffer); if (corrections.size() == 0) { continue; } - std::cout << "&"; // Because speller.set_queue_limit() doesn't actually work, hard limit it here - for (size_t i=0, n=0, e=corrections.size() ; i<e && n<suggs ; ++i) { - std::cout << "\t"; + for (size_t i=0, e=corrections.size() ; i<e && alts.size()<suggs ; ++i) { buffer.clear(); - if (cw - k != 0) { - words[0].buffer.tempSubString(0, words[cw-k].start).toUTF8String(buffer); + if (k != 0) { + words[0].buffer.tempSubString(0, words[k].start).toUTF8String(buffer); } if (uc_all) { UnicodeString::fromUTF8(corrections.top().first).toUpper().toUTF8String(buffer); @@ -106,20 +108,27 @@ bool find_alternatives(ZHfstOspeller& speller, size_t suggs) { else { buffer.append(corrections.top().first); } - if (cw - k != 0) { - words[0].buffer.tempSubString(words[cw-k].start + words[cw-k].count).toUTF8String(buffer); + if (k != 0) { + words[0].buffer.tempSubString(words[k].start + words[k].count).toUTF8String(buffer); } if (outputs.count(buffer) == 0) { - std::cout << buffer; - ++n; + alts.push_back(buffer); } outputs.insert(buffer); corrections.pop(); } + } + + if (!alts.empty()) { + std::cout << "&"; + for (auto& alt : alts) { + std::cout << "\t" << alt; + } std::cout << std::endl; return true; } + return false; } diff --git a/windows-Makefile.am b/windows-Makefile.am deleted file mode 100644 index 056197489a94133c92fc11b6da833b26125d7d93..0000000000000000000000000000000000000000 --- a/windows-Makefile.am +++ /dev/null @@ -1,278 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# Copyright 2010 University of Helsinki -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# to silence: -# libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. -ACLOCAL_AMFLAGS=-I m4 - -# targets -if EXTRA_DEMOS -CONFERENCE_DEMOS=hfst-ospell-norvig hfst-ospell-fsmnlp-2012 hfst-ospell-cicling\ - hfst-ospell-survey hfst-ospell-lrec2013 hfst-ispell -endif # EXTRA_DEMOS - -bin_PROGRAMS=hfst-ospell $(CONFERENCE_DEMOS) -#lib_LTLIBRARIES=libhfstospell.la -man1_MANS=hfst-ospell.1 - -PKG_LIBS= -PKG_CXXFLAGS= - -if WANT_ARCHIVE -PKG_LIBS+=$(LIBARCHIVE_LIBS) -PKG_CXXFLAGS+=$(LIBARCHIVE_CFLAGS) -endif - -#if WANT_LIBXMLPP -#PKG_LIBS+=$(LIBXMLPP_LIBS) -#PKG_CXXFLAGS+=$(LIBXMLPP_CFLAGS) -#endif - -if WANT_TINYXML2 -PKG_LIBS+=$(TINYXML2_LIBS) -PKG_CXXFLAGS+=$(TINYXML2_CFLAGS) -endif - -# library parts -#libhfstospell_la_SOURCES= - -#libhfstospell_la_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) $(PKG_CXXFLAGS) -#libhfstospell_la_LDFLAGS=-no-undefined -version-info 4:0:0 \ - $(PKG_LIBS) - -# link sample program against library here -hfst_ospell_SOURCES=main.cc hfst-ol.cc ospell.cc \ - ZHfstOspeller.cc ZHfstOspellerXmlMetadata.cc \ - tinyxml2.cc \ - libarchive/archive_acl.c \ - libarchive/archive_acl_private.h \ - libarchive/archive_check_magic.c \ - libarchive/archive_crc32.h \ - libarchive/archive_crypto.c \ - libarchive/archive_crypto_private.h \ - libarchive/archive_endian.h \ - libarchive/archive_entry.c \ - libarchive/archive_entry.h \ - libarchive/archive_entry_copy_stat.c \ - libarchive/archive_entry_link_resolver.c \ - libarchive/archive_entry_locale.h \ - libarchive/archive_entry_private.h \ - libarchive/archive_entry_sparse.c \ - libarchive/archive_entry_stat.c \ - libarchive/archive_entry_strmode.c \ - libarchive/archive_entry_xattr.c \ - libarchive/archive_options.c \ - libarchive/archive_options_private.h \ - libarchive/archive_platform.h \ - libarchive/archive_ppmd_private.h \ - libarchive/archive_ppmd7.c \ - libarchive/archive_ppmd7_private.h \ - libarchive/archive_private.h \ - libarchive/archive_rb.c \ - libarchive/archive_rb.h \ - libarchive/archive_read.c \ - libarchive/archive_read_data_into_fd.c \ - libarchive/archive_read_disk_entry_from_file.c \ - libarchive/archive_read_disk_posix.c \ - libarchive/archive_read_disk_private.h \ - libarchive/archive_read_disk_set_standard_lookup.c \ - libarchive/archive_read_extract.c \ - libarchive/archive_read_open_fd.c \ - libarchive/archive_read_open_file.c \ - libarchive/archive_read_open_filename.c \ - libarchive/archive_read_open_memory.c \ - libarchive/archive_read_private.h \ - libarchive/archive_read_set_options.c \ - libarchive/archive_read_support_filter_all.c \ - libarchive/archive_read_support_filter_compress.c \ - libarchive/archive_read_support_filter_gzip.c \ - libarchive/archive_read_support_filter_none.c \ - libarchive/archive_read_support_filter_program.c \ - libarchive/archive_read_support_filter_rpm.c \ - libarchive/archive_read_support_filter_uu.c \ - libarchive/archive_read_support_filter_xz.c \ - libarchive/archive_read_support_format_7zip.c \ - libarchive/archive_read_support_format_all.c \ - libarchive/archive_read_support_format_ar.c \ - libarchive/archive_read_support_format_by_code.c \ - libarchive/archive_read_support_format_cab.c \ - libarchive/archive_read_support_format_cpio.c \ - libarchive/archive_read_support_format_empty.c \ - libarchive/archive_read_support_format_iso9660.c \ - libarchive/archive_read_support_format_lha.c \ - libarchive/archive_read_support_format_mtree.c \ - libarchive/archive_read_support_format_rar.c \ - libarchive/archive_read_support_format_raw.c \ - libarchive/archive_read_support_format_tar.c \ - libarchive/archive_read_support_format_xar.c \ - libarchive/archive_read_support_format_zip.c \ - libarchive/archive_string.c \ - libarchive/archive_string.h \ - libarchive/archive_string_composition.h \ - libarchive/archive_string_sprintf.c \ - libarchive/archive_util.c \ - libarchive/archive_virtual.c \ - libarchive/archive_write.c \ - libarchive/archive_write_disk_posix.c \ - libarchive/archive_write_disk_private.h \ - libarchive/archive_write_disk_set_standard_lookup.c \ - libarchive/archive_write_open_fd.c \ - libarchive/archive_write_open_file.c \ - libarchive/archive_write_open_filename.c \ - libarchive/archive_write_open_memory.c \ - libarchive/archive_write_private.h \ - libarchive/archive_write_add_filter_compress.c \ - libarchive/archive_write_add_filter_gzip.c \ - libarchive/archive_write_add_filter_none.c \ - libarchive/archive_write_add_filter_program.c \ - libarchive/archive_write_add_filter_xz.c \ - libarchive/archive_write_set_format.c \ - libarchive/archive_write_set_format_7zip.c \ - libarchive/archive_write_set_format_ar.c \ - libarchive/archive_write_set_format_by_name.c \ - libarchive/archive_write_set_format_cpio.c \ - libarchive/archive_write_set_format_cpio_newc.c \ - libarchive/archive_write_set_format_iso9660.c \ - libarchive/archive_write_set_format_mtree.c \ - libarchive/archive_write_set_format_pax.c \ - libarchive/archive_write_set_format_shar.c \ - libarchive/archive_write_set_format_ustar.c \ - libarchive/archive_write_set_format_gnutar.c \ - libarchive/archive_write_set_format_xar.c \ - libarchive/archive_write_set_format_zip.c \ - libarchive/archive_write_set_options.c \ - libarchive/config_freebsd.h \ - libarchive/archive_read_support_filter_bzip2.c \ - libarchive/archive_write_add_filter_bzip2.c \ - libarchive/filter_fork.c \ - libarchive/filter_fork.h \ - libarchive/archive_entry_copy_bhfi.c \ - libarchive/archive_read_disk_windows.c \ - libarchive/archive_windows.h \ - libarchive/archive_windows.c \ - libarchive/archive_write_disk_windows.c \ - libarchive/filter_fork_windows.c - -#hfst_ospell_LDADD=libhfstospell.la -hfst_ospell_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -if EXTRA_DEMOS -hfst_ospell_norvig_SOURCES=main-norvig.cc -#hfst_ospell_norvig_LDADD=libhfstospell.la -hfst_ospell_norvig_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -hfst_ospell_cicling_SOURCES=main-cicling.cc -#hfst_ospell_cicling_LDADD=libhfstospell.la -hfst_ospell_cicling_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -hfst_ospell_lrec2013_SOURCES=main-lrec2013.cc -#hfst_ospell_lrec2013_LDADD=libhfstospell.la -hfst_ospell_lrec2013_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -hfst_ospell_survey_SOURCES=main-survey.cc -#hfst_ospell_survey_LDADD=libhfstospell.la -hfst_ospell_survey_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -hfst_ospell_fsmnlp_2012_SOURCES=main-fsmnlp-2012.cc -#hfst_ospell_fsmnlp_2012_LDADD=libhfstospell.la -hfst_ospell_fsmnlp_2012_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) -endif # EXTRA_DEMOS - -hfst_ispell_SOURCES=main-ispell.cc -#hfst_ispell_LDADD=libhfstospell.la -hfst_ispell_CXXFLAGS=$(AM_CXXFLAGS) $(CXXFLAGS) \ - $(PKG_CXXFLAGS) - -# install headers for library in hfst's includedir -include_HEADERS=hfst-ol.h ospell.h ol-exceptions.h \ - ZHfstOspeller.h ZHfstOspellerXmlMetadata.h tinyxml2.h - -# pkgconfig -pkgconfigdir=$(libdir)/pkgconfig -pkgconfig_DATA=hfstospell.pc - -# tests -if CAN_TEST -TXTS=acceptor.default.txt errmodel.default.txt errmodel.extrachars.txt -check_DATA=speller_basic.zhfst empty_descriptions.zhfst \ - empty_titles.zhfst empty_locale.zhfst \ - trailing_spaces.zhfst \ - spl.hfstol sug.hfstol err.hfstol \ - acceptor.default.hfst errmodel.default.hfst \ - errmodel.extrachars.hfst bad_errormodel.zhfst -# Actual test scripts: -TESTS=basic-zhfst.sh basic-legacy.sh basic-zhfst-fallback.sh \ - empty-descriptions.sh empty-titles.sh empty-locale.sh \ - trailing-spaces.sh bad-errormodel.sh empty-zhfst.sh -XFAIL_TESTS=empty-descriptions.sh empty-titles.sh empty-locale.sh empty-zhfst.sh -EXTRA_DIST=$(TXTS) $(TESTS) \ - basic_test.xml empty_descriptions.xml empty_titles.xml \ - empty_locale.xml trailing_spaces.xml \ - test.strings - -clean-local: - -rm -rf $(check_DATA) index.xml -endif # CAN_TEST - -# N.B. Do not parallel test, race condition exists -empty_descriptions.zhfst: acceptor.default.hfst errmodel.default.hfst empty_descriptions.xml - cp -f $(srcdir)/empty_descriptions.xml index.xml - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -empty_titles.zhfst: acceptor.default.hfst errmodel.default.hfst empty_titles.xml - cp -f $(srcdir)/empty_titles.xml index.xml - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -empty_locale.zhfst: acceptor.default.hfst errmodel.default.hfst empty_locale.xml - cp -f $(srcdir)/empty_locale.xml index.xml - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -trailing_spaces.zhfst: acceptor.default.hfst errmodel.default.hfst trailing_spaces.xml - cp -f $(srcdir)/trailing_spaces.xml index.xml - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -# N.B. Do not parallel test, race condition exists -speller_basic.zhfst: acceptor.default.hfst errmodel.default.hfst basic_test.xml - cp $(srcdir)/basic_test.xml index.xml - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -bad_errormodel.zhfst: acceptor.default.hfst errmodel.extrachars.hfst index.xml - cp -f $(srcdir)/errmodel.extrachars.hfst errmodel.default.hfst - $(ZIP) $(ZIPFLAGS) $@ acceptor.default.hfst errmodel.default.hfst index.xml - -sug.hfstol: acceptor.default.hfst - -ln -sf $< $@ - -spl.hfstol: acceptor.default.hfst - -ln -sf $< $@ - -err.hfstol: errmodel.default.hfst - -ln -sf $< $@ - -.txt.hfst: - hfst-txt2fst $< | hfst-fst2fst -f olw -o $@ - -.txt.hfstol: - hfst-txt2fst $< | hfst-fst2fst -f olw -o $@ - -hfst-ospell.1: hfst-ospell - help2man --no-discard-stderr $< > $@ diff --git a/windows-configure.ac b/windows-configure.ac deleted file mode 100644 index b0ab7d649a0bca75f5ff231605ad23ebf1a70231..0000000000000000000000000000000000000000 --- a/windows-configure.ac +++ /dev/null @@ -1,143 +0,0 @@ -## Process this file with autoconf to produce configure script - -## Copyright (C) 2010 University of Helsinki -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# autoconf requirements -AC_PREREQ([2.62]) -LT_PREREQ([2.2.6]) - -# init -AC_INIT([hfstospell], [0.3.0], [hfst-bugs@helsinki.fi], [hfstospell], [http://hfst.sf.net]) -AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign check-news color-tests silent-rules]) -AM_SILENT_RULES([yes]) -AC_REVISION([$Revision: 3876 $]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([ospell.cc]) -AC_CONFIG_HEADERS([config.h]) - -# Information on package -HFSTOSPELL_NAME=hfstospell -HFSTOSPELL_MAJOR=0 -HFSTOSPELL_MINOR=3 -HFSTOSPELL_EXTENSION=.0 -HFSTOSPELL_VERSION=$HFSTOSPELL_MAJOR.$HFSTOSPELL_MINOR$HFSTOSPELL_EXTENSION -AC_SUBST(HFSTOSPELL_MAJOR) -AC_SUBST(HFSTOSPELL_MINOR) -AC_SUBST(HFSTOSPELL_VERSION) -AC_SUBST(HFSTOSPELL_NAME) - -# Check for pkg-config first - the configuration won't work if it isn't available: -#AC_PATH_PROG([PKGCONFIG], [pkg-config], [no]) -#AS_IF([test "x$PKGCONFIG" = xno], [AC_MSG_ERROR([pkg-config is required - please install])]) -#AC_PATH_PROG([DOXYGEN], [doxygen], [false]) -#AM_CONDITIONAL([CAN_DOXYGEN], [test "x$DOXYGEN" != xfalse]) - - -# Settings -AC_ARG_ENABLE([extra_demos], - [AS_HELP_STRING([--enable-extra-demos], - [build conference demos for science reproduction @<:@default=no@:>@])], - [enable_extra_demos=$enableval], [enable_extra_demos=no]) -AM_CONDITIONAL([EXTRA_DEMOS], [test x$enable_extra_demos != xno]) -AC_ARG_ENABLE([zhfst], - [AS_HELP_STRING([--enable-zhfst], - [support zipped complex automaton sets @<:@default=check@:>@])], - [enable_zhfst=$enableval], [enable_zhfst=check]) -AC_ARG_ENABLE([xml], - [AS_HELP_STRING([--enable-xml=LIBXML], - [support xml metadata for zipped automaton sets with library LIBXML @<:@default=libxmlpp@:>@])], - [enable_xml=$enableval], [enable_xml=libxmlpp]) -AC_ARG_WITH([extract], - [AS_HELP_STRING([--with-extract=TARGET], - [extract zhfst archives to tmpdir or mem @<:@default=mem@:>@])], - [with_extract=$withval], [with_extract=mem]) -AS_IF([test "x$with_extract" = xmem], [AC_DEFINE([ZHFST_EXTRACT_TO_MEM], [1], - [Define to extract zhfst archives to char buffer])], - [AS_IF([test "x$with_extract" = xtmpdir], - [AC_DEFINE([ZHFST_EXTRACT_TO_TMPDIR], [1], - [Define to extract zhfst to tmp dir])], - [AC_MSG_ERROR([Use with-extract to mem or tmpdir])])]) - -# Checks for programs -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AC_PROG_CC -AC_PROG_CXX -AC_LIBTOOL_WIN32_DLL -LT_INIT -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PATH_PROG([HFST_TXT2FST], [hfst-txt2fst], [false]) -AC_PATH_PROG([HFST_FST2FST], [hfst-fst2fst], [false]) -AC_PATH_PROG([ZIP], [zip], [false]) -AM_CONDITIONAL([CAN_TEST], - [test x$HFST_TXT2FST != xfalse -a x$HFST_FST2FST != xfalse -a x$ZIP != xfalse]) - -# Checks for libraries -#AS_IF([test x$enable_zhfst != xno], -# [PKG_CHECK_MODULES([LIBARCHIVE], [libarchive > 3], -# [AC_DEFINE([HAVE_LIBARCHIVE], [1], [Use archives]) -# enable_zhfst=yes], -# [enable_zhfst=no])]) - -AC_DEFINE([HAVE_LIBARCHIVE], [1], [Use archives]) -AM_CONDITIONAL([WANT_ARCHIVE], [test x$enable_zhfst != xno]) - -#AS_IF([test x$enable_xml = xlibxmlpp], -# [PKG_CHECK_MODULES([LIBXMLPP], [libxml++-2.6 >= 2.10.0], -# [AC_DEFINE([HAVE_LIBXML], [1], [Use libxml++])], -# [AC_MSG_WARN([libxml++ failed, disabling xml]) -# enable_xml=no])]) -#AM_CONDITIONAL([WANT_LIBXMLPP], [test x$enable_xml = xlibxmlpp]) - -#AS_IF([test x$enable_xml = xtinyxml2], -# [PKG_CHECK_MODULES([TINYXML2], [tinyxml2 >= 1.0.8], -# [AC_DEFINE([HAVE_TINYXML2], [1], [Use tinyxml])], -# [AC_MSG_WARN([tinyxml missing, xml disabled]) -# enable_xml=no])]) - -AC_DEFINE([HAVE_TINYXML2], [1], [Use tinyxml]) -AM_CONDITIONAL([WANT_TINYXML2], [test x$enable_xml = xtinyxml2]) - -# Checks for header files -AC_CHECK_HEADERS([getopt.h error.h]) - -# Checks for types -AC_TYPE_SIZE_T - -# Checks for structures - -# Checks for compiler characteristics - -# Checks for library functions -AC_FUNC_MALLOC -AC_CHECK_FUNCS([strndup error]) -# Checks for system services - -# config files -AC_CONFIG_FILES([Makefile hfstospell.pc]) - -# output -AC_OUTPUT - -cat <<EOF --- Building $PACKAGE_STRING - * zhfst support: $enable_zhfst - * extracting to: $with_extract - * xml support: $enable_xml - * conference demos: $enable_extra_demos -EOF