Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
| 2 | |
Christian Egli | 84b1a81 | 2014-05-06 14:28:14 +0000 | [diff] [blame] | 3 | AC_PREREQ(2.68) |
Christian Egli | e29234a | 2021-09-03 11:11:28 +0200 | [diff] [blame] | 4 | AC_INIT([Liblouis], [3.19.0], [liblouis-liblouisxml@freelists.org], [liblouis], [http://www.liblouis.org]) |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 5 | AC_CONFIG_SRCDIR([liblouis/lou_backTranslateString.c]) |
Christian Egli | 4255aa2 | 2009-10-08 09:34:06 +0000 | [diff] [blame] | 6 | AM_CONFIG_HEADER(liblouis/config.h) |
Christian Egli | b715941 | 2009-10-30 11:14:49 +0000 | [diff] [blame] | 7 | |
| 8 | AC_CONFIG_AUX_DIR([build-aux]) |
| 9 | AC_CONFIG_MACRO_DIR([m4]) |
Christian Egli | d3430b7 | 2018-08-27 16:23:28 +0200 | [diff] [blame] | 10 | AM_INIT_AUTOMAKE([-Wall dist-zip]) |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 11 | |
| 12 | # Checks for programs. |
Christian Egli | 578e385 | 2017-06-22 11:01:37 +0200 | [diff] [blame] | 13 | # Try to compile using C99 |
| 14 | AC_PROG_CC_C99 |
Christian Egli | 4255aa2 | 2009-10-08 09:34:06 +0000 | [diff] [blame] | 15 | |
Christian Egli | 31ef6ff | 2015-06-05 11:22:36 +0200 | [diff] [blame] | 16 | # gnulib for the library |
Christian Egli | 4255aa2 | 2009-10-08 09:34:06 +0000 | [diff] [blame] | 17 | gl_EARLY |
Christian Egli | 31ef6ff | 2015-06-05 11:22:36 +0200 | [diff] [blame] | 18 | # gnulib for the tools |
| 19 | gl_tools_EARLY |
| 20 | |
Christian Egli | 4255aa2 | 2009-10-08 09:34:06 +0000 | [diff] [blame] | 21 | gl_INIT |
Christian Egli | 31ef6ff | 2015-06-05 11:22:36 +0200 | [diff] [blame] | 22 | gl_tools_INIT |
Christian Egli | 311d52b | 2013-01-11 16:19:23 +0000 | [diff] [blame] | 23 | |
Christian Egli | 4255aa2 | 2009-10-08 09:34:06 +0000 | [diff] [blame] | 24 | # Checks for more programs. |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 25 | AC_PROG_INSTALL |
| 26 | AC_PROG_LN_S |
| 27 | AC_PROG_MAKE_SET |
Christian Egli | b48904e | 2017-12-06 15:32:54 +0100 | [diff] [blame] | 28 | AM_PROG_AR |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 29 | |
Bert Frees | 4f532ad | 2019-04-03 13:01:25 +0200 | [diff] [blame] | 30 | # Check if the user wants to enable yaml tests |
| 31 | AC_ARG_WITH([yaml], |
| 32 | [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])], |
| 33 | [with_yaml=$withval], |
| 34 | []) |
| 35 | |
Bert Frees | e580f39 | 2016-10-10 12:29:29 +0200 | [diff] [blame] | 36 | # Checks for libraries. |
Bert Frees | 4f532ad | 2019-04-03 13:01:25 +0200 | [diff] [blame] | 37 | if test "x$with_yaml" == xno; then |
| 38 | AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests]) |
| 39 | else |
| 40 | AC_CHECK_LIB([yaml], [yaml_parser_initialize]) |
| 41 | fi |
| 42 | |
| 43 | AM_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 |
| 46 | if 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 |
| 52 | fi |
Bert Frees | e580f39 | 2016-10-10 12:29:29 +0200 | [diff] [blame] | 53 | |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 54 | # Checks for header files. |
| 55 | AC_HEADER_STDC |
| 56 | AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) |
| 57 | |
| 58 | # Checks for typedefs, structures, and compiler characteristics. |
| 59 | AC_C_CONST |
| 60 | |
| 61 | # Checks for library functions. |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 62 | AC_FUNC_MEMCMP |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 63 | AC_FUNC_VPRINTF |
| 64 | AC_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. |
| 68 | AH_TOP([ |
| 69 | #ifndef LOUISCFG_H |
| 70 | #define LOUISCFG_H |
| 71 | ]) |
| 72 | AH_BOTTOM([ |
| 73 | #endif /*LOUISCFG_H*/ |
| 74 | ]) |
| 75 | |
| 76 | # increment if the interface has additions, changes, removals. |
Christian Egli | 03d7d72 | 2019-12-02 17:29:11 +0100 | [diff] [blame] | 77 | LIBLOUIS_CURRENT=20 |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 78 | |
Christian Egli | 5f8769f | 2014-12-01 11:38:15 +0100 | [diff] [blame] | 79 | # increment any time the source changes; set to 0 if you increment |
| 80 | # CURRENT |
Christian Egli | e29234a | 2021-09-03 11:11:28 +0200 | [diff] [blame] | 81 | LIBLOUIS_REVISION=7 |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 82 | |
Christian Egli | 5f8769f | 2014-12-01 11:38:15 +0100 | [diff] [blame] | 83 | # 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 Egli | 03c21f1 | 2019-08-30 13:45:18 +0200 | [diff] [blame] | 86 | LIBLOUIS_AGE=0 |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 87 | |
| 88 | AC_SUBST(LIBLOUIS_CURRENT) |
| 89 | AC_SUBST(LIBLOUIS_REVISION) |
| 90 | AC_SUBST(LIBLOUIS_AGE) |
| 91 | |
Christian Egli | 0899aa1 | 2015-09-08 10:39:35 +0200 | [diff] [blame] | 92 | # needed to build the liblouis.def |
| 93 | DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}` |
| 94 | AC_SUBST(DLL_VERSION) |
| 95 | |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 96 | AC_ISC_POSIX |
| 97 | AC_HEADER_STDC |
| 98 | AC_LIBTOOL_WIN32_DLL |
Christian Egli | b715941 | 2009-10-30 11:14:49 +0000 | [diff] [blame] | 99 | AC_PROG_LIBTOOL |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 100 | |
Christian Egli | edcc09a | 2018-05-03 15:59:05 +0200 | [diff] [blame] | 101 | # catch as many warnings as possible with the help of the gnulib manywarnings module |
| 102 | gl_MANYWARN_ALL_GCC([warnings]) |
| 103 | # Set up the list of the pointless, undesired warnings. |
| 104 | nw= |
| 105 | nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings |
Christian Egli | f2bb9f8 | 2018-05-09 11:53:19 +0200 | [diff] [blame] | 106 | nw="$nw -Wsuggest-attribute=pure" # ignore recommendations to use |
| 107 | nw="$nw -Wsuggest-attribute=format" # attributes, most of these only |
| 108 | nw="$nw -Wsuggest-attribute=const" # work in gcc |
| 109 | nw="$nw -Wsuggest-attribute=noreturn" |
Christian Egli | edcc09a | 2018-05-03 15:59:05 +0200 | [diff] [blame] | 110 | # Enable all GCC warnings not in this list. |
| 111 | gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw]) |
| 112 | for w in $warnings; do |
| 113 | gl_WARN_ADD([$w]) |
| 114 | done |
| 115 | |
Christian Egli | dd378ff | 2017-10-03 13:56:10 +0200 | [diff] [blame] | 116 | # define an additional recursive make target to format the sources. |
| 117 | # Also check if clang-format is installed |
| 118 | AM_EXTRA_RECURSIVE_TARGETS([format-sources]) |
Christian Egli | 0051d36 | 2020-11-27 11:31:46 +0100 | [diff] [blame] | 119 | # prefer version 7 of clang-format |
| 120 | AC_CHECK_PROGS([SOURCE_FORMATTER], [clang-format-7 clang-format]) |
Christian Egli | dd378ff | 2017-10-03 13:56:10 +0200 | [diff] [blame] | 121 | AM_CONDITIONAL([HAVE_SOURCE_FORMATTER], [test x$SOURCE_FORMATTER = xclang-format]) |
| 122 | |
Christian Egli | 644ed62 | 2009-10-08 15:02:15 +0000 | [diff] [blame] | 123 | # 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 Egli | e63b359 | 2010-01-26 14:28:33 +0000 | [diff] [blame] | 127 | if test "x$cross_compiling" = xyes; then |
| 128 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) |
| 129 | else |
| 130 | AC_CHECK_PROG([HELP2MAN], [help2man], [help2man]) |
| 131 | fi |
Christian Egli | 644ed62 | 2009-10-08 15:02:15 +0000 | [diff] [blame] | 132 | AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man]) |
| 133 | |
Christian Egli | 6785ff8 | 2017-06-02 13:40:50 +0200 | [diff] [blame] | 134 | # Only run parts of the tests if we are cross compiling |
| 135 | AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes]) |
| 136 | |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 137 | # Check for makeinfo version >= 5, required for building documentation. |
Christian Egli | 5d9030a | 2015-03-16 22:38:47 +0100 | [diff] [blame] | 138 | have_makeinfo_5=false |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 139 | AC_PROG_SED |
| 140 | AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes]) |
| 141 | if test x"${MAKEINFO_FOUND}" = xyes |
| 142 | then |
| 143 | MAKEINFO_VERSION_REQ=5 |
Christian Egli | 774d74b | 2014-11-26 11:03:50 +0100 | [diff] [blame] | 144 | AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ]) |
Christian Egli | 32d0d5a | 2018-02-20 16:47:12 +0100 | [diff] [blame] | 145 | MAKEINFO_VERSION=`makeinfo --version | sed -ne 's/^\(makeinfo\|texi2any\) .* \([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*.*$/\2/p'` |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 146 | if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ |
| 147 | then |
| 148 | AC_MSG_RESULT([no]) |
Christian Egli | 674844e | 2015-03-12 13:56:49 +0100 | [diff] [blame] | 149 | AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.]) |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 150 | else |
| 151 | AC_MSG_RESULT([yes]) |
Christian Egli | 674844e | 2015-03-12 13:56:49 +0100 | [diff] [blame] | 152 | have_makeinfo_5=true |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 153 | fi |
| 154 | else |
Christian Egli | 25ef16b | 2015-05-22 12:22:52 +0200 | [diff] [blame] | 155 | AC_MSG_WARN([Missing program 'makeinfo', Documentation will not be built. Please install you you want documentation or refer to online resources.]) |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 156 | fi |
Christian Egli | 674844e | 2015-03-12 13:56:49 +0100 | [diff] [blame] | 157 | AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue]) |
Simon Aittamaa | bd5e648 | 2014-11-25 19:39:51 +0100 | [diff] [blame] | 158 | |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 159 | AC_ARG_ENABLE(ucs4, |
Christian Egli | 697a0d2 | 2014-03-03 09:46:35 +0000 | [diff] [blame] | 160 | AC_HELP_STRING(--enable-ucs4, Enable 4 byte-wide characters), |
Christian Egli | d4aaee8 | 2016-06-20 12:36:16 +0200 | [diff] [blame] | 161 | [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])], |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 162 | [enable_ucs4=no]) |
| 163 | |
Christian Egli | bbf00fd | 2009-11-12 10:02:23 +0000 | [diff] [blame] | 164 | AC_MSG_CHECKING([whether 4 byte-wide characters should be supported]) |
| 165 | AC_MSG_RESULT($enable_ucs4) |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 166 | |
| 167 | case "$enable_ucs4" in |
Christian Egli | bbf00fd | 2009-11-12 10:02:23 +0000 | [diff] [blame] | 168 | yes) WIDECHAR_TYPE='unsigned int';; |
| 169 | *) WIDECHAR_TYPE='unsigned short int';; |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 170 | esac |
Christian Egli | bbf00fd | 2009-11-12 10:02:23 +0000 | [diff] [blame] | 171 | AC_SUBST(WIDECHAR_TYPE) |
Christian Egli | 33ded85 | 2012-03-20 14:13:30 +0000 | [diff] [blame] | 172 | AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes]) |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 173 | |
James Teh | 75bfbe2 | 2009-01-20 12:19:47 +0000 | [diff] [blame] | 174 | case $host in |
| 175 | *mingw* | *cygwin*) |
James Teh | 115fb83 | 2009-02-14 00:47:32 +0000 | [diff] [blame] | 176 | CFLAGS="$CFLAGS -Wl,--add-stdcall-alias" |
Michael Whapples | 2bea4c8 | 2014-09-23 15:29:59 +0100 | [diff] [blame] | 177 | LDFLAGS="$LDFLAGS -avoid-version" |
James Teh | 75bfbe2 | 2009-01-20 12:19:47 +0000 | [diff] [blame] | 178 | ;; |
| 179 | esac |
| 180 | |
Bert Frees | 3c8fe3b | 2017-05-12 17:09:28 +0200 | [diff] [blame] | 181 | AC_CANONICAL_HOST |
| 182 | build_macosx=no |
| 183 | case $host_os in |
| 184 | darwin*) |
| 185 | build_macosx=yes |
| 186 | ;; |
| 187 | esac |
| 188 | AM_CONDITIONAL([OSX], [test "$build_macosx" = "yes"]) |
| 189 | |
John Boyer | 9bfed87 | 2011-06-12 22:56:54 +0000 | [diff] [blame] | 190 | AC_CONFIG_FILES([ |
| 191 | Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 192 | doc/Makefile |
| 193 | man/Makefile |
| 194 | liblouis/Makefile |
| 195 | liblouis/liblouis.h |
John Boyer | 9bfed87 | 2011-06-12 22:56:54 +0000 | [diff] [blame] | 196 | windows/Makefile |
| 197 | windows/include/Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 198 | windows/utils/Makefile |
| 199 | tables/Makefile |
John Boyer | 9bfed87 | 2011-06-12 22:56:54 +0000 | [diff] [blame] | 200 | liblouis.pc |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 201 | tests/Makefile |
Bert Frees | b76bef1 | 2017-10-08 22:17:55 +0200 | [diff] [blame] | 202 | tests/braille-specs/Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 203 | tests/resolve_table.h |
| 204 | tests/tables/Makefile |
| 205 | tests/tables/emphclass/Makefile |
Christian Egli | ab48b8a | 2020-08-28 15:18:04 +0200 | [diff] [blame] | 206 | tests/tables/attribute/Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 207 | tests/tables/moreTables/Makefile |
| 208 | tests/tables/resolve_table/Makefile |
| 209 | tests/tables/resolve_table/dir_1/Makefile |
| 210 | tests/tables/resolve_table/dir_1/dir_1.1/Makefile |
| 211 | tests/tables/resolve_table/dir_2/Makefile |
Christian Egli | 2a57605 | 2015-05-29 14:10:05 +0200 | [diff] [blame] | 212 | tests/tablesWithMetadata/Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 213 | tests/ueb_test_data/Makefile |
| 214 | tests/yaml/Makefile |
John Boyer | 9bfed87 | 2011-06-12 22:56:54 +0000 | [diff] [blame] | 215 | python/Makefile |
Christopher Brannon | a4539ce | 2017-04-24 18:03:29 -0700 | [diff] [blame] | 216 | python/setup.py |
John Boyer | 9bfed87 | 2011-06-12 22:56:54 +0000 | [diff] [blame] | 217 | python/louis/Makefile |
Davy Kager | 033d97c | 2017-06-21 18:58:56 +0200 | [diff] [blame] | 218 | tools/Makefile |
| 219 | tools/gnulib/Makefile |
Bert Frees | 1b5166b | 2017-08-10 12:21:19 +0200 | [diff] [blame] | 220 | tools/lou_maketable.d/Makefile |
| 221 | tools/lou_maketable.d/lou_maketable |
Christian Egli | 60e5bf8 | 2016-06-20 11:08:16 +0200 | [diff] [blame] | 222 | gnulib/Makefile]) |
Eitan Isaacson | 109996e | 2008-12-20 14:52:53 +0000 | [diff] [blame] | 223 | AC_OUTPUT |