]> git.wh0rd.org - fontconfig.git/blame - configure.in
Fix autoconf build process for fontconfig
[fontconfig.git] / configure.in
CommitLineData
24330d27
KP
1AC_INIT(fontconfig/fontconfig.h)
2
3AC_PREREQ(2.13)
4
5FC_MAJOR=1
6FC_MINOR=0
7FC_SUB=1
8FC_PRE=
9FC_IFACE_AGE=0
10FC_BIN_AGE=0
11
12AC_SUBST(FC_MAJOR)
13AC_SUBST(FC_MINOR)
14AC_SUBST(FC_SUB)
15AC_SUBST(FC_IFACE_AGE)
16AC_SUBST(FC_BIN_AGE)
17
18LT_RELEASE=$FC_MAJOR.$FC_MINOR
19LT_CURRENT=`expr $FC_SUB - $FC_IFACE_AGE`
20LT_REVISION=$FC_IFACE_AGE
21LT_AGE=`expr $FC_BIN_AGE - $FC_IFACE_AGE`
22AC_SUBST(LT_RELEASE)
23AC_SUBST(LT_CURRENT)
24AC_SUBST(LT_REVISION)
25AC_SUBST(LT_AGE)
26
27AM_INIT_AUTOMAKE("fontconfig", $FC_MAJOR.$FC_MINOR.$FC_SUB$FC_PRE)
28
29AC_CANONICAL_HOST
30AM_CONFIG_HEADER(config.h)
31
32AC_ARG_WITH(freetype_includes, [ --with-freetype-includes=DIR Use FreeType includes in DIR], freetype_includes=$withval, freetype_includes=yes)
33AC_ARG_WITH(freetype_lib, [ --with-freetype-lib=DIR Use FreeType library in DIR], freetype_lib=$withval, freetype_lib=yes)
34AC_ARG_WITH(freetype_config, [ --with-freeetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
35AC_ARG_WITH(xml2_includes, [ --with-xml2-includes=DIR Use xml2 includes in DIR], xml2_includes=$withval, xml2_includes=yes)
36AC_ARG_WITH(xml2_lib, [ --with-xml2-lib=DIR Use xml2 library in DIR], xml2_lib=$withval, xml2_lib=yes)
37AC_ARG_WITH(xml2_config, [ --with-freeetype-config=PROG Use FreeType configuration program PROG], xml2_config=$withval, xml2_config=yes)
38AC_ARG_WITH(fallback_fonts, [ --with-fallback-fonts=DIR Use fonts from DIR when config is busted], fallback_fonts="$withval", fallback_fonts=yes)
39AC_ISC_POSIX
40AC_PROG_CC
41AC_STDC_HEADERS
42AC_PROG_MAKE_SET
43AC_PROG_INSTALL
44
45AC_PROG_LN_S
46
47dnl
48dnl Libtool
49dnl
50AM_DISABLE_STATIC
51AM_PROG_LIBTOOL
52AC_SUBST(LIBTOOL_DEPS)
53if libtool --features | grep "enable static" >/dev/null; then
54 STATIC="-static"
55else
56 STATIC=
57fi
58AC_SUBST(STATIC)
59
60AC_SUBST(DEBUG_CFLAGS)
61AC_SUBST(GLOBAL_CFLAGS)
62
63AC_CHECK_FUNCS(getopt_long getopt)
64
65case "$freetype_config" in
66no)
67 ;;
68yes)
69 AC_CHECK_PROG(ft_config, freetype-config, freetype-config, no)
70 ;;
71*)
72 ft_config="$freetype_config"
73 ;;
74esac
75
76case "$freetype_includes" in
77no)
78 freetype_includes=""
79 ;;
80yes)
81 case "$ft_config" in
82 no)
83 freetype_includes=""
84 ;;
85 *)
86 freetype_includes="`$ft_config --cflags`"
87 ;;
88 esac
89 ;;
90*)
91 freetype_includes="-I$freetype_includes"
92 ;;
93esac
94
95case "$freetype_lib" in
96no)
97 freetype_lib=""
98 ;;
99yes)
100 case "$ft_config" in
101 no)
102 freetype_lib=""
103 ;;
104 *)
105 freetype_lib="`$ft_config --libs`"
106 ;;
107 esac
108 ;;
109*)
110 freetype_lib="-L$freetype_lib -lfreetype"
111 ;;
112esac
113
114case "$fallback_fonts" in
115yes)
116 AC_DEFINE_UNQUOTED(FC_FALLBACK_FONTS, "/usr/X11R6/lib/X11/fonts/Type1")
117 ;;
118*)
119 AC_DEFINE_UNQUOTED(FC_FALLBACK_FONTS, "$fallback_fonts")
120 ;;
121esac
122
123saved_LIBS="$LIBS"
124LIBS="$LIBS $freetype_lib"
125saved_CPPFLAGS="$CPPFLAGS"
126CPPFLAGS="$CPPFLAGS $freetype_includes"
127AC_CHECK_HEADERS(ft2build.h)
128
129case "$ac_cv_header_ft2build_h" in
130no)
131 CPPFLAGS="$saved_CPPFLAGS"
132 LIBS="$saved_LIBS"
133 ;;
134yes)
135 AC_CHECK_FUNCS(FT_Init_FreeType)
136 case "$ac_cv_func_FT_Init_FreeType" in
137 no)
138 CPPFLAGS="$saved_CPPFLAGS"
139 LIBS="$saved_LIBS"
140 ;;
141 yes)
142 AC_DEFINE(HAVE_FREETYPE)
143 ;;
144 esac
145 ;;
146esac
147
148case "$xml2_config" in
149no)
150 ;;
151yes)
152 AC_CHECK_PROG(xml2_config_prog, xml2-config, xml2-config, no)
153 ;;
154*)
155 ;;
156esac
157
158case "$xml2_includes" in
159no)
160 xml2_includes=""
161 ;;
162yes)
163 case "$xml2_config_prog" in
164 no)
165 xml2_includes=""
166 ;;
167 *)
168 xml2_includes="`$xml2_config_prog --cflags`"
169 ;;
170 esac
171 ;;
172*)
173 xml2_includes="-I$xml2_includes"
174 ;;
175esac
176
177case "$xml2_lib" in
178no)
179 xml2_lib=""
180 ;;
181yes)
182 case "$xml2_config_prog" in
183 no)
184 xml2_lib=""
185 ;;
186 *)
187 xml2_lib="`$xml2_config_prog --libs`"
188 ;;
189 esac
190 ;;
191*)
192 xml2_lib="-L$xml2_lib -lxml2"
193 ;;
194esac
195
196saved_LIBS="$LIBS"
197LIBS="$LIBS $xml2_lib"
198saved_CPPFLAGS="$CPPFLAGS"
199CPPFLAGS="$CPPFLAGS $xml2_includes"
200AC_CHECK_HEADERS(xmlversion.h)
201
202AC_OUTPUT(Makefile src/Makefile fontconfig/Makefile fc-cache/Makefile fc-list/Makefile)