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 if test x"$ac_cv_c_uint64_t" = x"yes"; then
43 AC_DEFINE([HAVE_UINT64_T], [1],
44 [Define if compiler accepts uint64_t data type.])
47 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
50 AT_REQUIRE_QT_VERSION([4.6])
52 if test x"$with_qt" != x"no"; then
53 AC_MSG_CHECKING([for QLocale::quoteString])
54 AS_VERSION_COMPARE([$QT_VERSION], [4.8],
58 AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
59 [Define if Qt function QLocale::quoteString is available.])])
62 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
69 [AS_HELP_STRING([--with-doc],
70 [install documentation @<:@default=yes@:>@])],
74 AC_ARG_WITH([freetype-config],
75 [AS_HELP_STRING([--with-freetype-config=PROG],
76 [use FreeType configuration program PROG])],
77 [freetype_config=$withval],
78 [freetype_config=yes])
80 if test "$freetype_config" = "yes"; then
81 AC_PATH_PROG(ft_config,
84 if test "$ft_config" = "no"; then
85 AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
88 ft_config="$freetype_config"
91 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
92 FREETYPE_LIBS="`$ft_config --libtool`"
94 # many platforms no longer install .la files for system libraries
95 if test ! -f $FREETYPE_LIBS; then
96 FREETYPE_LIBS="`$ft_config --libs`"
99 AC_SUBST(FREETYPE_CPPFLAGS)
100 AC_SUBST(FREETYPE_LIBS)
103 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
104 old_CPPFLAGS="$CPPFLAGS"
105 CPPFLAGS=$FREETYPE_CPPFLAGS
106 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
108 #include <ft2build.h>
109 #include FT_FREETYPE_H
110 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
111 #error Freetype version too low.
116 CPPFLAGS="$old_CPPFLAGS"],
117 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
120 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
121 old_CPPFLAGS="$CPPFLAGS"
122 CPPFLAGS=$FREETYPE_CPPFLAGS
125 AC_LANG_PUSH([LTLIZED C])
126 AC_RUN_IFELSE([AC_LANG_SOURCE([[
129 #include <ft2build.h>
130 #include FT_FREETYPE_H
137 FT_Int major, minor, patch;
139 error = FT_Init_FreeType(&library);
142 printf("(test program reports error code %d)... ", error);
146 FT_Library_Version(library, &major, &minor, &patch);
148 printf("(found %d.%d.%d)... ", major, minor, patch);
150 if (((major*1000 + minor)*1000 + patch) >= 2004005)
157 CPPFLAGS="$old_CPPFLAGS"
159 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
160 [AC_MSG_RESULT([skipped due to cross-compilation])])
164 if test $cross_compiling = no; then
165 AM_MISSING_PROG(HELP2MAN, help2man)
170 # The documentation is part of the distributed bundle. In the following,
171 # tests for the documentation building tools are made fatal in case those
172 # files are missing (which can happen during bootstrap).
175 [if test -f "$1"; then
182 image_file=$srcdir/doc/img/ttfautohintGUI.png
183 html_file=$srcdir/doc/ttfautohint.html
184 pdf_file=$srcdir/doc/ttfautohint.pdf
186 if test x"$with_doc" != x"no"; then
187 # snapshot image creation
188 if test x"$DISPLAY" == x; then
189 TA_DOC([$image_file],
190 [Need X11 to create snapshot image of ttfautohintGUI])
192 AC_CHECK_PROG([IMPORT], [import], [import], [no])
193 if test x"$IMPORT" == x"no"; then
194 TA_DOC([$image_file],
195 [Need ImageMagick to create snapshot image of ttfautohintGUI])
199 # conversion of SVG to PDF
200 AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
201 if test x"$INKSCAPE" == x"no"; then
203 [Need inkscape to convert SVG image files to PDF])
206 # documentation creation
207 AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
208 if test x"$PANDOC" == x"no"; then
210 [Need pandoc to create PDF and HTML documentation files])
214 AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
215 if test x"$PDFLATEX" == x"no"; then
217 [Need lualatex or xelatex to create documentation in PDF format])
221 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
223 AC_CONFIG_HEADERS([config.h])
224 AC_CONFIG_FILES([Makefile
231 # end of configure.ac