blob: c66d374d6a32b82670d0f51e5f084bf264afcbca [file] [log] [blame]
Eitan Isaacson109996e2008-12-20 14:52:53 +00001# Process this file with autoconf to produce a configure script.
2
Christian Egli84b1a812014-05-06 14:28:14 +00003AC_PREREQ(2.68)
Christian Egli8f230912017-03-06 14:34:02 +01004AC_INIT([Liblouis], [3.1.0], [liblouis-liblouisxml@freelists.org], [liblouis], [http://www.liblouis.org])
Eitan Isaacson109996e2008-12-20 14:52:53 +00005AC_CONFIG_SRCDIR([liblouis/lou_backTranslateString.c])
Christian Egli4255aa22009-10-08 09:34:06 +00006AM_CONFIG_HEADER(liblouis/config.h)
Christian Eglib7159412009-10-30 11:14:49 +00007
8AC_CONFIG_AUX_DIR([build-aux])
9AC_CONFIG_MACRO_DIR([m4])
Christian Egli84b1a812014-05-06 14:28:14 +000010AM_INIT_AUTOMAKE
Eitan Isaacson109996e2008-12-20 14:52:53 +000011
12# Checks for programs.
13AC_PROG_CC
Christian Egli4255aa22009-10-08 09:34:06 +000014
Christian Egli31ef6ff2015-06-05 11:22:36 +020015# gnulib for the library
Christian Egli4255aa22009-10-08 09:34:06 +000016gl_EARLY
Christian Egli31ef6ff2015-06-05 11:22:36 +020017# gnulib for the tools
18gl_tools_EARLY
19
Christian Egli4255aa22009-10-08 09:34:06 +000020gl_INIT
Christian Egli31ef6ff2015-06-05 11:22:36 +020021gl_tools_INIT
Christian Egli311d52b2013-01-11 16:19:23 +000022
Christian Egli4255aa22009-10-08 09:34:06 +000023# Checks for more programs.
Eitan Isaacson109996e2008-12-20 14:52:53 +000024AC_PROG_INSTALL
25AC_PROG_LN_S
26AC_PROG_MAKE_SET
Eitan Isaacson109996e2008-12-20 14:52:53 +000027
Bert Freese580f392016-10-10 12:29:29 +020028# Checks for libraries.
29AC_CHECK_LIB([yaml], [yaml_parser_initialize])
30
Eitan Isaacson109996e2008-12-20 14:52:53 +000031# Checks for header files.
32AC_HEADER_STDC
33AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
34
35# Checks for typedefs, structures, and compiler characteristics.
36AC_C_CONST
37
38# Checks for library functions.
Eitan Isaacson109996e2008-12-20 14:52:53 +000039AC_FUNC_MEMCMP
Eitan Isaacson109996e2008-12-20 14:52:53 +000040AC_FUNC_VPRINTF
41AC_CHECK_FUNCS([memset])
42
43# This is for stuff that absolutely must end up in pyconfig.h.
44# Please use pyport.h instead, if possible.
45AH_TOP([
46#ifndef LOUISCFG_H
47#define LOUISCFG_H
48])
49AH_BOTTOM([
50#endif /*LOUISCFG_H*/
51])
52
53# increment if the interface has additions, changes, removals.
Christian Egli8f230912017-03-06 14:34:02 +010054LIBLOUIS_CURRENT=13
Eitan Isaacson109996e2008-12-20 14:52:53 +000055
Christian Egli5f8769f2014-12-01 11:38:15 +010056# increment any time the source changes; set to 0 if you increment
57# CURRENT
Christian Egli96a0a8d2015-06-01 15:49:21 +020058LIBLOUIS_REVISION=0
Eitan Isaacson109996e2008-12-20 14:52:53 +000059
Christian Egli5f8769f2014-12-01 11:38:15 +010060# increment if any interfaces have been added; set to 0 if any
61# interfaces have been changed or removed. removal has precedence over
62# adding, so set to 0 if both happened.
Christian Egli8f230912017-03-06 14:34:02 +010063LIBLOUIS_AGE=1
Eitan Isaacson109996e2008-12-20 14:52:53 +000064
65AC_SUBST(LIBLOUIS_CURRENT)
66AC_SUBST(LIBLOUIS_REVISION)
67AC_SUBST(LIBLOUIS_AGE)
68
Christian Egli0899aa12015-09-08 10:39:35 +020069# needed to build the liblouis.def
70DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}`
71AC_SUBST(DLL_VERSION)
72
Eitan Isaacson109996e2008-12-20 14:52:53 +000073AC_ISC_POSIX
74AC_HEADER_STDC
75AC_LIBTOOL_WIN32_DLL
Christian Eglib7159412009-10-30 11:14:49 +000076AC_PROG_LIBTOOL
Eitan Isaacson109996e2008-12-20 14:52:53 +000077
Christian Egli644ed622009-10-08 15:02:15 +000078# GNU help2man creates man pages from --help output; in many cases,
79# this is sufficient, and obviates the need to maintain man pages
80# separately. However, some developers do not have it so we do not
81# make its use mandatory.
Christian Eglie63b3592010-01-26 14:28:33 +000082if test "x$cross_compiling" = xyes; then
83 AC_MSG_WARN([cannot generate manual pages while cross compiling])
84else
85 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
86fi
Christian Egli644ed622009-10-08 15:02:15 +000087AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
88
Simon Aittamaabd5e6482014-11-25 19:39:51 +010089# Check for makeinfo version >= 5, required for building documentation.
Christian Egli5d9030a2015-03-16 22:38:47 +010090have_makeinfo_5=false
Simon Aittamaabd5e6482014-11-25 19:39:51 +010091AC_PROG_SED
92AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes])
93if test x"${MAKEINFO_FOUND}" = xyes
94then
95 MAKEINFO_VERSION_REQ=5
Christian Egli774d74b2014-11-26 11:03:50 +010096 AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ])
Martin Michlmayre2fa19e2015-06-30 12:40:49 -040097 MAKEINFO_VERSION=`makeinfo --version | sed -ne 's/^\(makeinfo\|texi2any\) .* \([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*$/\2/p'`
Simon Aittamaabd5e6482014-11-25 19:39:51 +010098 if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ
99 then
100 AC_MSG_RESULT([no])
Christian Egli674844e2015-03-12 13:56:49 +0100101 AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100102 else
103 AC_MSG_RESULT([yes])
Christian Egli674844e2015-03-12 13:56:49 +0100104 have_makeinfo_5=true
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100105 fi
106else
Christian Egli25ef16b2015-05-22 12:22:52 +0200107 AC_MSG_WARN([Missing program 'makeinfo', Documentation will not be built. Please install you you want documentation or refer to online resources.])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100108fi
Christian Egli674844e2015-03-12 13:56:49 +0100109AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100110
Christian Egli51c156e2017-03-06 10:19:25 +0100111# Check if the user wants to enable yaml tests
112AC_ARG_WITH([yaml],
113 [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])],
114 [with_yaml=$withval],
115 [])
116
117if test "x$with_yaml" == xno; then
118 AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests])
119fi
120
121# if libyaml is missing warn or die depending on --with-yaml
122if test x$ac_cv_lib_yaml_yaml_parser_initialize != xyes; then
123 case "$with_yaml" in
124 yes) AC_MSG_ERROR([--with-yaml was given, but libyaml was not found]);;
125 no) ;;
126 *) AC_MSG_WARN([libyaml was not found. YAML tests will be skipped]);;
127 esac
128fi
129
Christian Egli66cfe502012-03-01 14:50:42 +0000130# Check if we have Python installed
131AM_PATH_PYTHON([2.6],, [:])
132AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
133
Eitan Isaacson109996e2008-12-20 14:52:53 +0000134AC_PATH_PROG(PKG_CONFIG, pkg-config)
135
136AC_ARG_ENABLE(ucs4,
Christian Egli697a0d22014-03-03 09:46:35 +0000137 AC_HELP_STRING(--enable-ucs4, Enable 4 byte-wide characters),
Christian Eglid4aaee82016-06-20 12:36:16 +0200138 [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])],
Eitan Isaacson109996e2008-12-20 14:52:53 +0000139 [enable_ucs4=no])
140
Christian Eglibbf00fd2009-11-12 10:02:23 +0000141AC_MSG_CHECKING([whether 4 byte-wide characters should be supported])
142AC_MSG_RESULT($enable_ucs4)
Eitan Isaacson109996e2008-12-20 14:52:53 +0000143
144case "$enable_ucs4" in
Christian Eglibbf00fd2009-11-12 10:02:23 +0000145yes) WIDECHAR_TYPE='unsigned int';;
146*) WIDECHAR_TYPE='unsigned short int';;
Eitan Isaacson109996e2008-12-20 14:52:53 +0000147esac
Christian Eglibbf00fd2009-11-12 10:02:23 +0000148AC_SUBST(WIDECHAR_TYPE)
Christian Egli33ded852012-03-20 14:13:30 +0000149AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000150
James Teh75bfbe22009-01-20 12:19:47 +0000151case $host in
152 *mingw* | *cygwin*)
James Teh115fb832009-02-14 00:47:32 +0000153 CFLAGS="$CFLAGS -Wl,--add-stdcall-alias"
Michael Whapples2bea4c82014-09-23 15:29:59 +0100154 LDFLAGS="$LDFLAGS -avoid-version"
James Teh75bfbe22009-01-20 12:19:47 +0000155 ;;
156esac
157
John Boyer9bfed872011-06-12 22:56:54 +0000158AC_CONFIG_FILES([
159 Makefile
160 doc/Makefile
161 man/Makefile
162 liblouis/Makefile
163 liblouis/liblouis.h
164 windows/Makefile
165 windows/include/Makefile
166 tables/Makefile
167 liblouis.pc
168 tests/Makefile
Christian Eglibb8a27b2014-03-03 09:43:05 +0000169 tests/resolve_table.h
John Boyer9bfed872011-06-12 22:56:54 +0000170 tests/tables/Makefile
Bert Frees595c8bd2015-12-22 00:09:31 +0100171 tests/tables/emphclass/Makefile
Christian Egli98e193a2012-05-31 15:07:11 +0000172 tests/tables/moreTables/Makefile
Christian Egli393e0d92014-02-28 12:51:51 +0000173 tests/tables/resolve_table/Makefile
174 tests/tables/resolve_table/dir_1/Makefile
175 tests/tables/resolve_table/dir_1/dir_1.1/Makefile
176 tests/tables/resolve_table/dir_2/Makefile
Christian Egli2a576052015-05-29 14:10:05 +0200177 tests/tablesWithMetadata/Makefile
Christian Egli66cfe502012-03-01 14:50:42 +0000178 tests/doctests/Makefile
Christian Egli66acf852016-06-15 18:14:32 +0200179 tests/ueb_test_data/Makefile
Christian Egli6d10c382016-01-12 17:10:21 +0100180 tests/yaml/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000181 python/Makefile
Christopher Brannona4539ce2017-04-24 18:03:29 -0700182 python/setup.py
John Boyer9bfed872011-06-12 22:56:54 +0000183 python/louis/Makefile
184 tools/Makefile
Christian Egli31ef6ff2015-06-05 11:22:36 +0200185 tools/gnulib/Makefile
Christian Egli60e5bf82016-06-20 11:08:16 +0200186 gnulib/Makefile])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000187AC_OUTPUT
188