blob: 98886706fb67b51581d4aa268f84988113035bca [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 Eglid1998f22017-06-06 14:46:08 +02004AC_INIT([Liblouis], [3.2.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.
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
Eitan Isaacson109996e2008-12-20 14:52:53 +000028
Bert Freese580f392016-10-10 12:29:29 +020029# Checks for libraries.
30AC_CHECK_LIB([yaml], [yaml_parser_initialize])
31
Eitan Isaacson109996e2008-12-20 14:52:53 +000032# Checks for header files.
33AC_HEADER_STDC
34AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
35
36# Checks for typedefs, structures, and compiler characteristics.
37AC_C_CONST
38
39# Checks for library functions.
Eitan Isaacson109996e2008-12-20 14:52:53 +000040AC_FUNC_MEMCMP
Eitan Isaacson109996e2008-12-20 14:52:53 +000041AC_FUNC_VPRINTF
42AC_CHECK_FUNCS([memset])
43
44# This is for stuff that absolutely must end up in pyconfig.h.
45# Please use pyport.h instead, if possible.
46AH_TOP([
47#ifndef LOUISCFG_H
48#define LOUISCFG_H
49])
50AH_BOTTOM([
51#endif /*LOUISCFG_H*/
52])
53
54# increment if the interface has additions, changes, removals.
Christian Eglid1998f22017-06-06 14:46:08 +020055LIBLOUIS_CURRENT=14
Eitan Isaacson109996e2008-12-20 14:52:53 +000056
Christian Egli5f8769f2014-12-01 11:38:15 +010057# increment any time the source changes; set to 0 if you increment
58# CURRENT
Christian Egli96a0a8d2015-06-01 15:49:21 +020059LIBLOUIS_REVISION=0
Eitan Isaacson109996e2008-12-20 14:52:53 +000060
Christian Egli5f8769f2014-12-01 11:38:15 +010061# increment if any interfaces have been added; set to 0 if any
62# interfaces have been changed or removed. removal has precedence over
63# adding, so set to 0 if both happened.
Christian Eglid1998f22017-06-06 14:46:08 +020064LIBLOUIS_AGE=0
Eitan Isaacson109996e2008-12-20 14:52:53 +000065
66AC_SUBST(LIBLOUIS_CURRENT)
67AC_SUBST(LIBLOUIS_REVISION)
68AC_SUBST(LIBLOUIS_AGE)
69
Christian Egli0899aa12015-09-08 10:39:35 +020070# needed to build the liblouis.def
71DLL_VERSION=`expr ${LIBLOUIS_CURRENT} - ${LIBLOUIS_AGE}`
72AC_SUBST(DLL_VERSION)
73
Eitan Isaacson109996e2008-12-20 14:52:53 +000074AC_ISC_POSIX
75AC_HEADER_STDC
76AC_LIBTOOL_WIN32_DLL
Christian Eglib7159412009-10-30 11:14:49 +000077AC_PROG_LIBTOOL
Eitan Isaacson109996e2008-12-20 14:52:53 +000078
Christian Egli644ed622009-10-08 15:02:15 +000079# GNU help2man creates man pages from --help output; in many cases,
80# this is sufficient, and obviates the need to maintain man pages
81# separately. However, some developers do not have it so we do not
82# make its use mandatory.
Christian Eglie63b3592010-01-26 14:28:33 +000083if test "x$cross_compiling" = xyes; then
84 AC_MSG_WARN([cannot generate manual pages while cross compiling])
85else
86 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
87fi
Christian Egli644ed622009-10-08 15:02:15 +000088AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
89
Christian Egli6785ff82017-06-02 13:40:50 +020090# Only run parts of the tests if we are cross compiling
91AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
92
Simon Aittamaabd5e6482014-11-25 19:39:51 +010093# Check for makeinfo version >= 5, required for building documentation.
Christian Egli5d9030a2015-03-16 22:38:47 +010094have_makeinfo_5=false
Simon Aittamaabd5e6482014-11-25 19:39:51 +010095AC_PROG_SED
96AC_CHECK_PROG([MAKEINFO_FOUND], [makeinfo], [yes])
97if test x"${MAKEINFO_FOUND}" = xyes
98then
99 MAKEINFO_VERSION_REQ=5
Christian Egli774d74b2014-11-26 11:03:50 +0100100 AC_MSG_CHECKING([for makeinfo version >= $MAKEINFO_VERSION_REQ])
Martin Michlmayre2fa19e2015-06-30 12:40:49 -0400101 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 +0100102 if test x$MAKEINFO_VERSION = x -o 0$MAKEINFO_VERSION -lt $MAKEINFO_VERSION_REQ
103 then
104 AC_MSG_RESULT([no])
Christian Egli674844e2015-03-12 13:56:49 +0100105 AC_MSG_WARN([Program 'makeinfo' version >= $MAKEINFO_VERSION_REQ is required. Documentation will not be built.])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100106 else
107 AC_MSG_RESULT([yes])
Christian Egli674844e2015-03-12 13:56:49 +0100108 have_makeinfo_5=true
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100109 fi
110else
Christian Egli25ef16b2015-05-22 12:22:52 +0200111 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 +0100112fi
Christian Egli674844e2015-03-12 13:56:49 +0100113AM_CONDITIONAL([HAVE_MAKEINFO_5], [test x$have_makeinfo_5 = xtrue])
Simon Aittamaabd5e6482014-11-25 19:39:51 +0100114
Christian Egli51c156e2017-03-06 10:19:25 +0100115# Check if the user wants to enable yaml tests
116AC_ARG_WITH([yaml],
117 [AS_HELP_STRING([--with-yaml], [enable YAML-based tests @<:@default=yes@:>@])],
118 [with_yaml=$withval],
119 [])
120
121if test "x$with_yaml" == xno; then
122 AC_DEFINE([WITHOUT_YAML],[1],[Disable YAML tests])
123fi
124
125# if libyaml is missing warn or die depending on --with-yaml
126if test x$ac_cv_lib_yaml_yaml_parser_initialize != xyes; then
127 case "$with_yaml" in
128 yes) AC_MSG_ERROR([--with-yaml was given, but libyaml was not found]);;
129 no) ;;
130 *) AC_MSG_WARN([libyaml was not found. YAML tests will be skipped]);;
131 esac
132fi
133
Christian Egli803d5c82017-06-01 12:23:16 +0200134AM_CONDITIONAL([WITH_YAML], [test "x$ac_cv_lib_yaml_yaml_parser_initialize" == xyes -a "x$with_yaml" != xno])
135
Eitan Isaacson109996e2008-12-20 14:52:53 +0000136AC_PATH_PROG(PKG_CONFIG, pkg-config)
137
138AC_ARG_ENABLE(ucs4,
Christian Egli697a0d22014-03-03 09:46:35 +0000139 AC_HELP_STRING(--enable-ucs4, Enable 4 byte-wide characters),
Christian Eglid4aaee82016-06-20 12:36:16 +0200140 [AC_DEFINE([WIDECHARS_ARE_UCS4], [1], [Define if widechars are ucs4])],
Eitan Isaacson109996e2008-12-20 14:52:53 +0000141 [enable_ucs4=no])
142
Christian Eglibbf00fd2009-11-12 10:02:23 +0000143AC_MSG_CHECKING([whether 4 byte-wide characters should be supported])
144AC_MSG_RESULT($enable_ucs4)
Eitan Isaacson109996e2008-12-20 14:52:53 +0000145
146case "$enable_ucs4" in
Christian Eglibbf00fd2009-11-12 10:02:23 +0000147yes) WIDECHAR_TYPE='unsigned int';;
148*) WIDECHAR_TYPE='unsigned short int';;
Eitan Isaacson109996e2008-12-20 14:52:53 +0000149esac
Christian Eglibbf00fd2009-11-12 10:02:23 +0000150AC_SUBST(WIDECHAR_TYPE)
Christian Egli33ded852012-03-20 14:13:30 +0000151AM_CONDITIONAL([HAVE_UCS4], [test x$enable_ucs4 = xyes])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000152
James Teh75bfbe22009-01-20 12:19:47 +0000153case $host in
154 *mingw* | *cygwin*)
James Teh115fb832009-02-14 00:47:32 +0000155 CFLAGS="$CFLAGS -Wl,--add-stdcall-alias"
Michael Whapples2bea4c82014-09-23 15:29:59 +0100156 LDFLAGS="$LDFLAGS -avoid-version"
James Teh75bfbe22009-01-20 12:19:47 +0000157 ;;
158esac
159
John Boyer9bfed872011-06-12 22:56:54 +0000160AC_CONFIG_FILES([
161 Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200162 doc/Makefile
163 man/Makefile
164 liblouis/Makefile
165 liblouis/liblouis.h
John Boyer9bfed872011-06-12 22:56:54 +0000166 windows/Makefile
167 windows/include/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200168 windows/utils/Makefile
169 tables/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000170 liblouis.pc
Davy Kager033d97c2017-06-21 18:58:56 +0200171 tests/Makefile
172 tests/resolve_table.h
173 tests/tables/Makefile
174 tests/tables/emphclass/Makefile
175 tests/tables/moreTables/Makefile
176 tests/tables/resolve_table/Makefile
177 tests/tables/resolve_table/dir_1/Makefile
178 tests/tables/resolve_table/dir_1/dir_1.1/Makefile
179 tests/tables/resolve_table/dir_2/Makefile
Christian Egli2a576052015-05-29 14:10:05 +0200180 tests/tablesWithMetadata/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200181 tests/ueb_test_data/Makefile
182 tests/yaml/Makefile
John Boyer9bfed872011-06-12 22:56:54 +0000183 python/Makefile
Christopher Brannona4539ce2017-04-24 18:03:29 -0700184 python/setup.py
John Boyer9bfed872011-06-12 22:56:54 +0000185 python/louis/Makefile
Davy Kager033d97c2017-06-21 18:58:56 +0200186 tools/Makefile
187 tools/gnulib/Makefile
Christian Egli60e5bf82016-06-20 11:08:16 +0200188 gnulib/Makefile])
Eitan Isaacson109996e2008-12-20 14:52:53 +0000189AC_OUTPUT