Version 0.6.1.
[ttfautohint.git] / configure.ac
blob85006c9d66766a173b7019ec09e02639989d3f5c
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.6.1],
15         [freetype-devel@nongnu.org])
16 AM_INIT_AUTOMAKE([-Wall -Werror gnits])
17 AC_CONFIG_MACRO_DIR([m4])
18 AM_SILENT_RULES([yes])
20 AC_PROG_CC
21 AC_PROG_CPP
23 AC_TYPE_UINT64_T
26 LT_INIT
27 LT_LTLIZE_LANG([C])
30 AC_ARG_WITH(freetype-config,
31             [  --with-freetype-config=PROG   Use FreeType configuration program PROG],
32             freetype_config=$withval,
33             freetype_config=yes)
35 if test "$freetype_config" = "yes"; then 
36   AC_PATH_PROG(ft_config,
37                freetype-config,
38                no)
39   if test "$ft_config" = "no"; then
40     AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
41   fi
42 else
43   ft_config="$freetype_config"
46 FREETYPE_CPPFLAGS="`$ft_config --cflags`"
47 FREETYPE_LDFLAGS="`$ft_config --libtool`"
49 AC_SUBST(FREETYPE_CPPFLAGS)
50 AC_SUBST(FREETYPE_LDFLAGS)
53 AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
54 old_CPPFLAGS="$CPPFLAGS"
55 CPPFLAGS=$FREETYPE_CPPFLAGS
56 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
58 #include <ft2build.h>
59 #include FT_FREETYPE_H
60 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
61 #error Freetype version too low.
62 #endif
64 ]])],
65 [AC_MSG_RESULT(yes)
66  CPPFLAGS="$old_CPPFLAGS"],
67 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
70 AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
71 old_CPPFLAGS="$CPPFLAGS"
72 CPPFLAGS=$FREETYPE_CPPFLAGS
73 old_LIBS="$LIBS"
74 LIBS=$FREETYPE_LDFLAGS
75 AC_LANG_PUSH([LTLIZED C])
76 AC_RUN_IFELSE([AC_LANG_SOURCE([[
78 #include <stdlib.h>
79 #include <ft2build.h>
80 #include FT_FREETYPE_H
82 int
83 main()
85   FT_Error error;
86   FT_Library library;
87   FT_Int major, minor, patch;
89   error = FT_Init_FreeType(&library);
90   if (error)
91   {
92     printf("(test program reports error code %d)... ", error);
93     exit(EXIT_FAILURE);
94   }
96   FT_Library_Version(library, &major, &minor, &patch);
98   printf("(found %d.%d.%d)... ", major, minor, patch);
100   if (((major*1000 + minor)*1000 + patch) >= 2004005)
101     exit(EXIT_SUCCESS);
102   exit(EXIT_FAILURE);
105 ]])],
106 [AC_MSG_RESULT(yes)
107  CPPFLAGS="$old_CPPFLAGS"
108  LIBS="$old_LIBS"],
109 [AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
110 AC_LANG_POP
113 if test $cross_compiling = no; then
114   AM_MISSING_PROG(HELP2MAN, help2man)
115 else
116   HELP2MAN=:
120 AC_CONFIG_HEADERS([config.h])
121 AC_CONFIG_FILES([Makefile
122                  src/Makefile])
123 AC_OUTPUT
125 # end of configure.ac