3 # Copyright (C) 2011-2013 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
32 # AM_PROG_AR is new in automake 1.11.2;
33 # however, MinGW doesn't have it yet (May 2012)
34 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
42 AT_REQUIRE_QT_VERSION([4.6])
44 if test x"$with_qt" != x"no"; then
45 AC_MSG_CHECKING([for QLocale::quoteString])
46 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
50 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
51 [Define if Qt function QLocale::quoteString is available.])])
54 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
61 [AS_HELP_STRING([--with-doc],
62 [install documentation @<:@default=yes@:>@])],
66 AC_ARG_WITH([freetype-config],
67 [AS_HELP_STRING([--with-freetype-config=PROG],
68 [use FreeType configuration program PROG])],
69 [freetype_config=$withval],
70 [freetype_config=yes])
72 if test "$freetype_config" = "yes"; then
73 AC_PATH_PROG(ft_config,
76 if test "$ft_config" = "no"; then
77 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
80 ft_config="$freetype_config"
83 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
84 FREETYPE_LIBS="`$ft_config --libtool`"
86 # many platforms no longer install .la files for system libraries
87 if test ! -f $FREETYPE_LIBS; then
88 FREETYPE_LIBS="`$ft_config --libs`"
91 AC_SUBST(FREETYPE_CPPFLAGS)
92 AC_SUBST(FREETYPE_LIBS)
95 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
96 old_CPPFLAGS="$CPPFLAGS"
97 CPPFLAGS=$FREETYPE_CPPFLAGS
98 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
100 #include <ft2build.h>
101 #include FT_FREETYPE_H
102 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
103 #error Freetype version too low.
108 CPPFLAGS="$old_CPPFLAGS"],
109 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
112 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
113 old_CPPFLAGS="$CPPFLAGS"
114 CPPFLAGS=$FREETYPE_CPPFLAGS
117 AC_LANG_PUSH([LTLIZED C])
118 AC_RUN_IFELSE([AC_LANG_SOURCE([[
121 #include <ft2build.h>
122 #include FT_FREETYPE_H
129 FT_Int major, minor, patch;
131 error = FT_Init_FreeType(&library);
134 printf("(test program reports error code %d)... ", error);
138 FT_Library_Version(library, &major, &minor, &patch);
140 printf("(found %d.%d.%d)... ", major, minor, patch);
142 if (((major*1000 + minor)*1000 + patch) >= 2004005)
149 CPPFLAGS="$old_CPPFLAGS"
151 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
152 [AC_MSG_RESULT([skipped due to cross-compilation])])
156 if test $cross_compiling = no; then
157 AM_MISSING_PROG(HELP2MAN, help2man)
162 # The documentation is part of the distributed bundle. In the following,
163 # tests for the documentation building tools are made fatal in case those
164 # files are missing (which can happen during bootstrap).
167 [if test -f "$1"; then
174 image_file=$srcdir/doc/img/ttfautohintGUI.png
175 html_file=$srcdir/doc/ttfautohint.html
176 pdf_file=$srcdir/doc/ttfautohint.pdf
178 if test x"$with_doc" != x"no"; then
179 # snapshot image creation
180 if test x"$DISPLAY" == x; then
181 TA_DOC([$image_file],
182 [Need X11 to create snapshot image of ttfautohintGUI])
184 AC_CHECK_PROG([IMPORT], [import], [import], [no])
185 if test x"$IMPORT" == x"no"; then
186 TA_DOC([$image_file],
187 [Need ImageMagick to create snapshot image of ttfautohintGUI])
191 # conversion of SVG to PDF
192 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
193 if test x"$INKSCAPE" == x"no"; then
195 [Need inkscape to convert SVG image files to PDF])
198 # documentation creation
199 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
200 if test x"$PANDOC" == x"no"; then
202 [Need pandoc to create PDF and HTML documentation files])
206 AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
207 if test x"$PDFLATEX" == x"no"; then
209 [Need lualatex or xelatex to create documentation in PDF format])
213 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
215 AC_CONFIG_HEADERS([config.h])
216 AC_CONFIG_FILES([Makefile
223 # end of configure.ac