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

3
AC_PREREQ(2.63.2)
Paolo Borelli's avatar
Paolo Borelli committed
4

Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
5
m4_define(gedit_major_version, 3)
Paolo Borelli's avatar
Paolo Borelli committed
6
m4_define(gedit_minor_version, 7)
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
7
m4_define(gedit_micro_version, 3)
8 9
m4_define(gedit_version, gedit_major_version.gedit_minor_version.gedit_micro_version)

10 11 12
AC_INIT([gedit],[gedit_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gedit],[gedit],[http://projects.gnome.org/gedit/])

AC_CONFIG_HEADERS(config.h)
Paolo Borelli's avatar
Paolo Borelli committed
13 14 15
AC_CONFIG_SRCDIR(gedit/gedit.c)
AC_CONFIG_MACRO_DIR([m4])

16 17 18 19 20 21 22
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)

23
AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip -Wno-portability])
24
AM_MAINTAINER_MODE([enable])
25 26

AM_SILENT_RULES([yes])
27

28
# Checks for programs
Paolo Borelli's avatar
Paolo Borelli committed
29 30 31
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
32 33
AC_SYS_LARGEFILE
PKG_PROG_PKG_CONFIG
34 35 36
# needed on osx
AC_PROG_OBJC

37
AM_PATH_PYTHON(3.2.3)
38

39 40 41 42
# Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT(disable-static)

43
GEDIT_API_VERSION=3.0
44 45
AC_SUBST(GEDIT_API_VERSION)

46
GTK_DOC_CHECK([1.0],[--flavour=no-tmpl])
47

48
AC_CHECK_FUNC(sigaction)
49
AC_CHECK_LIB(m, floor)
50

Paolo Borelli's avatar
Paolo Borelli committed
51 52 53
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")

54
dnl active plugins for gedit.schemas
55
ACTIVE_PLUGINS="'docinfo', 'modelines', 'filebrowser', 'spell', 'time'"
56 57
AC_SUBST(ACTIVE_PLUGINS)

58
dnl check for win32 platform
59
AC_MSG_CHECKING([for Win32 platform])
60 61 62 63 64 65 66 67 68 69 70
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

71 72 73 74
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
75
    AC_CHECK_TOOL(WINDRES, windres)
76
    ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
77 78 79 80 81 82 83 84
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

85 86 87 88 89 90 91 92 93 94 95 96 97
dnl check for osx platform
AC_MSG_CHECKING([for Mac OS X platform])
case "$host" in
  *-*-darwin*)
    platform_osx=yes
    ;;
  *)
    platform_osx=no
    ;;
esac
AC_MSG_RESULT([$platform_osx])
AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes")

98
dnl check for native osx
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
gdk_targets=`$PKG_CONFIG --variable=targets gdk-3.0`

gdk_windowing="x11"

for target in $gdk_targets;
do
	case "$target" in
		quartz)
			gdk_windowing=quartz
			;;
		win32)
			gdk_windowing=win32
			;;
	esac
done
114

115 116 117
AC_MSG_CHECKING([for native Mac OS X])
if test "$gdk_windowing" = "quartz"; then
	os_osx=yes
118
	ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
119 120 121 122 123
else
	os_osx=no
fi
AC_MSG_RESULT([$os_osx])
AM_CONDITIONAL(OS_OSX, test "$os_osx" = "yes")
124

125 126
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing" = "x11")

127 128
if test "$platform_osx" = "yes"; then
	AC_DEFINE([PLATFORM_OSX],[1],[Defined if platform is Mac OSX])
129 130
fi

131 132 133
AC_SUBST(DEFAULT_FONT)
AC_SUBST(DEFAULT_PRINT_FONT)

134 135 136
if test "$os_osx" = "yes"; then
	AC_DEFINE([OS_OSX],[1],[Defined if os is Mac OSX])

137
	PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration)
138

139 140
	AC_SUBST(GTK_MAC_CFLAGS)
	AC_SUBST(GTK_MAC_LIBS)
141 142
fi

143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
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`
])

159
dnl FULL_LIBEXECDIR is used for X-GNOME-Bugzilla-ExtraInfoScript expansion
160
dnl in data/gedit.desktop.in.in
161 162
GEDIT_FULLPATH(libexecdir, NONE, FULL_LIBEXECDIR)
AC_SUBST(FULL_LIBEXECDIR)
Paolo Borelli's avatar
Paolo Borelli committed
163 164 165 166 167

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

168
IT_PROG_INTLTOOL([0.40.0])
169

170 171 172
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT([external])

173
AC_SUBST([GETTEXT_PACKAGE], [gedit])
174
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define to the gettext package name.])
Paolo Borelli's avatar
Paolo Borelli committed
175

176 177 178 179
dnl ================================================================
dnl Use gvfs metadata or the old xml file store.
dnl ================================================================

180
if test "x$os_win32" != "xno"; then
181
	gvfs_metadata_default="no"
182
else
183
	gvfs_metadata_default="yes"
184 185
fi

186 187 188
AC_ARG_ENABLE([gvfs-metadata],
	AS_HELP_STRING([--enable-gvfs-metadata], [Enable using gvfs to store metadata]),
	[enable_gvfs_metadata=$enableval],
189
	[enable_gvfs_metadata=$gvfs_metadata_default])
190

191
AM_CONDITIONAL(ENABLE_GVFS_METADATA, test "x$enable_gvfs_metadata" != "xno")
192

193 194
if test "x$enable_gvfs_metadata" != "xno"; then
	AC_DEFINE([ENABLE_GVFS_METADATA], [1], [Define to enable using gvfs metadata])
195 196
fi

197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
dnl ================================================================
dnl check update plugin
dnl ================================================================

AC_ARG_ENABLE([updater],
	AS_HELP_STRING([--disable-updater],[Disable check update plugin (default: enabled)]),
	[enable_updater=$enableval],
	[enable_updater=yes])

if test "x$enable_updater" != "xno"; then
	PKG_CHECK_MODULES(LIBSOUP, \
		libsoup-2.4,
		have_libsoup=yes,
		have_libsoup=no)
	
212
	if test "x$have_libsoup" = "xyes"; then
213
		if test "x$os_win32" = "xyes"; then
214
			enable_updater=yes
215
		elif test "x$os_osx" = "xyes"; then
216 217 218 219 220 221 222 223 224 225
			enable_updater=yes
		else
			enable_updater=no
		fi
	else
		enable_updater=no
	fi
fi

AM_CONDITIONAL(ENABLE_UPDATER, test x"$enable_updater" = "xyes")
Paolo Borelli's avatar
Paolo Borelli committed
226 227

dnl ================================================================
228
dnl spell plugins checks: enchant and iso-codes
Paolo Borelli's avatar
Paolo Borelli committed
229 230
dnl ================================================================

231 232 233 234 235 236 237 238 239 240 241 242 243 244
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
245

246 247 248 249 250
		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])
251 252
			if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
			   $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
253 254 255 256 257 258 259 260 261 262 263 264 265 266
				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
Paolo Borelli's avatar
Paolo Borelli committed
267
	else
268
		enable_enchant=no
269
		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
270 271 272
	fi
fi

273
AM_CONDITIONAL(ENABLE_ENCHANT, test x"$enable_enchant" = "xyes")
Paolo Borelli's avatar
Paolo Borelli committed
274

275 276 277 278 279 280 281
dnl ================================================================
dnl libzeitgeit check: for zeitgeist plugin
dnl ================================================================

LIBZEITGEIST_REQUIRED=0.3.2

AC_ARG_ENABLE([zeitgeist],
282
	AS_HELP_STRING([--enable-zeitgeist[=@<:@no/auto/yes@:>@]],[Build with zeitgeist support]),
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
	[enable_zeitgeist=$enableval],
	[enable_zeitgeist="auto"])

if test "x$enable_zeitgeist" = "xauto" ; then
	PKG_CHECK_EXISTS([zeitgeist-1.0 >= $LIBZEITGEIST_REQUIRED], \
			  enable_zeitgeist="yes", enable_zeitgeist="no")
fi

if test "x$enable_zeitgeist" = "xyes" ; then
	PKG_CHECK_MODULES(ZEITGEIST, \
			  [zeitgeist-1.0 >= $LIBZEITGEIST_REQUIRED])
fi

AM_CONDITIONAL(ENABLE_ZEITGEIST, test x"$enable_zeitgeist" = "xyes")

298
PYGOBJECT_REQUIRED=3.0.0
299 300 301 302 303 304 305

AC_ARG_ENABLE([python],
              AS_HELP_STRING([--enable-python[=@<:@no/auto/yes@:>@]],[Build with python support]),
              [enable_python=$enableval],
              [enable_python="auto"])

if test "x$enable_python" = "xauto"; then
306
	PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
307 308 309 310
	                 [enable_python=yes],[enable_python=no])
fi

if test "x$enable_python" = "xyes"; then
311
	PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
312

313
	pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
314 315 316 317 318
	AC_SUBST(pyoverridesdir)
fi

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

Paolo Borelli's avatar
Paolo Borelli committed
319 320 321 322
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================

323 324
# Dependencies

Paolo Borelli's avatar
Paolo Borelli committed
325
PKG_CHECK_MODULES(GEDIT, [
326
	libxml-2.0 >= 2.5.0
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
327
	glib-2.0 >= 2.28.0
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
328
	gio-2.0 >= 2.35.4
329
	gtk+-3.0 >= 3.6.0
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
330
	gtksourceview-3.0 >= 3.0.0
331 332
	libpeas-1.0 >= 1.7.0
	libpeas-gtk-1.0 >= 1.7.0
333
	gsettings-desktop-schemas
Paolo Borelli's avatar
Paolo Borelli committed
334 335
])

336 337 338 339 340 341 342 343 344 345
if test "$os_osx" = "no" &&
   test "$os_win32" = "no"; then
	PKG_CHECK_MODULES(X11, [
		x11
	])
else
	X11_CFLAGS=
	X11_LIBS=
fi

346 347 348 349 350 351 352 353 354 355 356
if test "$platform_win32" = "no"; then
	PKG_CHECK_MODULES(UNIX, [
		gio-unix-2.0 >= 2.25.5
	])
else
	UNIX_CFLAGS=
	UNIX_LIBS=
fi

GEDIT_CFLAGS="$GEDIT_CFLAGS $X11_CFLAGS $UNIX_CFLAGS"
GEDIT_LIBS="$GEDIT_LIBS $X11_LIBS $UNIX_LIBS"
357 358 359 360

AC_SUBST(GEDIT_CFLAGS)
AC_SUBST(GEDIT_LIBS)

Paolo Borelli's avatar
Paolo Borelli committed
361
dnl ================================================================
362
dnl GSettings stuff
Paolo Borelli's avatar
Paolo Borelli committed
363 364
dnl ================================================================

365
GLIB_GSETTINGS
Paolo Borelli's avatar
Paolo Borelli committed
366 367 368 369

dnl ================================================================
dnl Misc
dnl ================================================================
370
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
Paolo Borelli's avatar
Paolo Borelli committed
371
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
372
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
373

374
GNOME_COMPILE_WARNINGS([maximum])
Paolo Borelli's avatar
Paolo Borelli committed
375

376 377 378 379 380 381
if test "$USE_MAINTAINER_MODE" = "yes"; then
	enable_deprecations=yes
else
	enable_deprecations=no
fi

Paolo Borelli's avatar
Paolo Borelli committed
382
AC_ARG_ENABLE(deprecations,
383
              [AS_HELP_STRING([--enable-deprecations],
384 385
                              [warn about deprecated usages [default=no]])],
              [enable_deprecations=$enableval], [])
Paolo Borelli's avatar
Paolo Borelli committed
386

387
if test "$enable_deprecations" = "yes"; then
388
	DISABLE_DEPRECATED_CFLAGS="\
389
-DGSEAL_ENABLE \
Paolo Borelli's avatar
Paolo Borelli committed
390 391 392 393
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
394 395
-DGNOME_DISABLE_DEPRECATED \
-DPEAS_DISABLE_DEPRECATED"
396 397

	AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
Paolo Borelli's avatar
Paolo Borelli committed
398 399
fi

400 401 402 403
# on win32 plugins must be able to resolve all symbols at link time
# so we create a lib
if test "$platform_win32" = yes; then
	GEDIT_IMPLIB="-lgedit-$GEDIT_API_VERSION"
404
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version -no-undefined -Wl,\$(top_builddir)/gedit/libgedit.a"
405 406 407
	if test "$os_win32" = yes; then
		PLUGIN_LIBTOOL_FLAGS="${PLUGIN_LIBTOOL_FLAGS} -mwindows"
	fi
408 409 410 411 412
else
	GEDIT_IMPLIB=""
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
fi
AC_SUBST(GEDIT_IMPLIB)
Paolo Borelli's avatar
Paolo Borelli committed
413
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
414

415
GEDIT_PLUGINS_DATA_DIR="$datadir/gedit/plugins"
416 417
AC_SUBST(GEDIT_PLUGINS_DATA_DIR)

418
GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit/plugins"
419
AC_SUBST(GEDIT_PLUGINS_LIBS_DIR)
420

421
YELP_HELP_INIT
422

423
# Introspection
424
GOBJECT_INTROSPECTION_CHECK([0.9.3])
425 426 427 428 429 430 431 432

if test "$found_introspection" = "yes"; then
	enable_introspection=yes
	AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable GObject Introspection])
else
	enable_introspection=no
fi

433
AC_CONFIG_FILES([
Paolo Borelli's avatar
Paolo Borelli committed
434 435 436
Makefile
data/gedit.desktop.in
data/gedit.pc
437
data/org.gnome.gedit.gschema.xml.in
Paolo Borelli's avatar
Paolo Borelli committed
438
data/Makefile
439 440
docs/Makefile
docs/reference/Makefile
441
gedit/theatrics/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
442
gedit/Makefile
443
help/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
444
pixmaps/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
445
plugins/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
446
plugins/changecase/Makefile
447
plugins/checkupdate/org.gnome.gedit.plugins.checkupdate.gschema.xml.in
448
plugins/checkupdate/Makefile
449 450
plugins/externaltools/data/Makefile
plugins/externaltools/Makefile
451
plugins/externaltools/org.gnome.gedit.plugins.externaltools.gschema.xml.in
452 453
plugins/externaltools/scripts/Makefile
plugins/externaltools/tools/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
454
plugins/docinfo/Makefile
455
plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in
456
plugins/filebrowser/Makefile
457
plugins/modelines/Makefile
458
plugins/pythonconsole/Makefile
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
459
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in
460
plugins/pythonconsole/pythonconsole/Makefile
461 462 463 464 465 466
plugins/quickopen/Makefile
plugins/quickopen/quickopen/Makefile
plugins/snippets/data/lang/Makefile
plugins/snippets/data/Makefile
plugins/snippets/Makefile
plugins/snippets/snippets/Makefile
Paolo Borelli's avatar
Paolo Borelli committed
467 468
plugins/sort/Makefile
plugins/spell/Makefile
469
plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
Paolo Borelli's avatar
Paolo Borelli committed
470
plugins/time/Makefile
471
plugins/zeitgeist/Makefile
472
po/Makefile.in
473
tests/Makefile
474
win32/gedit.iss
475 476 477
win32/Makefile
osx/Info.plist
osx/Makefile])
Paolo Borelli's avatar
Paolo Borelli committed
478

479
AC_OUTPUT
Paolo Borelli's avatar
Paolo Borelli committed
480 481 482 483 484 485 486

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
487
	Spell Plugin enabled:	$enable_enchant
488
	Gvfs metadata enabled:	$enable_gvfs_metadata
489 490
	Deprecations enabled:	$enable_deprecations
	GObject Introspection:	$enable_introspection
491
	GDK Backend:            $gdk_windowing
492
	Zeitgeist support:      $enable_zeitgeist
493
	Python support:         $enable_python
Paolo Borelli's avatar
Paolo Borelli committed
494 495
"

496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
if expr ${GEDIT_MINOR_VERSION} % 2 > /dev/null; then
	stable_version=`expr ${GEDIT_MINOR_VERSION} - 1`

cat << EOF
 *** IMPORTANT *** 

This is an unstable version of gedit. 
It is for test purposes only.

Please, DO NOT use it in a production environment.
It will probably crash and you will lose your data.

If you are looking for a stable release of gedit, either download
it from:

Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
511
  http://ftp.gnome.org/pub/gnome/sources/gedit/${GEDIT_MAJOR_VERSION}.${stable_version}/
512

513
Or checkout the gnome-${GEDIT_MAJOR_VERSION}-${stable_version} branch of the gedit module from:
514 515 516 517 518 519 520 521 522

  git://git.gnome.org/gedit

Thanks,
The gedit team

 *** END OF WARNING ***
EOF

523
fi