configure.ac 11.7 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)

5
m4_define(gedit_major_version,  2)
Paolo Borelli's avatar
Paolo Borelli committed
6
m4_define(gedit_minor_version, 20)
Paolo Borelli's avatar
Paolo Borelli committed
7
m4_define(gedit_micro_version,  3)
8 9 10
m4_define(gedit_version, gedit_major_version.gedit_minor_version.gedit_micro_version)

AC_INIT(gedit, gedit_version, http://bugzilla.gnome.org/enter_bug.cgi?product=gedit)
Paolo Borelli's avatar
Paolo Borelli committed
11 12 13
AC_CONFIG_SRCDIR(gedit/gedit.c)
AC_CONFIG_MACRO_DIR([m4])

14 15 16 17 18 19 20
AC_DEFINE(GEDIT_MAJOR_VERSION, gedit_major_version, [Gedit major version])
AC_SUBST(GEDIT_MAJOR_VERSION, gedit_major_version)
AC_DEFINE(GEDIT_MINOR_VERSION, gedit_minor_version, [Gedit minor version])
AC_SUBST(GEDIT_MINOR_VERSION, gedit_minor_version)
AC_DEFINE(GEDIT_MICRO_VERSION, gedit_micro_version, [Gedit micro version])
AC_SUBST(GEDIT_MICRO_VERSION, gedit_micro_version)

Paolo Borelli's avatar
Paolo Borelli committed
21
GEDIT_API_VERSION=2.20
22
AC_SUBST(GEDIT_API_VERSION)
Paolo Borelli's avatar
Paolo Borelli committed
23

24
AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip])
Paolo Borelli's avatar
Paolo Borelli committed
25 26

AM_MAINTAINER_MODE
27 28
AC_CONFIG_HEADERS(config.h)
AC_DISABLE_STATIC
Paolo Borelli's avatar
Paolo Borelli committed
29 30

AC_PATH_PROG(GCONFTOOL, gconftool-2)
31
IT_PROG_INTLTOOL([0.35.0])
Paolo Borelli's avatar
Paolo Borelli committed
32

33
AC_PROG_LIBTOOL
Paolo Borelli's avatar
Paolo Borelli committed
34

35 36 37
GNOME_DOC_INIT
GTK_DOC_CHECK([1.0])

Paolo Borelli's avatar
Paolo Borelli committed
38 39 40 41
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
42
AC_PATH_PROG(GZIP, gzip)
Paolo Borelli's avatar
Paolo Borelli committed
43 44 45 46

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

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
dnl ===============================================================
dnl Expanded dirs
dnl ===============================================================

# This macro expands DIR and assigns it to RET.
# If DIR is NONE, then it's replaced by DEFAULT.
# Based on AC_DEFINE_DIR
AC_DEFUN([GEDIT_FULLPATH], [
  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  ac_expand=[$]$1
  test "x$ac_expand" = xNONE && ac_expand="[$]$2"
  ac_expand=`eval echo [$]ac_expand`
  $3=`eval echo [$]ac_expand`
])

dnl FULL_LIBDIR is used for X-GNOME-Bugzilla-ExtraInfoScript expansion
dnl in data/gedit.desktop.in.in
GEDIT_FULLPATH(libdir, NONE, FULL_LIBDIR)
AC_SUBST(FULL_LIBDIR)
Paolo Borelli's avatar
Paolo Borelli committed
67 68 69 70 71 72 73 74

dnl ================================================================
dnl Gettext stuff.
dnl ================================================================

GETTEXT_PACKAGE=gedit
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
75

Paolo Borelli's avatar
Paolo Borelli committed
76 77 78 79
AM_GLIB_GNU_GETTEXT


dnl ================================================================
80
dnl spell plugins checks: enchant and iso-codes
Paolo Borelli's avatar
Paolo Borelli committed
81 82
dnl ================================================================

83 84 85 86 87 88 89 90 91 92 93 94 95 96
ENCHANT_REQUIRED=1.2.0
ISO_CODES_REQUIRED=0.35
	
AC_ARG_ENABLE([spell],
	AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
	[enable_enchant=$enableval],
	[enable_enchant=yes])

if test "x$enable_enchant" = "xyes" ; then

	PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, \
			  have_enchant=yes, have_enchant=no)

	if test "x$have_enchant" = "xyes"; then
97

98 99 100 101 102
		PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
				 [have_iso_codes=yes],[have_iso_codes=no])

		if test "x$have_iso_codes" = "xyes"; then
			AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
103 104
			if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
			   $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
				result=yes
			else
				result=no
				have_iso_codes=no
			fi
			AC_MSG_RESULT([$result])
		fi

		if test "x$have_iso_codes" = "xyes"; then
			AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
			AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package])
		else
			AC_MSG_ERROR([iso-codes is required to build the spell plugin. Use --disable-spell to build without spell plugin.])
		fi
	
		enable_enchant=yes
		ENCHANT_CFLAGS="${ENCHANT_CFLAGS}"
		ENCHANT_LIBS="${ENCHANT_LIBS}"
		SPELL_PLUGIN_DIR="spell"
Paolo Borelli's avatar
Paolo Borelli committed
124
	else
125
		AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without spell plugin.])
Paolo Borelli's avatar
Paolo Borelli committed
126 127
	fi
else
128 129 130 131
	enable_enchant=no
	ENCHANT_CFLAGS=
	ENCHANT_LIBS=
	SPELL_PLUGIN_DIR=
Paolo Borelli's avatar
Paolo Borelli committed
132 133
fi

134 135 136
AC_SUBST(ENCHANT_CFLAGS)
AC_SUBST(ENCHANT_LIBS)
AC_SUBST(SPELL_PLUGIN_DIR)
Paolo Borelli's avatar
Paolo Borelli committed
137

138 139 140 141 142
dnl ================================================================
dnl libattr checks
dnl ================================================================

AC_CHECK_LIB(attr, attr_copy_fd)
Paolo Borelli's avatar
Paolo Borelli committed
143

144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
AC_MSG_CHECKING([whether libattr support is requested])
AC_ARG_ENABLE([attr],
	AS_HELP_STRING([--enable-attr],[Enable libattr support]),
	[enable_attr=$enableval have_attr=$enableval],
	[enable_attr=autodetect have_attr=yes])
AC_MSG_RESULT([$enable_attr])

if test "x$have_attr" != "xno"; then
	AC_CHECK_LIB([attr], [attr_copy_fd], [],
                [
                have_attr=no
                if test "x$enable_attr" = "xyes"; then
                        AC_MSG_ERROR([libattr not found])
                elif test "x$enable_attr" = "xautodetect"; then
                        AC_MSG_WARN([libattr not found, disabling libattr support])
                fi
                ])
fi

Paolo Borelli's avatar
Paolo Borelli committed
163 164 165 166 167
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================

PKG_CHECK_MODULES(GEDIT, [
168 169
	glib-2.0 >= 2.14.0
	gtk+-2.0 >= 2.12.0
Paolo Borelli's avatar
Paolo Borelli committed
170
	gtksourceview-2.0 >= 2.0.0
171 172 173 174
	libgnomeui-2.0 >= 2.16.0
	libglade-2.0 >= 2.5.1
	libgnomeprintui-2.2 >= 2.12.1
	gnome-vfs-2.0 >= 2.16.0
Paolo Borelli's avatar
Paolo Borelli committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
])
GEDIT_LIBS="${GEDIT_LIBS}"
AC_SUBST(GEDIT_LIBS)
AC_SUBST(GEDIT_CFLAGS)


dnl ================================================================
dnl GConf related settings
dnl ================================================================

AM_GCONF_SOURCE_2

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 && \
Paolo Borelli's avatar
Paolo Borelli committed
239
		/bin/sh ../libtool --mode=link ${CC} -o testpython.la -rpath `pwd` -module -avoid-version -no-undefined $PYTHON_LIB_LOC testpython.lo $PYTHON_LIBS $PYTHON_EXTRA_LIBS >/dev/null 2>&1 && \
Paolo Borelli's avatar
Paolo Borelli committed
240 241 242 243 244 245 246 247 248 249 250
		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

251 252 253 254 255 256 257 258 259
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
fi

Paolo Borelli's avatar
Paolo Borelli committed
260
if test "x$have_python" != "xno"; then
261 262
	PYGOBJECT_REQUIRED=2.11.5
	PYGTK_REQUIRED=2.9.7
Paolo Borelli's avatar
Paolo Borelli committed
263
	PYGTKSOURCEVIEW_REQUIRED=2.0.0
Paolo Borelli's avatar
Paolo Borelli committed
264 265

	PKG_CHECK_MODULES([PYGTK], [
266
		pygobject-2.0 >= $PYGOBJECT_REQUIRED
Paolo Borelli's avatar
Paolo Borelli committed
267
		pygtk-2.0 >= $PYGTK_REQUIRED
268
		pygtksourceview-2.0 >= $PYGTKSOURCEVIEW_REQUIRED],
269 270 271 272 273 274
		[],
		[
		have_python=no
		if test "x$enable_python" = "xyes"; then
			AC_MSG_ERROR([$PYGTK_PKG_ERRORS])
		elif test "x$enable_python" = "xautodetect"; then
Paolo Borelli's avatar
Paolo Borelli committed
275
                        enable_python=no
276 277 278 279
			AC_MSG_WARN([$PYGTK_PKG_ERRORS])
			AC_MSG_WARN([Disabling python support])
		fi
		])
Paolo Borelli's avatar
Paolo Borelli committed
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296

	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])
297

Paolo Borelli's avatar
Paolo Borelli committed
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
	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

316
if test "x$have_python" != "xno" -a "x$enable_python" != "xno"; then
Paolo Borelli's avatar
Paolo Borelli committed
317 318 319 320 321 322
	enable_python=yes
	AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
fi

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

323 324 325
dnl This allows the bug-report script to know whether python has been enabled
AC_SUBST(enable_python)

Paolo Borelli's avatar
Paolo Borelli committed
326 327 328 329
dnl ================================================================
dnl Misc
dnl ================================================================
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
330
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
Paolo Borelli's avatar
Paolo Borelli committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
			      
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

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

352
AC_CONFIG_FILES([
Paolo Borelli's avatar
Paolo Borelli committed
353 354 355 356
Makefile
bindings/Makefile
bindings/python/Makefile
data/gedit.desktop.in
357
data/gedit-bugreport.sh
Paolo Borelli's avatar
Paolo Borelli committed
358 359
data/gedit.pc
data/Makefile
360 361
docs/Makefile
docs/reference/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
362 363
gedit/dialogs/Makefile
gedit/Makefile
364
help/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
365 366 367 368 369
help/eu/Makefile
help/ro/Makefile
pixmaps/Makefile
plugins/changecase/Makefile
plugins/docinfo/Makefile
370 371
plugins/externaltools/Makefile
plugins/externaltools/tools/Makefile
372
plugins/externaltools/data/Makefile
373
plugins/externaltools/scripts/Makefile
374
plugins/filebrowser/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
375 376
plugins/indent/Makefile
plugins/Makefile
377
plugins/modelines/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
378
plugins/pythonconsole/Makefile
Steve Frécinaux's avatar
Steve Frécinaux committed
379
plugins/pythonconsole/pythonconsole/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
380
plugins/sample/Makefile
Paolo Maggi's avatar
Paolo Maggi committed
381 382 383
plugins/snippets/Makefile
plugins/snippets/snippets/Makefile
plugins/snippets/data/Makefile
384
plugins/snippets/data/lang/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
385 386 387 388 389 390
plugins/sort/Makefile
plugins/spell/Makefile
plugins/taglist/Makefile
plugins/time/Makefile
po/Makefile.in])

391
AC_OUTPUT
Paolo Borelli's avatar
Paolo Borelli committed
392 393 394 395 396 397 398

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
399
	Libattr enabled:	$have_attr
Paolo Borelli's avatar
Paolo Borelli committed
400
	Python Plugins Support: $enable_python
401
	Spell Plugin enabled:	$enable_enchant
Paolo Borelli's avatar
Paolo Borelli committed
402 403 404
"

dnl uncomment this in developement releases
Paolo Borelli's avatar
Paolo Borelli committed
405
dnl cat $srcdir/message-of-doom