3 # Copyright (C) 2011-2014 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]
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
35 PKG_PROG_PKG_CONFIG([0.24])
37 # AM_PROG_AR is new in automake 1.11.2;
38 # however, MinGW doesn't have it yet (May 2012)
39 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
44 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
47 AT_REQUIRE_QT_VERSION([4.6])
49 if test x"$with_qt" != x"no"; then
50 AC_MSG_CHECKING([for QLocale::quoteString])
51 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
55 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
56 [Define if Qt function QLocale::quoteString is available.])])
59 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
65 # We use libtool's convenient check for the math library.
71 [AS_HELP_STRING([--with-doc],
72 [install documentation @<:@default=yes@:>@])],
76 AC_ARG_WITH([freetype-config],
77 [AS_HELP_STRING([--with-freetype-config=PROG],
78 [use FreeType configuration program PROG])],
79 [freetype_config=$withval],
80 [freetype_config=yes])
82 if test "$freetype_config" = "yes"; then
83 AC_PATH_TOOL(ft_config,
86 if test "$ft_config" = "no"; then
87 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
90 ft_config="$freetype_config"
93 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
94 FREETYPE_LIBS="`$ft_config --libtool`"
96 # many platforms no longer install .la files for system libraries
97 if test ! -f $FREETYPE_LIBS; then
98 FREETYPE_LIBS="`$ft_config --libs`"
101 AC_SUBST(FREETYPE_CPPFLAGS)
102 AC_SUBST(FREETYPE_LIBS)
105 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
106 old_CPPFLAGS="$CPPFLAGS"
107 CPPFLAGS=$FREETYPE_CPPFLAGS
108 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
110 #include <ft2build.h>
111 #include FT_FREETYPE_H
112 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
113 #error Freetype version too low.
118 CPPFLAGS="$old_CPPFLAGS"],
119 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
122 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
123 old_CPPFLAGS="$CPPFLAGS"
124 CPPFLAGS=$FREETYPE_CPPFLAGS
127 AC_LANG_PUSH([LTLIZED C])
128 AC_RUN_IFELSE([AC_LANG_SOURCE([[
131 #include <ft2build.h>
132 #include FT_FREETYPE_H
139 FT_Int major, minor, patch;
141 error = FT_Init_FreeType(&library);
144 printf("(test program reports error code %d)... ", error);
148 FT_Library_Version(library, &major, &minor, &patch);
150 printf("(found %d.%d.%d)... ", major, minor, patch);
152 if (((major*1000 + minor)*1000 + patch) >= 2004005)
159 CPPFLAGS="$old_CPPFLAGS"
161 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
162 [AC_MSG_RESULT([skipped due to cross-compilation])])
166 if test $cross_compiling = no; then
167 AM_MISSING_PROG(HELP2MAN, help2man)
172 # The documentation is part of the distributed bundle. In the following,
173 # tests for the documentation building tools are made fatal in case those
174 # files are missing (which can happen during bootstrap).
177 [if test -f "$1"; then
184 image_file=$srcdir/doc/img/ttfautohintGUI.png
185 html_file=$srcdir/doc/ttfautohint.html
186 pdf_file=$srcdir/doc/ttfautohint.pdf
188 if test x"$with_doc" != x"no"; then
189 # snapshot image creation
190 if test x"$DISPLAY" == x; then
191 TA_DOC([$image_file],
192 [Need X11 to create snapshot image of ttfautohintGUI])
194 AC_CHECK_PROG([IMPORT], [import], [import], [no])
195 if test x"$IMPORT" == x"no"; then
196 TA_DOC([$image_file],
197 [Need ImageMagick to create snapshot image of ttfautohintGUI])
201 # conversion of SVG to PDF
202 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
203 if test x"$INKSCAPE" == x"no"; then
205 [Need inkscape to convert SVG image files to PDF])
208 # documentation creation
209 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
210 if test x"$PANDOC" == x"no"; then
212 [Need pandoc to create PDF and HTML documentation files])
216 AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
217 if test x"$PDFLATEX" == x"no"; then
219 [Need lualatex or xelatex to create documentation in PDF format])
223 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
225 AC_CONFIG_HEADERS([config.h])
226 AC_CONFIG_FILES([Makefile
233 # end of configure.ac