configure.ac 14.2 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, 14)
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 11 12 13 14 15 16 17 18 19 20 21 22 23 24
AC_INIT([gedit],
        [gedit_version],
	[http://bugzilla.gnome.org/enter_bug.cgi?product=gedit],
	[gedit],
	[https://wiki.gnome.org/Apps/Gedit])

# Dependencies
GLIB_REQUIRED=2.40.0
GTK_REQUIRED=3.14.0
GTKSOURCEVIEW_REQUIRED=3.14.0
LIBPEAS_REQUIRED=1.7.0
LIBXML_REQUIRED=2.5.0
ENCHANT_REQUIRED=1.2.0
ISO_CODES_REQUIRED=0.35
PYGOBJECT_REQUIRED=3.0.0
25 26

AC_CONFIG_HEADERS(config.h)
Paolo Borelli's avatar
Paolo Borelli committed
27 28 29
AC_CONFIG_SRCDIR(gedit/gedit.c)
AC_CONFIG_MACRO_DIR([m4])

30 31 32 33 34 35 36
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)

37
AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip -Wno-portability subdir-objects])
38
AM_MAINTAINER_MODE([enable])
39 40

AM_SILENT_RULES([yes])
41

42
# Checks for programs
Paolo Borelli's avatar
Paolo Borelli committed
43 44 45
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
46 47
AC_SYS_LARGEFILE
PKG_PROG_PKG_CONFIG
48 49 50
# needed on osx
AC_PROG_OBJC

51 52 53 54
# Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT(disable-static)

55
GEDIT_API_VERSION=3.12
56 57
AC_SUBST(GEDIT_API_VERSION)

58
GTK_DOC_CHECK([1.0],[--flavour=no-tmpl])
59

60
AC_CHECK_FUNC(sigaction)
61
AC_CHECK_LIB(m, floor)
62

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

66
dnl active plugins for gedit.schemas
67
ACTIVE_PLUGINS="'docinfo', 'modelines', 'filebrowser', 'spell', 'time'"
68 69
AC_SUBST(ACTIVE_PLUGINS)

70
dnl check for win32 platform
71
AC_MSG_CHECKING([for Win32 platform])
72 73
case "$host" in
  *-*-mingw*|*-*-cygwin*)
74 75 76 77 78 79 80 81 82 83 84
        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'
85 86 87 88 89 90 91 92 93
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

94 95 96 97
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
98
    AC_CHECK_TOOL(WINDRES, windres)
99
    ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
100 101 102 103 104 105 106 107
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

108 109 110 111 112 113 114 115 116 117 118 119 120
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")

121
dnl check for native osx
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
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
137

138 139 140
AC_MSG_CHECKING([for native Mac OS X])
if test "$gdk_windowing" = "quartz"; then
	os_osx=yes
141
	ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
142 143 144 145 146
else
	os_osx=no
fi
AC_MSG_RESULT([$os_osx])
AM_CONDITIONAL(OS_OSX, test "$os_osx" = "yes")
147

148 149
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing" = "x11")

150 151
if test "$platform_osx" = "yes"; then
	AC_DEFINE([PLATFORM_OSX],[1],[Defined if platform is Mac OSX])
152 153
fi

154 155 156
AC_SUBST(DEFAULT_FONT)
AC_SUBST(DEFAULT_PRINT_FONT)

157 158 159
if test "$os_osx" = "yes"; then
	AC_DEFINE([OS_OSX],[1],[Defined if os is Mac OSX])

160
	PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration)
161

162 163
	AC_SUBST(GTK_MAC_CFLAGS)
	AC_SUBST(GTK_MAC_LIBS)
164 165
fi

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
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`
])

182
dnl FULL_LIBEXECDIR is used for X-GNOME-Bugzilla-ExtraInfoScript expansion
Matthias Clasen's avatar
Matthias Clasen committed
183
dnl in data/org.gnome.gedit.desktop.in.in
184 185
GEDIT_FULLPATH(libexecdir, NONE, FULL_LIBEXECDIR)
AC_SUBST(FULL_LIBEXECDIR)
Paolo Borelli's avatar
Paolo Borelli committed
186 187 188 189 190

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

191
IT_PROG_INTLTOOL([0.50.1])
192

193 194 195
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT([external])

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

199 200 201 202
dnl ================================================================
dnl Use gvfs metadata or the old xml file store.
dnl ================================================================

203
if test "x$os_win32" != "xno" || test "x$os_osx" != "xno"; then
204
	gvfs_metadata_default="no"
205
else
206
	gvfs_metadata_default="yes"
207 208
fi

209 210 211
AC_ARG_ENABLE([gvfs-metadata],
	AS_HELP_STRING([--enable-gvfs-metadata], [Enable using gvfs to store metadata]),
	[enable_gvfs_metadata=$enableval],
212
	[enable_gvfs_metadata=$gvfs_metadata_default])
213

214
AM_CONDITIONAL(ENABLE_GVFS_METADATA, test "x$enable_gvfs_metadata" != "xno")
215

216 217
if test "x$enable_gvfs_metadata" != "xno"; then
	AC_DEFINE([ENABLE_GVFS_METADATA], [1], [Define to enable using gvfs metadata])
218 219
fi

220 221 222 223 224 225 226 227 228 229 230 231 232 233
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)
234

235
	if test "x$have_libsoup" = "xyes"; then
236
		if test "x$os_win32" = "xyes"; then
237
			enable_updater=yes
238
		elif test "x$os_osx" = "xyes"; then
239 240 241 242 243 244 245 246 247 248
			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
249 250

dnl ================================================================
251
dnl spell plugins checks: enchant and iso-codes
Paolo Borelli's avatar
Paolo Borelli committed
252 253
dnl ================================================================

254 255 256 257 258 259 260 261 262 263 264
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
265

266 267 268 269 270
		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])
271 272
			if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
			   $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
273 274 275 276 277 278 279 280 281 282 283 284 285 286
				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
287
	else
288
		enable_enchant=no
289
		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
290 291 292
	fi
fi

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

295 296 297 298 299 300
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
301
	PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
302 303 304 305
	                 [enable_python=yes],[enable_python=no])
fi

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

309
	pyoverridesdir="\$(pyexecdir)/gi/overrides"
310 311 312 313 314
	AC_SUBST(pyoverridesdir)
fi

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

Paolo Borelli's avatar
Paolo Borelli committed
315 316 317 318
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================

319 320
# Dependencies

Paolo Borelli's avatar
Paolo Borelli committed
321
PKG_CHECK_MODULES(GEDIT, [
322 323 324
	libxml-2.0 >= $LIBXML_REQUIRED
	glib-2.0 >= $GLIB_REQUIRED
	gio-2.0 >= $GLIB_REQUIRED
325
	gmodule-2.0
326 327 328 329
	gtk+-3.0 >= $GTK_REQUIRED
	gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED
	libpeas-1.0 >= $LIBPEAS_REQUIRED
	libpeas-gtk-1.0 >= $LIBPEAS_REQUIRED
330
	gsettings-desktop-schemas
Paolo Borelli's avatar
Paolo Borelli committed
331 332
])

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

343 344 345 346 347 348 349 350 351 352 353
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"
354 355 356 357

AC_SUBST(GEDIT_CFLAGS)
AC_SUBST(GEDIT_LIBS)

358 359 360 361 362 363
dnl ================================================================
dnl libgd
dnl ================================================================

LIBGD_INIT([tagged-entry static])

Paolo Borelli's avatar
Paolo Borelli committed
364
dnl ================================================================
365
dnl GSettings stuff
Paolo Borelli's avatar
Paolo Borelli committed
366 367
dnl ================================================================

368
GLIB_GSETTINGS
Paolo Borelli's avatar
Paolo Borelli committed
369 370 371 372

dnl ================================================================
dnl Misc
dnl ================================================================
373
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
Paolo Borelli's avatar
Paolo Borelli committed
374
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
375
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
376

377 378
AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_8, [minimum gdk version])

379
GNOME_COMPILE_WARNINGS([maximum])
Paolo Borelli's avatar
Paolo Borelli committed
380 381

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

386
AC_MSG_CHECKING([whether to forbid deprecated symbols])
387
if test "$enable_deprecations" = "yes"; then
388
	AC_MSG_RESULT(yes)
389
	DISABLE_DEPRECATED_CFLAGS="\
390
-DGSEAL_ENABLE \
Paolo Borelli's avatar
Paolo Borelli committed
391 392 393 394
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
395 396
-DGNOME_DISABLE_DEPRECATED \
-DPEAS_DISABLE_DEPRECATED"
397 398

	AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
399 400
else
	AC_MSG_RESULT(no)
Paolo Borelli's avatar
Paolo Borelli committed
401 402
fi

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

418
GEDIT_PLUGINS_DATA_DIR="$datadir/gedit/plugins"
419 420
AC_SUBST(GEDIT_PLUGINS_DATA_DIR)

421
GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit/plugins"
422
AC_SUBST(GEDIT_PLUGINS_LIBS_DIR)
423

424
YELP_HELP_INIT
425

426
# Introspection
427
GOBJECT_INTROSPECTION_CHECK([0.9.3])
428 429 430 431 432 433 434 435

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
436
# Vala
437
VAPIGEN_CHECK([0.25.1])
Evan Nemerson's avatar
Evan Nemerson committed
438

439 440
if test "$os_osx" = "yes"; then
	os_menus_ui=menus-osx.ui
441
	os_style_css=gedit-style-osx.css
442 443
else
	os_menus_ui=menus-default.ui
444
	os_style_css=
445

446 447
	OS_DEPENDENT_RESOURCE_FILES='<file preprocess="xml-stripblanks">gtk/menus-traditional.ui</file>'
fi
448

449 450 451 452
if test "x$os_style_css" != "x"; then
	OS_DEPENDENT_RESOURCE_FILES+="<file>css/gedit-style-os.css</file>"
	AC_CONFIG_LINKS(gedit/resources/css/gedit-style-os.css:gedit/resources/css/$os_style_css)
fi
453

454
AC_SUBST(OS_DEPENDENT_RESOURCE_FILES)
455 456
AC_CONFIG_LINKS(gedit/resources/gtk/menus.ui:gedit/resources/gtk/$os_menus_ui)

457
AC_CONFIG_FILES([
Paolo Borelli's avatar
Paolo Borelli committed
458
Makefile
459
gedit/resources/gedit.gresource.xml
Matthias Clasen's avatar
Matthias Clasen committed
460
data/org.gnome.gedit.desktop.in
Paolo Borelli's avatar
Paolo Borelli committed
461
data/gedit.pc
462
data/org.gnome.gedit.gschema.xml
463 464
docs/Makefile
docs/reference/Makefile
465
help/Makefile
466
libgd/Makefile
467
plugins/checkupdate/org.gnome.gedit.plugins.checkupdate.gschema.xml.in
468
plugins/externaltools/org.gnome.gedit.plugins.externaltools.gschema.xml.in
469
plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in
Ignacio Casal Quinteiro's avatar
Ignacio Casal Quinteiro committed
470
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in
471
plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
472
po/Makefile.in
473
osx/bundle/data/Info.plist])
Paolo Borelli's avatar
Paolo Borelli committed
474

475
AC_OUTPUT
Paolo Borelli's avatar
Paolo Borelli committed
476 477 478 479 480 481 482

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
483
	Spell Plugin enabled:	$enable_enchant
484
	Gvfs metadata enabled:	$enable_gvfs_metadata
485 486
	Deprecations enabled:	$enable_deprecations
	GObject Introspection:	$enable_introspection
487
	GDK Backend:            $gdk_windowing
488
	Python support:         $enable_python
Evan Nemerson's avatar
Evan Nemerson committed
489
	Vala support:           $enable_vala
Paolo Borelli's avatar
Paolo Borelli committed
490 491
"

492 493 494 495
if expr ${GEDIT_MINOR_VERSION} % 2 > /dev/null; then
	stable_version=`expr ${GEDIT_MINOR_VERSION} - 1`

cat << EOF
496
 *** IMPORTANT ***
497

498
This is an unstable version of gedit.
499 500 501 502 503 504 505 506
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
507
  http://ftp.gnome.org/pub/gnome/sources/gedit/${GEDIT_MAJOR_VERSION}.${stable_version}/
508

509
Or checkout the gnome-${GEDIT_MAJOR_VERSION}-${stable_version} branch of the gedit module from:
510 511 512 513 514 515 516 517 518

  git://git.gnome.org/gedit

Thanks,
The gedit team

 *** END OF WARNING ***
EOF

519
fi