3 # Copyright (C) 2011-2021 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.
247 # https://github.com/googlei18n/noto-fonts/
249 # To be more precise, we don't directly access the git repository; instead,
250 # we simply test the presence of a typical font file (using the `kpsewhich'
251 # program as provided by TeXLive and other TeX distributions); the user
252 # should set the TTFONTS environment variable to add the corresponding
253 # directory to the TrueType font search path.
257 # TTFONTS="/path/to/git/noto-fonts/unhinted/ttf//;"
259 # (note the trailing `;').
261 noto_font_file=NotoSerifYezidi-Regular.ttf
264 if test x"$with_doc" != x"no"; then
265 # snapshot image creation
266 if test x"$DISPLAY" == x; then
267 TA_DOC([$image_file],
268 [Need X11 to create snapshot image of ttfautohintGUI])
270 AC_CHECK_PROG([IMPORT], [import], [import], [no])
271 if test x"$IMPORT" == x"no"; then
272 TA_DOC([$image_file],
273 [Need ImageMagick to create snapshot image of ttfautohintGUI])
277 # conversion of SVG to PDF
278 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
279 if test x"$INKSCAPE" == x"no"; then
281 [Need inkscape to convert SVG image files to PDF])
284 # documentation creation
285 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
286 if test x"$PANDOC" == x"no"; then
288 [Need pandoc to create PDF and HTML documentation files])
292 # To support Devanagari and other Indic scripts properly,
293 # we currently can use XeTeX only.
294 AC_CHECK_PROGS([LATEX], [xelatex], [no])
295 if test x"$LATEX" == x"no"; then
297 [Need xelatex to create documentation in PDF format])
299 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [no])
300 if test x"$KPSEWHICH" == x"no"; then
301 AC_MSG_WARN([Can't find `kpsewhich' to check presence of Noto font files automatically.])
303 [Need kpsewhich to find fonts for documentation in PDF format.])
305 AC_MSG_CHECKING([for font $noto_font_file])
306 $KPSEWHICH $noto_font_file &> /dev/null
307 if test $? -eq 0; then
311 AC_MSG_WARN([Can't find `$noto_font_file'.])
313 [Adjust the `TTFONTS' environment variable so that the Noto fonts are found.])
319 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
321 # pandoc (currently version 1.15.2.1) doesn't have the equivalent to
322 # a compiler's `-I' command line option to make it search image files
323 # in specified directories; for this reason, we create symlinks.
324 AC_CONFIG_COMMANDS([doc/img/create-links],
325 [abs_top_srcdir=`(cd "$srcdir"; pwd)`
326 abs_top_builddir=`pwd`
327 if test "$abs_top_srcdir" != "$abs_top_builddir"; then
329 && $LN_S "$abs_top_srcdir"/doc/img/* img
332 AC_CONFIG_HEADERS([config.h])
333 AC_CONFIG_FILES([Makefile
337 frontend/static-plugins.cpp
341 # end of configure.ac