blob: 0e2bbf626b5306441268f7a29d4800dd2600cbfb [file] [log] [blame]
Javier Jardón2abe1262011-01-09 22:18:53 -05001AC_PREREQ([2.64])
Behdad Esfahbod8c5f5e62012-06-17 14:58:59 -04002AC_INIT([HarfBuzz],
Behdad Esfahbodf7e8dcf2012-05-11 22:00:06 +02003 [0.9.0],
Javier Jardón2abe1262011-01-09 22:18:53 -05004 [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
5 [harfbuzz],
Behdad Esfahbod5b21eff2011-05-25 14:49:35 -04006 [http://harfbuzz.org/])
Javier Jardón2abe1262011-01-09 22:18:53 -05007
Behdad Esfahbod29aa4002009-11-02 16:28:39 -05008AC_CONFIG_SRCDIR([harfbuzz.pc.in])
9AC_CONFIG_HEADERS([config.h])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050010
Javier Jardón2abe1262011-01-09 22:18:53 -050011AM_INIT_AUTOMAKE([1.11.1 gnu dist-bzip2 no-dist-gzip -Wall no-define])
Javier Jardón2abe1262011-01-09 22:18:53 -050012AM_SILENT_RULES([yes])
13
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050014# Initialize libtool
15LT_PREREQ([2.2])
16LT_INIT([disable-static])
17
Javier Jardón2abe1262011-01-09 22:18:53 -050018# Check for programs
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050019AC_PROG_CC
Behdad Esfahbod01098162010-10-05 18:36:45 -040020AM_PROG_CC_C_O
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050021AC_PROG_CXX
22
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040023# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040024m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
25m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
26m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
27m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
28HB_VERSION_MAJOR=hb_version_major
29HB_VERSION_MINOR=hb_version_minor
30HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040031HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040032AC_SUBST(HB_VERSION_MAJOR)
33AC_SUBST(HB_VERSION_MINOR)
34AC_SUBST(HB_VERSION_MICRO)
35AC_SUBST(HB_VERSION)
36
Behdad Esfahbod329c1572011-05-25 16:07:07 -040037# Libtool version
38m4_define([hb_version_int],
39 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
40m4_if(m4_eval(hb_version_minor % 2), [1],
41 dnl for unstable releases
42 [m4_define([hb_libtool_revision], 0)],
43 dnl for stable releases
44 [m4_define([hb_libtool_revision], hb_version_micro)])
45m4_define([hb_libtool_age],
46 m4_eval(hb_version_int - hb_libtool_revision))
47m4_define([hb_libtool_current],
48 m4_eval(hb_version_major + hb_libtool_age))
49HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
50AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040051
Behdad Esfahbod8c0ea7b2012-06-24 13:20:56 -040052dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
Behdad Esfahbod95ab82a2012-01-15 14:56:56 -050053dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040054
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040055# Functions and headers
Behdad Esfahbodcdafe3a2012-06-05 16:34:49 -040056AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize sched_yield mmap _setmode isatty)
57AC_CHECK_HEADERS(unistd.h sys/mman.h sched.h io.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050058
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040059# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040060AC_CANONICAL_HOST
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050061if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040062
Behdad Esfahbod71cef142011-05-06 19:30:59 -040063 # Make symbols link locally
64 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
65
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040066 # Make sure we don't link to libstdc++
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050067 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040068
69 case "$host" in
70 arm-*-*)
71 # Request byte alignment on arm
72 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
73 ;;
74 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050075fi
76
77dnl ==========================================================================
78
Behdad Esfahbod68c75b42012-06-05 19:55:46 -040079have_ot=true
80if $have_ot; then
81 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
82fi
83AM_CONDITIONAL(HAVE_OT, $have_ot)
84
85dnl ===========================================================================
86
Behdad Esfahbode6a5b882011-05-05 16:24:42 -040087PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -050088if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -050089 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -050090fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050091AM_CONDITIONAL(HAVE_GLIB, $have_glib)
92
Behdad Esfahbodc214cff2011-08-14 15:17:16 +020093PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
94if $have_gthread; then
95 AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
96fi
97AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
98
Behdad Esfahbod3d0ddd12012-01-15 15:55:52 -050099PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200100if $have_gobject; then
101 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200102 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
103 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200104fi
105AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
106
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400107dnl ==========================================================================
108
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500109PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
110if $have_cairo; then
111 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
112fi
113AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
114
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500115PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
116if $have_cairo_ft; then
117 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
118fi
119AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
120
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400121dnl ==========================================================================
122
Behdad Esfahbodd1f17072010-11-30 00:57:15 -0500123PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
Behdad Esfahbod880c1f02011-09-19 23:10:22 -0400124 have_icu=true
125 AC_CHECK_HEADERS(unicode/uchar.h,, have_icu=false)
126 AC_MSG_CHECKING([for libicuuc])
127 LIBS_old=$LIBS
128 LIBS="$LIBS -licuuc"
129 AC_TRY_LINK([#include <unicode/uchar.h>],
130 [u_getIntPropertyValue (0, (UProperty)0);],
131 AC_MSG_RESULT(yes),
132 AC_MSG_RESULT(no);have_icu=false)
133 LIBS=$LIBS_old
134 if $have_icu; then
135 ICU_CFLAGS=-D_REENTRANT
136 ICU_LIBS="-licuuc"
137 AC_SUBST(ICU_CFLAGS)
138 AC_SUBST(ICU_LIBS)
Behdad Esfahbodd1f17072010-11-30 00:57:15 -0500139 fi
140])
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500141if $have_icu; then
142 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
143fi
144AM_CONDITIONAL(HAVE_ICU, $have_icu)
145
Behdad Esfahbod46377392011-08-24 02:12:05 +0200146dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200147
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400148PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200149if $have_graphite; then
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400150 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200151fi
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400152AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200153
154dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400155
Behdad Esfahbod0b7e4d92011-08-15 20:41:59 +0200156PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500157if $have_freetype; then
158 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbodcd11a982009-12-20 23:05:02 +0100159 _save_libs="$LIBS"
160 _save_cflags="$CFLAGS"
161 LIBS="$LIBS $FREETYPE_LIBS"
162 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
163 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
164 LIBS="$_save_libs"
165 CFLAGS="$_save_cflags"
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500166fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500167AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
168
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400169dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500170
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400171AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true, have_uniscribe=false)
172if $have_uniscribe; then
173 UNISCRIBE_CFLAGS=
174 UNISCRIBE_LIBS="-lusp10 -lgdi32"
175 AC_SUBST(UNISCRIBE_CFLAGS)
176 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbod02aeca92011-08-04 22:31:05 -0400177 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400178fi
179AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
180
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400181dnl ===========================================================================
182
183AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
184 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400185 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400186 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400187 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
188 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
189 void mutex_unlock (int *m) { __sync_lock_release (m); }
190 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400191 )
192])
193if $hb_cv_have_intel_atomic_primitives; then
194 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
195fi
196
197dnl ===========================================================================
198
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500199AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500200Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400201harfbuzz.pc
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500202src/Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400203src/hb-version.h
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200204util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400205test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500206test/api/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500207test/shaping/Makefile
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500208])
209
210AC_OUTPUT