Trace fallback style assignment.
[ttfautohint.git] / configure.ac
blobec5ec9f9238ec749451d981f6f4c07f87b8043f2
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])
17 AM_INIT_AUTOMAKE([-Wall -Werror]
18                  m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-],
19                            [gnu], [gnits]))
21 AC_CONFIG_MACRO_DIRS([gnulib/m4
22                       m4])
24 AM_SILENT_RULES([yes])
26 AC_USE_SYSTEM_EXTENSIONS
28 AC_PROG_CPP
29 AC_PROG_CC
30 AC_PROG_CXX
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])
37 gl_EARLY
38 gl_INIT
40 AC_TYPE_UINT64_T
42 PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz >= 0.9.19])
44 AT_WITH_QT
45 AT_REQUIRE_QT_VERSION([4.6])
47 if test x"$with_qt" != x"no"; then
48   AC_MSG_CHECKING([for QLocale::quoteString])
49   AS_VERSION_COMPARE([$QT_VERSION], [4.8],
50     [AC_MSG_RESULT(no)],
51     [AC_MSG_RESULT(no)],
52     [AC_MSG_RESULT(yes)
53      AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
54        [Define if Qt function QLocale::quoteString is available.])])
57 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
59 LT_INIT
60 LT_LTLIZE_LANG([C])
63 AC_ARG_WITH([doc],
64             [AS_HELP_STRING([--with-doc],
65                             [install documentation @<:@default=yes@:>@])],
66             [],
67             [with_doc=yes])
69 AC_ARG_WITH([freetype-config],
70             [AS_HELP_STRING([--with-freetype-config=PROG],
71                             [use FreeType configuration program PROG])],
72             [freetype_config=$withval],
73             [freetype_config=yes])
75 if test "$freetype_config" = "yes"; then
76   AC_PATH_PROG(ft_config,
77                freetype-config,
78                no)
79   if test "$ft_config" = "no"; then
80     AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
81   fi
82 else
83   ft_config="$freetype_config"
86 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
87 FREETYPE_LIBS="`$ft_config --libtool`"
89 # many platforms no longer install .la files for system libraries
90 if test ! -f $FREETYPE_LIBS; then
91   FREETYPE_LIBS="`$ft_config --libs`"
94 AC_SUBST(FREETYPE_CPPFLAGS)
95 AC_SUBST(FREETYPE_LIBS)
98 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
99 old_CPPFLAGS="$CPPFLAGS"
100 CPPFLAGS=$FREETYPE_CPPFLAGS
101 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
103 #include <ft2build.h>
104 #include FT_FREETYPE_H
105 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
106 #error Freetype version too low.
107 #endif
109 ]])],
110 [AC_MSG_RESULT(yes)
111  CPPFLAGS="$old_CPPFLAGS"],
112 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
115 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
116 old_CPPFLAGS="$CPPFLAGS"
117 CPPFLAGS=$FREETYPE_CPPFLAGS
118 old_LIBS="$LIBS"
119 LIBS=$FREETYPE_LIBS
120 AC_LANG_PUSH([LTLIZED C])
121 AC_RUN_IFELSE([AC_LANG_SOURCE([[
123 #include <stdlib.h>
124 #include <ft2build.h>
125 #include FT_FREETYPE_H
128 main()
130   FT_Error error;
131   FT_Library library;
132   FT_Int major, minor, patch;
134   error = FT_Init_FreeType(&library);
135   if (error)
136   {
137     printf("(test program reports error code %d)... ", error);
138     exit(EXIT_FAILURE);
139   }
141   FT_Library_Version(library, &major, &minor, &patch);
143   printf("(found %d.%d.%d)... ", major, minor, patch);
145   if (((major*1000 + minor)*1000 + patch) >= 2004005)
146     exit(EXIT_SUCCESS);
147   exit(EXIT_FAILURE);
150 ]])],
151 [AC_MSG_RESULT(yes)
152  CPPFLAGS="$old_CPPFLAGS"
153  LIBS="$old_LIBS"],
154 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
155 [AC_MSG_RESULT([skipped due to cross-compilation])])
156 AC_LANG_POP
159 if test $cross_compiling = no; then
160   AM_MISSING_PROG(HELP2MAN, help2man)
161 else
162   HELP2MAN=:
165 # The documentation is part of the distributed bundle.  In the following,
166 # tests for the documentation building tools are made fatal in case those
167 # files are missing (which can happen during bootstrap).
169 AC_DEFUN([TA_DOC],
170   [if test -f "$1"; then
171      AC_MSG_WARN([$2])
172      with_doc=no
173    else
174      AC_MSG_ERROR([$2])
175    fi])
177 image_file=$srcdir/doc/img/ttfautohintGUI.png
178 html_file=$srcdir/doc/ttfautohint.html
179 pdf_file=$srcdir/doc/ttfautohint.pdf
181 if test x"$with_doc" != x"no"; then
182   # snapshot image creation
183   if test x"$DISPLAY" == x; then
184     TA_DOC([$image_file],
185            [Need X11 to create snapshot image of ttfautohintGUI])
186   else
187     AC_CHECK_PROG([IMPORT], [import], [import], [no])
188     if test x"$IMPORT" == x"no"; then
189       TA_DOC([$image_file],
190              [Need ImageMagick to create snapshot image of ttfautohintGUI])
191     fi
192   fi
194   # conversion of SVG to PDF
195   AC_CHECK_PROG([INKSCAPE], [inkscape], [inkscape], [no])
196   if test x"$INKSCAPE" == x"no"; then
197     TA_DOC([$pdf_file],
198            [Need inkscape to convert SVG image files to PDF])
199   fi
201   # documentation creation
202   AC_CHECK_PROG([PANDOC], [pandoc], [pandoc], [no])
203   if test x"$PANDOC" == x"no"; then
204     TA_DOC([$html_file],
205            [Need pandoc to create PDF and HTML documentation files])
206   fi
208   # PDF documentation
209   AC_CHECK_PROGS([LATEX], [lualatex xelatex], [no])
210   if test x"$PDFLATEX" == x"no"; then
211     TA_DOC([$pdf_file],
212            [Need lualatex or xelatex to create documentation in PDF format])
213   fi
216 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != x"no"])
218 AC_CONFIG_HEADERS([config.h])
219 AC_CONFIG_FILES([Makefile
220                  gnulib/src/Makefile
221                  lib/Makefile
222                  frontend/Makefile
223                  doc/Makefile])
224 AC_OUTPUT
226 # end of configure.ac