3 # Copyright (C) 2011-2020 by Werner Lemberg.
5 # This file is part of the ttfautohint library, and may only be used,
6 # modified, and distributed under the terms given in `COPYING'. By
7 # continuing to use, modify, or distribute this file you indicate that you
8 # have read `COPYING' and understand and accept it fully.
10 # The file `COPYING' mentioned in the previous paragraph is distributed
11 # with the ttfautohint library.
13 AC_INIT([ttfautohint],
14 m4_esyscmd([gnulib/git-version-gen VERSION]),
15 [freetype-devel@nongnu.org])
16 AC_CONFIG_AUX_DIR([gnulib])
17 AC_CONFIG_SRCDIR([lib/ttfautohint.pc.in])
19 AM_INIT_AUTOMAKE([-Wall -Werror tar-ustar]
20 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),
24 AC_CONFIG_MACRO_DIRS([gnulib/m4
27 AM_SILENT_RULES([yes])
29 dnl Derive version triplet (major, minor, revision) from package version
32 dnl If `AC_PACKAGE_VERSION' contains the suffix `-dirty', we remove it. If
33 dnl it then still contains a dash, we have to remove the last dot and
34 dnl everything appended to it (this was added by the `git-version-gen'
35 dnl script to reflect git commits after the last tagged commit, which we
38 dnl No quotes around first argument of `m4_bpatsubst'.
39 dnl No quotes around `m4_bpatsubst'.
40 m4_define([ttfa_version], m4_bpatsubst(AC_PACKAGE_VERSION, [-dirty$]))
41 m4_define([ttfa_version], m4_bpatsubst(ttfa_version, [\.[^.]+-.+$]))
43 dnl No quotes around first argument of `m4_split'.
44 dnl No quotes around `m4_split'.
45 m4_define([ttfa_triplet], m4_split(ttfa_version, [\.]))
47 dnl No quotes around second argument of `m4_argn'.
48 dnl No quotes around `m4_argn'.
49 m4_define([ttfa_major], m4_argn([1], ttfa_triplet))
50 m4_define([ttfa_minor], m4_argn([2], ttfa_triplet))
51 m4_define([ttfa_revision], m4_argn([3], ttfa_triplet))
53 dnl No quotes around first two arguments of `m4_if'.
56 [m4_define([ttfa_revision], [0])],
62 [AC_MSG_WARN([Revision number of version tuplet set to ttfa_revision.])])
64 ttfautohint_major=ttfa_major
65 ttfautohint_minor=ttfa_minor
66 ttfautohint_revision=ttfa_revision
68 AC_SUBST([ttfautohint_major])
69 AC_SUBST([ttfautohint_minor])
70 AC_SUBST([ttfautohint_revision])
72 AC_USE_SYSTEM_EXTENSIONS
83 PKG_PROG_PKG_CONFIG([0.24])
85 # AM_PROG_AR is new in automake 1.11.2;
86 # however, MinGW doesn't have it yet (May 2012)
87 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
89 AC_PATH_PROG([BISON], [bison])
90 AC_PATH_PROG([FLEX], [flex])
94 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 2.4.0])
96 AT_WITH_QT([], [], [QTPLUGIN.imageformats = -])
97 AT_REQUIRE_QT_VERSION([4.6])
99 if test x"$with_qt" != x"no"; then
100 AC_MSG_CHECKING([for QLocale::quoteString])
101 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
105 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
106 [Define if Qt function QLocale::quoteString is available.])])
109 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
115 # We use libtool's convenient check for the math library.
121 [AS_HELP_STRING([--with-doc],
122 [install documentation @<:@default=yes@:>@])],
126 AC_ARG_WITH([freetype-config],
127 [AS_HELP_STRING([--with-freetype-config=PROG],
128 [use FreeType configuration program PROG])],
129 [freetype_config=$withval],
130 [freetype_config=yes])
132 if test "$freetype_config" = "yes"; then
133 AC_PATH_TOOL(ft_config,
137 ft_config="$freetype_config"
140 if test "$ft_config" = "no"; then
141 # freetype-config tool not found or disabled; try pkg-config
142 PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.4.5])
143 if { test -z "$FREETYPE_CFLAGS" || test -z "$FREETYPE_LIBS"; }; then
144 AC_MSG_ERROR([FreeType library is missing; see https://www.freetype.org/])
146 FREETYPE_CPPFLAGS="$FREETYPE_CFLAGS"
148 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
149 FREETYPE_LIBS="`$ft_config --libtool`"
151 # many platforms no longer install .la files for system libraries
152 if test ! -f "$FREETYPE_LIBS"; then
153 FREETYPE_LIBS="`$ft_config --libs`"
157 AC_SUBST([FREETYPE_CPPFLAGS])
158 AC_SUBST([FREETYPE_LIBS])
161 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
162 old_CPPFLAGS="$CPPFLAGS"
163 CPPFLAGS=$FREETYPE_CPPFLAGS
164 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
166 #include <ft2build.h>
167 #include FT_FREETYPE_H
168 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
169 #error Freetype version too low.
174 CPPFLAGS="$old_CPPFLAGS"],
175 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
178 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
179 old_CPPFLAGS="$CPPFLAGS"
180 CPPFLAGS=$FREETYPE_CPPFLAGS
183 AC_LANG_PUSH([LTLIZED C])
184 AC_RUN_IFELSE([AC_LANG_SOURCE([[
187 #include <ft2build.h>
188 #include FT_FREETYPE_H
195 FT_Int major, minor, patch;
197 error = FT_Init_FreeType(&library);
200 printf("(test program reports error code %d)... ", error);
204 FT_Library_Version(library, &major, &minor, &patch);
206 printf("(found %d.%d.%d)... ", major, minor, patch);
208 if (((major*1000 + minor)*1000 + patch) >= 2004005)
215 CPPFLAGS="$old_CPPFLAGS"
217 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
218 [AC_MSG_RESULT([skipped due to cross-compilation])])
222 if test $cross_compiling = no; then
223 AM_MISSING_PROG(HELP2MAN, help2man)
228 # The documentation is part of the distributed bundle. In the following,
229 # tests for the documentation building tools are made fatal in case those
230 # files are missing (which can happen during bootstrap).
233 [if test -f "$1"; then
240 image_file=$srcdir/doc/img/ttfautohintGUI.png
241 html_file=$srcdir/doc/ttfautohint.html
242 pdf_file=$srcdir/doc/ttfautohint.pdf
244 # We use the Noto font family within the PDF documentation file, since it
245 # has the best Unicode coverage of all freely available fonts. However, due
246 # to some bugs in the currently released version and lacking support for
247 # some scripts, it is necessary to access fonts from the `noto-fonts-alpha'
248 # git repository, which can be found at
250 # https://github.com/googlei18n/noto-fonts-alpha/
252 # Interestingly, at least one font we need (`NotoSansGujarati-Regular.ttf')
253 # is not yet present in the `noto-fonts-alpha' repository, so we have to
256 # https://github.com/googlei18n/noto-fonts/
260 # To be more precise, we don't directly access the git repositories;
261 # instead, we simply test the presence of two typical font files (using the
262 # `kpsewhich' program as provided by TeXLive and other TeX distributions);
263 # the user should set the TTFONTS environment variable to add the
264 # corresponding directories to the TrueType font search path.
266 noto_font_file=NotoSansGujarati-Regular.ttf
267 noto_font_alpha_file=NotoSansArabic-Regular.ttf
269 if test x"$with_doc" != x"no"; then
270 # snapshot image creation
271 if test x"$DISPLAY" == x; then
272 TA_DOC([$image_file],
273 [Need X11 to create snapshot image of ttfautohintGUI])
275 AC_CHECK_PROG([IMPORT], [import], [import], [no])
276 if test x"$IMPORT" == x"no"; then
277 TA_DOC([$image_file],
278 [Need ImageMagick to create snapshot image of ttfautohintGUI])
282 # conversion of SVG to PDF
283 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
284 if test x"$INKSCAPE" == x"no"; then
286 [Need inkscape to convert SVG image files to PDF])
289 # documentation creation
290 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
291 if test x"$PANDOC" == x"no"; then
293 [Need pandoc to create PDF and HTML documentation files])
297 # To support Devanagari and other Indic scripts properly,
298 # we currently can use XeTeX only.
299 AC_CHECK_PROGS([LATEX], [xelatex], [no])
300 if test x"$PDFLATEX" == x"no"; then
302 [Need xelatex to create documentation in PDF format])
304 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [no])
305 if test x"$KPSEWHICH" == x"no"; then
306 AC_MSG_WARN([Can't find \`kpsewhich' to check presence of Noto font files automatically.])
308 [Adjust the \`TTFONTS' environment variable so that the fonts are found.])
310 $KPSEWHICH $noto_font_file &> /dev/null
311 if test $? -ne 0; then
312 AC_MSG_WARN([Can't find \`$noto_font_file'.])
314 [Adjust the \`TTFONTS' environment variable so that the Noto fonts are found.])
317 $KPSEWHICH $noto_font_alpha_file &> /dev/null
318 if test $? -ne 0; then
319 AC_MSG_WARN([Can't find \`$noto_font_alpha_file'.])
321 [Adjust the \`TTFONTS' environment variable so that the Noto alpha fonts are found.])
327 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
329 # pandoc (currently version 1.15.2.1) doesn't have the equivalent to
330 # a compiler's `-I' command line option to make it search image files
331 # in specified directories; for this reason, we create symlinks.
332 AC_CONFIG_COMMANDS([doc/img/create-links],
333 [abs_top_srcdir=`(cd "$srcdir"; pwd)`
334 abs_top_builddir=`pwd`
335 if test "$abs_top_srcdir" != "$abs_top_builddir"; then
337 && $LN_S "$abs_top_srcdir"/doc/img/* img
340 AC_CONFIG_HEADERS([config.h])
341 AC_CONFIG_FILES([Makefile
345 frontend/static-plugins.cpp
349 # end of configure.ac