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