configure.ac 14 KB

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