3 # Copyright (C) 2011-2022 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 subdir-objects]
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])
95 HARFBUZZ_CPPFLAGS="$HARFBUZZ_CFLAGS"
96 AC_SUBST([HARFBUZZ_CPPFLAGS])
98 AT_WITH_QT([], [], [QTPLUGIN.imageformats = -])
99 AT_REQUIRE_QT_VERSION([4.6])
101 if test x"$with_qt" != x"no"; then
102 AC_MSG_CHECKING([for QLocale::quoteString])
103 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
107 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
108 [Define if Qt function QLocale::quoteString is available.])])
111 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
116 # We use libtool's convenient check for the math library.
121 [AS_HELP_STRING([--with-doc],
122 [install documentation @<:@default=yes@:>@])],
126 PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.4.5])
127 FREETYPE_CPPFLAGS="$FREETYPE_CFLAGS"
128 AC_SUBST([FREETYPE_CPPFLAGS])
130 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
131 old_CPPFLAGS="$CPPFLAGS"
132 CPPFLAGS=$FREETYPE_CPPFLAGS
133 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
135 #include <ft2build.h>
136 #include FT_FREETYPE_H
137 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
138 #error Freetype version too low.
143 CPPFLAGS="$old_CPPFLAGS"],
144 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
146 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
147 old_CPPFLAGS="$CPPFLAGS"
148 CPPFLAGS=$FREETYPE_CPPFLAGS
151 AC_LANG_PUSH([LTLIZED C])
152 AC_RUN_IFELSE([AC_LANG_SOURCE([[
155 #include <ft2build.h>
156 #include FT_FREETYPE_H
163 FT_Int major, minor, patch;
165 error = FT_Init_FreeType(&library);
168 printf("(test program reports error code %d)... ", error);
172 FT_Library_Version(library, &major, &minor, &patch);
174 printf("(found %d.%d.%d)... ", major, minor, patch);
176 if (((major*1000 + minor)*1000 + patch) >= 2004005)
183 CPPFLAGS="$old_CPPFLAGS"
185 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
186 [AC_MSG_RESULT([skipped due to cross-compilation])])
190 if test $cross_compiling = no; then
191 AM_MISSING_PROG(HELP2MAN, help2man)
196 # The documentation is part of the distributed bundle. In the following,
197 # tests for the documentation building tools are made fatal in case those
198 # files are missing (which can happen during bootstrap).
201 [if test -f "$1"; then
207 image_file=$srcdir/doc/img/ttfautohintGUI.png
208 html_file=$srcdir/doc/ttfautohint.html
209 pdf_file=$srcdir/doc/ttfautohint.pdf
211 # We use the Noto font family within the PDF documentation file, since it
212 # has the best Unicode coverage of all freely available fonts.
214 # https://github.com/googlei18n/noto-fonts/
216 # To be more precise, we don't directly access the git repository; instead,
217 # we simply test the presence of a typical font file (using the `kpsewhich'
218 # program as provided by TeX Live and other TeX distributions); the user
219 # should set the TTFONTS environment variable to add the corresponding
220 # directory to the TrueType font search path.
224 # TTFONTS="/path/to/git/noto-fonts/unhinted/ttf//;"
226 # (note the trailing `;').
228 noto_font_file=NotoSerifYezidi-Regular.ttf
231 if test x"$with_doc" != x"no"; then
232 # snapshot image creation
233 if test x"$DISPLAY" == x; then
234 TA_DOC([$image_file],
235 [Need X11 to create snapshot image of ttfautohintGUI])
237 AC_CHECK_PROG([IMPORT], [import], [import], [no])
238 if test x"$IMPORT" == x"no"; then
239 TA_DOC([$image_file],
240 [Need ImageMagick to create snapshot image of ttfautohintGUI])
244 # conversion of SVG to PDF
245 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
246 if test x"$INKSCAPE" == x"no"; then
248 [Need inkscape to convert SVG image files to PDF])
251 # documentation creation
252 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
253 if test x"$PANDOC" == x"no"; then
255 [Need pandoc to create PDF and HTML documentation files])
259 # To support Devanagari and other Indic scripts properly,
260 # we currently can use XeTeX only.
261 AC_CHECK_PROGS([LATEX], [xelatex], [no])
262 if test x"$LATEX" == x"no"; then
264 [Need xelatex to create documentation in PDF format])
266 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [no])
267 if test x"$KPSEWHICH" == x"no"; then
268 AC_MSG_WARN([Can't find `kpsewhich' to check presence of Noto font files automatically.])
270 [Need kpsewhich to find fonts for documentation in PDF format.])
272 AC_MSG_CHECKING([for font $noto_font_file])
273 $KPSEWHICH $noto_font_file &> /dev/null
274 if test $? -eq 0; then
278 AC_MSG_WARN([Can't find `$noto_font_file'.])
280 [Adjust the `TTFONTS' environment variable so that the Noto fonts are found.])
286 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
288 # Let autoconf create the `img' subdirectory, if necessary.
289 # `mkdir' is just a tag.
290 AC_CONFIG_COMMANDS([doc/img/mkdir], [true])
292 AC_CONFIG_HEADERS([config.h])
293 AC_CONFIG_FILES([Makefile
294 frontend/static-plugins.cpp])
297 # end of configure.ac