3 # Copyright (C) 2011-2012 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]), [-],
20 AC_CONFIG_MACRO_DIR([gnulib/m4
22 AM_SILENT_RULES([yes])
24 AC_USE_SYSTEM_EXTENSIONS
30 # AM_PROG_AR is new in automake 1.11.2;
31 # however, MinGW doesn't have it yet (May 2012)
32 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
40 AT_REQUIRE_QT_VERSION([4.6])
42 if test x"$with_qt" != x"no"; then
43 AC_MSG_CHECKING([for QLocale::quoteString])
44 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
48 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
49 [Define if Qt function QLocale::quoteString is available.])])
52 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
59 [AS_HELP_STRING([--with-doc],
60 [install documentation @<:@default=yes@:>@])],
64 AC_ARG_WITH([freetype-config],
65 [AS_HELP_STRING([--with-freetype-config=PROG],
66 [use FreeType configuration program PROG])],
67 [freetype_config=$withval],
68 [freetype_config=yes])
70 if test "$freetype_config" = "yes"; then
71 AC_PATH_PROG(ft_config,
74 if test "$ft_config" = "no"; then
75 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
78 ft_config="$freetype_config"
81 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
82 FREETYPE_LIBS="`$ft_config --libtool`"
84 # many platforms no longer install .la files for system libraries
85 if test ! -f $FREETYPE_LIBS; then
86 FREETYPE_LIBS="`$ft_config --libs`"
89 AC_SUBST(FREETYPE_CPPFLAGS)
90 AC_SUBST(FREETYPE_LIBS)
93 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
94 old_CPPFLAGS="$CPPFLAGS"
95 CPPFLAGS=$FREETYPE_CPPFLAGS
96 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
99 #include FT_FREETYPE_H
100 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
101 #error Freetype version too low.
106 CPPFLAGS="$old_CPPFLAGS"],
107 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
110 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
111 old_CPPFLAGS="$CPPFLAGS"
112 CPPFLAGS=$FREETYPE_CPPFLAGS
115 AC_LANG_PUSH([LTLIZED C])
116 AC_RUN_IFELSE([AC_LANG_SOURCE([[
119 #include <ft2build.h>
120 #include FT_FREETYPE_H
127 FT_Int major, minor, patch;
129 error = FT_Init_FreeType(&library);
132 printf("(test program reports error code %d)... ", error);
136 FT_Library_Version(library, &major, &minor, &patch);
138 printf("(found %d.%d.%d)... ", major, minor, patch);
140 if (((major*1000 + minor)*1000 + patch) >= 2004005)
147 CPPFLAGS="$old_CPPFLAGS"
149 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
153 if test $cross_compiling = no; then
154 AM_MISSING_PROG(HELP2MAN, help2man)
159 # The documentation is part of the distributed bundle. In the following,
160 # tests for the documentation building tools are made fatal in case those
161 # files are missing (which can happen during bootstrap).
164 [if test -f "$1"; then
171 image_file=$srcdir/doc/img/ttfautohintGUI.png
172 html_file=$srcdir/doc/ttfautohint.html
173 pdf_file=$srcdir/doc/ttfautohint.pdf
175 if test x"$with_doc" != x"no"; then
176 # snapshot image creation
177 if test x"$DISPLAY" == x; then
178 TA_DOC([$image_file],
179 [Need X11 to create snapshot image of ttfautohintGUI])
181 AC_CHECK_PROG([IMPORT], [import], [import], [no])
182 if test x"$IMPORT" == x"no"; then
183 TA_DOC([$image_file],
184 [Need ImageMagick to create snapshot image of ttfautohintGUI])
188 # conversion of SVG to PDF
189 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
190 if test x"$PANDOC" == x"no"; then
192 [Need inkscape to convert SVG image files to PDF])
195 # documentation creation
196 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
197 if test x"$PANDOC" == x"no"; then
199 [Need pandoc to create PDF and HTML documentation files])
201 AC_CHECK_PROG([GHC], [ghc], [ghc], [no])
202 if test x"$GHC" == x"no"; then
204 [Need Glasgow Haskell Compiler (ghc) to create pandoc filter])
208 AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [no])
209 if test x"$PDFLATEX" == x"no"; then
211 [Need pdflatex to create documentation in PDF format])
215 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
217 AC_CONFIG_HEADERS([config.h])
218 AC_CONFIG_FILES([Makefile
225 # end of configure.ac