Use `Control_Type' to handle different segment directions.
[ttfautohint.git] / configure.ac
blobad3e1e7366595ce4d6b2b319c771ffecf3ad900d
1 # configure.ac
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])
18 AM_INIT_AUTOMAKE([-Wall -Werror]
19                  m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),
20                            [-], [gnu],
21                            [gnits]))
23 AC_CONFIG_MACRO_DIRS([gnulib/m4
24                       m4])
26 AM_SILENT_RULES([yes])
28 AC_USE_SYSTEM_EXTENSIONS
30 AC_PROG_CPP
31 AC_PROG_CC
32 AC_PROG_CXX
33 AC_C_INLINE
35 PKG_PROG_PKG_CONFIG([0.24])
37 # AM_PROG_AR is new in automake 1.11.2;
38 # however, MinGW doesn't have it yet (May 2012)
39 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
41 AC_PATH_PROG([BISON], [bison])
42 AC_PATH_PROG([FLEX], [flex])
44 gl_EARLY
45 gl_INIT
47 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
49 AT_WITH_QT
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],
55     [AC_MSG_RESULT(no)],
56     [AC_MSG_RESULT(no)],
57     [AC_MSG_RESULT(yes)
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"])
64 LT_INIT
65 LT_LTLIZE_LANG([C])
68 # We use libtool's convenient check for the math library.
69 LT_LIB_M
70 AC_SUBST(LIBM)
73 AC_ARG_WITH([doc],
74             [AS_HELP_STRING([--with-doc],
75                             [install documentation @<:@default=yes@:>@])],
76             [],
77             [with_doc=yes])
79 AC_ARG_WITH([freetype-config],
80             [AS_HELP_STRING([--with-freetype-config=PROG],
81                             [use FreeType configuration program PROG])],
82             [freetype_config=$withval],
83             [freetype_config=yes])
85 if test "$freetype_config" = "yes"; then
86   AC_PATH_TOOL(ft_config,
87                freetype-config,
88                no)
89   if test "$ft_config" = "no"; then
90     AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
91   fi
92 else
93   ft_config="$freetype_config"
96 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
97 FREETYPE_LIBS="`$ft_config --libtool`"
99 # many platforms no longer install .la files for system libraries
100 if test ! -f $FREETYPE_LIBS; then
101   FREETYPE_LIBS="`$ft_config --libs`"
104 AC_SUBST(FREETYPE_CPPFLAGS)
105 AC_SUBST(FREETYPE_LIBS)
108 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
109 old_CPPFLAGS="$CPPFLAGS"
110 CPPFLAGS=$FREETYPE_CPPFLAGS
111 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
113 #include <ft2build.h>
114 #include FT_FREETYPE_H
115 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
116 #error Freetype version too low.
117 #endif
119 ]])],
120 [AC_MSG_RESULT(yes)
121  CPPFLAGS="$old_CPPFLAGS"],
122 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
125 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
126 old_CPPFLAGS="$CPPFLAGS"
127 CPPFLAGS=$FREETYPE_CPPFLAGS
128 old_LIBS="$LIBS"
129 LIBS=$FREETYPE_LIBS
130 AC_LANG_PUSH([LTLIZED C])
131 AC_RUN_IFELSE([AC_LANG_SOURCE([[
133 #include <stdlib.h>
134 #include <ft2build.h>
135 #include FT_FREETYPE_H
138 main()
140   FT_Error error;
141   FT_Library library;
142   FT_Int major, minor, patch;
144   error = FT_Init_FreeType(&library);
145   if (error)
146   {
147     printf("(test program reports error code %d)... ", error);
148     exit(EXIT_FAILURE);
149   }
151   FT_Library_Version(library, &major, &minor, &patch);
153   printf("(found %d.%d.%d)... ", major, minor, patch);
155   if (((major*1000 + minor)*1000 + patch) >= 2004005)
156     exit(EXIT_SUCCESS);
157   exit(EXIT_FAILURE);
160 ]])],
161 [AC_MSG_RESULT(yes)
162  CPPFLAGS="$old_CPPFLAGS"
163  LIBS="$old_LIBS"],
164 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
165 [AC_MSG_RESULT([skipped due to cross-compilation])])
166 AC_LANG_POP
169 if test $cross_compiling = no; then
170   AM_MISSING_PROG(HELP2MAN, help2man)
171 else
172   HELP2MAN=:
175 # The documentation is part of the distributed bundle.  In the following,
176 # tests for the documentation building tools are made fatal in case those
177 # files are missing (which can happen during bootstrap).
179 AC_DEFUN([TA_DOC],
180   [if test -f "$1"; then
181      AC_MSG_WARN([$2])
182      with_doc=no
183    else
184      AC_MSG_ERROR([$2])
185    fi])
187 image_file=$srcdir/doc/img/ttfautohintGUI.png
188 html_file=$srcdir/doc/ttfautohint.html
189 pdf_file=$srcdir/doc/ttfautohint.pdf
191 if test x"$with_doc" != x"no"; then
192   # snapshot image creation
193   if test x"$DISPLAY" == x; then
194     TA_DOC([$image_file],
195            [Need X11 to create snapshot image of ttfautohintGUI])
196   else
197     AC_CHECK_PROG([IMPORT], [import], [import], [no])
198     if test x"$IMPORT" == x"no"; then
199       TA_DOC([$image_file],
200              [Need ImageMagick to create snapshot image of ttfautohintGUI])
201     fi
202   fi
204   # conversion of SVG to PDF
205   AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
206   if test x"$INKSCAPE" == x"no"; then
207     TA_DOC([$pdf_file],
208            [Need inkscape to convert SVG image files to PDF])
209   fi
211   # documentation creation
212   AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
213   if test x"$PANDOC" == x"no"; then
214     TA_DOC([$html_file],
215            [Need pandoc to create PDF and HTML documentation files])
216   fi
218   # PDF documentation
219   AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
220   if test x"$PDFLATEX" == x"no"; then
221     TA_DOC([$pdf_file],
222            [Need lualatex or xelatex to create documentation in PDF format])
223   fi
226 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
228 AC_CONFIG_HEADERS([config.h])
229 AC_CONFIG_FILES([Makefile
230                  gnulib/src/Makefile
231                  lib/Makefile
232                  frontend/Makefile
233                  doc/Makefile])
234 AC_OUTPUT
236 # end of configure.ac