blob: bd7776b0f32207ee0e08d07daf1afaa146a95cfc [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 Eglif628d162022-12-05 16:04:29 +01004AC_INIT([Liblouis], [3.24.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 Egli81fa55e2022-01-12 15:00:48 +010013AC_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
Christian Eglib48904e2017-12-06 15:32:54 +010027AM_PROG_AR
Eitan Isaacson109996e2008-12-20 14:52:53 +000028
Bert Frees4f532ad2019-04-03 13:01:25 +020029# Check if the user wants to enable yaml tests
30AC_ARG_WITH([yaml],
31 [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])],
32 [with_yaml=$withval],
33 [])
34
kmamadoudram55f935f2022-03-21 13:48:33 +010035# Check if the user wants to enable coverage
36AC_ARG_WITH([coverage],
37 [AS_HELP_STRING([--with-coverage], [enable clang coverage in the fuzzer tests (also add coverage to lib sources) @<:@default=no@:>@])],
38 [])
39
40# Check if the user wants to compile fuzzer
41AC_ARG_WITH([fuzzer],
42 [AS_HELP_STRING([--with-fuzzer], [enable fuzzer for function lou_translateString @<:@default=no@:>@])],
43 [])
44
Bert Freese580f392016-10-10 12:29:29 +020045# Checks for libraries.
Bert Frees4f532ad2019-04-03 13:01:25 +020046if test "x$with_yaml" == xno; then
47 AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests])
48else
49 AC_CHECK_LIB([yaml], [yaml_parser_initialize])
50fi
51
52AM_CONDITIONAL([WITH_YAML], [test "x$ac_cv_lib_yaml_yaml_parser_initialize" == xyes -a "x$with_yaml" != xno])
53
54# If libyaml is missing warn or die depending on --with-yaml
55if test x$ac_cv_lib_yaml_yaml_parser_initialize != xyes; then
56 case "$with_yaml" in
57 yes) AC_MSG_ERROR([--with-yaml was given, but libyaml was not found]);;
58 no) ;;
59 *) AC_MSG_WARN([libyaml was not found. YAML tests will be skipped]);;
60 esac
61fi
Bert Freese580f392016-10-10 12:29:29 +020062
kmamadoudram55f935f2022-03-21 13:48:33 +010063# Check for coverage
64AM_CONDITIONAL(USE_COVERAGE, [test x"$with_coverage" = xyes])
65
66# Check for fuzzer
67AC_MSG_CHECKING([whether to enable fuzzer])
68AS_IF([test "x$with_fuzzer" = "xyes" && test "$CC" = "clang" && test "$CXX" = "clang++"], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]))
69AM_CONDITIONAL(USE_FUZZER, [test "x$with_fuzzer" = "xyes" && test "$CC" = "clang" && test "$CXX" = "clang++"])
70
Eitan Isaacson109996e2008-12-20 14:52:53 +000071# Checks for header files.
72AC_HEADER_STDC
73AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
74
75# Checks for typedefs, structures, and compiler characteristics.
76AC_C_CONST
77
78# Checks for library functions.
Eitan Isaacson109996e2008-12-20 14:52:53 +000079AC_FUNC_MEMCMP
Eitan Isaacson109996e2008-12-20 14:52:53 +000080AC_FUNC_VPRINTF
81AC_CHECK_FUNCS([memset])
82
83# This is for stuff that absolutely must end up in pyconfig.h.
84# Please use pyport.h instead, if possible.
85AH_TOP([
86#ifndef LOUISCFG_H
87#define LOUISCFG_H
88])
89AH_BOTTOM([
90#endif /*LOUISCFG_H*/
91])
92
93# increment if the interface has additions, changes, removals.
Christian Egli03d7d722019-12-02 17:29:11 +010094LIBLOUIS_CURRENT=20
Eitan Isaacson109996e2008-12-20 14:52:53 +000095
Christian Egli5f8769f2014-12-01 11:38:15 +010096# increment any time the source changes; set to 0 if you increment
97# CURRENT
Christian Eglif628d162022-12-05 16:04:29 +010098LIBLOUIS_REVISION=12
Eitan Isaacson109996e2008-12-20 14:52:53 +000099
Christian Egli5f8769f2014-12-01 11:38:15 +0100100# increment if any interfaces have been added; set to 0 if any
101# interfaces have been changed or removed. removal has precedence over
102# adding, so set to 0 if both happened.
Christian Egli03c21f12019-08-30 13:45:18 +0200103LIBLOUIS_AGE=0
Eitan Isaacson109996e2008-12-20 14:52:53 +0000104
105AC_SUBST(LIBLOUIS_CURRENT)
106AC_SUBST(LIBLOUIS_REVISION)
107AC_SUBST(LIBLOUIS_AGE)
108
Christian Egli0899aa12015-09-08 10:39:35 +0200109# needed to build the liblouis.def
110DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}`
111AC_SUBST(DLL_VERSION)
112
Eitan Isaacson109996e2008-12-20 14:52:53 +0000113AC_ISC_POSIX
114AC_HEADER_STDC
115AC_LIBTOOL_WIN32_DLL
Christian Eglib7159412009-10-30 11:14:49 +0000116AC_PROG_LIBTOOL
Eitan Isaacson109996e2008-12-20 14:52:53 +0000117
Christian Egliedcc09a2018-05-03 15:59:05 +0200118# catch as many warnings as possible with the help of the gnulib manywarnings module
119gl_MANYWARN_ALL_GCC([warnings])
120# Set up the list of the pointless, undesired warnings.
121nw=
122nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
Christian Eglif2bb9f82018-05-09 11:53:19 +0200123nw="$nw -Wsuggest-attribute=pure" # ignore recommendations to use
124nw="$nw -Wsuggest-attribute=format" # attributes, most of these only
125nw="$nw -Wsuggest-attribute=const" # work in gcc
126nw="$nw -Wsuggest-attribute=noreturn"
Christian Egliedcc09a2018-05-03 15:59:05 +0200127# Enable all GCC warnings not in this list.
128gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
129for w in $warnings; do
130 gl_WARN_ADD([$w])
131done
132
Christian Eglidd378ff2017-10-03 13:56:10 +0200133# define an additional recursive make target to format the sources.
134# Also check if clang-format is installed
135AM_EXTRA_RECURSIVE_TARGETS([format-sources])
Christian Egli112c1c92022-11-25 15:40:49 +0100136# prefer version 14 of clang-format as it is part of Ubuntu 22.04 LTS
137AC_CHECK_PROGS([SOURCE_FORMATTER], [clang-format-14 clang-format])
138AM_CONDITIONAL([HAVE_SOURCE_FORMATTER], [test x$SOURCE_FORMATTER = xclang-format -o x$SOURCE_FORMATTER = xclang-format-14])
Christian Eglidd378ff2017-10-03 13:56:10 +0200139
Christian Egli644ed622009-10-08 15:02:15 +0000140# GNU help2man creates man pages from --help output; in many cases,
141# this is sufficient, and obviates the need to maintain man pages
142# separately. However, some developers do not have it so we do not
143# make its use mandatory.
Christian Eglie63b3592010-01-26 14:28:33 +0000144if test "x$cross_compiling" = xyes; then
145 AC_MSG_WARN([cannot generate manual pages while cross compiling])
146else
147 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
148fi
Christian Egli644ed622009-10-08 15:02:15 +0000149AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
150
Christian Egli6785ff82017-06-02 13:40:50 +0200151# Only run parts of the tests if we are cross compiling
152AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
153
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100154# Check for makeinfo version >= 5, required for building documentation.
Christian Egli5d9030a2015-03-16 22:38:47 +0100155have_makeinfo_5=false
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100156AC_PROG_SED
157AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes])
158if test x"${MAKEINFO_FOUND}" = xyes
159then
160 MAKEINFO_VERSION_REQ=5
Christian Egli774d74b2014-11-26 11:03:50 +0100161 AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ])
Christian Egli32d0d5a2018-02-20 16:47:12 +0100162 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 +0100163 if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ
164 then
165 AC_MSG_RESULT([no])
Christian Egli674844e2015-03-12 13:56:49 +0100166 AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100167 else
168 AC_MSG_RESULT([yes])
Christian Egli674844e2015-03-12 13:56:49 +0100169 have_makeinfo_5=true
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100170 fi
171else
Christian Egli25ef16b2015-05-22 12:22:52 +0200172 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 +0100173fi
Christian Egli674844e2015-03-12 13:56:49 +0100174AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100175
Christian Egliedadfae2021-12-03 15:09:46 +0100176# Check if the user wants to enable macros.
177# Macros are an experimental feature and need to be enabled
178# explicitely. They are a helpful tool for refactoring, but for now we
179# don't want to expose it to users yet.
180AC_ARG_ENABLE([macros],
181 [AS_HELP_STRING([--enable-macros], [enable macros @<:@default=no@:>@])],
182 [enable_macros=$enableval],
183 [])
184
185if test "x$enable_macros" == xyes; then
186 AC_DEFINE([ENABLE_MACROS],[1],[Enable macros])
187fi
188AM_CONDITIONAL([ENABLE_MACROS], [test "x$enable_macros" = xyes])
189
Eitan Isaacson109996e2008-12-20 14:52:53 +0000190AC_ARG_ENABLE(ucs4,
Christian Egliedadfae2021-12-03 15:09:46 +0100191 AC_HELP_STRING(--enable-ucs4, enable 4 byte-wide characters),
Christian Eglid4aaee82016-06-20 12:36:16 +0200192 [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])],
Eitan Isaacson109996e2008-12-20 14:52:53 +0000193 [enable_ucs4=no])
194
Christian Eglibbf00fd2009-11-12 10:02:23 +0000195AC_MSG_CHECKING([whether 4 byte-wide characters should be supported])
196AC_MSG_RESULT($enable_ucs4)
Eitan Isaacson109996e2008-12-20 14:52:53 +0000197
198case "$enable_ucs4" in
Christian Eglibbf00fd2009-11-12 10:02:23 +0000199yes) WIDECHAR_TYPE='unsigned int';;
200*) WIDECHAR_TYPE='unsigned short int';;
Eitan Isaacson109996e2008-12-20 14:52:53 +0000201esac
Christian Eglibbf00fd2009-11-12 10:02:23 +0000202AC_SUBST(WIDECHAR_TYPE)
Christian Egli33ded852012-03-20 14:13:30 +0000203AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000204
James Teh75bfbe22009-01-20 12:19:47 +0000205case $host in
206 *mingw* | *cygwin*)
James Teh115fb832009-02-14 00:47:32 +0000207 CFLAGS="$CFLAGS -Wl,--add-stdcall-alias"
Michael Whapples2bea4c82014-09-23 15:29:59 +0100208 LDFLAGS="$LDFLAGS -avoid-version"
James Teh75bfbe22009-01-20 12:19:47 +0000209 ;;
210esac
211
Bert Frees3c8fe3b2017-05-12 17:09:28 +0200212AC_CANONICAL_HOST
213build_macosx=no
214case $host_os in
215 darwin*)
216 build_macosx=yes
217 ;;
218esac
219AM_CONDITIONAL([OSX], [test "$build_macosx" = "yes"])
220
John Boyer9bfed872011-06-12 22:56:54 +0000221AC_CONFIG_FILES([
222 Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200223 doc/Makefile
224 man/Makefile
225 liblouis/Makefile
226 liblouis/liblouis.h
John Boyer9bfed872011-06-12 22:56:54 +0000227 windows/Makefile
228 windows/include/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200229 windows/utils/Makefile
230 tables/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000231 liblouis.pc
Davy Kager033d97c2017-06-21 18:58:56 +0200232 tests/Makefile
Bert Freesb76bef12017-10-08 22:17:55 +0200233 tests/braille-specs/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200234 tests/resolve_table.h
235 tests/tables/Makefile
236 tests/tables/emphclass/Makefile
Christian Egliab48b8a2020-08-28 15:18:04 +0200237 tests/tables/attribute/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200238 tests/tables/moreTables/Makefile
239 tests/tables/resolve_table/Makefile
240 tests/tables/resolve_table/dir_1/Makefile
241 tests/tables/resolve_table/dir_1/dir_1.1/Makefile
242 tests/tables/resolve_table/dir_2/Makefile
Christian Egli2a576052015-05-29 14:10:05 +0200243 tests/tablesWithMetadata/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200244 tests/ueb_test_data/Makefile
245 tests/yaml/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000246 python/Makefile
Christopher Brannona4539ce2017-04-24 18:03:29 -0700247 python/setup.py
John Boyer9bfed872011-06-12 22:56:54 +0000248 python/louis/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200249 tools/Makefile
250 tools/gnulib/Makefile
Bert Frees1b5166b2017-08-10 12:21:19 +0200251 tools/lou_maketable.d/Makefile
252 tools/lou_maketable.d/lou_maketable
Christian Egli60e5bf82016-06-20 11:08:16 +0200253 gnulib/Makefile])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000254AC_OUTPUT