forked from apertium/apertium-recursive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
75 lines (56 loc) · 2.21 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
AC_PREREQ(2.61)
m4_define([required_libxml_version], [2.6.17])
m4_define([required_apertium_version], [3.8.0])
m4_define([required_lttoolbox_version], [3.6.0])
AC_INIT([apertium-recursive], [1.1.0], [awesomeevildudes@gmail.com])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([src/auto_config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX
AM_SANITY_CHECK
AC_LANG_CPLUSPLUS
CFLAGS="-Wall -Wextra $CFLAGS"
CXXFLAGS="-Wall -Wextra $CXXFLAGS"
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug compiler options],
[case "${enableval}" in
yes ) CXXFLAGS="-g -Wall";CFLAGS="-g -ggdb -Og -DDEBUG" ;;
no ) ;;
* ) AC_MSG_ERROR("Invalid value ${enableval} for --enable-debug") ;; esac])
PKG_CHECK_MODULES([LTTOOLBOX], [lttoolbox >= required_lttoolbox_version])
AC_SUBST(LTTOOLBOX_CFLAGS)
AC_SUBST(LTTOOLBOX_LIBS)
PKG_CHECK_MODULES([APERTIUM], [apertium >= required_apertium_version])
AC_SUBST(APERTIUM_CFLAGS)
AC_SUBST(APERTIUM_LIBS)
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= required_libxml_version])
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
PKG_CHECK_MODULES([ICU], [icu-i18n, icu-io, icu-uc])
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_LIBS)
# Checks for libraries.
AC_CHECK_LIB(xml2, xmlReaderForFile)
AC_CHECK_FUNCS([setlocale strdup getopt_long])
AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, fputc_unlocked, fputs_unlocked, getopt_long])
CPPFLAGS="$CPPFLAGS $CFLAGS $LTTOOLBOX_CFLAGS $APERTIUM_CFLAGS $LIBXML_CFLAGS $ICU_CFLAGS"
LIBS="$LIBS $LTTOOLBOX_LIBS $APERTIUM_LIBS $LIBXML_LIBS $ICU_LIBS"
# Checks for highest supported C++ standard
AC_LANG(C++)
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_CONFIG_FILES([
Makefile
src/Makefile
apertium-recursive.pc
])
AC_OUTPUT