configure.ac 9.58 KB
Newer Older
Paolo Borelli's avatar
Paolo Borelli committed
1 2 3 4
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)

Paolo Borelli's avatar
Paolo Borelli committed
5
AC_INIT(gedit, 2.13.3, http://bugzilla.gnome.org/enter_bug.cgi?product=gedit)
Paolo Borelli's avatar
Paolo Borelli committed
6 7 8
AC_CONFIG_SRCDIR(gedit/gedit.c)
AC_CONFIG_MACRO_DIR([m4])

Paolo Borelli's avatar
Paolo Borelli committed
9
GEDIT_MAJOR=2.14
Paolo Borelli's avatar
Paolo Borelli committed
10 11 12 13
AC_SUBST(GEDIT_MAJOR)

AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

14 15
GNOME_DOC_INIT

Paolo Borelli's avatar
Paolo Borelli committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
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 -I m4")


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, [
	glib-2.0 >= 2.8.0
	gtk+-2.0 >= 2.8.0
	gtksourceview-1.0 >= 1.2.0
	libgnomeui-2.0 >= 2.6.0
	libglade-2.0 >= 2.4.0
	libgnomeprintui-2.2 >= 2.6.0
87
	gnome-vfs-2.0 >= 2.13.4
Paolo Borelli's avatar
Paolo Borelli committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
])
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 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 Python
dnl ================================================================

AC_MSG_CHECKING([whether Python support is requested])
AC_ARG_ENABLE([python],
	AS_HELP_STRING([--enable-python],[Enable python support]),
	[enable_python=$enableval have_python=$enableval],
	[enable_python=autodetect have_python=yes])
AC_MSG_RESULT([$enable_python])

if test "x$have_python" != "xno"; then
	AM_PATH_PYTHON([2.3],[],[no])
	if test "x$PYTHON" = "x:"; then
		have_python=no
	fi
fi

if test "x$have_python" != "xno"; then
	AM_CHECK_PYTHON_HEADERS([],[have_python=no])
fi

if test "x$have_python" != "xno"; then
	PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
	PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
	PYTHON_LIBS="-lpython$PYTHON_VERSION"
	PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
	PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
	PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
	PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
	PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
	AC_SUBST([PYTHON_LIBS])
	AC_SUBST([PYTHON_LIB_LOC])
	AC_SUBST([PYTHON_CFLAGS])
	AC_SUBST([PYTHON_EXTRA_LIBS])

	dnl FIXME: do we really need this test?
	AC_MSG_CHECKING([whether we can build a shared library depending on libpython])
	rm -rf testpython
	mkdir testpython
	cd testpython
	cat > testpython.c <<EOF
#include <Python.h>
int testpython (void)
{
Py_Exit (0);
}
EOF

	if /bin/sh ../libtool --mode=compile ${CC} $PYTHON_CFLAGS -c testpython.c >/dev/null 2>&1 && \
		/bin/sh ../libtool --mode=link ${CC} -o testpython.la -rpath `pwd` -module -avoid-version $PYTHON_LIB_LOC testpython.lo $PYTHON_LIBS $PYTHON_EXTRA_LIBS >/dev/null 2>&1 && \
		grep 'dlname.*testpython' testpython.la >/dev/null 2>&1; then
		result=yes
	else
		result=no
		have_python=no
	fi
	cd ..
	rm -rf testpython
	AC_MSG_RESULT([$result])
fi

if test "x$have_python" != "xno"; then
190 191
	PYGTK_REQUIRED=2.8.0
	GNOME_PYTHON_DESKTOP_REQUIRED=2.13.3
Paolo Borelli's avatar
Paolo Borelli committed
192 193 194

	PKG_CHECK_MODULES([PYGTK], [
		pygtk-2.0 >= $PYGTK_REQUIRED
195
		gnome-python-desktop-2.0 >= $GNOME_PYTHON_DESKTOP_REQUIRED],
Paolo Borelli's avatar
Paolo Borelli committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
		[],[have_python=no])

	AC_SUBST([PYGTK_CFLAGS])
	AC_SUBST([PYGTK_LIBS])
fi

if test "x$have_python" != "xno"; then
	AC_MSG_CHECKING([for pygtk defs])
	PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
	AC_MSG_RESULT([$PYGTK_DEFSDIR])

	AC_MSG_CHECKING([for pygtk codegen])
	PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
	AC_MSG_RESULT([$PYGTK_CODEGEN])

	AC_MSG_CHECKING([for pygtk h2def])
	PYGTK_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/h2def.py"
	AC_MSG_RESULT([$PYGTK_H2DEF])
214

Paolo Borelli's avatar
Paolo Borelli committed
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
	AC_SUBST([PYGTK_DEFSDIR])
	AC_SUBST([PYGTK_CODEGEN])
	AC_SUBST([PYGTK_H2DEF])

	dnl Check for -fno-strict-aliasing
	FLAGS="-fno-strict-aliasing"
	save_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS $FLAGS"
	AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
	AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no])
	CFLAGS="$save_CFLAGS"
	AC_MSG_RESULT($compiler_has_option)
	if test $compiler_has_option = yes; then
		NO_STRICT_ALIASING_CFLAGS="$FLAGS"
	fi
	AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
fi

if test "x$have_python" != "xyes"; then
	if test "x$enable_python" = "xyes"; then
		AC_MSG_ERROR([Python not found])
	elif test "x$enable_python" = "xautodetect"; then
		enable_python=no
		AC_MSG_WARN([Python not found, disabling python support])
	fi
elif test "x$enable_python" != "xno"; then
	enable_python=yes
	AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
fi

AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])

dnl ================================================================
dnl Misc
dnl ================================================================
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
bindings/Makefile
bindings/python/Makefile
data/gedit.desktop.in
data/gedit.pc
data/Makefile
gedit/dialogs/Makefile
gedit/Makefile
gedit/recent-files/Makefile
293
help/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
294 295 296 297 298 299 300
help/eu/Makefile
help/ko/Makefile
help/ro/Makefile
help/sv/Makefile
pixmaps/Makefile
plugins/changecase/Makefile
plugins/docinfo/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
301 302
plugins/externaltools/Makefile
plugins/externaltools/tools/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
303 304
plugins/indent/Makefile
plugins/Makefile
305
plugins/modelines/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
306 307
plugins/pythonconsole/Makefile
plugins/sample/Makefile
Paolo Maggi's avatar
Paolo Maggi committed
308 309 310
plugins/snippets/Makefile
plugins/snippets/snippets/Makefile
plugins/snippets/data/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
plugins/sort/Makefile
plugins/spell/Makefile
plugins/taglist/Makefile
plugins/time/Makefile
po/Makefile.in])


echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
	Python Plugins Support: $enable_python

"

dnl uncomment this in developement releases
dnl cat $srcdir/message-of-doom