blob: d3414c88c6897f722f7fdc1ddfb28e39f434927e [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 Egli91062732021-12-06 16:40:40 +01004AC_INIT([Liblouis], [3.20.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 Eglid3430b72018-08-27 16:23:28 +020010AM_INIT_AUTOMAKE([-Wall dist-zip])
Eitan Isaacson109996e2008-12-20 14:52:53 +000011
12# Checks for programs.
Christian Egli578e3852017-06-22 11:01:37 +020013# Try to compile using C99
14AC_PROG_CC_C99
Christian Egli4255aa22009-10-08 09:34:06 +000015
Christian Egli31ef6ff2015-06-05 11:22:36 +020016# gnulib for the library
Christian Egli4255aa22009-10-08 09:34:06 +000017gl_EARLY
Christian Egli31ef6ff2015-06-05 11:22:36 +020018# gnulib for the tools
19gl_tools_EARLY
20
Christian Egli4255aa22009-10-08 09:34:06 +000021gl_INIT
Christian Egli31ef6ff2015-06-05 11:22:36 +020022gl_tools_INIT
Christian Egli311d52b2013-01-11 16:19:23 +000023
Christian Egli4255aa22009-10-08 09:34:06 +000024# Checks for more programs.
Eitan Isaacson109996e2008-12-20 14:52:53 +000025AC_PROG_INSTALL
26AC_PROG_LN_S
27AC_PROG_MAKE_SET
Christian Eglib48904e2017-12-06 15:32:54 +010028AM_PROG_AR
Eitan Isaacson109996e2008-12-20 14:52:53 +000029
Bert Frees4f532ad2019-04-03 13:01:25 +020030# Check if the user wants to enable yaml tests
31AC_ARG_WITH([yaml],
32 [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])],
33 [with_yaml=$withval],
34 [])
35
Bert Freese580f392016-10-10 12:29:29 +020036# Checks for libraries.
Bert Frees4f532ad2019-04-03 13:01:25 +020037if test "x$with_yaml" == xno; then
38 AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests])
39else
40 AC_CHECK_LIB([yaml], [yaml_parser_initialize])
41fi
42
43AM_CONDITIONAL([WITH_YAML], [test "x$ac_cv_lib_yaml_yaml_parser_initialize" == xyes -a "x$with_yaml" != xno])
44
45# If libyaml is missing warn or die depending on --with-yaml
46if test x$ac_cv_lib_yaml_yaml_parser_initialize != xyes; then
47 case "$with_yaml" in
48 yes) AC_MSG_ERROR([--with-yaml was given, but libyaml was not found]);;
49 no) ;;
50 *) AC_MSG_WARN([libyaml was not found. YAML tests will be skipped]);;
51 esac
52fi
Bert Freese580f392016-10-10 12:29:29 +020053
Eitan Isaacson109996e2008-12-20 14:52:53 +000054# Checks for header files.
55AC_HEADER_STDC
56AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
57
58# Checks for typedefs, structures, and compiler characteristics.
59AC_C_CONST
60
61# Checks for library functions.
Eitan Isaacson109996e2008-12-20 14:52:53 +000062AC_FUNC_MEMCMP
Eitan Isaacson109996e2008-12-20 14:52:53 +000063AC_FUNC_VPRINTF
64AC_CHECK_FUNCS([memset])
65
66# This is for stuff that absolutely must end up in pyconfig.h.
67# Please use pyport.h instead, if possible.
68AH_TOP([
69#ifndef LOUISCFG_H
70#define LOUISCFG_H
71])
72AH_BOTTOM([
73#endif /*LOUISCFG_H*/
74])
75
76# increment if the interface has additions, changes, removals.
Christian Egli03d7d722019-12-02 17:29:11 +010077LIBLOUIS_CURRENT=20
Eitan Isaacson109996e2008-12-20 14:52:53 +000078
Christian Egli5f8769f2014-12-01 11:38:15 +010079# increment any time the source changes; set to 0 if you increment
80# CURRENT
Christian Egli91062732021-12-06 16:40:40 +010081LIBLOUIS_REVISION=8
Eitan Isaacson109996e2008-12-20 14:52:53 +000082
Christian Egli5f8769f2014-12-01 11:38:15 +010083# increment if any interfaces have been added; set to 0 if any
84# interfaces have been changed or removed. removal has precedence over
85# adding, so set to 0 if both happened.
Christian Egli03c21f12019-08-30 13:45:18 +020086LIBLOUIS_AGE=0
Eitan Isaacson109996e2008-12-20 14:52:53 +000087
88AC_SUBST(LIBLOUIS_CURRENT)
89AC_SUBST(LIBLOUIS_REVISION)
90AC_SUBST(LIBLOUIS_AGE)
91
Christian Egli0899aa12015-09-08 10:39:35 +020092# needed to build the liblouis.def
93DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}`
94AC_SUBST(DLL_VERSION)
95
Eitan Isaacson109996e2008-12-20 14:52:53 +000096AC_ISC_POSIX
97AC_HEADER_STDC
98AC_LIBTOOL_WIN32_DLL
Christian Eglib7159412009-10-30 11:14:49 +000099AC_PROG_LIBTOOL
Eitan Isaacson109996e2008-12-20 14:52:53 +0000100
Christian Egliedcc09a2018-05-03 15:59:05 +0200101# catch as many warnings as possible with the help of the gnulib manywarnings module
102gl_MANYWARN_ALL_GCC([warnings])
103# Set up the list of the pointless, undesired warnings.
104nw=
105nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
Christian Eglif2bb9f82018-05-09 11:53:19 +0200106nw="$nw -Wsuggest-attribute=pure" # ignore recommendations to use
107nw="$nw -Wsuggest-attribute=format" # attributes, most of these only
108nw="$nw -Wsuggest-attribute=const" # work in gcc
109nw="$nw -Wsuggest-attribute=noreturn"
Christian Egliedcc09a2018-05-03 15:59:05 +0200110# Enable all GCC warnings not in this list.
111gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
112for w in $warnings; do
113 gl_WARN_ADD([$w])
114done
115
Christian Eglidd378ff2017-10-03 13:56:10 +0200116# define an additional recursive make target to format the sources.
117# Also check if clang-format is installed
118AM_EXTRA_RECURSIVE_TARGETS([format-sources])
Christian Egli0051d362020-11-27 11:31:46 +0100119# prefer version 7 of clang-format
120AC_CHECK_PROGS([SOURCE_FORMATTER], [clang-format-7 clang-format])
Christian Eglidd378ff2017-10-03 13:56:10 +0200121AM_CONDITIONAL([HAVE_SOURCE_FORMATTER], [test x$SOURCE_FORMATTER = xclang-format])
122
Christian Egli644ed622009-10-08 15:02:15 +0000123# GNU help2man creates man pages from --help output; in many cases,
124# this is sufficient, and obviates the need to maintain man pages
125# separately. However, some developers do not have it so we do not
126# make its use mandatory.
Christian Eglie63b3592010-01-26 14:28:33 +0000127if test "x$cross_compiling" = xyes; then
128 AC_MSG_WARN([cannot generate manual pages while cross compiling])
129else
130 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
131fi
Christian Egli644ed622009-10-08 15:02:15 +0000132AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
133
Christian Egli6785ff82017-06-02 13:40:50 +0200134# Only run parts of the tests if we are cross compiling
135AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
136
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100137# Check for makeinfo version >= 5, required for building documentation.
Christian Egli5d9030a2015-03-16 22:38:47 +0100138have_makeinfo_5=false
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100139AC_PROG_SED
140AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes])
141if test x"${MAKEINFO_FOUND}" = xyes
142then
143 MAKEINFO_VERSION_REQ=5
Christian Egli774d74b2014-11-26 11:03:50 +0100144 AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ])
Christian Egli32d0d5a2018-02-20 16:47:12 +0100145 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 +0100146 if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ
147 then
148 AC_MSG_RESULT([no])
Christian Egli674844e2015-03-12 13:56:49 +0100149 AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100150 else
151 AC_MSG_RESULT([yes])
Christian Egli674844e2015-03-12 13:56:49 +0100152 have_makeinfo_5=true
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100153 fi
154else
Christian Egli25ef16b2015-05-22 12:22:52 +0200155 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 +0100156fi
Christian Egli674844e2015-03-12 13:56:49 +0100157AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100158
Christian Egliedadfae2021-12-03 15:09:46 +0100159# Check if the user wants to enable macros.
160# Macros are an experimental feature and need to be enabled
161# explicitely. They are a helpful tool for refactoring, but for now we
162# don't want to expose it to users yet.
163AC_ARG_ENABLE([macros],
164 [AS_HELP_STRING([--enable-macros], [enable macros @<:@default=no@:>@])],
165 [enable_macros=$enableval],
166 [])
167
168if test "x$enable_macros" == xyes; then
169 AC_DEFINE([ENABLE_MACROS],[1],[Enable macros])
170fi
171AM_CONDITIONAL([ENABLE_MACROS], [test "x$enable_macros" = xyes])
172
Eitan Isaacson109996e2008-12-20 14:52:53 +0000173AC_ARG_ENABLE(ucs4,
Christian Egliedadfae2021-12-03 15:09:46 +0100174 AC_HELP_STRING(--enable-ucs4, enable 4 byte-wide characters),
Christian Eglid4aaee82016-06-20 12:36:16 +0200175 [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])],
Eitan Isaacson109996e2008-12-20 14:52:53 +0000176 [enable_ucs4=no])
177
Christian Eglibbf00fd2009-11-12 10:02:23 +0000178AC_MSG_CHECKING([whether 4 byte-wide characters should be supported])
179AC_MSG_RESULT($enable_ucs4)
Eitan Isaacson109996e2008-12-20 14:52:53 +0000180
181case "$enable_ucs4" in
Christian Eglibbf00fd2009-11-12 10:02:23 +0000182yes) WIDECHAR_TYPE='unsigned int';;
183*) WIDECHAR_TYPE='unsigned short int';;
Eitan Isaacson109996e2008-12-20 14:52:53 +0000184esac
Christian Eglibbf00fd2009-11-12 10:02:23 +0000185AC_SUBST(WIDECHAR_TYPE)
Christian Egli33ded852012-03-20 14:13:30 +0000186AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000187
James Teh75bfbe22009-01-20 12:19:47 +0000188case $host in
189 *mingw* | *cygwin*)
James Teh115fb832009-02-14 00:47:32 +0000190 CFLAGS="$CFLAGS -Wl,--add-stdcall-alias"
Michael Whapples2bea4c82014-09-23 15:29:59 +0100191 LDFLAGS="$LDFLAGS -avoid-version"
James Teh75bfbe22009-01-20 12:19:47 +0000192 ;;
193esac
194
Bert Frees3c8fe3b2017-05-12 17:09:28 +0200195AC_CANONICAL_HOST
196build_macosx=no
197case $host_os in
198 darwin*)
199 build_macosx=yes
200 ;;
201esac
202AM_CONDITIONAL([OSX], [test "$build_macosx" = "yes"])
203
John Boyer9bfed872011-06-12 22:56:54 +0000204AC_CONFIG_FILES([
205 Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200206 doc/Makefile
207 man/Makefile
208 liblouis/Makefile
209 liblouis/liblouis.h
John Boyer9bfed872011-06-12 22:56:54 +0000210 windows/Makefile
211 windows/include/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200212 windows/utils/Makefile
213 tables/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000214 liblouis.pc
Davy Kager033d97c2017-06-21 18:58:56 +0200215 tests/Makefile
Bert Freesb76bef12017-10-08 22:17:55 +0200216 tests/braille-specs/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200217 tests/resolve_table.h
218 tests/tables/Makefile
219 tests/tables/emphclass/Makefile
Christian Egliab48b8a2020-08-28 15:18:04 +0200220 tests/tables/attribute/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200221 tests/tables/moreTables/Makefile
222 tests/tables/resolve_table/Makefile
223 tests/tables/resolve_table/dir_1/Makefile
224 tests/tables/resolve_table/dir_1/dir_1.1/Makefile
225 tests/tables/resolve_table/dir_2/Makefile
Christian Egli2a576052015-05-29 14:10:05 +0200226 tests/tablesWithMetadata/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200227 tests/ueb_test_data/Makefile
228 tests/yaml/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000229 python/Makefile
Christopher Brannona4539ce2017-04-24 18:03:29 -0700230 python/setup.py
John Boyer9bfed872011-06-12 22:56:54 +0000231 python/louis/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200232 tools/Makefile
233 tools/gnulib/Makefile
Bert Frees1b5166b2017-08-10 12:21:19 +0200234 tools/lou_maketable.d/Makefile
235 tools/lou_maketable.d/lou_maketable
Christian Egli60e5bf82016-06-20 11:08:16 +0200236 gnulib/Makefile])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000237AC_OUTPUT