3 # Copyright (C) 2011-2015 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])
18 AM_INIT_AUTOMAKE([-Wall -Werror tar-ustar]
19 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),
23 AC_CONFIG_MACRO_DIRS([gnulib/m4
26 AM_SILENT_RULES([yes])
28 AC_USE_SYSTEM_EXTENSIONS
39 PKG_PROG_PKG_CONFIG([0.24])
41 # AM_PROG_AR is new in automake 1.11.2;
42 # however, MinGW doesn't have it yet (May 2012)
43 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
45 AC_PATH_PROG([BISON], [bison])
46 AC_PATH_PROG([FLEX], [flex])
50 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
53 AT_REQUIRE_QT_VERSION([4.6])
55 if test x"$with_qt" != x"no"; then
56 AC_MSG_CHECKING([for QLocale::quoteString])
57 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
61 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
62 [Define if Qt function QLocale::quoteString is available.])])
65 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
71 # We use libtool's convenient check for the math library.
77 [AS_HELP_STRING([--with-doc],
78 [install documentation @<:@default=yes@:>@])],
82 AC_ARG_WITH([freetype-config],
83 [AS_HELP_STRING([--with-freetype-config=PROG],
84 [use FreeType configuration program PROG])],
85 [freetype_config=$withval],
86 [freetype_config=yes])
88 if test "$freetype_config" = "yes"; then
89 AC_PATH_TOOL(ft_config,
92 if test "$ft_config" = "no"; then
93 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
96 ft_config="$freetype_config"
99 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
100 FREETYPE_LIBS="`$ft_config --libtool`"
102 # many platforms no longer install .la files for system libraries
103 if test ! -f $FREETYPE_LIBS; then
104 FREETYPE_LIBS="`$ft_config --libs`"
107 AC_SUBST(FREETYPE_CPPFLAGS)
108 AC_SUBST(FREETYPE_LIBS)
111 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
112 old_CPPFLAGS="$CPPFLAGS"
113 CPPFLAGS=$FREETYPE_CPPFLAGS
114 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
116 #include <ft2build.h>
117 #include FT_FREETYPE_H
118 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
119 #error Freetype version too low.
124 CPPFLAGS="$old_CPPFLAGS"],
125 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
128 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
129 old_CPPFLAGS="$CPPFLAGS"
130 CPPFLAGS=$FREETYPE_CPPFLAGS
133 AC_LANG_PUSH([LTLIZED C])
134 AC_RUN_IFELSE([AC_LANG_SOURCE([[
137 #include <ft2build.h>
138 #include FT_FREETYPE_H
145 FT_Int major, minor, patch;
147 error = FT_Init_FreeType(&library);
150 printf("(test program reports error code %d)... ", error);
154 FT_Library_Version(library, &major, &minor, &patch);
156 printf("(found %d.%d.%d)... ", major, minor, patch);
158 if (((major*1000 + minor)*1000 + patch) >= 2004005)
165 CPPFLAGS="$old_CPPFLAGS"
167 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
168 [AC_MSG_RESULT([skipped due to cross-compilation])])
172 if test $cross_compiling = no; then
173 AM_MISSING_PROG(HELP2MAN, help2man)
178 # The documentation is part of the distributed bundle. In the following,
179 # tests for the documentation building tools are made fatal in case those
180 # files are missing (which can happen during bootstrap).
183 [if test -f "$1"; then
190 image_file=$srcdir/doc/img/ttfautohintGUI.png
191 html_file=$srcdir/doc/ttfautohint.html
192 pdf_file=$srcdir/doc/ttfautohint.pdf
194 if test x"$with_doc" != x"no"; then
195 # snapshot image creation
196 if test x"$DISPLAY" == x; then
197 TA_DOC([$image_file],
198 [Need X11 to create snapshot image of ttfautohintGUI])
200 AC_CHECK_PROG([IMPORT], [import], [import], [no])
201 if test x"$IMPORT" == x"no"; then
202 TA_DOC([$image_file],
203 [Need ImageMagick to create snapshot image of ttfautohintGUI])
207 # conversion of SVG to PDF
208 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
209 if test x"$INKSCAPE" == x"no"; then
211 [Need inkscape to convert SVG image files to PDF])
214 # documentation creation
215 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
216 if test x"$PANDOC" == x"no"; then
218 [Need pandoc to create PDF and HTML documentation files])
222 # To support Devanagari and other Indic scripts properly,
223 # we currently can use XeTeX only.
224 AC_CHECK_PROGS([LATEX], [xelatex], [no])
225 if test x"$PDFLATEX" == x"no"; then
227 [Need xelatex to create documentation in PDF format])
231 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
233 # pandoc (currently version 1.15.2.1) doesn't have the equivalent to
234 # a compiler's `-I' command line option to make it search image files
235 # in specified directories; for this reason, we create symlinks.
236 AC_CONFIG_COMMANDS([doc/img/create-links],
237 [abs_top_srcdir=`(cd "$srcdir"; pwd)`
238 abs_top_builddir=`pwd`
239 if test "$abs_top_srcdir" != "$abs_top_builddir"; then
241 && $LN_S "$abs_top_srcdir"/doc/img/* img
244 AC_CONFIG_HEADERS([config.h])
245 AC_CONFIG_FILES([Makefile
252 # end of configure.ac