Adding prob files
[apertium.git] / trunk / apertium / configure.ac
blob7b0e14dc9f60d42d0d7b0b848327c327b1c5ab44
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.52)
6 m4_define([required_lttoolbox_version], [3.0.0])
7 m4_define([required_libxml_version], [2.6.17])
8 m4_define([required_libpcre_version], [6.4])
9 #m4_define([required_pkg_config_version], [0.15])
11 AC_INIT([apertium], [3.0.6], [sortiz@users.sourceforge.net])
12 AC_CONFIG_HEADER([apertium/apertium_config.h])
14 GENERIC_LIBRARY_NAME=apertium
16 # Release versioning
17 GENERIC_MAJOR_VERSION=3
18 GENERIC_MINOR_VERSION=0
19 GENERIC_MICRO_VERSION=6
21 # API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
22 GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION
23 AC_SUBST(GENERIC_API_VERSION)
25 # Shared library versioning
26 GENERIC_LIBRARY_VERSION=0:0:0
27 #                       | | |
28 #                +------+ | +---+
29 #                |        |     |
30 #             current:revision:age
31 #                |        |     |
32 #                |        |     +- increment if interfaces have been added
33 #                |        |        set to zero if interfaces have been removed
34 #                                  or changed
35 #                |        +- increment if source code has changed
36 #                |           set to zero if current is incremented
37 #                +- increment if interfaces have been added, removed or changed
39 AC_SUBST(GENERIC_LIBRARY_VERSION)
40 PACKAGE=$GENERIC_LIBRARY_NAME
41 AC_SUBST(GENERIC_LIBRARY_NAME)
43 GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
44 GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
45 AC_SUBST(GENERIC_RELEASE)
46 AC_SUBST(GENERIC_VERSION)
48 VERSION=$GENERIC_VERSION
50 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
52 # Checks for programs.
54 AC_MSG_CHECKING([Compilation architecture: PPC, i686, x86_64, Other])
55 if test x$(which arch) = x
56 then ARCH=$($(which uname) -m)
57 else ARCH=$($(which arch))
60 if test x$ARCH = xppc
61 then
62   AC_MSG_RESULT([PowerPC])
63   CFLAGS="$CFLAGS -Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer"
64   CXXFLAGS="$CXXFLAGS -Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer"
65 else
66   if test x$ARCH = xi686
67   then
68     AC_MSG_RESULT([i686])
69     CFLAGS="$CFLAGS -Wall -ansi -march=i686 -O3 -fomit-frame-pointer -funroll-loops"
70     CXXFLAGS="$CXXFLAGS -Wall -ansi -march=i686 -O3 \
71               -fomit-frame-pointer -funroll-loops"
72   else
73     if test x$ARCH = xx86_64
74     then
75       AC_MSG_RESULT([x86_64])
76       CFLAGS="-Wall -ansi -O3 -mtune=nocona -fomit-frame-pointer -funroll-loops $CFLAGS"
77       CXXFLAGS="-Wall -ansi -O3 -mtune=nocona \
78               -fomit-frame-pointer -funroll-loops $CXXFLAGS"
79     else
80       AC_MSG_RESULT([Other])
81       CFLAGS="-Wall -ansi -O3 $CFLAGS"
82       CXXFLAGS="-Wall -ansi -O3 $CXXFLAGS"
83     fi    
84   fi
87 AC_PROG_CXX
88 AC_PROG_LIBTOOL
89 AM_SANITY_CHECK
90 AC_LANG_CPLUSPLUS
92 AC_ARG_ENABLE(debug,
93               [  --enable-debug    Enable "-g -Wall" compiler options], 
94               [CXXFLAGS="-g -Wall"; CFLAGS="-g -Wall"])
96 AC_ARG_ENABLE(profile,
97               [  --enable-profile  Enable "-pg -g -Wall" compiler options],
98               [CXXFLAGS="-pg -g -Wall"; CFLAGS="-pg -g -Wall"; LDFLAGS="-pg"])
100 AC_PATH_PROG(XMLLINT, xmllint, no)
101 if test x$ac_cv_path_XMLLINT = x
102 then
103   AC_MSG_ERROR([You don't have xmllint installed.])
105 if test x$ac_cv_path_XMLLINT = xno
106 then
107   AC_MSG_ERROR([You don't have xmllint installed.])
110   AC_PATH_PROG(XSLTPROC, xsltproc, no)
111   if test x$ac_cv_path_XSLTPROC = x
112   then
113     AC_MSG_ERROR([You don't have xsltproc installed.])
114   fi
115   if test x$ac_cv_path_XSLTPROC = xno
116   then
117     AC_MSG_ERROR([You don't have xsltproc installed.])
118   fi
121 AC_PATH_PROG(BASH, bash, no)
122 if test x$ac_cv_path_BASH = x
123 then
124   AC_MSG_ERROR([You don't have bash installed.])
126 if test x$ac_cv_path_BASH = xno
127 then
128   AC_MSG_ERROR([You don't have bash installed.])
131 AC_PATH_PROG(FLEX, flex, no)
132 if test x$ac_cv_path_FLEX = x
133 then
134   AC_MSG_ERROR([You don't have flex installed.])
136 if test x$ac_cv_path_FLEX = xno
137 then
138   AC_MSG_ERROR([You don't have flex installed.])
141 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
142 if test x$ac_cv_path_PKG_CONFIG = x
143 then
144   AC_MSG_ERROR([You don't have pkg-config installed.])
146 if test x$ac_cv_path_PKG_CONFIG = xno
147 then
148   AC_MSG_ERROR([You don't have pkg-config installed.])
151 AC_CHECK_HEADER(pcreposix.h,
152   AC_CHECK_LIB(pcre, pcre_info,[
153   LIBS="$LIBS -lpcreposix -lpcre"
154   no_comp_check=yes],
155   AC_MSG_ERROR([*** unable to locate pcre library ***])),
156   AC_MSG_ERROR([*** unable to locate pcreposix.h include file ***]))
158 AC_CHECK_HEADER(pcrecpp.h,
159   AC_CHECK_LIB(pcrecpp,pcre_compile,[
160   LIBS="$LIBS -lpcrecpp"
161   no_comp_check=yes],
162   AC_MSG_ERROR([*** unable to locate pcrecpp library ***])),
163   AC_MSG_ERROR([*** unable to locate pcrecpp.h include file ***])) 
165 PKG_CHECK_MODULES(APERTIUM, [dnl
166   lttoolbox-3.0 >= required_lttoolbox_version dnl
167   libxml-2.0 >= required_libxml_version dnl
168   libpcre >= required_libpcre_version], CPPFLAGS="$CPPFLAGS $APERTIUM_CFLAGS"; LIBS="$LIBS $APERTIUM_LIBS")
169   
170 # Checks for header files.
171 AC_HEADER_STDC
172 AC_CHECK_HEADERS([stdlib.h string.h unistd.h stddef.h])
174 # Checks for typedefs, structures, and compiler characteristics.
175 AC_HEADER_STDBOOL
176 AC_C_CONST
177 AC_TYPE_SIZE_T
179 # Checks for library functions.
180 AC_FUNC_ERROR_AT_LINE
181 AC_FUNC_MALLOC
182 AC_FUNC_REALLOC
184 AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, fputc_unlocked, fputs_unlocked, getopt_long, fgetwc_unlocked, fputwc_unlocked, fgetws_unlocked, fputws_unlocked])
186 AC_CHECK_FUNCS([setlocale strdup])
188 AC_OUTPUT([Makefile apertium-3.0.pc apertium/Makefile])