Debian Codegraph @

configure.ac

raw ◀ ▶
1 Debian patch touch this file
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.68)
4 AC_INIT([Liblouis], [3.39.0], [[email protected]], [liblouis], [http://www.liblouis.io])
5 AC_CONFIG_SRCDIR([liblouis/lou_backTranslateString.c])
6 AM_CONFIG_HEADER(liblouis/config.h)
7
8 AC_CONFIG_AUX_DIR([build-aux])
9 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE([-Wall dist-zip])
11
12 # Checks for programs.
13 AC_PROG_CC
14
15 # gnulib for the library
16 gl_EARLY
17 # gnulib for the tools
18 gl_tools_EARLY
19
20 gl_INIT
21 gl_tools_INIT
22
23 # Checks for more programs.
24 AC_PROG_INSTALL
25 AC_PROG_LN_S
26 AC_PROG_MAKE_SET
27 AM_PROG_AR
28
29 # Check if the user wants to enable yaml tests
30 AC_ARG_WITH([yaml],
31 [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])],
32 [with_yaml=$withval],
33 [])
34
35 # Check if the user wants to enable coverage
36 AC_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
41 AC_ARG_WITH([fuzzer],
42 [AS_HELP_STRING([--with-fuzzer], [enable fuzzer for function lou_translateString @<:@default=no@:>@])],
43 [])
44
45 # Checks for libraries.
46 if test "x$with_yaml" = xno; then
47 AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests])
48 else
49 AC_CHECK_LIB([yaml], [yaml_parser_initialize])
50 fi
51
52 AM_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
55 if 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
61 fi
62
63 # Check for coverage
64 AM_CONDITIONAL(USE_COVERAGE, [test x"$with_coverage" = xyes])
65
66 # Check for fuzzer
67 AC_MSG_CHECKING([whether to enable fuzzer])
68 AS_IF([test "$CC" != "clang" || test "$CXX" != "clang++"], [with_fuzzer=no])
69 AS_IF([test "x$with_fuzzer" = "xyes"],
70 [
71 AC_MSG_RESULT([yes])
72 HOST_CPU="`$CC -print-target-triple | sed -e 's/-.*//'`"
73 CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
74 LIBFUZZER_NO_MAIN="`$CC $CFLAGS -print-file-name=libclang_rt.fuzzer_no_main-$HOST_CPU.a` -lstdc++ -lm"
75 ],
76 AC_MSG_RESULT([no]))
77 AC_SUBST(LIBFUZZER_NO_MAIN)
78 AM_CONDITIONAL(USE_FUZZER, [test "x$with_fuzzer" = "xyes"])
79
80 # Checks for header files.
81 AC_HEADER_STDC
82 AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
83
84 # Checks for typedefs, structures, and compiler characteristics.
85 AC_C_CONST
86
87 # Checks for library functions.
88 AC_FUNC_MEMCMP
89 AC_FUNC_VPRINTF
90 AC_CHECK_FUNCS([memset])
91
92 # This is for stuff that absolutely must end up in pyconfig.h.
93 # Please use pyport.h instead, if possible.
94 AH_TOP([
95 #ifndef LOUISCFG_H
96 #define LOUISCFG_H
97 ])
98 AH_BOTTOM([
99 #endif /*LOUISCFG_H*/
100 ])
101
102 # increment if the interface has additions, changes, removals.
103 LIBLOUIS_CURRENT=21
104
105 # increment any time the source changes; set to 0 if you increment
106 # CURRENT
107 LIBLOUIS_REVISION=4
108
109 # increment if any interfaces have been added; set to 0 if any
110 # interfaces have been changed or removed. removal has precedence over
111 # adding, so set to 0 if both happened.
112 LIBLOUIS_AGE=1
113
114 AC_SUBST(LIBLOUIS_CURRENT)
115 AC_SUBST(LIBLOUIS_REVISION)
116 AC_SUBST(LIBLOUIS_AGE)
117
118 # needed to build the liblouis.def
119 DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}`
120 AC_SUBST(DLL_VERSION)
121
122 AC_ISC_POSIX
123 AC_HEADER_STDC
124 AC_LIBTOOL_WIN32_DLL
125 AC_PROG_LIBTOOL
126
•127 # define an additional recursive make target to format the sources.
128 # Also check if clang-format is installed
129 AM_EXTRA_RECURSIVE_TARGETS([format-sources])
130 # prefer version 18 of clang-format as it is part of Ubuntu 24.04 LTS
•131 AC_CHECK_PROGS([SOURCE_FORMATTER], [clang-format-18 clang-format])
132 AM_CONDITIONAL([HAVE_SOURCE_FORMATTER], [test x$SOURCE_FORMATTER = xclang-format -o x$SOURCE_FORMATTER = xclang-format-18])
133
134 # GNU help2man creates man pages from --help output; in many cases,
135 # this is sufficient, and obviates the need to maintain man pages
136 # separately. However, some developers do not have it so we do not
137 # make its use mandatory.
138 #if test "x$cross_compiling" = xyes; then
139 # AC_MSG_WARN([cannot generate manual pages while cross compiling])
140 #else
141 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
142 #fi
143 AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
144
145 # Only run parts of the tests if we are cross compiling
146 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
147
148 # Check for makeinfo version >= 5, required for building documentation.
149 have_makeinfo_5=false
150 AC_PROG_SED
151 AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes])
152 if test x"${MAKEINFO_FOUND}" = xyes
153 then
154 MAKEINFO_VERSION_REQ=5
155 AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ])
156 MAKEINFO_VERSION=`makeinfo --version | sed -ne 's/^\(makeinfo\|texi2any\) .* \([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*.*$/\2/p'`
157 if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ
158 then
159 AC_MSG_RESULT([no])
160 AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.])
161 else
162 AC_MSG_RESULT([yes])
163 have_makeinfo_5=true
164 fi
165 else
166 AC_MSG_WARN([Missing program 'makeinfo', Documentation will not be built. Please install you you want documentation or refer to online resources.])
167 fi
168 AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue])
169
170 # Check if the user wants to enable macros.
171 # Macros are an experimental feature and need to be enabled
172 # explicitely. They are a helpful tool for refactoring, but for now we
173 # don't want to expose it to users yet.
174 AC_ARG_ENABLE([macros],
175 [AS_HELP_STRING([--enable-macros], [enable macros @<:@default=no@:>@])],
176 [enable_macros=$enableval],
177 [])
178
179 if test "x$enable_macros" = xyes; then
180 AC_DEFINE([ENABLE_MACROS],[1],[Enable macros])
181 fi
182 AM_CONDITIONAL([ENABLE_MACROS], [test "x$enable_macros" = xyes])
183
184 AC_ARG_ENABLE(ucs4,
185 AC_HELP_STRING(--enable-ucs4, enable 4 byte-wide characters),
186 [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])],
187 [enable_ucs4=no])
188
189 AC_MSG_CHECKING([whether 4 byte-wide characters should be supported])
190 AC_MSG_RESULT($enable_ucs4)
191
192 case "$enable_ucs4" in
193 yes) WIDECHAR_TYPE='unsigned int';;
194 *) WIDECHAR_TYPE='unsigned short int';;
195 esac
196 AC_SUBST(WIDECHAR_TYPE)
197 AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes])
198
199 case $host in
200 *mingw* | *cygwin*)
201 CFLAGS="$CFLAGS -Wl,--add-stdcall-alias"
202 LDFLAGS="$LDFLAGS -avoid-version"
203 ;;
204 esac
205
206 # add an --enable-macos-universal-binary flag that when building for
207 # mac create a universal x86_64 / arm64 binary
208 AC_ARG_ENABLE([macos-universal-binary],
209 [AS_HELP_STRING([--enable-macos-universal-binary],
210 [Create an universal x86_64+arm64 binary when building for macos)])],,
211 [enable_macos_universal_binary=no])
212
213 # Determine if we're building for macos/darwin by checking for macos &
214 # darwin in the build triple.
215 AC_CANONICAL_HOST
216 build_macosx=no
217 case $host_os in
218 *macos*)
219 build_macosx=yes ;;
220 *darwin*)
221 build_macosx=yes ;;
222 esac
223 AM_CONDITIONAL([OSX], [test "$build_macosx" = "yes"])
224
225 # If building for Mac we will pass x86_64 or arm64 to the compiler
226 # based on user options or target type.
227 AS_IF([test "$build_macosx" = "yes"],[
228 clang_arch_x86_64="no"
229 clang_arch_arm64="no"
230
231 # If building a universal binary ask clang for both
232 AS_IF([test "$enable_macos_universal_binary" = "yes"],[
233 clang_arch_x86_64="yes"
234 clang_arch_arm64="yes"
235 ],[
236 # If building for x86_64 ask for that
237 AS_IF([test "$host_cpu" = "x86_64"],[
238 clang_arch_x86_64="yes"
239 ])
240 # If building for arm64, ask for that
241 AS_IF([test "$host_cpu" = "aarch64"],[
242 clang_arch_arm64="yes"
243 ])
244 ])
245 # set the defines for our makefile
246 AM_CONDITIONAL([CLANG_ARCH_X86_64], [test "$clang_arch_x86_64" = "yes"])
247 AM_CONDITIONAL([CLANG_ARCH_ARM64], [test "$clang_arch_arm64" = "yes"])
248 ], [
249 # Just set these to false. They need to be present in the else
250 # clause to keep automake happy.
251 AM_CONDITIONAL([CLANG_ARCH_X86_64], [false])
252 AM_CONDITIONAL([CLANG_ARCH_ARM64], [false])
253 ])
254
255 AC_CONFIG_FILES([
256 Makefile
257 doc/Makefile
258 man/Makefile
259 liblouis/Makefile
260 liblouis/liblouis.h
261 windows/Makefile
262 windows/include/Makefile
263 windows/utils/Makefile
264 tables/Makefile
265 liblouis.pc
266 tests/Makefile
267 tests/braille-specs/Makefile
268 tests/fuzzing/Makefile
269 tests/resolve_table.h
270 tests/tables/Makefile
271 tests/tables/emphclass/Makefile
272 tests/tables/attribute/Makefile
273 tests/tables/moreTables/Makefile
274 tests/tables/resolve_table/Makefile
275 tests/tables/resolve_table/dir_1/Makefile
276 tests/tables/resolve_table/dir_1/dir_1.1/Makefile
277 tests/tables/resolve_table/dir_2/Makefile
278 tests/tablesWithMetadata/Makefile
279 tests/yaml/Makefile
280 python/Makefile
281 python/pyproject.toml
282 python/louis/Makefile
283 python/examples/Makefile
284 python/tests/Makefile
285 tools/Makefile
286 tools/gnulib/Makefile
287 tools/lou_maketable.d/Makefile
288 tools/lou_maketable.d/lou_maketable
289 gnulib/Makefile])
290 AC_OUTPUT