Version 0.8.
[ttfautohint.git] / configure.ac
blob5a03b4bc8d2532eff8412768ce82c4c1396c43d9
1 # configure.ac
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         [0.8],
15         [freetype-devel@nongnu.org])
16 AC_CONFIG_AUX_DIR([gnulib])
17 AM_INIT_AUTOMAKE([-Wall -Werror gnits])
18 AC_CONFIG_MACRO_DIR([gnulib/m4
19                      m4])
20 AM_SILENT_RULES([yes])
22 AC_PROG_CPP
23 AC_PROG_CC
24 AC_PROG_CXX
26 gl_EARLY
27 gl_INIT
29 AC_TYPE_UINT64_T
31 AT_WITH_QT
32 AT_REQUIRE_QT_VERSION([4.6])
34 if test x"$with_qt" != x"no"; then
35   AC_MSG_CHECKING([for QLocale::quoteString])
36   AS_VERSION_COMPARE([$QT_VERSION], [4.8],
37     [AC_MSG_RESULT(no)],
38     [AC_MSG_RESULT(no)],
39     [AC_MSG_RESULT(yes)
40      AC_DEFINE([HAVE_QT_QUOTESTRING], [1],
41        [Define if Qt function QLocale::quoteString is available.])])
44 AM_CONDITIONAL([USE_QT], [test x"$with_qt" != x"no"])
46 LT_INIT
47 LT_LTLIZE_LANG([C])
50 AC_ARG_WITH(freetype-config,
51             [  --with-freetype-config=PROG   Use FreeType configuration program PROG],
52             freetype_config=$withval,
53             freetype_config=yes)
55 if test "$freetype_config" = "yes"; then 
56   AC_PATH_PROG(ft_config,
57                freetype-config,
58                no)
59   if test "$ft_config" = "no"; then
60     AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
61   fi
62 else
63   ft_config="$freetype_config"
66 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
67 FREETYPE_LIBS="`$ft_config --libtool`"
69 AC_SUBST(FREETYPE_CPPFLAGS)
70 AC_SUBST(FREETYPE_LIBS)
73 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
74 old_CPPFLAGS="$CPPFLAGS"
75 CPPFLAGS=$FREETYPE_CPPFLAGS
76 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
78 #include <ft2build.h>
79 #include FT_FREETYPE_H
80 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
81 #error Freetype version too low.
82 #endif
84 ]])],
85 [AC_MSG_RESULT(yes)
86  CPPFLAGS="$old_CPPFLAGS"],
87 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
90 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
91 old_CPPFLAGS="$CPPFLAGS"
92 CPPFLAGS=$FREETYPE_CPPFLAGS
93 old_LIBS="$LIBS"
94 LIBS=$FREETYPE_LIBS
95 AC_LANG_PUSH([LTLIZED C])
96 AC_RUN_IFELSE([AC_LANG_SOURCE([[
98 #include <stdlib.h>
99 #include <ft2build.h>
100 #include FT_FREETYPE_H
103 main()
105   FT_Error error;
106   FT_Library library;
107   FT_Int major, minor, patch;
109   error = FT_Init_FreeType(&library);
110   if (error)
111   {
112     printf("(test program reports error code %d)... ", error);
113     exit(EXIT_FAILURE);
114   }
116   FT_Library_Version(library, &major, &minor, &patch);
118   printf("(found %d.%d.%d)... ", major, minor, patch);
120   if (((major*1000 + minor)*1000 + patch) >= 2004005)
121     exit(EXIT_SUCCESS);
122   exit(EXIT_FAILURE);
125 ]])],
126 [AC_MSG_RESULT(yes)
127  CPPFLAGS="$old_CPPFLAGS"
128  LIBS="$old_LIBS"],
129 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
130 AC_LANG_POP
133 if test $cross_compiling = no; then
134   AM_MISSING_PROG(HELP2MAN, help2man)
135 else
136   HELP2MAN=:
140 AC_CONFIG_HEADERS([config.h])
141 AC_CONFIG_FILES([Makefile
142                  gnulib/src/Makefile
143                  lib/Makefile
144                  frontend/Makefile])
145 AC_OUTPUT
147 # end of configure.ac