dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.52)

AC_INIT(gedit, 2.8.3, http://bugzilla.gnome.org/enter_bug.cgi?product=gedit)
AC_CONFIG_SRCDIR(gedit/gedit2.c)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

GEDIT_MAJOR=2.8
AC_SUBST(GEDIT_MAJOR)

AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
AM_DISABLE_STATIC

AC_PATH_PROG(GCONFTOOL, gconftool-2)
AC_PROG_INTLTOOL([0.31])

AM_PROG_LIBTOOL

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")

dnl ================================================================
dnl Gettext stuff.
dnl ================================================================
GETTEXT_PACKAGE=gedit
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
ALL_LINGUAS="af am ar az be bg bn bs ca cs cy da de el en_CA en_GB es et eu fa fi fr ga gl gu he hi hr hu id is it ja kn ko lt lv mi mk ml mn mr ms nb ne nl nn no or pa pl pt pt_BR ro ru sk sl sq sr sr@Latn sv ta th tk tr uk vi wa zh_CN zh_TW"
AM_GLIB_GNU_GETTEXT

dnl ******************
dnl pspell checks
dnl ******************

AC_MSG_CHECKING([for aspell/pspell])
if pspell-config version > /dev/null 2>&1; then
	pspell_ver=`pspell-config version`
	pspell_num=`echo ${pspell_ver} | awk 'BEGIN {FS="."}{printf $1*10000 + $2*100 + $3;}'`
	if test ${pspell_num} -lt 1200; then
		AC_MSG_RESULT([pspell version .12 or later required, you have ${pspell_ver} installed])
	else
		AC_MSG_RESULT([found ($pspell_ver)])

		AC_CHECK_HEADER(pspell/pspell.h,
			[AC_CHECK_LIB(aspell, new_aspell_speller, 
				[PSPELL_LIBS="-laspell" SPELL_PLUGIN_DIR="spell" AC_SUBST(SPELL_PLUGIN_DIR)],
   				[AC_CHECK_LIB(pspell, new_pspell_manager, 
					[PSPELL_LIBS="-lpspell" SPELL_PLUGIN_DIR="spell" AC_SUBST(SPELL_PLUGIN_DIR)],
					[AC_MSG_WARN([You must have the aspell or pspell dev packages to build the spell plugin.])] 
				)]
			)],
			[AC_MSG_WARN([You must have the aspell or pspell dev packages to build the spell plugin.])] 
		)
	fi
else
	AC_MSG_RESULT([not found])
fi

AC_SUBST(PSPELL_LIBS)

dnl
dnl Start of pkg-config checks
dnl
PKG_CHECK_MODULES(GEDIT, libgnomeui-2.0 >= 2.8.0 libglade-2.0 >= 2.3.6
                         eel-2.0 >= 2.6.0 gtksourceview-1.0 >= 1.1.1
			 libgnomeprintui-2.2 >= 2.6.0)
GEDIT_LIBS="${GEDIT_LIBS}"
AC_SUBST(GEDIT_LIBS)
AC_SUBST(GEDIT_CFLAGS)

dnl
dnl GConf related settings
dnl

AM_GCONF_SOURCE_2

dnl
dnl Check popt
dnl

AC_CHECK_LIB(popt, poptStrippedArgv,, AC_MSG_ERROR([popt 1.5 or newer is required to build
gedit. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))

dnl
dnl Check ngettext
dnl

AC_CHECK_FUNCS(ngettext,, AC_MSG_ERROR([ngettext function is required to build gedit.]))

dnl ================================================================
dnl GEDIT_DATA_DIR - Sets the location of the data directory, where we install
dnl source files added to projects (such as all the Gnome m4 macros).
dnl This will substitute GEDIT_DATA_DIR in config.h.
dnl ================================================================
if test "x${datadir}" = 'x${prefix}/share'; then
  if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(GEDIT_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [Directory of data files])
  else
    AC_DEFINE_UNQUOTED(GEDIT_DATA_DIR, "${prefix}/share/${PACKAGE}", [Directory of data files])
  fi
else
  AC_DEFINE_UNQUOTED(GEDIT_DATA_DIR, "${datadir}/${PACKAGE}", [Directory of data files])
fi

dnl ================================================================
dnl PIXMAPS 
dnl ================================================================
if test "x${prefix}" = "xNONE"; then
  AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [Directory of pixmaps])
  pixmapsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
else
  AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [Directory of pixmaps])
  pixmapsdir="${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
fi

AC_SUBST(pixmapsdir)

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
			      
GNOME_COMPILE_WARNINGS(yes)

AC_ARG_ENABLE(deprecations,
              [AC_HELP_STRING([--enable-deprecations],
                              [warn about deprecated usages [default=no]])],,
              [enable_deprecations=no])

if test "x$enable_deprecations" = "xyes"; then
   DISABLE_DEPRECATED_CFLAGS="\
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED"
   AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
fi

dnl stuff for the CORBA interface

ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
AC_SUBST(ORBIT_IDL)

LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
AC_SUBST(LIBBONOBO_IDL)

BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
AC_SUBST(BONOBO_ACTIVATION_IDL)

PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)

AC_OUTPUT([
Makefile
data/gedit.pc
data/Makefile
po/Makefile.in
gedit/Makefile
gedit/dialogs/Makefile
gedit/recent-files/Makefile
pixmaps/Makefile
plugins/Makefile
plugins/changecase/Makefile
plugins/spell/Makefile
plugins/docinfo/Makefile
plugins/sample/Makefile
plugins/time/Makefile
plugins/indent/Makefile
plugins/taglist/Makefile
plugins/shell_output/Makefile
plugins/sort/Makefile
viewer/Makefile
help/Makefile
help/C/Makefile
help/de/Makefile
help/es/Makefile
help/eu/Makefile
help/fr/Makefile
help/it/Makefile
help/sv/Makefile
help/ja/Makefile
help/ko/Makefile
help/zh_CN/Makefile
help/zh_HK/Makefile
help/zh_TW/Makefile
help/ro/Makefile
])


echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC} 

"

dnl cat $srcdir/message-of-doom
