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])
17 AM_INIT_AUTOMAKE([-Wall -Werror]
18 m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-],
21 AC_CONFIG_MACRO_DIRS([gnulib/m4
24 AM_SILENT_RULES([yes])
26 AC_USE_SYSTEM_EXTENSIONS
31 PKG_PROG_PKG_CONFIG([0.24])
33 # AM_PROG_AR is new in automake 1.11.2;
34 # however, MinGW doesn't have it yet (May 2012)
35 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
42 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
45 AT_REQUIRE_QT_VERSION([4.6])
47 if test x"$with_qt" != x"no"; then
48 AC_MSG_CHECKING([for QLocale::quoteString])
49 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
53 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
54 [Define if Qt function QLocale::quoteString is available.])])
57 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
64 [AS_HELP_STRING([--with-doc],
65 [install documentation @<:@default=yes@:>@])],
69 AC_ARG_WITH([freetype-config],
70 [AS_HELP_STRING([--with-freetype-config=PROG],
71 [use FreeType configuration program PROG])],
72 [freetype_config=$withval],
73 [freetype_config=yes])
75 if test "$freetype_config" = "yes"; then
76 AC_PATH_PROG(ft_config,
79 if test "$ft_config" = "no"; then
80 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
83 ft_config="$freetype_config"
86 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
87 FREETYPE_LIBS="`$ft_config --libtool`"
89 # many platforms no longer install .la files for system libraries
90 if test ! -f $FREETYPE_LIBS; then
91 FREETYPE_LIBS="`$ft_config --libs`"
94 AC_SUBST(FREETYPE_CPPFLAGS)
95 AC_SUBST(FREETYPE_LIBS)
98 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
99 old_CPPFLAGS="$CPPFLAGS"
100 CPPFLAGS=$FREETYPE_CPPFLAGS
101 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
103 #include <ft2build.h>
104 #include FT_FREETYPE_H
105 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
106 #error Freetype version too low.
111 CPPFLAGS="$old_CPPFLAGS"],
112 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
115 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
116 old_CPPFLAGS="$CPPFLAGS"
117 CPPFLAGS=$FREETYPE_CPPFLAGS
120 AC_LANG_PUSH([LTLIZED C])
121 AC_RUN_IFELSE([AC_LANG_SOURCE([[
124 #include <ft2build.h>
125 #include FT_FREETYPE_H
132 FT_Int major, minor, patch;
134 error = FT_Init_FreeType(&library);
137 printf("(test program reports error code %d)... ", error);
141 FT_Library_Version(library, &major, &minor, &patch);
143 printf("(found %d.%d.%d)... ", major, minor, patch);
145 if (((major*1000 + minor)*1000 + patch) >= 2004005)
152 CPPFLAGS="$old_CPPFLAGS"
154 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
155 [AC_MSG_RESULT([skipped due to cross-compilation])])
159 if test $cross_compiling = no; then
160 AM_MISSING_PROG(HELP2MAN, help2man)
165 # The documentation is part of the distributed bundle. In the following,
166 # tests for the documentation building tools are made fatal in case those
167 # files are missing (which can happen during bootstrap).
170 [if test -f "$1"; then
177 image_file=$srcdir/doc/img/ttfautohintGUI.png
178 html_file=$srcdir/doc/ttfautohint.html
179 pdf_file=$srcdir/doc/ttfautohint.pdf
181 if test x"$with_doc" != x"no"; then
182 # snapshot image creation
183 if test x"$DISPLAY" == x; then
184 TA_DOC([$image_file],
185 [Need X11 to create snapshot image of ttfautohintGUI])
187 AC_CHECK_PROG([IMPORT], [import], [import], [no])
188 if test x"$IMPORT" == x"no"; then
189 TA_DOC([$image_file],
190 [Need ImageMagick to create snapshot image of ttfautohintGUI])
194 # conversion of SVG to PDF
195 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
196 if test x"$INKSCAPE" == x"no"; then
198 [Need inkscape to convert SVG image files to PDF])
201 # documentation creation
202 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
203 if test x"$PANDOC" == x"no"; then
205 [Need pandoc to create PDF and HTML documentation files])
209 AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
210 if test x"$PDFLATEX" == x"no"; then
212 [Need lualatex or xelatex to create documentation in PDF format])
216 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
218 AC_CONFIG_HEADERS([config.h])
219 AC_CONFIG_FILES([Makefile
226 # end of configure.ac