Clean up spec file for packaging
[profile/ivi/pango.git] / configure.in
1 dnl Process this file with autoconf to create configure.
2 AC_PREREQ(2.56)
3
4 dnl ==========================================================================
5 dnl                               Versioning              
6 dnl ==========================================================================
7
8 dnl Making releases:
9 dnl   PANGO_VERSION_MICRO += 1;
10 dnl   PANGO_INTERFACE_AGE += 1;
11 dnl   PANGO_BINARY_AGE += 1;
12 dnl if any functions have been added, set PANGO_INTERFACE_AGE to 0.
13 dnl if backwards compatibility has been broken,
14 dnl set PANGO_BINARY_AGE _and_ PANGO_INTERFACE_AGE to 0.
15
16 dnl
17 dnl We do the version number components as m4 macros
18 dnl so that we can base configure --help output off
19 dnl of them.
20 dnl
21
22 dnl The triplet 
23 m4_define([pango_version_major], [1])
24 m4_define([pango_version_minor], [30])
25 m4_define([pango_version_micro], [0])
26
27 m4_define([pango_version],
28           [pango_version_major.pango_version_minor.pango_version_micro])
29 dnl The X.Y in -lpango-X.Y line. This is expected to stay 1.0 until Pango 2.
30 m4_define([pango_api_version], [1.0])
31 m4_if(m4_eval(pango_version_minor % 2), [1],
32       [
33         dnl for unstable releases
34         m4_define([pango_interface_age], [0])
35       ],
36       [
37         dnl for stable releases
38         m4_define([pango_interface_age], pango_version_micro)
39       ])
40 dnl Number of releases since we've broken binary compatibility.
41 m4_define([pango_binary_age],
42           [m4_eval(100 * pango_version_minor + pango_version_micro)])
43 dnl Module API version.  This should be stepped up when a change causes
44 dnl older modules to not work with new pango.
45 m4_define([pango_module_version], [1.6.0])
46
47
48 AC_INIT(pango, pango_version(),
49         [http://bugzilla.gnome.org/enter_bug.cgi?product=pango])
50
51 AC_CONFIG_SRCDIR([pango.pc.in])
52
53 dnl -Wno-portability tells automake to stop complaining about the
54 dnl usage of GNU Make specific features.
55 AM_INIT_AUTOMAKE(1.9 gnits dist-xz no-dist-gzip -Wno-portability)
56 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
57 AM_CONFIG_HEADER([config.h])
58
59
60 PANGO_VERSION_MAJOR=pango_version_major()
61 PANGO_VERSION_MINOR=pango_version_minor()
62 PANGO_VERSION_MICRO=pango_version_micro()
63 PANGO_VERSION=pango_version()
64 PANGO_API_VERSION=pango_api_version()
65 PANGO_INTERFACE_AGE=pango_interface_age()
66 PANGO_BINARY_AGE=pango_binary_age()
67 PANGO_MODULE_VERSION=pango_module_version()
68
69 AC_SUBST(PANGO_VERSION_MAJOR)
70 AC_SUBST(PANGO_VERSION_MINOR)
71 AC_SUBST(PANGO_VERSION_MICRO)
72 AC_SUBST(PANGO_VERSION)
73 AC_SUBST(PANGO_API_VERSION)
74 AC_SUBST(PANGO_INTERFACE_AGE)
75 AC_SUBST(PANGO_BINARY_AGE)
76 AC_SUBST(PANGO_MODULE_VERSION)
77
78 AC_DEFINE(MODULE_VERSION, "pango_module_version()", [Module interface version])
79 AC_DEFINE(PANGO_BINARY_AGE, pango_binary_age(), [PANGO binary age])
80 AC_DEFINE(PANGO_INTERFACE_AGE, pango_interface_age(), [PANGO interface age])
81 AC_DEFINE(PANGO_VERSION_MAJOR, pango_version_major(), [PANGO major version])
82 AC_DEFINE(PANGO_VERSION_MINOR, pango_version_minor(), [PANGO minor version])
83 AC_DEFINE(PANGO_VERSION_MICRO, pango_version_micro(), [PANGO micro version])
84
85 dnl libtool versioning
86 m4_define([lt_current], [m4_eval(100 * pango_version_minor + pango_version_micro - pango_interface_age)])
87 m4_define([lt_revision], [pango_interface_age])
88 m4_define([lt_age], [m4_eval(pango_binary_age - pango_interface_age)])
89 VERSION_INFO="lt_current():lt_revision():lt_age()"
90 PANGO_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
91
92 AC_SUBST(PANGO_CURRENT_MINUS_AGE)
93
94 dnl ==========================================================================
95
96 AC_CANONICAL_HOST
97
98 AC_MSG_CHECKING([for native Win32])
99 case "$host" in
100   *-*-mingw*)
101     pango_os_win32=yes
102     case "$host" in
103       x86_64-*-*)
104         LIB_EXE_MACHINE_FLAG=X64
105         ;;
106       *)
107         LIB_EXE_MACHINE_FLAG=X86
108         ;;
109     esac
110     ;;
111   *)
112     pango_os_win32=no
113     ;;
114 esac
115 AC_MSG_RESULT([$pango_os_win32])
116
117 AC_SUBST(LIB_EXE_MACHINE_FLAG)
118
119 AM_CONDITIONAL(OS_WIN32, test "$pango_os_win32" = "yes")
120
121 AC_PROG_CC
122
123 dnl
124 dnl Check for a working C++ compiler, but do not bail out, if none is found.
125 dnl We use this for an automated test for C++ header correctness.
126 dnl
127 AC_CHECK_TOOLS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], gcc)
128 AC_LANG_SAVE
129 AC_LANG_CPLUSPLUS
130 AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
131 AM_CONDITIONAL(HAVE_CXX, test "$CXX" != "")
132 AC_LANG_RESTORE
133
134 #
135 # Checks for HarfBuzz
136 #
137
138 AC_PROG_CXX
139 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
140 AC_CHECK_HEADERS(unistd.h sys/mman.h)
141
142 # Make sure we don't link to libstdc++ (needs de-gcc-fication)
143 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
144
145
146 #
147 # Win32 stuff
148 #
149
150 AC_LIBTOOL_WIN32_DLL
151 AM_DISABLE_STATIC
152
153 if test "$pango_os_win32" = "yes"; then
154   if test x$enable_static = xyes -o x$enable_static = x; then
155     AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
156     enable_static=no
157   fi
158   if test x$enable_shared = xno; then
159     AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
160   fi
161   enable_shared=yes
162 fi
163
164 AM_PROG_LIBTOOL
165 dnl when using libtool 2.x create libtool early, because it's used in configure
166 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
167
168 AC_MSG_CHECKING([for some Win32 platform])
169 case "$host" in
170   *-*-mingw*|*-*-cygwin*)
171     pango_platform_win32=yes
172     ;;
173   *)
174     pango_platform_win32=no
175     ;;
176 esac
177 AC_MSG_RESULT([$pango_platform_win32])
178 AM_CONDITIONAL(PLATFORM_WIN32, test "$pango_platform_win32" = "yes")
179
180 if test "$pango_platform_win32" = "yes"; then
181   AC_CHECK_TOOL(WINDRES, windres, no)
182   if test "$WINDRES" = no; then
183     AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
184   fi
185   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
186 fi
187 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
188
189 changequote(,)dnl
190 if test "x$GCC" = "xyes"; then
191   case " $CFLAGS " in
192   *[\ \ ]-Wall[\ \      ]*) ;;
193   *) CFLAGS="$CFLAGS -Wall" ;;
194   esac
195 fi
196 changequote([,])dnl
197
198 dnl declare --enable-* args and collect ac_help strings
199
200 m4_define([debug_default],
201           m4_if(m4_eval(pango_version_minor() % 2), [1], [yes], [minimum]))
202
203 AC_ARG_ENABLE(debug,
204               AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
205                              [turn on debugging @<:@default=debug_default()@:>@]),
206               ,
207               enable_debug=debug_default())
208
209 if test "x$enable_debug" = "xyes"; then
210   PANGO_DEBUG_FLAGS="-DPANGO_ENABLE_DEBUG"
211 else
212   PANGO_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
213
214   if test "x$enable_debug" = "xno"; then
215     PANGO_DEBUG_FLAGS="$GLIB_DEBUG_FLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS $PANGO_DEBUG_FLAGS"
216   fi
217 fi
218
219 AC_SUBST(PANGO_DEBUG_FLAGS)
220
221 AC_ARG_ENABLE(rebuilds,
222               [AC_HELP_STRING([--disable-rebuilds],
223                               [disable all source autogeneration rules])],,
224               [enable_rebuilds=yes])
225
226 AM_CONDITIONAL(CROSS_COMPILING, [test $cross_compiling = yes])
227
228 have_x=false
229 if test "x$pango_os_win32" != xyes; then
230   AC_PATH_XTRA
231
232   if test x$no_x = xyes ; then
233     AC_MSG_WARN([X development libraries not found])
234     have_x=false
235   else
236     X_LIBS="$X_LIBS -lX11"
237     have_x=true
238     AC_DEFINE(HAVE_X, 1, [Have X libraries])
239   fi
240 fi
241 AM_CONDITIONAL(HAVE_X, $have_x) 
242
243 have_fontconfig=false
244 have_freetype=false
245 have_xft=false
246
247 #
248 # Check for fontconfig
249 #
250 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.5.0, have_fontconfig=true, AC_MSG_RESULT([no]))
251
252 #
253 # Checks for FreeType
254 #
255 if $have_fontconfig ; then
256   # The first version of freetype with a .pc file is 2.1.5.  That's recent
257   # enough for all the functions we use I guess.  No version check needed.
258   PKG_CHECK_MODULES(FREETYPE, freetype2, have_freetype=true, AC_MSG_RESULT([no]))
259 fi
260 if $have_freetype ; then
261   AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
262   # By freetype, we really always mean freetype+fontconfig
263   FREETYPE_CFLAGS="$FREETYPE_CFLAGS $FONTCONFIG_CFLAGS"
264   FREETYPE_LIBS="$FREETYPE_LIBS $FONTCONFIG_LIBS"
265 fi
266 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
267
268 #
269 # Checks for Xft/XRender
270 #
271 if $have_x && $have_freetype ; then
272   PKG_CHECK_MODULES(XFT, xft >= 2.0.0 xrender, have_xft=true, AC_MSG_RESULT([no]))
273 fi
274 if $have_xft ; then
275   AC_DEFINE(HAVE_XFT, 1, [Have Xft library])
276 fi
277 AM_CONDITIONAL(HAVE_XFT, $have_xft)
278
279 #
280 # Checks for Win32 GDI
281 #
282 have_win32=false
283 WIN32_LIBS=""
284 WIN32_CFLAGS=""
285 # The following doesn't work with autoconf-2.13, so we check $host instead
286 # AC_CHECK_LIB(gdi32, GetTextMetricsA@8, have_win32=true, : )
287 case "$host" in
288   *-*-mingw*|*-*-cygwin*) have_win32=true ;;
289 esac
290
291
292 if test $have_win32 = true; then
293   WIN32_LIBS="-lgdi32"
294 fi
295
296 AC_SUBST(WIN32_LIBS)
297 AM_CONDITIONAL(HAVE_WIN32, $have_win32) 
298
299 # Ensure MSVC-compatible struct packing convention is used when
300 # compiling for Win32 with gcc.
301 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
302 # gcc2 uses "-fnative-struct".
303 if test "$pango_os_win32" = "yes"; then
304   if test x"$GCC" = xyes; then
305     msnative_struct=''
306     AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
307     if test -z "$ac_cv_prog_CC"; then
308       our_gcc="$CC"
309     else
310       our_gcc="$ac_cv_prog_CC"
311     fi
312     case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
313       2.)
314         if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
315           msnative_struct='-fnative-struct'
316         fi
317         ;;
318       *)
319         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
320           msnative_struct='-mms-bitfields'
321         fi
322         ;;
323     esac
324     if test x"$msnative_struct" = x ; then
325       AC_MSG_RESULT([no way])
326       AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
327     else
328       CFLAGS="$CFLAGS $msnative_struct"
329       AC_MSG_RESULT([${msnative_struct}])
330     fi
331   fi
332 fi
333
334 #
335 # Checks for ATSUI
336 #
337 AC_CHECK_HEADER(Carbon/Carbon.h, [have_atsui=true], [have_atsui=false])
338
339 #
340 # Checks for CoreText
341 #
342
343 AC_MSG_CHECKING([for CoreText availability])
344 pango_save_libs=$LIBS
345 LIBS="$LIBS -framework ApplicationServices"
346 AC_TRY_LINK([#include <Carbon/Carbon.h>], [CTGetCoreTextVersion ();],
347 [have_core_text=yes], [have_core_text=no])
348 LIBS=$pango_save_libs
349
350 if test "$have_core_text" = "yes"; then
351   AC_DEFINE(HAVE_CORE_TEXT, 1, [Whether CoreText is available on the system])
352 fi
353
354 AC_MSG_RESULT([$have_core_text])
355
356 AM_CONDITIONAL(HAVE_CORE_TEXT, test "$have_core_text" = "yes")
357
358 #
359 # Checks for Cairo
360 #
361 have_cairo=false
362 have_cairo_png=false
363 have_cairo_ps=false
364 have_cairo_pdf=false
365 have_cairo_xlib=false
366 have_cairo_freetype=false
367 have_cairo_win32=false
368 have_cairo_atsui=false
369 cairo_required=1.7.6
370
371 PKG_CHECK_MODULES(CAIRO, cairo >= $cairo_required, have_cairo=true, AC_MSG_RESULT([no]))
372    
373 if $have_cairo ; then
374   pango_save_libs=$LIBS
375   LIBS="$LIBS $CAIRO_LIBS"
376   pango_save_ldflags=$LDFLAGS
377   LDFLAGS="$LDFLAGS $CAIRO_LIBS"
378
379   have_cairo=false
380   cairo_font_backends=""
381
382   if $have_freetype; then
383     PKG_CHECK_EXISTS(cairo-ft >= $cairo_required, have_cairo_freetype=true, :)
384   fi
385   if $have_cairo_freetype; then
386     AC_DEFINE(HAVE_CAIRO_FREETYPE, 1, [Whether Cairo can use FreeType for fonts])
387     cairo_font_backends="freetype $cairo_font_backends"
388     have_cairo=true
389   fi
390
391   if $have_win32; then
392     PKG_CHECK_EXISTS(cairo-win32 >= $cairo_required, have_cairo_win32=true, :)
393   fi
394   if $have_cairo_win32; then
395     AC_DEFINE(HAVE_CAIRO_WIN32, 1, [Whether Cairo can use the Win32 GDI for fonts])
396     cairo_font_backends="win32 $cairo_font_backends"
397     have_cairo=true
398   fi
399
400   if test $have_atsui -o $have_core_text; then
401     PKG_CHECK_EXISTS(cairo-quartz-font >= $cairo_required, have_cairo_atsui=true, :)
402   fi
403   if $have_cairo_atsui; then
404     AC_DEFINE(HAVE_CAIRO_ATSUI, 1, [Whether Cairo can use ATSUI for fonts])
405     cairo_font_backends="quartz $cairo_font_backends"
406     have_cairo=true
407   fi
408
409   AC_MSG_CHECKING([which cairo font backends could be used])
410   if $have_cairo ; then
411     AC_MSG_RESULT([$cairo_font_backends])
412   else
413     AC_MSG_RESULT([none])
414     AC_MSG_NOTICE([Disabling cairo support])
415   fi
416
417   if $have_cairo ; then
418     AC_DEFINE(HAVE_CAIRO, 1, [Have usable Cairo library and font backend])
419
420     PKG_CHECK_EXISTS(cairo-png >= $cairo_required, have_cairo_png=true, :)
421     if $have_cairo_png; then
422       AC_DEFINE(HAVE_CAIRO_PNG, 1, [Whether Cairo has PNG support])
423     fi
424   
425     PKG_CHECK_EXISTS(cairo-ps >= $cairo_required, have_cairo_ps=true, :)
426     if $have_cairo_ps; then
427       AC_DEFINE(HAVE_CAIRO_PS, 1, [Whether Cairo has PS support])
428     fi
429   
430     PKG_CHECK_EXISTS(cairo-pdf >= $cairo_required, have_cairo_pdf=true, :)
431     if $have_cairo_pdf; then
432       AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether Cairo has PDF support])
433     fi
434   
435     PKG_CHECK_EXISTS(cairo-xlib >= $cairo_required, have_cairo_xlib=true, :)
436     if $have_cairo_xlib; then
437       AC_DEFINE(HAVE_CAIRO_XLIB, 1, [Whether Cairo has Xlib support])
438     fi
439   fi
440
441   LIBS=$pango_save_libs
442   LDFLAGS=$pango_save_ldflags
443 fi
444
445 AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
446 AM_CONDITIONAL(HAVE_CAIRO_PNG, $have_cairo_png)
447 AM_CONDITIONAL(HAVE_CAIRO_PS, $have_cairo_ps)
448 AM_CONDITIONAL(HAVE_CAIRO_PDF, $have_cairo_pdf)
449 AM_CONDITIONAL(HAVE_CAIRO_XLIB, $have_cairo_xlib)
450 AM_CONDITIONAL(HAVE_CAIRO_WIN32, $have_cairo_win32)
451 AM_CONDITIONAL(HAVE_CAIRO_FREETYPE, $have_cairo_freetype)
452 AM_CONDITIONAL(HAVE_CAIRO_ATSUI, $have_cairo_atsui)
453
454 #
455 # We must have some backend defined, in order for the pango-querymodules
456 # rule in pango/Makefile.am to work correctly. If you are up to writing
457 # a new Pango backend outside of Pango, you are up to sending the necessary
458 # patch to fix that rule. :-)
459 #
460 if $have_freetype || $have_x || $have_xft || $have_cairo || $have_win32 ; then : ; else
461   AC_MSG_ERROR([*** Could not enable any of FreeType, X11, Cairo, or Win32 backends.
462 *** Must have at least one backend to build Pango.])
463 fi
464
465 #
466 # Checks for GLib
467 #
468 GLIB_REQUIRED_VERSION=2.31.0
469 GLIB_MODULES="glib-2.0 >= $GLIB_REQUIRED_VERSION gobject-2.0 gmodule-no-export-2.0"
470
471 PKG_CHECK_MODULES(GLIB, $GLIB_MODULES, :,
472   AC_MSG_ERROR([
473 *** Glib $GLIB_REQUIRED_VERSION or better is required. The latest version of 
474 *** Glib is always available from ftp://ftp.gtk.org/.]))
475
476 # Setup GLIB_MKENUMS to use glib-mkenums even if GLib is uninstalled.
477 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
478 AC_SUBST(GLIB_MKENUMS)
479
480
481 # Add in gthread-2.0 to CFLAGS but not to LIBS so we get any
482 # necesary defines for thread-safety.
483 GLIB_CFLAGS=`$PKG_CONFIG --cflags $GLIB_MODULES gthread-2.0`
484
485 #
486 # Checks for LibThai
487 #
488 have_libthai=false
489 LIBTHAI_REQUIRED_VERSION=0.1.9
490 PKG_CHECK_MODULES(LIBTHAI, libthai >= $LIBTHAI_REQUIRED_VERSION, have_libthai=true, :)
491
492 #
493 # Checks for GObject Introspection
494 #
495
496 GOBJECT_INTROSPECTION_CHECK([0.9.5])
497
498 #
499 # Modules to build
500 #
501 arabic_modules="arabic-fc,arabic-lang"
502 basic_modules="basic-fc,basic-win32,basic-x,basic-atsui,basic-coretext"
503 hangul_modules="hangul-fc"
504 hebrew_modules="hebrew-fc"
505 indic_modules="indic-fc,indic-lang"
506 khmer_modules="khmer-fc"
507 syriac_modules="syriac-fc"
508 thai_modules="thai-fc"
509 tibetan_modules="tibetan-fc"
510
511 if $have_libthai ; then
512   thai_modules="$thai_modules,thai-lang"
513 fi
514
515 all_modules="$arabic_modules,$basic_modules,$hangul_modules,$hebrew_modules,$indic_modules,$khmer_modules,$syriac_modules,$thai_modules,$tibetan_modules"
516
517 #
518 # Allow building some or all modules included
519 #
520 AC_MSG_CHECKING(modules to link statically)
521
522 AC_ARG_WITH(included_modules,
523    AC_HELP_STRING([--with-included-modules=no/yes/MODULE1 MODULE2 ...],
524                   [build the given modules included @<:@default=no@:>@]))
525
526 included_modules=""
527 case x$with_included_modules in
528         xyes)   included_modules=$all_modules ;;
529         xno|x)  included_modules="" ;;
530         *)      included_modules=$with_included_modules ;;
531 esac
532 AC_MSG_RESULT($included_modules)
533 AM_CONDITIONAL(HAVE_INCLUDED_MODULES, test "x$included_modules" != x)
534
535 #
536 # Allow building only some or none of modules dynamic
537 #
538 AC_MSG_CHECKING(dynamic modules to build)
539
540 AC_ARG_WITH(dynamic_modules,
541    AC_HELP_STRING([--with-dynamic-modules=no/yes/MODULE1 MODULE2 ...],
542                   [build the given dynamic modules @<:@default=yes@:>@]))
543
544 dynamic_modules=""
545 case x$with_dynamic_modules in
546         xyes|x) dynamic_modules=$all_modules ;;
547         xno)    dynamic_modules="" ;;
548         *)      dynamic_modules=$with_dynamic_modules ;;
549 esac
550 AC_MSG_RESULT([$dynamic_modules (those built into Pango will be excluded)])
551 AM_CONDITIONAL(HAVE_DYNAMIC_MODULES, test "x$dynamic_modules" != x)
552
553
554 INCLUDED_X_MODULES=
555 INCLUDED_FC_MODULES=
556 INCLUDED_WIN32_MODULES=
557 INCLUDED_ATSUI_MODULES=
558 INCLUDED_CORE_TEXT_MODULES=
559 INCLUDED_LANG_MODULES=
560
561 AC_SUBST(INCLUDED_X_MODULES)
562 AC_SUBST(INCLUDED_FC_MODULES)
563 AC_SUBST(INCLUDED_WIN32_MODULES)
564 AC_SUBST(INCLUDED_ATSUI_MODULES)
565 AC_SUBST(INCLUDED_CORE_TEXT_MODULES)
566 AC_SUBST(INCLUDED_LANG_MODULES)
567
568 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=", "
569 for module in $included_modules; do
570   case $indic_modules in
571     *$module*)  dir=indic ;;
572     *)          dir=`echo $module | sed "s/-.*//"` ;;
573   esac
574   included_path="\$(top_builddir)/modules/$dir/libpango-$module.la"
575
576   case $module in
577     *-x)        INCLUDED_X_MODULES="$INCLUDED_X_MODULES $included_path" ;;
578     *-fc)       INCLUDED_FC_MODULES="$INCLUDED_FC_MODULES $included_path" ;;
579     *-win32)    INCLUDED_WIN32_MODULES="$INCLUDED_WIN32_MODULES $included_path" ;;
580     *-atsui)    INCLUDED_ATSUI_MODULES="$INCLUDED_ATSUI_MODULES $included_path" ;;
581     *-coretext) INCLUDED_CORE_TEXT_MODULES="$INCLUDED_CORE_TEXT_MODULES $included_path" ;;
582     *-lang)     INCLUDED_LANG_MODULES="$INCLUDED_LANG_MODULES $included_path" ;;
583     *)          IFS="$pango_save_ifs"; AC_MSG_ERROR([specified module $module not recognized]) ;;
584   esac
585 done
586 IFS="$pango_save_ifs"
587
588 AM_CONDITIONAL(INCLUDE_ARABIC_FC,       echo $included_modules | egrep '(^|,)arabic-fc($|,)'    > /dev/null)
589 AM_CONDITIONAL(INCLUDE_ARABIC_LANG,     echo $included_modules | egrep '(^|,)arabic-lang($|,)'  > /dev/null)
590 AM_CONDITIONAL(INCLUDE_BASIC_FC,        echo $included_modules | egrep '(^|,)basic-fc($|,)'     > /dev/null)
591 AM_CONDITIONAL(INCLUDE_BASIC_WIN32,     echo $included_modules | egrep '(^|,)basic-win32($|,)'  > /dev/null)
592 AM_CONDITIONAL(INCLUDE_BASIC_X,         echo $included_modules | egrep '(^|,)basic-x($|,)'      > /dev/null)
593 AM_CONDITIONAL(INCLUDE_BASIC_ATSUI,     echo $included_modules | egrep '(^|,)basic-atsui($|,)'  > /dev/null)
594 AM_CONDITIONAL(INCLUDE_BASIC_CORE_TEXT, echo $included_modules | egrep '(^|,)basic-coretext($|,)'       > /dev/null)
595 AM_CONDITIONAL(INCLUDE_HANGUL_FC,       echo $included_modules | egrep '(^|,)hangul-fc($|,)'    > /dev/null)
596 AM_CONDITIONAL(INCLUDE_HEBREW_FC,       echo $included_modules | egrep '(^|,)hebrew-fc($|,)'    > /dev/null)
597 AM_CONDITIONAL(INCLUDE_INDIC_FC,        echo $included_modules | egrep '(^|,)indic-fc($|,)'     > /dev/null)
598 AM_CONDITIONAL(INCLUDE_INDIC_LANG,      echo $included_modules | egrep '(^|,)indic-lang($|,)'   > /dev/null)
599 AM_CONDITIONAL(INCLUDE_KHMER_FC,        echo $included_modules | egrep '(^|,)khmer-fc($|,)'     > /dev/null)
600 AM_CONDITIONAL(INCLUDE_SYRIAC_FC,       echo $included_modules | egrep '(^|,)syriac-fc($|,)'    > /dev/null)
601 AM_CONDITIONAL(INCLUDE_THAI_FC,         echo $included_modules | egrep '(^|,)thai-fc($|,)'      > /dev/null)
602 AM_CONDITIONAL(INCLUDE_THAI_LANG,       echo $included_modules | egrep '(^|,)thai-lang($|,)'    > /dev/null)
603 AM_CONDITIONAL(INCLUDE_TIBETAN_FC,      echo $included_modules | egrep '(^|,)tibetan-fc($|,)'   > /dev/null)
604
605 AM_CONDITIONAL(DYNAMIC_ARABIC_FC,       echo $dynamic_modules | egrep '(^|,)arabic-fc($|,)'     > /dev/null)
606 AM_CONDITIONAL(DYNAMIC_ARABIC_LANG,     echo $dynamic_modules | egrep '(^|,)arabic-lang($|,)'   > /dev/null)
607 AM_CONDITIONAL(DYNAMIC_BASIC_FC,        echo $dynamic_modules | egrep '(^|,)basic-fc($|,)'      > /dev/null)
608 AM_CONDITIONAL(DYNAMIC_BASIC_WIN32,     echo $dynamic_modules | egrep '(^|,)basic-win32($|,)'   > /dev/null)
609 AM_CONDITIONAL(DYNAMIC_BASIC_X,         echo $dynamic_modules | egrep '(^|,)basic-x($|,)'       > /dev/null)
610 AM_CONDITIONAL(DYNAMIC_BASIC_ATSUI,     echo $dynamic_modules | egrep '(^|,)basic-atsui($|,)'   > /dev/null)
611 AM_CONDITIONAL(DYNAMIC_BASIC_CORE_TEXT, echo $dynamic_modules | egrep '(^|,)basic-coretext($|,)'        > /dev/null)
612 AM_CONDITIONAL(DYNAMIC_HANGUL_FC,       echo $dynamic_modules | egrep '(^|,)hangul-fc($|,)'     > /dev/null)
613 AM_CONDITIONAL(DYNAMIC_HEBREW_FC,       echo $dynamic_modules | egrep '(^|,)hebrew-fc($|,)'     > /dev/null)
614 AM_CONDITIONAL(DYNAMIC_INDIC_FC,        echo $dynamic_modules | egrep '(^|,)indic-fc($|,)'      > /dev/null)
615 AM_CONDITIONAL(DYNAMIC_INDIC_LANG,      echo $dynamic_modules | egrep '(^|,)indic-lang($|,)'    > /dev/null)
616 AM_CONDITIONAL(DYNAMIC_KHMER_FC,        echo $dynamic_modules | egrep '(^|,)khmer-fc($|,)'      > /dev/null)
617 AM_CONDITIONAL(DYNAMIC_SYRIAC_FC,       echo $dynamic_modules | egrep '(^|,)syriac-fc($|,)'     > /dev/null)
618 AM_CONDITIONAL(DYNAMIC_THAI_FC,         echo $dynamic_modules | egrep '(^|,)thai-fc($|,)'       > /dev/null)
619 AM_CONDITIONAL(DYNAMIC_THAI_LANG,       echo $dynamic_modules | egrep '(^|,)thai-lang($|,)'     > /dev/null)
620 AM_CONDITIONAL(DYNAMIC_TIBETAN_FC,      echo $dynamic_modules | egrep '(^|,)tibetan-fc($|,)'    > /dev/null)
621
622 #
623 # We use flockfile to implement pango_getline() - should be moved to GLib
624 # strtok_r isn't present on some systems
625 #
626 AC_CHECK_FUNCS(flockfile strtok_r)
627
628 dnl **************************
629 dnl *** Checks for gtk-doc ***
630 dnl **************************
631
632 if $have_cairo ; then : ; else
633    if  test x$enable_gtk_doc = xyes ; then
634       AC_MSG_WARN([Cairo not present, disabling doc building])      
635       enable_gtk_doc=no
636    fi
637 fi
638
639 GTK_DOC_CHECK([1.0])
640
641 AC_ARG_ENABLE(man,
642               AC_HELP_STRING([--enable-man],
643                              [regenerate man pages from Docbook @<:@default=no@:>@]),
644               enable_man=yes,
645               enable_man=no)
646
647 if test "x$enable_man" != xno ; then
648   dnl
649   dnl Check for xsltproc
650   dnl
651   AC_PATH_PROG([XSLTPROC], [xsltproc])
652   if test -z "$XSLTPROC"; then
653     enable_man=no
654   fi
655 fi
656
657 if test "x$enable_man" != xno ; then
658   dnl check for DocBook DTD and stylesheets in the local catalog.
659   JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
660      [DocBook XML DTD V4.1.2],,enable_man=no)
661   JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
662      [DocBook XSL Stylesheets],,enable_man=no)
663 fi
664
665 AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
666
667 AC_ARG_ENABLE(doc-cross-references,
668               AC_HELP_STRING([--disable-doc-cross-references],
669                              [cross reference glib and cairo symbols @<:@default=yes@:>@]),
670               enable_doc_cross_references=$enableval,
671               enable_doc_cross_references=yes)
672
673 if test "x$enable_doc_cross_references" != xno ; then
674         GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
675         CAIRO_PREFIX="`pkg-config --variable=prefix cairo`"
676         AC_SUBST(GLIB_PREFIX)
677         AC_SUBST(CAIRO_PREFIX)
678 fi
679 AM_CONDITIONAL(ENABLE_DOC_CROSS_REFERENCES, test x$enable_doc_cross_references != xno)
680
681 dnl ********************************************************
682 dnl * Options to pass to libtool
683 dnl ********************************************************
684
685 # Note that -module isn't included here since automake needs to see it to know
686 # that something like pango-arabic-fc.la is a valid libtool archive
687 #
688 LIBRARY_LIBTOOL_OPTIONS="-version-info $VERSION_INFO"
689 MODULE_LIBTOOL_OPTIONS="-export-dynamic -avoid-version"
690 if test "$pango_platform_win32" = yes; then
691     # We currently use .def files on Windows
692     true
693     LIBRARY_LIBTOOL_OPTIONS="$LIBRARY_LIBTOOL_OPTIONS -no-undefined"
694     MODULE_LIBTOOL_OPTIONS="$MODULE_LIBTOOL_OPTIONS -no-undefined"
695 else
696     # libtool option to control which symbols are exported
697     # right now, symbols starting with '_' are not exported
698     LIBRARY_LIBTOOL_OPTIONS="$LIBRARY_LIBTOOL_OPTIONS "'-export-symbols-regex "^pango_.*"'
699     MODULE_LIBTOOL_OPTIONS="$MODULE_LIBTOOL_OPTIONS "'-export-symbols-regex "^script_engine_.*"'
700 fi
701 AC_SUBST(LIBRARY_LIBTOOL_OPTIONS)
702 AC_SUBST(MODULE_LIBTOOL_OPTIONS)
703
704 dnl ********************************************************
705 dnl * See whether we need to load our modules as .la files *
706 dnl ********************************************************
707
708 use_la_modules=false
709
710 # is there any platform that we have to use .la files?
711
712 if $use_la_modules ; then
713    AC_DEFINE(USE_LA_MODULES, 1, [Whether to load modules via .la files rather than directly])
714 fi
715
716 dnl ******************************************************
717 dnl * See whether to include shared library dependencies *
718 dnl ******************************************************
719
720 AC_ARG_ENABLE(explicit-deps, 
721               AC_HELP_STRING([--enable-explicit-deps=@<:@no/auto/yes@:>@],
722                              [use explicit dependencies in .pc files @<:@default=auto@:>@]),
723               enable_explicit_deps="$enableval", 
724               enable_explicit_deps=auto)
725
726 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
727 case $enable_explicit_deps in
728   auto)
729     export SED
730     deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
731     if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
732       enable_explicit_deps=yes  
733     else
734       enable_explicit_deps=no  
735     fi
736   ;;
737   yes|no) 
738   ;;
739   *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
740   ;;
741 esac
742 AC_MSG_RESULT($enable_explicit_deps)
743
744 PKGCONFIG_MATH_LIBS=
745 PKGCONFIG_CAIRO_REQUIRES=
746
747 if test $enable_explicit_deps = yes ; then
748   PKGCONFIG_MATH_LIBS=-lm
749
750   X_LIBS="$X_LIBS $X_EXTRA_LIBS"
751
752   if $have_cairo_freetype;  then
753     PKGCONFIG_CAIRO_REQUIRES="$PKGCONFIG_CAIRO_REQUIRES pangoft2"
754   fi
755   if $have_cairo_win32;  then
756     PKGCONFIG_CAIRO_REQUIRES="$PKGCONFIG_CAIRO_REQUIRES pangowin32"
757   fi
758 fi
759
760 AC_SUBST(PKGCONFIG_MATH_LIBS)
761 AC_SUBST(PKGCONFIG_CAIRO_REQUIRES)
762 AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
763
764 AC_CONFIG_COMMANDS([pango/module-defs.h],
765 [
766 cat > pango/module-defs.h <<EOTEXT
767 /* Autogenerated by configure. Do not edit */
768
769 #include "modules.h"
770
771 EOTEXT
772
773 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
774 for module in $included_modules; do
775   module_c=`echo $module | sed s/-/_/`
776   cat >> pango/module-defs.h <<EOTEXT
777 extern void         _pango_${module_c}_script_engine_list (PangoEngineInfo **engines, int *n_engines);
778 extern void         _pango_${module_c}_script_engine_init (GTypeModule *module);
779 extern void         _pango_${module_c}_script_engine_exit (void);
780 extern PangoEngine *_pango_${module_c}_script_engine_create (const char *id);
781
782 EOTEXT
783 done 
784
785 IFS="$pango_save_ifs"
786 ],[
787 included_modules=$included_modules
788 ])
789
790 AC_CONFIG_COMMANDS([pango/module-defs-x.c],
791 [
792 ### X modules
793 cat > pango/module-defs-x.c <<EOTEXT
794 /* Autogenerated by configure. Do not edit */
795
796 #include "module-defs.h"
797
798 PangoIncludedModule _pango_included_x_modules@<:@@:>@ = {
799 EOTEXT
800
801 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
802 for module in $included_modules; do
803   if echo $module | egrep -- "-x($|,)" > /dev/null; then  
804     module_c=`echo $module | sed s/-/_/`
805     cat >> pango/module-defs-x.c <<EOTEXT
806  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
807 EOTEXT
808  fi
809 done
810
811 IFS="$pango_save_ifs"
812
813 cat >> pango/module-defs-x.c <<EOTEXT
814  { NULL, NULL, NULL, NULL },
815 };
816 EOTEXT
817 ])
818
819 AC_CONFIG_COMMANDS([pango/module-defs-fc.c],
820 [
821 ### FC modules
822 cat > pango/module-defs-fc.c <<EOTEXT
823 /* Autogenerated by configure. Do not edit */
824
825 #include "module-defs.h"
826
827 PangoIncludedModule _pango_included_fc_modules@<:@@:>@ = {
828 EOTEXT
829
830 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
831 for module in $included_modules; do
832   if echo $module | egrep -- "-fc($|,)" > /dev/null; then
833     module_c=`echo $module | sed s/-/_/`
834     cat >> pango/module-defs-fc.c <<EOTEXT
835  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
836 EOTEXT
837   fi
838 done
839
840 IFS="$pango_save_ifs"
841
842 cat >> pango/module-defs-fc.c <<EOTEXT
843  { NULL, NULL, NULL, NULL },
844 };
845 EOTEXT
846 ])
847
848 AC_CONFIG_COMMANDS([pango/module-defs-win32.c],
849 [
850 ### Win32 modules
851 cat > pango/module-defs-win32.c <<EOTEXT
852 /* Autogenerated by configure. Do not edit */
853
854 #include "module-defs.h"
855
856 PangoIncludedModule _pango_included_win32_modules@<:@@:>@ = {
857 EOTEXT
858
859 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
860 for module in $included_modules; do
861   if echo $module | egrep -- "-win32($|,)" > /dev/null; then
862     module_c=`echo $module | sed s/-/_/`
863     cat >> pango/module-defs-win32.c <<EOTEXT
864  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
865 EOTEXT
866   fi
867 done
868
869 IFS="$pango_save_ifs"
870
871 cat >> pango/module-defs-win32.c <<EOTEXT
872  { NULL, NULL, NULL, NULL },
873 };
874 EOTEXT
875 ])
876
877 AC_CONFIG_COMMANDS([pango/module-defs-atsui.c],
878 [
879 ### ATSUI modules
880 cat > pango/module-defs-atsui.c <<EOTEXT
881 /* Autogenerated by configure. Do not edit */
882
883 #include "module-defs.h"
884
885 PangoIncludedModule _pango_included_atsui_modules@<:@@:>@ = {
886 EOTEXT
887
888 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
889 for module in $included_modules; do
890   if echo $module | egrep -- "-atsui($|,)" > /dev/null; then
891     module_c=`echo $module | sed s/-/_/`
892     cat >> pango/module-defs-atsui.c <<EOTEXT
893  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
894 EOTEXT
895   fi
896 done
897
898 IFS="$pango_save_ifs"
899
900 cat >> pango/module-defs-atsui.c <<EOTEXT
901  { NULL, NULL, NULL, NULL },
902 };
903 EOTEXT
904 ])
905
906 AC_CONFIG_COMMANDS([pango/module-defs-coretext.c],
907 [
908 ### CoreText modules
909 cat > pango/module-defs-coretext.c <<EOTEXT
910 /* Autogenerated by configure. Do not edit */
911
912 #include "module-defs.h"
913
914 PangoIncludedModule _pango_included_core_text_modules@<:@@:>@ = {
915 EOTEXT
916
917 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
918 for module in $included_modules; do
919   if echo $module | egrep -- "-coretext($|,)" > /dev/null; then
920     module_c=`echo $module | sed s/-/_/`
921     cat >> pango/module-defs-coretext.c <<EOTEXT
922  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
923 EOTEXT
924   fi
925 done
926
927 IFS="$pango_save_ifs"
928
929 cat >> pango/module-defs-coretext.c <<EOTEXT
930  { NULL, NULL, NULL, NULL },
931 };
932 EOTEXT
933 ])
934
935 AC_CONFIG_COMMANDS([pango/module-defs-lang.c],
936 [
937 ### lang modules
938 cat > pango/module-defs-lang.c <<EOTEXT
939 /* Autogenerated by configure. Do not edit */
940
941 #include "module-defs.h"
942
943 PangoIncludedModule _pango_included_lang_modules@<:@@:>@ = {
944 EOTEXT
945
946 IFS="${IFS=     }"; pango_save_ifs="$IFS"; IFS=","
947 for module in $included_modules; do
948   if echo $module | egrep -- "-lang($|,)" > /dev/null; then
949     module_c=`echo $module | sed s/-/_/`
950     cat >> pango/module-defs-lang.c <<EOTEXT
951  { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
952 EOTEXT
953   fi
954 done
955
956 IFS="$pango_save_ifs"
957
958 cat >> pango/module-defs-lang.c <<EOTEXT
959  { NULL, NULL, NULL, NULL },
960 };
961 EOTEXT
962 ])
963
964
965 AC_HEADER_DIRENT
966 AC_CHECK_HEADERS(unistd.h)
967
968 # Honor aclocal flags
969 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
970 dnl ===========================================================================
971 AC_CONFIG_COMMANDS([pango/pango-features.h],
972           [featuresfile=pango/pango-features.h
973            outfile=$featuresfile.tmp
974            AC_MSG_NOTICE([creating $featuresfile])
975            cat >$outfile <<_EOF
976 /* Generated by configure. Do not edit */
977 #ifndef PANGO_FEATURES_H
978 #define PANGO_FEATURES_H
979
980 #define PANGO_VERSION_MAJOR $PANGO_VERSION_MAJOR
981 #define PANGO_VERSION_MINOR $PANGO_VERSION_MINOR
982 #define PANGO_VERSION_MICRO $PANGO_VERSION_MICRO
983
984 #define PANGO_VERSION_STRING "$PANGO_VERSION_MAJOR.$PANGO_VERSION_MINOR.$PANGO_VERSION_MICRO"
985
986 _EOF
987         # TODO: define macros for enabled features/backends here
988
989         echo '' >>$outfile
990         echo '#endif' >>$outfile
991
992         if cmp -s $outfile $featuresfile; then
993           AC_MSG_NOTICE([$featuresfile is unchanged])
994           rm -f $outfile
995         else
996           mv $outfile $featuresfile
997         fi
998 ],[
999         PANGO_VERSION_MAJOR=$PANGO_VERSION_MAJOR
1000         PANGO_VERSION_MINOR=$PANGO_VERSION_MINOR
1001         PANGO_VERSION_MICRO=$PANGO_VERSION_MICRO
1002 ])
1003
1004 AC_CONFIG_FILES([
1005 Makefile 
1006 pango/Makefile
1007 pango/mini-fribidi/Makefile
1008 pango/opentype/Makefile
1009 pango/pango.rc
1010 pango/pangoft2.rc
1011 pango/pangowin32.rc
1012 pango/pangocairo.rc
1013 pango/pangox.rc
1014 pango/pangoxft.rc
1015 pango-view/Makefile
1016 modules/Makefile
1017 modules/arabic/Makefile
1018 modules/basic/Makefile
1019 modules/hangul/Makefile
1020 modules/hebrew/Makefile
1021 modules/indic/Makefile
1022 modules/khmer/Makefile
1023 modules/syriac/Makefile
1024 modules/thai/Makefile
1025 modules/tibetan/Makefile
1026 examples/Makefile
1027 docs/Makefile
1028 docs/version.xml
1029 tools/Makefile
1030 tests/Makefile
1031 build/Makefile
1032 build/win32/Makefile
1033 build/win32/vs9/Makefile
1034 build/win32/vs10/Makefile
1035 pango.pc
1036 pangox.pc
1037 pangowin32.pc
1038 pangoft2.pc
1039 pangoxft.pc
1040 pangocairo.pc
1041 pango-uninstalled.pc
1042 pangox-uninstalled.pc
1043 pangowin32-uninstalled.pc
1044 pangoft2-uninstalled.pc
1045 pangoxft-uninstalled.pc
1046 pangocairo-uninstalled.pc
1047 pango-zip.sh
1048 config.h.win32
1049 ])
1050
1051 AC_CONFIG_FILES([tests/runtests.sh],
1052                 [chmod +x tests/runtests.sh])
1053
1054 AC_OUTPUT
1055
1056 backends=""
1057 if $have_cairo ; then backends="$backends Cairo"; fi
1058 if $have_win32 ; then backends="$backends Win32"; fi
1059 if $have_xft ; then backends="$backends Xft"; fi
1060 if $have_freetype && $have_fontconfig ; then backends="$backends FreeType"; fi
1061 if $have_x ; then backends="$backends X"; fi
1062    
1063 echo "configuration:
1064         backends:$backends"