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
37 PKG_PROG_PKG_CONFIG([0.24])
39 # AM_PROG_AR is new in automake 1.11.2;
40 # however, MinGW doesn't have it yet (May 2012)
41 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
43 AC_PATH_PROG([BISON], [bison])
44 AC_PATH_PROG([FLEX], [flex])
48 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
51 AT_REQUIRE_QT_VERSION([4.6])
53 if test x"$with_qt" != x"no"; then
54 AC_MSG_CHECKING([for QLocale::quoteString])
55 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
59 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
60 [Define if Qt function QLocale::quoteString is available.])])
63 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
69 # We use libtool's convenient check for the math library.
75 [AS_HELP_STRING([--with-doc],
76 [install documentation @<:@default=yes@:>@])],
80 AC_ARG_WITH([freetype-config],
81 [AS_HELP_STRING([--with-freetype-config=PROG],
82 [use FreeType configuration program PROG])],
83 [freetype_config=$withval],
84 [freetype_config=yes])
86 if test "$freetype_config" = "yes"; then
87 AC_PATH_TOOL(ft_config,
90 if test "$ft_config" = "no"; then
91 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
94 ft_config="$freetype_config"
97 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
98 FREETYPE_LIBS="`$ft_config --libtool`"
100 # many platforms no longer install .la files for system libraries
101 if test ! -f $FREETYPE_LIBS; then
102 FREETYPE_LIBS="`$ft_config --libs`"
105 AC_SUBST(FREETYPE_CPPFLAGS)
106 AC_SUBST(FREETYPE_LIBS)
109 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
110 old_CPPFLAGS="$CPPFLAGS"
111 CPPFLAGS=$FREETYPE_CPPFLAGS
112 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
114 #include <ft2build.h>
115 #include FT_FREETYPE_H
116 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
117 #error Freetype version too low.
122 CPPFLAGS="$old_CPPFLAGS"],
123 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
126 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
127 old_CPPFLAGS="$CPPFLAGS"
128 CPPFLAGS=$FREETYPE_CPPFLAGS
131 AC_LANG_PUSH([LTLIZED C])
132 AC_RUN_IFELSE([AC_LANG_SOURCE([[
135 #include <ft2build.h>
136 #include FT_FREETYPE_H
143 FT_Int major, minor, patch;
145 error = FT_Init_FreeType(&library);
148 printf("(test program reports error code %d)... ", error);
152 FT_Library_Version(library, &major, &minor, &patch);
154 printf("(found %d.%d.%d)... ", major, minor, patch);
156 if (((major*1000 + minor)*1000 + patch) >= 2004005)
163 CPPFLAGS="$old_CPPFLAGS"
165 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
166 [AC_MSG_RESULT([skipped due to cross-compilation])])
170 if test $cross_compiling = no; then
171 AM_MISSING_PROG(HELP2MAN, help2man)
176 # The documentation is part of the distributed bundle. In the following,
177 # tests for the documentation building tools are made fatal in case those
178 # files are missing (which can happen during bootstrap).
181 [if test -f "$1"; then
188 image_file=$srcdir/doc/img/ttfautohintGUI.png
189 html_file=$srcdir/doc/ttfautohint.html
190 pdf_file=$srcdir/doc/ttfautohint.pdf
192 if test x"$with_doc" != x"no"; then
193 # snapshot image creation
194 if test x"$DISPLAY" == x; then
195 TA_DOC([$image_file],
196 [Need X11 to create snapshot image of ttfautohintGUI])
198 AC_CHECK_PROG([IMPORT], [import], [import], [no])
199 if test x"$IMPORT" == x"no"; then
200 TA_DOC([$image_file],
201 [Need ImageMagick to create snapshot image of ttfautohintGUI])
205 # conversion of SVG to PDF
206 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
207 if test x"$INKSCAPE" == x"no"; then
209 [Need inkscape to convert SVG image files to PDF])
212 # documentation creation
213 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
214 if test x"$PANDOC" == x"no"; then
216 [Need pandoc to create PDF and HTML documentation files])
220 # To support Devanagari and other Indic scripts properly,
221 # we currently can use XeTeX only.
222 AC_CHECK_PROGS([LATEX], [xelatex], [no])
223 if test x"$PDFLATEX" == x"no"; then
225 [Need xelatex to create documentation in PDF format])
229 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
231 AC_CONFIG_HEADERS([config.h])
232 AC_CONFIG_FILES([Makefile
239 # end of configure.ac