dnl Process this file with autoconf to create configure.

AC_INIT(ChangeLog)

dnl ==========================================================================
dnl                               Versioning              
dnl ==========================================================================

dnl Making releases:
dnl   PANGO_MICRO_VERSION += 1;
dnl   PANGO_INTERFACE_AGE += 1;
dnl   PANGO_BINARY_AGE += 1;
dnl if any functions have been added, set PANGO_INTERFACE_AGE to 0.
dnl if backwards compatibility has been broken,
dnl set PANGO_BINARY_AGE _and_ PANGO_INTERFACE_AGE to 0.

dnl The triplet 
PANGO_MAJOR_VERSION=1
PANGO_MINOR_VERSION=0
PANGO_MICRO_VERSION=4
PANGO_VERSION=$PANGO_MAJOR_VERSION.$PANGO_MINOR_VERSION.$PANGO_MICRO_VERSION

dnl The X.Y in -lpango-X.Y line. This is expected to stay 1.0 until Pango 2.
PANGO_API_VERSION=1.0

dnl Number of releases since we've added interfaces
PANGO_INTERFACE_AGE=4

dnl Number of releases since we've broken binary compatibility. Should equal
dnl PANGO_MICRO_VERSION for a stable release
# PANGO_BINARY_AGE=0
PANGO_BINARY_AGE=$PANGO_MICRO_VERSION

dnl This is the last version with which we have compatibility with
dnl with the modules for; it isn't the same as
dnl PANGO_API_VERSION.'PANGO_MICRO_VERSION - PANGO_BINARY_AGE' since we have
dnl engine only API    
PANGO_MODULE_VERSION=1.0.0

AC_SUBST(PANGO_MAJOR_VERSION)
AC_SUBST(PANGO_MINOR_VERSION)
AC_SUBST(PANGO_VERSION)
AC_SUBST(PANGO_API_VERSION)
AC_SUBST(PANGO_MICRO_VERSION)
AC_SUBST(PANGO_INTERFACE_AGE)
AC_SUBST(PANGO_BINARY_AGE)
AC_SUBST(PANGO_MODULE_VERSION)

dnl libtool versioning
lt_current=`expr $PANGO_MICRO_VERSION - $PANGO_INTERFACE_AGE`
lt_revision=$PANGO_INTERFACE_AGE
lt_age=`expr $PANGO_BINARY_AGE - $PANGO_INTERFACE_AGE`
LT_VERSION_INFO="$lt_current:$lt_revision:$lt_age"
LT_CURRENT_MINUS_AGE=`expr $lt_current - $lt_age`

AC_SUBST(LT_VERSION_INFO)
AC_SUBST(LT_CURRENT_MINUS_AGE)

dnl ==========================================================================

AM_INIT_AUTOMAKE(pango, $PANGO_VERSION)

AM_CONFIG_HEADER(config.h)

AC_PROG_CC
	
dnl 
dnl Check for a working C++ compiler, but do not bail out, if none is found.
dnl We use this for an automated test for C++ header correctness.
dnl 
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
AM_CONDITIONAL(HAVE_CXX, test "$CXX" != "")
AC_LANG_RESTORE

AC_LIBTOOL_WIN32_DLL
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AM_PROG_LEX
AC_PROG_YACC

AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    pango_platform_win32=yes
    ;;
  *)
    pango_platform_win32=no
    ;;
esac
AC_MSG_RESULT([$pango_platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$pango_platform_win32" = "yes")

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    pango_os_win32=yes
    ;;
  *)
    pango_os_win32=no
    ;;
esac
AC_MSG_RESULT([$pango_os_win32])
AM_CONDITIONAL(OS_WIN32, test "$pango_os_win32" = "yes")

if test "$pango_os_win32" = "yes"; then
  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)

# define a MAINT-like variable REBUILD which is set if Perl
# is found, so autogenerated sources can be rebuilt

AC_CHECK_PROGS(PERL, perl5 perl)

REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
     test -n "$PERL" && \
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
  REBUILD=
fi
AC_SUBST(REBUILD)

AC_PATH_XTRA

if test x$no_x = xyes ; then
  AC_MSG_WARN([X development libraries not found])
  have_x=false
else
  X_LIBS="$X_LIBS -lX11"
  have_x=true
fi
AM_CONDITIONAL(HAVE_X, $have_x) 

#
# Checks for FreeType
#
FREETYPE_LIBS=
FREETYPE_CFLAGS=
have_freetype=false
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "x$FREETYPE_CONFIG" != "xno" ; then
  FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
  FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`

  AC_CHECK_LIB(freetype, FT_New_Face, have_freetype=true
	       ,:,$FREETYPE_LIBS)

  if $have_freetype ; then
    pango_save_cppflags="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"

    AC_MSG_CHECKING([For sufficiently new FreeType (at least 2.0.1)])
    AC_TRY_COMPILE([
#include <freetype/freetype.h>
#include FT_ERRORS_H
]
                ,[(void)1;],:,have_freetype=false)
    if $have_freetype ; then
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi

    CPPFLAGS="$pango_save_cppflags"
  fi
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) 

## see which freetype we have, 2.0.3 vs. 2.0.4
pango_save_cppflags="$CPPFLAGS"  
CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
AC_CHECK_HEADER(freetype/internal/tterrors.h, AC_DEFINE(HAVE_FREETYPE_2_0_3))
CPPFLAGS="$pango_save_cppflags"

## Check to see whether we have FT_Get_First_Char(), new in 2.0.9
pango_save_libs=$LIBS
LIBS="$LIBS $FREETYPE_LIBS"
AC_CHECK_FUNCS(FT_Get_First_Char)
LIBS=$pango_save_libs

#
# Checks for Xft/XRender
#
have_xft=false
XFT_LIBS=""
XFT_CFLAGS=""
if test $have_x = true ; then
  if test $have_freetype = true ; then
    pango_save_cppflags="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS $X_CFLAGS"

    AC_CHECK_LIB(Xrender, XRenderFindFormat, 
      [AC_CHECK_LIB(Xft, XftFontOpen,
	[AC_CHECK_HEADER(X11/Xft/XftFreetype.h,
	  have_xft=true,:)],
	:,-lXrender -lXext $X_LIBS $FREETYPE_LIBS)]
    ,:,-lXext $X_LIBS)

    CPPFLAGS="$pango_save_cppflags"
    
    if $have_xft ; then
      XFT_LIBS="-lXft -lXrender -lXext $X_LIBS $FREETYPE_LIBS $X_EXTRA_LIBS"
    fi
  fi
fi

AC_SUBST(XFT_LIBS)
AM_CONDITIONAL(HAVE_XFT, $have_xft) 

#
# Checks for Win32 GDI
#
have_win32=false
WIN32_LIBS=""
WIN32_CFLAGS=""
# The following doesn't work with autoconf-2.13, so we check $host instead
# AC_CHECK_LIB(gdi32, GetTextMetricsA@8, have_win32=true, : )
case "$host" in
  *-*-mingw*|*-*-cygwin*) have_win32=true ;;
esac


if test $have_win32 = true; then
  WIN32_LIBS="-lgdi32"
fi

AC_SUBST(WIN32_LIBS)
AM_CONDITIONAL(HAVE_WIN32, $have_win32) 

#
# We must have some backend defined, in order for the pango-querymodules
# rule in pango/Makefile.am to work correctly. If you are up to writing
# a new Pango backend outside of Pango, you are up to sending the necessary
# patch to fix that rule. :-)
#
if $HAVE_FREETYPE || $HAVE_X || $HAVE_XFT || $HAVE_WIN32  ; then : ; else
  AC_MSG_ERROR([*** Didn't find any of FreeType, X11, or Win32.
*** Must have at least one backend to build Pango.])
fi

#
# Checks for GLib
#
GLIB_REQUIRED_VERSION=2.0.0

AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
  AC_MSG_ERROR([
*** Glib $GLIB_REQUIRED_VERSION or better is required. The latest version of 
*** Glib is always available from ftp://ftp.gtk.org/.]),
  gobject gmodule)

GLIB_CFLAGS=`$PKG_CONFIG --cflags gthread-2.0`

CFLAGS="$CFLAGS $GLIB_CFLAGS"

AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)

#
# Checks for fribidi
#
#AC_ARG_WITH(fribidi, [ --with-fribidi     Use external fribidi library ],,with_fribidi=no)
#
FRIBIDI_LIBS=""
FRIBIDI_CFLAGS=""
FRIBIDI_PC=""
have_fribidi=no
#
#if test "x$with_fribidi" = "xyes" ; then
#   AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no)
#   if test x$FRIBIDI_CONFIG = xno ; then
#     AC_MSG_ERROR([*** fribidi-config not found])
#   fi
#
#   if $FRIBIDI_CONFIG --cflags | grep lib/glib/include > /dev/null ; then
#     AC_MSG_ERROR([*** fribidi appears to be compiled against GLib-1.2.x.
#     *** You must compile fribidi with GLib-1.3.1 or better.])
#   fi
# 
#   FRIBIDI_CFLAGS="`$FRIBIDI_CONFIG --cflags`"
#   CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
#   FRIBIDI_LIBS="`$FRIBIDI_CONFIG --libs`"
#   FRIBIDI_PC="fribidi,"	
#
#   AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :,
#	        AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)
#
#   AC_DEFINE(HAVE_FRIBIDI)
#   have_fribidi=yes
#fi

AC_SUBST(FRIBIDI_LIBS)
AC_SUBST(FRIBIDI_CFLAGS)
AC_SUBST(FRIBIDI_PC)
AM_CONDITIONAL(HAVE_FRIBIDI, test x$have_fribidi = xyes)

#
# Allow setting a default path for XftConfig
#
AC_ARG_WITH(xftconfig-dir, [  --with-xftconfig-dir=PATH   path to system XftConfig file for minixft ])

if test "x$with_xftconfig_dir" != "x"; then
   AC_DEFINE_UNQUOTED(MINI_XFTCONFIG_DIR, "$with_xftconfig_dir")
fi

#
# The OpenType test programs aren't particularly portable
#
have_varargs=no
AC_MSG_CHECKING(Whether to build OpenType test programs)
pango_save_cppflags="$CPPFLAGS"
AC_TRY_COMPILE([#include <glib.h>],[
#if !(defined(G_HAVE_ISO_VARARGS) || defined(G_HAVE_GNUC_VARARGS))
#error "No varargs macro definitions"
#endif
],have_varargs=yes)
AC_MSG_RESULT($have_varargs)
AM_CONDITIONAL(BUILD_OT_TESTS, test $have_varargs = yes)

#
# Allow building some or all modules included
#
AC_MSG_CHECKING(modules to link statically)

AC_ARG_WITH(included_modules, [  --with-included-modules=MODULE1,MODULE2,...   build the given modules into Pango])

arabic_modules="arabic-ft2,arabic-x,arabic-xft"
basic_modules="basic-ft2,basic-win32,basic-x,basic-xft"
hangul_modules="hangul-x"
hebrew_modules="hebrew-ft2,hebrew-x,hebrew-xft"
indic_modules="bengali-x,devanagari-x,gurmukhi-x,gujarati-x,myanmar-x"
tamil_modules="tamil-x,tamil-xft"
thai_modules="thai-x"

all_modules="$arabic_modules,$basic_modules,$hangul_modules,$hebrew_modules,$indic_modules,$tamil_modules,$thai_modules"

included_modules=""
if test "x$with_included_modules" != xno || test "x$with_included_modules" = x ; then

   # If no modules specified, include all modules
   if test "x$with_included_modules" = xyes ; then
     included_modules="$all_modules"
   else
     included_modules="$with_included_modules"
   fi
fi

AC_MSG_RESULT($included_modules)
AM_CONDITIONAL(HAVE_INCLUDED_MODULES, test "x$included_modules" != x)

INCLUDED_X_MODULES=
INCLUDED_XFT_MODULES=
INCLUDED_FT2_MODULES=
INCLUDED_WIN32_MODULES=
IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $indic_modules | egrep "(^| )$module(\$| )" > /dev/null; then
    dir=indic
  else
    dir=`echo $module | sed "s/-.*//"`
  fi

  if echo $module | egrep -- "-xft($|,)" > /dev/null; then
    INCLUDED_XFT_MODULES="$INCLUDED_XFT_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
  elif echo $module | egrep -- "-ft2($|,)" > /dev/null; then
    INCLUDED_FT2_MODULES="$INCLUDED_FT2_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
  elif echo $module | egrep -- "-x($|,)" > /dev/null; then
    INCLUDED_X_MODULES="$INCLUDED_X_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
  elif echo $module | egrep -- "-win32($|,)" > /dev/null; then
    INCLUDED_WIN32_MODULES="$INCLUDED_WIN32_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
  else
    AC_MSG_ERROR([the specified module $module does not exist])
  fi
done
IFS="$pango_save_ifs"

AC_SUBST(INCLUDED_X_MODULES)
AC_SUBST(INCLUDED_XFT_MODULES)
AC_SUBST(INCLUDED_FT2_MODULES)
AC_SUBST(INCLUDED_WIN32_MODULES)

AM_CONDITIONAL(INCLUDE_ARABIC_FT2,echo $included_modules | egrep '(^|,)arabic-ft2($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_ARABIC_X,echo $included_modules | egrep '(^|,)arabic-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_ARABIC_XFT,echo $included_modules | egrep '(^|,)arabic-xft($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_BASIC_FT2,echo $included_modules | egrep '(^|,)basic-ft2($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_WIN32,echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_XFT,echo $included_modules | egrep '(^|,)basic-xft($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_X,echo $included_modules | egrep '(^|,)basic-x($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_HANGUL_X,echo $included_modules | egrep '(^|,)hangul-x($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_HEBREW_FT2,echo $included_modules | egrep '(^|,)hebrew-ft2($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_HEBREW_X,echo $included_modules | egrep '(^|,)hebrew-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_HEBREW_XFT,echo $included_modules | egrep '(^|,)hebrew-xft($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_BENGALI_X,echo $included_modules | egrep '(^|,)bengali-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_DEVANAGARI_X,echo $included_modules | egrep '(^|,)devanagari-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_GUJARATI_X,echo $included_modules | egrep '(^|,)gujarati-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_GURMUKHI_X,echo $included_modules | egrep '(^|,)gurmukhi-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_MYANMAR_X,echo $included_modules | egrep '(^|,)myanmar-x($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_TAMIL_X,echo $included_modules | egrep '(^|,)tamil-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_TAMIL_XFT,echo $included_modules | egrep '(^|,)tamil-xft($|,)' > /dev/null)

AM_CONDITIONAL(INCLUDE_THAI_X,echo $included_modules | egrep '(^|,)thai-x($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_THAI_XFT,echo $included_modules | egrep '(^|,)thai-xft($|,)' > /dev/null)


#
# We use flockfile to implement pango_getline() - should be moved to GLib
# strtok_r isn't present on some systems
#
AC_CHECK_FUNCS(flockfile strtok_r)

#
# Check for Qt - which we use for building the viewer example, if
# present
#

AC_ARG_WITH(qt, [  --with-qt=DIR           location where Qt is installed],,with_qt=yes)

if test "$CXX" != "" ; then
  AC_MSG_CHECKING(For Qt location)
  
  if test "x$with_qt" = xyes ; then
  # Search for Qt in a common location. The ls -r is an attempt to find the newest 
     if test "x$QTDIR" != x ; then
       if test -x $QTDIR/bin/moc ; then : ; else
	 QTDIR=
       fi
     else
       dirs=`cd /usr/lib && ls -d -r qt*`
       for dir in $dirs ; do
          case $dir in
            qt2*|qt-2*|qt3*|qt-3*)
              if test -x /usr/lib/$dir/bin/moc ; then
                QTDIR=/usr/lib/$dir
               break
	     fi
	    ;;
	  esac      
       done
     fi
  else
     if test "x$with_qt" != xno ; then
	if test -x $with_qt/bin/moc ; then
	   QTDIR=$with_qt
	fi
     else
        QTDIR=""
     fi
  fi

  if test "x$QTDIR" = x ; then
    AC_MSG_RESULT(none)
  else
    AC_MSG_RESULT($QTDIR)
  fi
else
  QTDIR=""
fi

if test x"$QTDIR" != "x" ; then
  AC_MSG_CHECKING(For working Qt)

  pango_save_libs="$LIBS"
  pango_save_cppflags="$CPPFLAGS"
  LIBS="-L$QTDIR/lib -lqt $LIBS"
  CPPFLAGS="-I $QTDIR/include"
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_TRY_LINK([#include <qapplication.h>],
              [QApplication a ();], 
               [AC_MSG_RESULT(yes)],
               [QTDIR=""; AC_MSG_RESULT(no)])
  AC_LANG_RESTORE
  LIBS="$pango_save_libs"
  CPPFLAGS="$pango_save_cppflags"
fi

AM_CONDITIONAL(BUILD_QT_TEST, test "x$QTDIR" != x)
AC_SUBST(QTDIR)
  
dnl **************************
dnl *** Checks for gtk-doc ***
dnl **************************

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH    path to installed docs ])

if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gtk-doc/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)


AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)

gtk_doc_min_version=0.6
if $GTKDOC ; then 
    gtk_doc_version=`gtkdoc-mkdb --version`
    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
    if perl <<EOF ; then
      exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
            ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
EOF
      AC_MSG_RESULT(yes)
   else
      AC_MSG_RESULT(no)
      GTKDOC=false
   fi
fi

AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
AC_SUBST(HAVE_GTK_DOC)

AC_CHECK_PROG(DB2HTML, db2html, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)

dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc        use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=no)

if test x$enable_gtk_doc = xyes ; then
  if test x$GTKDOC = xtrue ; then
    enable_gtk_doc=yes
  else
    enable_gtk_doc=no 
  fi
fi

dnl NOTE: We need to use a separate automake conditional for this
dnl       to make this work with the tarballs.
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)

dnl ********************************************************
dnl * See whether we need to load our modules as .la files *
dnl ********************************************************

use_la_modules=false
case $host in
  *-aix*) use_la_modules=true
esac

if $use_la_modules ; then
   AC_DEFINE(USE_LA_MODULES, 1, [Whether to load modules via .la files rather than directly])
fi

dnl ******************************************************
dnl * See whether to include shared library dependencies *
dnl ******************************************************

AC_ARG_ENABLE(explicit-deps, 
              [  --enable-explicit-deps=[yes/no/auto]    use explicit dependencies in .pc files [default=auto]],
              enable_explicit_deps="$enableval", 
              enable_explicit_deps=auto)

AC_MSG_CHECKING([Whether to write dependencies into .pc files])
case $enable_explicit_deps in
  auto)
    deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh`
    if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then
      enable_explicit_deps=yes  
    else
      enable_explicit_deps=no  
    fi
  ;;
  yes|no) 
  ;;
  *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
  ;;
esac
AC_MSG_RESULT($enable_explicit_deps)

if test $enable_explicit_deps = yes ; then
  PKGCONFIG_X_LIBS="$X_LIBS $X_EXTRA_LIBS"
  PKGCONFIG_XFT_LIBS=$XFT_LIBS
  PKGCONFIG_FREETYPE_LIBS=$XFT_LIBS
else
  PKGCONFIG_X_LIBS=
  PKGCONFIG_XFT_LIBS=
  PKGCONFIG_FREETYPE_LIBS=
fi
AC_SUBST(PKGCONFIG_X_LIBS)
AC_SUBST(PKGCONFIG_XFT_LIBS)
AC_SUBST(PKGCONFIG_FREETYPE_LIBS)
AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)

AC_OUTPUT_COMMANDS([
cat > pango/module-defs.h <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "modules.h"

EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  module_c=`echo $module | sed s/-/_/`
  cat >> pango/module-defs.h <<EOTEXT
extern void         _pango_${module_c}_script_engine_list (PangoEngineInfo **engines, int *n_engines);
extern PangoEngine *_pango_${module_c}_script_engine_load (const char *id);
extern void         _pango_${module_c}_script_engine_unload (PangoEngine *engine);

EOTEXT
done 

IFS="$pango_save_ifs"

### X modules
cat > pango/module-defs-x.c <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "module-defs.h"

PangoIncludedModule _pango_included_x_modules[] = {
EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $module | egrep -- "-x($|,)" > /dev/null; then  
    module_c=`echo $module | sed s/-/_/`
    cat >> pango/module-defs-x.c <<EOTEXT
 { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
EOTEXT
 fi
done

IFS="$pango_save_ifs"

cat >> pango/module-defs-x.c <<EOTEXT
 { NULL, NULL, NULL },
};
EOTEXT


### XFT modules
cat > pango/module-defs-xft.c <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "module-defs.h"

PangoIncludedModule _pango_included_xft_modules[] = {
EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $module | egrep -- "-xft($|,)" > /dev/null; then
    module_c=`echo $module | sed s/-/_/`
    cat >> pango/module-defs-xft.c <<EOTEXT
 { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
EOTEXT
  fi
done

IFS="$pango_save_ifs"

cat >> pango/module-defs-xft.c <<EOTEXT
 { NULL, NULL, NULL },
};
EOTEXT


### FT2 modules
cat > pango/module-defs-ft2.c <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "module-defs.h"

PangoIncludedModule _pango_included_ft2_modules[] = {
EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $module | egrep -- "-ft2($|,)" > /dev/null; then
    module_c=`echo $module | sed s/-/_/`
    cat >> pango/module-defs-ft2.c <<EOTEXT
 { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
EOTEXT
  fi
done

IFS="$pango_save_ifs"

cat >> pango/module-defs-ft2.c <<EOTEXT
 { NULL, NULL, NULL },
};
EOTEXT

### Win32 modules
cat > pango/module-defs-win32.c <<EOTEXT
/* Autogenerated by configure. Do not edit */

#include "module-defs.h"

PangoIncludedModule _pango_included_win32_modules[] = {
EOTEXT

IFS="${IFS= 	}"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
  if echo $module | egrep -- "-win32($|,)" > /dev/null; then
    module_c=`echo $module | sed s/-/_/`
    cat >> pango/module-defs-win32.c <<EOTEXT
 { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
EOTEXT
  fi
done

IFS="$pango_save_ifs"

cat >> pango/module-defs-win32.c <<EOTEXT
 { NULL, NULL, NULL },
};
EOTEXT

],[
included_modules=$included_modules
])

AC_HEADER_DIRENT
AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))

# Honor aclocal flags
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

AC_OUTPUT([
Makefile 
pango/Makefile
pango/mini-fribidi/Makefile
pango/mini-xft/Makefile
pango/opentype/Makefile
pango/makefile.mingw
pango/pango.rc
pango/pangoft2.rc
pango/pangowin32.rc
pango/opentype/makefile.mingw
modules/Makefile
modules/arabic/Makefile
modules/basic/Makefile
modules/basic/makefile.mingw
modules/hangul/Makefile
modules/indic/Makefile
modules/tamil/Makefile
modules/thai/Makefile
modules/hebrew/Makefile
examples/Makefile
examples/makefile.mingw
docs/Makefile
tools/Makefile
tests/Makefile
pango.spec
pango.pc
pangox.pc
pangowin32.pc
pangoft2.pc
pangoxft.pc
pango-uninstalled.pc
pangox-uninstalled.pc
pangowin32-uninstalled.pc
pangoft2-uninstalled.pc
pangoxft-uninstalled.pc
pango-zip.sh
],[case "$CONFIG_FILES" in
*pango-config*)chmod +x pango-config;;
esac])
