Adding
[apertium.git] / apertium-tagger-training-tools / configure.ac
blobe4dc12073a0ee3e15eb44561863f50b9e8758f34
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.52)
6 m4_define([required_lttoolbox_version], [2.0])
7 m4_define([required_apertium_version], [2.0])
8 m4_define([required_libxml_version], [2.6.17])
10 AC_INIT([apertium-tagger-training-tools], [1.0.0], [fsanchez@dlsi.ua.es])
12 AC_CONFIG_HEADERS([src/configure.H])
14 # Release versioning
15 GENERIC_MAJOR_VERSION=1
16 GENERIC_MINOR_VERSION=0
17 GENERIC_MICRO_VERSION=0
19 GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
20 AC_SUBST(GENERIC_API_VERSION)
22 PACKAGE=apertium-tagger-training-tools
24 GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
25 GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
26 AC_SUBST(GENERIC_RELEASE)
27 AC_SUBST(GENERIC_VERSION)
29 VERSION=$GENERIC_VERSION
31 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
33 # Checks for programs.
35 AC_MSG_CHECKING([Compilation architecture: PPC, i686, x86_64, Other])
36 if test x$(which arch) = x
37 then ARCH=$($(which uname) -m)
38 else ARCH=$($(which arch))
41 if test x$ARCH = xppc
42 then
43   AC_MSG_RESULT([PowerPC])
44   CFLAGS="-Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer $CFLAGS"
45   CXXFLAGS="-Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer $CXXFLAGS"
46 else
47   if test x$ARCH = xi686
48   then
49     AC_MSG_RESULT([i686])
50     CFLAGS="-Wall -ansi -march=i686 -O3 -fomit-frame-pointer -funroll-loops $CFLAGS"
51     CXXFLAGS="-Wall -ansi -march=i686 -O3 \
52               -fomit-frame-pointer -funroll-loops $CXXFLAGS"
53   
54   else
55     if test x$ARCH = xx86_64
56     then
57       AC_MSG_RESULT([x86_64])
58       CFLAGS="-Wall -ansi -O3 -mtune=nocona -fomit-frame-pointer -funroll-loops $CFLAGS"
59       CXXFLAGS="-Wall -ansi -O3 -mtune=nocona \
60               -fomit-frame-pointer -funroll-loops $CXXFLAGS"
61     else
62       AC_MSG_RESULT([Other])
63       CFLAGS="-Wall -ansi -O3 $CFLAGS"
64       CXXFLAGS="-Wall -ansi -O3 $CXXFLAGS"
65     fi
66   fi
69 AC_PROG_CXX
70 AC_PROG_LIBTOOL
71 AM_SANITY_CHECK
72 AC_LANG_CPLUSPLUS
74 AC_ARG_ENABLE(debug,
75               [  --enable-debug    Enable "-g -Wall" compiler options], 
76               [CXXFLAGS="-g -Wall"; CFLAGS="-g -Wall"])
78 AC_ARG_ENABLE(profile,
79               [  --enable-profile  Enable "-pg -g -Wall" compiler options],
80               [CXXFLAGS="-pg -g -Wall"; CFLAGS="-pg -g -Wall"; LDFLAGS="-pg"])
82 if test x$ARCH = xppc
83 then
84   AC_PATH_PROG(XSLTPROC, sabcmd, no)
85   if test x$ac_cv_path_XSLTPROC = x
86   then
87     AC_MSG_ERROR([You don't have sablotron installed.])
88   fi
89   if test x$ac_cv_path_XSLTPROC = xno
90   then
91     AC_MSG_ERROR([You don't have sablotron installed.])
92   fi
93 else 
94   AC_PATH_PROG(XSLTPROC, xsltproc, no)
95   if test x$ac_cv_path_XSLTPROC = x
96   then
97     AC_MSG_ERROR([You don't have xsltproc installed.])
98   fi
99   if test x$ac_cv_path_XSLTPROC = xno
100   then
101     AC_MSG_ERROR([You don't have xsltproc installed.])
102   fi
105 AC_PATH_PROG(BASH, bash, no)
106 if test x$ac_cv_path_BASH = x
107 then
108   AC_MSG_ERROR([You don't have bash installed.])
110 if test x$ac_cv_path_BASH = xno
111 then
112   AC_MSG_ERROR([You don't have bash installed.])
115 AC_PATH_PROG(PERL, perl, no)
116 if test x$ac_cv_path_PERL = x
117 then
118   AC_MSG_ERROR([You don't have perl installed.])
120 if test x$ac_cv_path_PERL = xno
121 then
122   AC_MSG_ERROR([You don't have perl installed.])
124     
125 AC_PATH_PROG(APERTIUM_DESTXT, apertium-destxt, no)
126 AC_PATH_PROG(LTPROC, lt-proc, no)
128 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
129 if test x$ac_cv_path_PKG_CONFIG = x
130 then
131   AC_MSG_ERROR([You don't have pkg-config installed.])
133 if test x$ac_cv_path_PKG_CONFIG = xno
134 then
135   AC_MSG_ERROR([You don't have pkg-config installed.])
138 PKG_CHECK_MODULES(LIBXML2, [dnl
139   libxml-2.0 >= required_libxml_version])
141 PKG_CHECK_MODULES(LTTOOLBOX, [dnl
142   lttoolbox-2.0 >= required_lttoolbox_version])
143   
144 PKG_CHECK_MODULES(APERTIUM, [dnl
145   apertium-2.0 >= required_apertium_version])
147 #Check for libraries.
148 AC_CHECK_LIB(xml2, xmlReaderForFile)
150 # Checks for header files.
151 AC_HEADER_STDC
152 AC_CHECK_HEADERS([regex.h sys/types.h sys/times.h sys/wait.h sys/resource.h locale.h getopt.h])
154 # Checks for typedefs, structures, and compiler characteristics.
155 AC_HEADER_STDBOOL
156 AC_C_CONST
157 AC_TYPE_SIZE_T
159 # Checks for library functions.
160 AC_FUNC_ERROR_AT_LINE
161 AC_FUNC_MALLOC
162 AC_FUNC_REALLOC
164 #AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, fputc_unlocked, fputs_unlocked, getopt_long])
165 AC_CHECK_DECLS([getopt_long])
167 #AC_CHECK_FUNCS([setlocale strdup])
168 AC_CHECK_FUNCS([setlocale])
170 AC_OUTPUT([Makefile src/Makefile apertium-tagger-training-tools-1.0.pc])