Blame configure.ac

Packit 2b3545
# The contents of this file are subject to the Mozilla Public License Version 
Packit 2b3545
# 1.1 (the "License"); you may not use this file except in compliance with 
Packit 2b3545
# the License. You may obtain a copy of the License at 
Packit 2b3545
# http://www.mozilla.org/MPL/
Packit 2b3545
# 
Packit 2b3545
# Software distributed under the License is distributed on an "AS IS" basis,
Packit 2b3545
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
Packit 2b3545
# for the specific language governing rights and limitations under the
Packit 2b3545
# License.
Packit 2b3545
# 
Packit 2b3545
# The Original Code is Libvoikko: Library of natural language processing tools.
Packit 2b3545
# The Initial Developer of the Original Code is Harri Pitkänen <hatapitk@iki.fi>.
Packit 2b3545
# Portions created by the Initial Developer are Copyright (C) 2006 - 2011
Packit 2b3545
# the Initial Developer. All Rights Reserved.
Packit 2b3545
# 
Packit 2b3545
# Alternatively, the contents of this file may be used under the terms of
Packit 2b3545
# either the GNU General Public License Version 2 or later (the "GPL"), or
Packit 2b3545
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
Packit 2b3545
# in which case the provisions of the GPL or the LGPL are applicable instead
Packit 2b3545
# of those above. If you wish to allow use of your version of this file only
Packit 2b3545
# under the terms of either the GPL or the LGPL, and not to allow others to
Packit 2b3545
# use your version of this file under the terms of the MPL, indicate your
Packit 2b3545
# decision by deleting the provisions above and replace them with the notice
Packit 2b3545
# and other provisions required by the GPL or the LGPL. If you do not delete
Packit 2b3545
# the provisions above, a recipient may use your version of this file under
Packit 2b3545
# the terms of any one of the MPL, the GPL or the LGPL.
Packit 2b3545
Packit 2b3545
Packit 2b3545
dnl General options for autoconf
Packit 2b3545
AC_PREREQ(2.60)
Packit 2b3545
AC_INIT([libvoikko],[4.1.1],[hatapitk@iki.fi])
Packit 2b3545
Packit 2b3545
LT_PREREQ([2.2.6])
Packit 2b3545
Packit 2b3545
AC_CONFIG_HEADERS(config.h)
Packit 2b3545
AM_INIT_AUTOMAKE([1.10 foreign])
Packit 2b3545
AC_CONFIG_MACRO_DIR([m4])
Packit 2b3545
Packit 2b3545
dnl Checks for programs
Packit 2b3545
AC_PROG_CXX
Packit 2b3545
AC_PROG_INSTALL
Packit 2b3545
AM_PATH_PYTHON([3])
Packit 2b3545
Packit 2b3545
dnl Libtool (new and old)
Packit 2b3545
AC_LIBTOOL_WIN32_DLL
Packit 2b3545
LT_INIT
Packit 2b3545
Packit 2b3545
AM_MAINTAINER_MODE
Packit 2b3545
Packit 2b3545
dnl Compiler features
Packit 2b3545
AC_LANG_CPLUSPLUS
Packit 2b3545
AC_C_CONST
Packit 2b3545
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
Packit 2b3545
Packit 2b3545
# Prepare platform specific setups (sets $host_os a.o.):
Packit 2b3545
AC_CANONICAL_HOST
Packit 2b3545
Packit 2b3545
# The default dictionary path is empty (no default locations to search from)
Packit 2b3545
DICTIONARY_PATH=
Packit 2b3545
AC_ARG_WITH(dictionary-path,
Packit 2b3545
            AC_HELP_STRING([--with-dictionary-path=PATH],
Packit 2b3545
	                   [Dictionary path]),
Packit 2b3545
	    [DICTIONARY_PATH="$withval"])
Packit 2b3545
AC_DEFINE_UNQUOTED(DICTIONARY_PATH, "$DICTIONARY_PATH", [Dictionary path])
Packit 2b3545
AC_SUBST(DICTIONARY_PATH)
Packit 2b3545
Packit 2b3545
dnl Checks for headers
Packit 2b3545
AC_HEADER_ASSERT
Packit 2b3545
AC_CHECK_HEADERS([stddef.h])
Packit 2b3545
AC_CHECK_HEADERS([stdlib.h])
Packit 2b3545
AC_CHECK_HEADERS([langinfo.h])
Packit 2b3545
AC_CHECK_HEADERS([locale.h])
Packit 2b3545
AC_CHECK_HEADERS([wctype.h])
Packit 2b3545
AC_CHECK_HEADERS([wchar.h],,[AC_MSG_ERROR([wchar.h not found])])
Packit 2b3545
Packit 2b3545
dnl Types
Packit 2b3545
AC_TYPE_SIZE_T
Packit 2b3545
Packit 2b3545
dnl GCC visibility support
Packit 2b3545
AH_TEMPLATE(GCC_VISIBILITY, [GCC visibility support])
Packit 2b3545
tmp_CXXFLAGS="$CXXFLAGS"
Packit 2b3545
CXXFLAGS="$CXXFLAGS -Wall -Werror -fvisibility=hidden"
Packit 2b3545
AC_MSG_CHECKING([whether $CC supports the visibility attribute])
Packit 2b3545
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
Packit 2b3545
[
Packit 2b3545
  void __attribute__ ((visibility("default"))) test_default (void) {}
Packit 2b3545
  void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
Packit 2b3545
 int main (int argc, char **argv) { test_default (); test_hidden (); return 0; }
Packit 2b3545
])],
Packit 2b3545
[
Packit 2b3545
  AC_DEFINE(GCC_VISIBILITY, 1)
Packit 2b3545
  CFLAGS="$CFLAGS -fvisibility=hidden"
Packit 2b3545
  CXXFLAGS="$tmp_CXXFLAGS -fvisibility=hidden"
Packit 2b3545
  AC_MSG_RESULT([yes])
Packit 2b3545
],
Packit 2b3545
[
Packit 2b3545
  CXXFLAGS="$tmp_CXXFLAGS"
Packit 2b3545
  AC_MSG_RESULT([no])
Packit 2b3545
])
Packit 2b3545
Packit 2b3545
dnl Build tools
Packit 2b3545
buildtools="yes"
Packit 2b3545
AC_ARG_ENABLE(buildtools, AC_HELP_STRING([--disable-buildtools],
Packit 2b3545
        [disable voikkovfstc]),
Packit 2b3545
        [buildtools=${enableval}], [buildtools=yes])
Packit 2b3545
AM_CONDITIONAL([HAVE_BUILDTOOLS], [test x$buildtools = xyes])
Packit 2b3545
Packit 2b3545
dnl Test tools
Packit 2b3545
testtools="yes"
Packit 2b3545
AC_ARG_ENABLE(testtools, AC_HELP_STRING([--disable-testtools],
Packit 2b3545
	[disable voikkospell, voikkohyphenate and voikkogc]),
Packit 2b3545
	[testtools=${enableval}], [testtools=yes])
Packit 2b3545
AM_CONDITIONAL([HAVE_TESTTOOLS], [test x$testtools = xyes])
Packit 2b3545
	
Packit 2b3545
dnl Malaga support
Packit 2b3545
malaga="no"
Packit 2b3545
AH_TEMPLATE(HAVE_MALAGA, [Have MALAGA])
Packit 2b3545
AC_ARG_ENABLE(malaga, AC_HELP_STRING([--enable-malaga],
Packit 2b3545
	[enable Malaga morphology backend (dictionary version 2)]),
Packit 2b3545
	[malaga=${enableval}], [malaga=no])
Packit 2b3545
if test x$malaga = xyes; then
Packit 2b3545
	AC_DEFINE(HAVE_MALAGA, 1)
Packit 2b3545
fi
Packit 2b3545
AM_CONDITIONAL([HAVE_MALAGA], [test x$malaga = xyes])
Packit 2b3545
Packit 2b3545
dnl HFST support
Packit 2b3545
hfst="yes"
Packit 2b3545
AH_TEMPLATE(HAVE_HFST, [Have HFST])
Packit 2b3545
AC_ARG_ENABLE(hfst, AC_HELP_STRING([--disable-hfst],
Packit 2b3545
	[disable HFST morphology backend]),
Packit 2b3545
	[hfst=${enableval}], [hfst=yes])
Packit 2b3545
dnl must be AS_IF for some aclocals to pick PKG_CHECK_MODULES somehow.
Packit 2b3545
dnl AC_PROVIDE_IFELSE doesn't work on mac?
Packit 2b3545
AS_IF([test x$hfst = xyes], [
Packit 2b3545
      PKG_CHECK_MODULES([HFSTOSPELL], [hfstospell >= 0.2])
Packit 2b3545
	  AC_DEFINE(HAVE_HFST, 1)
Packit 2b3545
	  CXXFLAGS="$CXXFLAGS $HFSTOSPELL_CFLAGS"
Packit 2b3545
	])
Packit 2b3545
AM_CONDITIONAL([HAVE_HFST], [test x$hfst = xyes])
Packit 2b3545
Packit 2b3545
dnl VISLCG3 support
Packit 2b3545
AH_TEMPLATE(HAVE_VISLCG3, [Have VISLCG3])
Packit 2b3545
AC_ARG_ENABLE(vislcg3, AC_HELP_STRING([--enable-vislcg3],
Packit 2b3545
	[enable vislcg3 grammar checking backend (EXPERIMENTAL!)]),
Packit 2b3545
	[cg3=${enableval}], [cg3=no])
Packit 2b3545
dnl must be AS_IF for some aclocals to pick PKG_CHECK_MODULES somehow.
Packit 2b3545
dnl AC_PROVIDE_IFELSE doesn't work on mac?
Packit 2b3545
AS_IF([test x$cg3 = xyes], [
Packit 2b3545
	PKG_CHECK_MODULES([VISLCG3], [cg3 >= 0.9])
Packit 2b3545
	AC_CHECK_HEADERS([tinyxml2.h],,[AC_MSG_ERROR([tinyxml2.h not found])])
Packit 2b3545
	AC_DEFINE(HAVE_VISLCG3, 1)
Packit 2b3545
	CXXFLAGS="$CXXFLAGS $VISLCG3_CFLAGS"
Packit 2b3545
	])
Packit 2b3545
AM_CONDITIONAL([HAVE_VISLCG3], [test x$cg3 = xyes])
Packit 2b3545
Packit 2b3545
Packit 2b3545
dnl VFST support
Packit 2b3545
vfst="yes"
Packit 2b3545
AH_TEMPLATE(HAVE_VFST, [Have VFST])
Packit 2b3545
AC_ARG_ENABLE(vfst, AC_HELP_STRING([--disable-vfst],
Packit 2b3545
	[disable VFST morphology backend]),
Packit 2b3545
	[vfst=${enableval}], [vfst=yes])
Packit 2b3545
if test x$vfst = xyes; then
Packit 2b3545
	AC_DEFINE(HAVE_VFST, 1)
Packit 2b3545
fi
Packit 2b3545
AM_CONDITIONAL([HAVE_VFST], [test x$vfst = xyes])
Packit 2b3545
Packit 2b3545
Packit 2b3545
dnl support for experimental parts of VFST format
Packit 2b3545
expvfst="no"
Packit 2b3545
AH_TEMPLATE(HAVE_EXPERIMENTAL_VFST, [Have experimental VFST])
Packit 2b3545
AC_ARG_ENABLE(expvfst, AC_HELP_STRING([--enable-expvfst],
Packit 2b3545
	[enable EXPERIMENTAL features of VFST morphology backend]),
Packit 2b3545
	[expvfst=${enableval}], [expvfst=no])
Packit 2b3545
if test x$expvfst = xyes; then
Packit 2b3545
	AC_DEFINE(HAVE_EXPERIMENTAL_VFST, 1)
Packit 2b3545
fi
Packit 2b3545
AM_CONDITIONAL([HAVE_EXPERIMENTAL_VFST], [test x$expvfst = xyes])
Packit 2b3545
Packit 2b3545
dnl Lttoolbox support
Packit 2b3545
AH_TEMPLATE(HAVE_LTTOOLBOX, [Have Lttoolbox])
Packit 2b3545
AC_ARG_ENABLE(lttoolbox, AC_HELP_STRING([--enable-lttoolbox],
Packit 2b3545
	[enable Lttoolbox morphology backend (EXPERIMENTAL!)]),
Packit 2b3545
	[lttoolbox=${enableval}], [lttoolbox=no])
Packit 2b3545
if test x$lttoolbox = xyes; then
Packit 2b3545
	PKG_CHECK_MODULES([LTTOOLBOX], [lttoolbox-3.2 >= 3.2.0])
Packit 2b3545
	AC_DEFINE(HAVE_LTTOOLBOX, 1)
Packit 2b3545
	CXXFLAGS="$CXXFLAGS $LTTOOLBOX_CFLAGS"
Packit 2b3545
fi
Packit 2b3545
AM_CONDITIONAL([HAVE_LTTOOLBOX], [test x$lttoolbox = xyes])
Packit 2b3545
Packit 2b3545
dnl External dictionary loading
Packit 2b3545
external_dicts="yes"
Packit 2b3545
AH_TEMPLATE(DISABLE_EXTDICTS, [Disable external dictionaries])
Packit 2b3545
AC_ARG_ENABLE(external_dicts, AC_HELP_STRING([--disable-external-dicts],
Packit 2b3545
	[disable loading of external dictionaries (use with experimental or patched builds)]),
Packit 2b3545
	[external_dicts=${enableval}], [external_dicts=yes])
Packit 2b3545
if test x$external_dicts = xno; then
Packit 2b3545
	AC_DEFINE(DISABLE_EXTDICTS, 1)
Packit 2b3545
fi
Packit 2b3545
Packit 2b3545
Packit 2b3545
dnl Windows specific settings
Packit 2b3545
if test x$build_os == xmingw32; then
Packit 2b3545
  LIBLDFLAGSWIN="-Wl,--output-def,libvoikko-1.def"
Packit 2b3545
fi
Packit 2b3545
AC_SUBST(LIBLDFLAGSWIN)
Packit 2b3545
Packit 2b3545
AX_PTHREAD([AM_CONDITIONAL([HAVE_PTHREAD],[true])], [AM_CONDITIONAL([HAVE_PTHREAD],[false])])
Packit 2b3545
Packit 2b3545
dnl Functions
Packit 2b3545
AC_FUNC_MALLOC
Packit 2b3545
AC_FUNC_REALLOC
Packit 2b3545
AC_FUNC_STAT
Packit 2b3545
AC_CHECK_FUNCS([mmap])
Packit 2b3545
AC_CHECK_FUNCS([setlocale])
Packit 2b3545
AC_CHECK_FUNCS([mbrlen])
Packit 2b3545
AC_CHECK_FUNCS([memset])
Packit 2b3545
AC_CHECK_FUNCS([strchr])
Packit 2b3545
AC_CHECK_FUNCS([getpwuid_r])
Packit 2b3545
Packit 2b3545
dnl Default compiler settings
Packit 2b3545
CXXFLAGS="$CXXFLAGS -Wall -Werror -pedantic"
Packit 2b3545
Packit 2b3545
AC_CONFIG_FILES([Makefile src/Makefile src/tools/Makefile java/Makefile msvc/Makefile test/Makefile cs/Makefile cl/Makefile src/libvoikko.pc])
Packit 2b3545
AC_OUTPUT
Packit 2b3545
Packit 2b3545
cat <
Packit 2b3545
Packit 2b3545
Libvoikko was configured with the following options
Packit 2b3545
  * VFST support:                   $vfst
Packit 2b3545
  *   Experimental VFST features:   $expvfst
Packit 2b3545
  * HFST support:                   $hfst
Packit 2b3545
  * Malaga support:                 $malaga
Packit 2b3545
  * Experimental VISLCG3 support:   $cg3
Packit 2b3545
  * Experimental Lttoolbox support: $lttoolbox
Packit 2b3545
  * Morphology compilers:           $buildtools
Packit 2b3545
  * Simple client programs:         $testtools
Packit 2b3545
EOF
Packit 2b3545
if test x$DICTIONARY_PATH = x; then
Packit 2b3545
cat <
Packit 2b3545
  * Fallback dictionary path:       (none)
Packit 2b3545
  NOTE!  As of libvoikko 4.0 NO HARDCODED FALLBACK DICTIONARY PATH
Packit 2b3545
  NOTE!  IS USED unless one is specified using --with-dictionary-path.
Packit 2b3545
  NOTE!  If you intend to use libvoikko for writing aids in
Packit 2b3545
  NOTE!  end user applications we strongly suggest adding the following:
Packit 2b3545
  NOTE!  OS X: --with-dictionary-path=/Library/Spelling/voikko:/usr/lib/voikko
Packit 2b3545
  NOTE!  Linux: --with-dictionary-path=/usr/share/voikko:/usr/lib/voikko
Packit 2b3545
EOF
Packit 2b3545
else
Packit 2b3545
cat <
Packit 2b3545
  * Fallback dictionary path:       $DICTIONARY_PATH
Packit 2b3545
EOF
Packit 2b3545
fi