[Tizen] [GPOS] Avoid O(n^2) behavior in mark-attachment
[platform/upstream/harfbuzz.git] / configure.ac
1 AC_PREREQ([2.64])
2 AC_INIT([HarfBuzz],
3         [3.4.0],
4         [https://github.com/harfbuzz/harfbuzz/issues/new],
5         [harfbuzz],
6         [http://harfbuzz.org/])
7
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR([src/harfbuzz.pc.in])
10 AC_CONFIG_HEADERS([config.h])
11
12 AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-xz no-dist-gzip -Wall no-define color-tests -Wno-portability])
13 AM_SILENT_RULES([yes])
14 AX_CODE_COVERAGE
15
16 # Initialize libtool
17 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
18 LT_PREREQ([2.2])
19 LT_INIT([disable-static])
20
21 # Check for programs
22 AC_PROG_CC
23 AC_PROG_CC_C99
24 AM_PROG_CC_C_O
25 AC_PROG_CXX
26 AX_CXX_COMPILE_STDCXX(11)
27 AC_SYS_LARGEFILE
28 PKG_PROG_PKG_CONFIG([0.28])
29 AM_MISSING_PROG([RAGEL], [ragel])
30 AM_MISSING_PROG([GIT], [git])
31
32 # Version
33 m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
34 m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
35 m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
36 m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
37 HB_VERSION_MAJOR=hb_version_major
38 HB_VERSION_MINOR=hb_version_minor
39 HB_VERSION_MICRO=hb_version_micro
40 HB_VERSION=AC_PACKAGE_VERSION
41 AC_SUBST(HB_VERSION_MAJOR)
42 AC_SUBST(HB_VERSION_MINOR)
43 AC_SUBST(HB_VERSION_MICRO)
44 AC_SUBST(HB_VERSION)
45
46 # Libtool version
47 m4_define([hb_version_int],
48           m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
49 HB_LIBTOOL_VERSION_INFO=hb_version_int:0:hb_version_int
50 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
51
52 AC_ARG_WITH([libstdc++],
53         [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
54                         [Allow linking with libstdc++ @<:@default=no@:>@])],
55         [with_libstdcxx=$withval],
56         [with_libstdcxx=no])
57 AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
58
59 # Documentation
60 have_gtk_doc=false
61 m4_ifdef([GTK_DOC_CHECK], [
62 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
63         if test "x$enable_gtk_doc" = xyes; then
64                 have_gtk_doc=true
65         fi
66 ], [
67         AM_CONDITIONAL([ENABLE_GTK_DOC], false)
68 ])
69
70 # Functions and headers
71 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale uselocale)
72 AC_CHECK_HEADERS(unistd.h sys/mman.h stdbool.h xlocale.h)
73
74 # Compiler flags
75 AC_CANONICAL_HOST
76 AC_CHECK_ALIGNOF([struct{char;}])
77 if test "x$GCC" = "xyes"; then
78
79         # Make symbols link locally
80         AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
81
82         # Make it possible to not link to libstdc++
83         # No threadsafe statics in C++ as we do it ourselves.
84         # We don't use these features, so it's safe to disable them
85         # even in the cases where we DO link to libstdc++.
86         # Put -fno-rtti before $CXXFLAGS such that users can re-enable it
87         # by overriding CXXFLAGS.
88         CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics"
89
90         case "$host" in
91                 *-*-mingw*)
92                 ;;
93                 *)
94                         # Hide inline methods
95                         CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
96                 ;;
97         esac
98
99         case "$host" in
100                 arm-*-*)
101                         if test "x$ac_cv_alignof_struct_char__" != x1; then
102                                 # Request byte alignment
103                                 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
104                         fi
105                 ;;
106         esac
107 fi
108
109 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
110
111 hb_os_win32=no
112 AC_MSG_CHECKING([for native Win32])
113 case "$host" in
114   *-*-mingw*)
115     hb_os_win32=yes
116     ;;
117 esac
118 AC_MSG_RESULT([$hb_os_win32])
119 AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
120
121 have_pthread=false
122 AX_PTHREAD([have_pthread=true])
123 if $have_pthread; then
124         AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
125 fi
126 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
127
128 dnl ==========================================================================
129
130 AC_ARG_WITH(glib,
131         [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
132                         [Use glib @<:@default=auto@:>@])],,
133         [with_glib=auto])
134 have_glib=false
135 GLIB_DEPS="glib-2.0 >= 2.19.1"
136 AC_SUBST(GLIB_DEPS)
137 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
138         PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
139 fi
140 if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
141         AC_MSG_ERROR([glib support requested but glib-2.0 not found])
142 fi
143 if $have_glib; then
144         AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
145 fi
146 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
147
148 dnl ===========================================================================
149
150 AC_ARG_WITH(gobject,
151         [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
152                         [Use gobject @<:@default=no@:>@])],,
153         [with_gobject=no])
154 have_gobject=false
155 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
156         PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
157 fi
158 if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
159         AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
160 fi
161 if $have_gobject; then
162         AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
163         GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
164         AC_SUBST(GLIB_MKENUMS)
165 fi
166 AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
167 AC_SUBST(have_gobject)
168
169 dnl ===========================================================================
170
171
172 dnl ===========================================================================
173 # Gobject-Introspection
174 have_introspection=false
175 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
176         if $have_gobject; then
177                 GOBJECT_INTROSPECTION_CHECK([1.34.0])
178                 if test "x$found_introspection" = xyes; then
179                         have_introspection=true
180                 fi
181         else
182                 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
183         fi
184 ], [
185         AM_CONDITIONAL([HAVE_INTROSPECTION], false)
186 ])
187
188 dnl ==========================================================================
189
190 AC_ARG_WITH(cairo,
191         [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
192                         [Use cairo @<:@default=auto@:>@])],,
193         [with_cairo=auto])
194 have_cairo=false
195 if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
196         PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
197 fi
198 if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
199         AC_MSG_ERROR([cairo support requested but not found])
200 fi
201 if $have_cairo; then
202         AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
203 fi
204 AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
205
206 have_cairo_ft=false
207 if $have_cairo; then
208         PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
209 fi
210 if $have_cairo_ft; then
211         AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
212 fi
213 AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
214
215 dnl ==========================================================================
216
217 AC_ARG_WITH(chafa,
218         [AS_HELP_STRING([--with-chafa=@<:@yes/no/auto@:>@],
219                         [Use chafa @<:@default=auto@:>@])],,
220         [with_chafa=auto])
221 have_chafa=false
222 if test "x$with_chafa" = "xyes" -o "x$with_chafa" = "xauto"; then
223         PKG_CHECK_MODULES(CHAFA, chafa >= 1.6.0, have_chafa=true, :)
224 fi
225 if test "x$with_chafa" = "xyes" -a "x$have_chafa" != "xtrue"; then
226         AC_MSG_ERROR([chafa support requested but not found])
227 fi
228 if $have_chafa; then
229         AC_DEFINE(HAVE_CHAFA, 1, [Have chafa terminal graphics library])
230 fi
231 AM_CONDITIONAL(HAVE_CHAFA, $have_chafa)
232
233 dnl ==========================================================================
234
235 AC_ARG_WITH(icu,
236         [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
237                         [Use ICU @<:@default=auto@:>@])],,
238         [with_icu=auto])
239 have_icu=false
240 if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
241         PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
242 fi
243 if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
244         AC_MSG_ERROR([icu support requested but icu-uc not found])
245 fi
246
247 if $have_icu; then
248         CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
249         AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
250         if test "x$with_icu" = "xbuiltin"; then
251                 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
252         fi
253 fi
254 AM_CONDITIONAL(HAVE_ICU, $have_icu)
255 AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
256
257 dnl ===========================================================================
258
259 AC_ARG_WITH(graphite2,
260         [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
261                         [Use the graphite2 library @<:@default=no@:>@])],,
262         [with_graphite2=no])
263 have_graphite2=false
264 GRAPHITE2_DEPS="graphite2 >= 1.2.0"
265 AC_SUBST(GRAPHITE2_DEPS)
266 if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
267         PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
268         if test "x$have_graphite2" != "xtrue"; then
269                 # If pkg-config is not available, graphite2 can still be there
270                 ac_save_CFLAGS="$CFLAGS"
271                 ac_save_CPPFLAGS="$CPPFLAGS"
272                 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
273                 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
274                 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
275                 CPPFLAGS="$ac_save_CPPFLAGS"
276                 CFLAGS="$ac_save_CFLAGS"
277         fi
278 fi
279 if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
280         AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
281 fi
282 if $have_graphite2; then
283         AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
284 fi
285 AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
286
287 dnl ==========================================================================
288
289 AC_ARG_WITH(freetype,
290         [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
291                         [Use the FreeType library @<:@default=auto@:>@])],,
292         [with_freetype=auto])
293 have_freetype=false
294 FREETYPE_DEPS="freetype2 >= 12.0.6"
295 AC_SUBST(FREETYPE_DEPS)
296 if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
297         # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
298         PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
299 fi
300 if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
301         AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
302 fi
303 if $have_freetype; then
304         AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
305         save_libs=$LIBS
306         LIBS="$LIBS $FREETYPE_LIBS"
307         AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
308         LIBS=$save_libs
309 fi
310 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
311
312 dnl ===========================================================================
313
314 AC_ARG_WITH(uniscribe,
315         [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
316                         [Use the Uniscribe library @<:@default=no@:>@])],,
317         [with_uniscribe=no])
318 have_uniscribe=false
319 if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
320         AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
321 fi
322 if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
323         AC_MSG_ERROR([uniscribe support requested but not found])
324 fi
325 if $have_uniscribe; then
326         UNISCRIBE_CFLAGS=
327         UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
328         AC_SUBST(UNISCRIBE_CFLAGS)
329         AC_SUBST(UNISCRIBE_LIBS)
330         AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
331 fi
332 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
333
334 dnl ===========================================================================
335
336 AC_ARG_WITH(gdi,
337         [AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@],
338                         [Provide GDI integration helpers @<:@default=no@:>@])],,
339         [with_gdi=no])
340 have_gdi=false
341 if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then
342         AC_CHECK_HEADERS(windows.h, have_gdi=true)
343 fi
344 if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then
345         AC_MSG_ERROR([gdi support requested but not found])
346 fi
347 if $have_gdi; then
348         GDI_CFLAGS=
349         GDI_LIBS="-lgdi32"
350         AC_SUBST(GDI_CFLAGS)
351         AC_SUBST(GDI_LIBS)
352         AC_DEFINE(HAVE_GDI, 1, [Have GDI library])
353 fi
354 AM_CONDITIONAL(HAVE_GDI, $have_gdi)
355
356 dnl ===========================================================================
357
358 AC_ARG_WITH(directwrite,
359         [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
360                         [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
361         [with_directwrite=no])
362 have_directwrite=false
363 AC_LANG_PUSH([C++])
364 if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
365         AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
366 fi
367 AC_LANG_POP([C++])
368 if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
369         AC_MSG_ERROR([directwrite support requested but not found])
370 fi
371 if $have_directwrite; then
372         DIRECTWRITE_CXXFLAGS=
373         DIRECTWRITE_LIBS=
374         AC_SUBST(DIRECTWRITE_CXXFLAGS)
375         AC_SUBST(DIRECTWRITE_LIBS)
376         AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
377 fi
378 AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
379
380 dnl ===========================================================================
381
382 AC_ARG_WITH(coretext,
383         [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
384                         [Use CoreText @<:@default=no@:>@])],,
385         [with_coretext=no])
386 have_coretext=false
387 if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
388         AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
389
390         if $have_coretext; then
391                 CORETEXT_CFLAGS=
392                 CORETEXT_LIBS="-framework ApplicationServices"
393                 AC_SUBST(CORETEXT_CFLAGS)
394                 AC_SUBST(CORETEXT_LIBS)
395         else
396                 # On iOS CoreText and CoreGraphics are stand-alone frameworks
397                 if test "x$have_coretext" != "xtrue"; then
398                         # Check for a different symbol to avoid getting cached result.
399                         AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
400                 fi
401
402                 if $have_coretext; then
403                         CORETEXT_CFLAGS=
404                         CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
405                         AC_SUBST(CORETEXT_CFLAGS)
406                         AC_SUBST(CORETEXT_LIBS)
407                 fi
408         fi
409 fi
410 if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
411         AC_MSG_ERROR([CoreText support requested but libcoretext not found])
412 fi
413 if $have_coretext; then
414         AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
415 fi
416 AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
417
418 dnl ===========================================================================
419
420 AC_CONFIG_FILES([
421 Makefile
422 src/Makefile
423 src/harfbuzz-config.cmake
424 util/Makefile
425 test/Makefile
426 test/api/Makefile
427 test/fuzzing/Makefile
428 test/shape/Makefile
429 test/shape/data/Makefile
430 test/shape/data/aots/Makefile
431 test/shape/data/in-house/Makefile
432 test/shape/data/text-rendering-tests/Makefile
433 test/subset/Makefile
434 test/subset/data/Makefile
435 test/subset/data/repack_tests/Makefile
436 docs/Makefile
437 docs/version.xml
438 ])
439
440 AC_OUTPUT
441
442 echo
443 echo "C++ compiler version:"
444 $CXX --version
445 echo
446
447 AC_MSG_NOTICE([
448
449 Autotools is no longer our supported build system for building the library
450 for *nix distributions, please migrate to meson.
451
452 ])
453
454
455 AC_MSG_NOTICE([
456
457 Build configuration:
458
459 Unicode callbacks (you want at least one):
460         Builtin                 true
461         Glib:                   ${have_glib}
462         ICU:                    ${have_icu}
463
464 Font callbacks (the more the merrier):
465         FreeType:               ${have_freetype}
466
467 Tools used for command-line utilities:
468         Cairo:                  ${have_cairo}
469         Chafa:                  ${have_chafa}
470
471 Additional shapers:
472         Graphite2:              ${have_graphite2}
473
474 Platform shapers (not normally needed):
475         CoreText:               ${have_coretext}
476         DirectWrite:            ${have_directwrite}
477         GDI:                    ${have_gdi}
478         Uniscribe:              ${have_uniscribe}
479
480 Other features:
481         Documentation:          ${enable_gtk_doc}
482         GObject bindings:       ${have_gobject}
483         Introspection:          ${have_introspection}
484 ])