configure.ac 13.4 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)
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
6
m4_define(gedit_minor_version, 13)
Sébastien Wilmet's avatar
Sébastien Wilmet committed
7
m4_define(gedit_micro_version, 2)
8 9
m4_define(gedit_version, gedit_major_version.gedit_minor_version.gedit_micro_version)

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

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 subdir-objects])
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 38 39 40
# Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT(disable-static)

41
GEDIT_API_VERSION=3.12
42 43
AC_SUBST(GEDIT_API_VERSION)

44
GTK_DOC_CHECK([1.0],[--flavour=no-tmpl])
45

46
AC_CHECK_FUNC(sigaction)
47
AC_CHECK_LIB(m, floor)
48

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

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

56
dnl check for win32 platform
57
AC_MSG_CHECKING([for Win32 platform])
58 59
case "$host" in
  *-*-mingw*|*-*-cygwin*)
60 61 62 63 64 65 66 67 68 69 70
        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --output-def -Xlinker $lib.def && $DLLTOOL --dllname $soname --def $lib.def --output-delaylib $lib'
	# If the export-symbols file already is a .def file (1st line
	# is EXPORTS), use it as is; otherwise, prepend...
	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
	  cp $export_symbols $output_objdir/$soname.def;
	else
	  echo EXPORTS > $output_objdir/$soname.def;
	  cat $export_symbols >> $output_objdir/$soname.def;
	fi~
	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base;
	$DLLTOOL --dllname $soname --def $output_objdir/$soname.def --output-delaylib $lib'
71 72 73 74 75 76 77 78 79
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

80 81 82 83
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
84
    AC_CHECK_TOOL(WINDRES, windres)
85
    ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
86 87 88 89 90 91 92 93
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

94 95 96 97 98 99 100 101 102 103 104 105 106
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")

107
dnl check for native osx
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
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
123

124 125 126
AC_MSG_CHECKING([for native Mac OS X])
if test "$gdk_windowing" = "quartz"; then
	os_osx=yes
127
	ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
128 129 130 131 132
else
	os_osx=no
fi
AC_MSG_RESULT([$os_osx])
AM_CONDITIONAL(OS_OSX, test "$os_osx" = "yes")
133

134 135
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing" = "x11")

136 137
if test "$platform_osx" = "yes"; then
	AC_DEFINE([PLATFORM_OSX],[1],[Defined if platform is Mac OSX])
138 139
fi

140 141 142
AC_SUBST(DEFAULT_FONT)
AC_SUBST(DEFAULT_PRINT_FONT)

143 144 145
if test "$os_osx" = "yes"; then
	AC_DEFINE([OS_OSX],[1],[Defined if os is Mac OSX])

146
	PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration)
147

148 149
	AC_SUBST(GTK_MAC_CFLAGS)
	AC_SUBST(GTK_MAC_LIBS)
150 151
fi

152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
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`
])

168
dnl FULL_LIBEXECDIR is used for X-GNOME-Bugzilla-ExtraInfoScript expansion
169
dnl in data/gedit.desktop.in.in
170 171
GEDIT_FULLPATH(libexecdir, NONE, FULL_LIBEXECDIR)
AC_SUBST(FULL_LIBEXECDIR)
Paolo Borelli's avatar
Paolo Borelli committed
172 173 174 175 176

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

177
IT_PROG_INTLTOOL([0.50.1])
178

179 180 181
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT([external])

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

185 186 187 188
dnl ================================================================
dnl Use gvfs metadata or the old xml file store.
dnl ================================================================

189
if test "x$os_win32" != "xno"; then
190
	gvfs_metadata_default="no"
191
else
192
	gvfs_metadata_default="yes"
193 194
fi

195 196 197
AC_ARG_ENABLE([gvfs-metadata],
	AS_HELP_STRING([--enable-gvfs-metadata], [Enable using gvfs to store metadata]),
	[enable_gvfs_metadata=$enableval],
198
	[enable_gvfs_metadata=$gvfs_metadata_default])
199

200
AM_CONDITIONAL(ENABLE_GVFS_METADATA, test "x$enable_gvfs_metadata" != "xno")
201

202 203
if test "x$enable_gvfs_metadata" != "xno"; then
	AC_DEFINE([ENABLE_GVFS_METADATA], [1], [Define to enable using gvfs metadata])
204 205
fi

206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
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)
	
221
	if test "x$have_libsoup" = "xyes"; then
222
		if test "x$os_win32" = "xyes"; then
223
			enable_updater=yes
224
		elif test "x$os_osx" = "xyes"; then
225 226 227 228 229 230 231 232 233 234
			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
235 236

dnl ================================================================
237
dnl spell plugins checks: enchant and iso-codes
Paolo Borelli's avatar
Paolo Borelli committed
238 239
dnl ================================================================

240 241 242 243 244 245 246 247 248 249 250 251 252 253
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
254

255 256 257 258 259
		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])
260 261
			if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
			   $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
262 263 264 265 266 267 268 269 270 271 272 273 274 275
				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
276
	else
277
		enable_enchant=no
278
		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
279 280 281
	fi
fi

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

284
PYGOBJECT_REQUIRED=3.0.0
285 286 287 288 289 290 291

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
292
	PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
293 294 295 296
	                 [enable_python=yes],[enable_python=no])
fi

if test "x$enable_python" = "xyes"; then
297
	AM_PATH_PYTHON(3.2.3)
298
	PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
299

300
	pyoverridesdir="\$(pyexecdir)/gi/overrides"
301 302 303 304 305
	AC_SUBST(pyoverridesdir)
fi

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

Paolo Borelli's avatar
Paolo Borelli committed
306 307 308 309
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================

310 311
# Dependencies

Paolo Borelli's avatar
Paolo Borelli committed
312
PKG_CHECK_MODULES(GEDIT, [
313
	libxml-2.0 >= 2.5.0
Yosef Or Boczko's avatar
Yosef Or Boczko committed
314
	glib-2.0 >= 2.39.5
315
	gio-2.0 >= 2.37.0
316
	gmodule-2.0
317
	gtk+-3.0 >= 3.13.3
318
	gtksourceview-3.0 >= 3.11.2
319 320
	libpeas-1.0 >= 1.7.0
	libpeas-gtk-1.0 >= 1.7.0
321
	gsettings-desktop-schemas
Paolo Borelli's avatar
Paolo Borelli committed
322 323
])

324 325 326 327 328 329 330 331 332 333
if test "$os_osx" = "no" &&
   test "$os_win32" = "no"; then
	PKG_CHECK_MODULES(X11, [
		x11
	])
else
	X11_CFLAGS=
	X11_LIBS=
fi

334 335 336 337 338 339 340 341 342 343 344
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"
345 346 347 348

AC_SUBST(GEDIT_CFLAGS)
AC_SUBST(GEDIT_LIBS)

349 350 351 352 353 354
dnl ================================================================
dnl libgd
dnl ================================================================

LIBGD_INIT([tagged-entry static])

Paolo Borelli's avatar
Paolo Borelli committed
355
dnl ================================================================
356
dnl GSettings stuff
Paolo Borelli's avatar
Paolo Borelli committed
357 358
dnl ================================================================

359
GLIB_GSETTINGS
Paolo Borelli's avatar
Paolo Borelli committed
360 361 362 363

dnl ================================================================
dnl Misc
dnl ================================================================
364
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
Paolo Borelli's avatar
Paolo Borelli committed
365
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
366
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
367

368 369
AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_8, [minimum gdk version])

370
GNOME_COMPILE_WARNINGS([maximum])
Paolo Borelli's avatar
Paolo Borelli committed
371 372

AC_ARG_ENABLE(deprecations,
373
              [AS_HELP_STRING([--enable-deprecations],
374 375
                              [warn about deprecated usages [default=no]])],
              [enable_deprecations=$enableval], [])
Paolo Borelli's avatar
Paolo Borelli committed
376

377
AC_MSG_CHECKING([whether to forbid deprecated symbols])
378
if test "$enable_deprecations" = "yes"; then
379
	AC_MSG_RESULT(yes)
380
	DISABLE_DEPRECATED_CFLAGS="\
381
-DGSEAL_ENABLE \
Paolo Borelli's avatar
Paolo Borelli committed
382 383 384 385
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
386 387
-DGNOME_DISABLE_DEPRECATED \
-DPEAS_DISABLE_DEPRECATED"
388 389

	AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
390 391
else
	AC_MSG_RESULT(no)
Paolo Borelli's avatar
Paolo Borelli committed
392 393
fi

394 395 396
# on win32 plugins must be able to resolve all symbols at link time
# so we create a lib
if test "$platform_win32" = yes; then
397
	GEDIT_IMPLIB='-L${libdir}/gedit -lgedit'
398
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version -no-undefined"
399 400 401
	if test "$os_win32" = yes; then
		PLUGIN_LIBTOOL_FLAGS="${PLUGIN_LIBTOOL_FLAGS} -mwindows"
	fi
402 403 404 405 406
else
	GEDIT_IMPLIB=""
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
fi
AC_SUBST(GEDIT_IMPLIB)
Paolo Borelli's avatar
Paolo Borelli committed
407
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
408

409
GEDIT_PLUGINS_DATA_DIR="$datadir/gedit/plugins"
410 411
AC_SUBST(GEDIT_PLUGINS_DATA_DIR)

412
GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit/plugins"
413
AC_SUBST(GEDIT_PLUGINS_LIBS_DIR)
414

415
YELP_HELP_INIT
416

417
# Introspection
418
GOBJECT_INTROSPECTION_CHECK([0.9.3])
419 420 421 422 423 424 425 426

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

Evan Nemerson's avatar
Evan Nemerson committed
427 428 429
# Vala
VAPIGEN_CHECK

430
AC_CONFIG_FILES([
Paolo Borelli's avatar
Paolo Borelli committed
431 432 433
Makefile
data/gedit.desktop.in
data/gedit.pc
434
data/org.gnome.gedit.gschema.xml
435 436
docs/Makefile
docs/reference/Makefile
437
help/Makefile
438
libgd/Makefile
439
plugins/checkupdate/org.gnome.gedit.plugins.checkupdate.gschema.xml.in
440
plugins/externaltools/org.gnome.gedit.plugins.externaltools.gschema.xml.in
441
plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
442
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in
443
plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
444 445
po/Makefile.in
win32/gedit.iss
446
osx/Info.plist])
Paolo Borelli's avatar
Paolo Borelli committed
447

448
AC_OUTPUT
Paolo Borelli's avatar
Paolo Borelli committed
449 450 451 452 453 454 455

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
456
	Spell Plugin enabled:	$enable_enchant
457
	Gvfs metadata enabled:	$enable_gvfs_metadata
458 459
	Deprecations enabled:	$enable_deprecations
	GObject Introspection:	$enable_introspection
460
	GDK Backend:            $gdk_windowing
461
	Python support:         $enable_python
Evan Nemerson's avatar
Evan Nemerson committed
462
	Vala support:           $enable_vala
Paolo Borelli's avatar
Paolo Borelli committed
463 464
"

465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
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
480
  http://ftp.gnome.org/pub/gnome/sources/gedit/${GEDIT_MAJOR_VERSION}.${stable_version}/
481

482
Or checkout the gnome-${GEDIT_MAJOR_VERSION}-${stable_version} branch of the gedit module from:
483 484 485 486 487 488 489 490 491

  git://git.gnome.org/gedit

Thanks,
The gedit team

 *** END OF WARNING ***
EOF

492
fi