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])
34 AT_REQUIRE_QT_VERSION([4.6])
36 if test x"$with_qt" != x"no"; then
37 AC_MSG_CHECKING([for QLocale::quoteString])
38 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
42 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
43 [Define if Qt function QLocale::quoteString is available.])])
46 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
53 [AS_HELP_STRING([--with-doc],
54 [install documentation @<:@default=yes@:>@])],
58 AC_ARG_WITH([freetype-config],
59 [AS_HELP_STRING([--with-freetype-config=PROG],
60 [use FreeType configuration program PROG])],
61 [freetype_config=$withval],
62 [freetype_config=yes])
64 if test "$freetype_config" = "yes"; then
65 AC_PATH_PROG(ft_config,
68 if test "$ft_config" = "no"; then
69 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
72 ft_config="$freetype_config"
75 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
76 FREETYPE_LIBS="`$ft_config --libtool`"
78 # many platforms no longer install .la files for system libraries
79 if test ! -f $FREETYPE_LIBS; then
80 FREETYPE_LIBS="`$ft_config --libs`"
83 AC_SUBST(FREETYPE_CPPFLAGS)
84 AC_SUBST(FREETYPE_LIBS)
87 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
88 old_CPPFLAGS="$CPPFLAGS"
89 CPPFLAGS=$FREETYPE_CPPFLAGS
90 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
93 #include FT_FREETYPE_H
94 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
95 #error Freetype version too low.
100 CPPFLAGS="$old_CPPFLAGS"],
101 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
104 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
105 old_CPPFLAGS="$CPPFLAGS"
106 CPPFLAGS=$FREETYPE_CPPFLAGS
109 AC_LANG_PUSH([LTLIZED C])
110 AC_RUN_IFELSE([AC_LANG_SOURCE([[
113 #include <ft2build.h>
114 #include FT_FREETYPE_H
121 FT_Int major, minor, patch;
123 error = FT_Init_FreeType(&library);
126 printf("(test program reports error code %d)... ", error);
130 FT_Library_Version(library, &major, &minor, &patch);
132 printf("(found %d.%d.%d)... ", major, minor, patch);
134 if (((major*1000 + minor)*1000 + patch) >= 2004005)
141 CPPFLAGS="$old_CPPFLAGS"
143 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
147 if test $cross_compiling = no; then
148 AM_MISSING_PROG(HELP2MAN, help2man)
153 # The documentation is part of the distributed bundle. In the following,
154 # tests for the documentation building tools are made fatal in case those
155 # files are missing (which can happen during bootstrap).
158 [if test -f "$1"; then
165 image_file=$srcdir/doc/img/ttfautohintGUI.png
166 html_file=$srcdir/doc/ttfautohint.html
167 pdf_file=$srcdir/doc/ttfautohint.pdf
169 if test x"$with_doc" != x"no"; then
170 # snapshot image creation
171 if test x"$DISPLAY" == x; then
172 TA_DOC([$image_file],
173 [Need X11 to create snapshot image of ttfautohintGUI])
175 AC_CHECK_PROG([IMPORT], [import], [import], [no])
176 if test x"$IMPORT" == x"no"; then
177 TA_DOC([$image_file],
178 [Need ImageMagick to create snapshot image of ttfautohintGUI])
182 # documentation creation
183 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
184 if test x"$PANDOC" == x"no"; then
186 [Need pandoc to create PDF and HTML documentation files])
190 AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [no])
191 if test x"$PDFLATEX" == x"no"; then
193 [Need pdflatex to create documentation in PDF format])
197 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
199 AC_CONFIG_HEADERS([config.h])
200 AC_CONFIG_FILES([Makefile
207 # end of configure.ac