configure.ac 13.7 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)
6
m4_define(gedit_minor_version, 31)
Jeremy Bicha's avatar
Jeremy Bicha 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
AC_INIT([gedit],
        [gedit_version],
Paolo Borelli's avatar
Paolo Borelli committed
12 13 14
        [https://wiki.gnome.org/Apps/Gedit/ReportingBugs],
        [gedit],
        [https://wiki.gnome.org/Apps/Gedit])
15

Sébastien Wilmet's avatar
Sébastien Wilmet committed
16 17 18
GEDIT_API_VERSION=3.14
AC_SUBST(GEDIT_API_VERSION)

19
# Dependencies
20
GLIB_REQUIRED=2.44
Jeremy Bicha's avatar
Jeremy Bicha committed
21
GTK_REQUIRED=3.22.0
22
GTKSOURCEVIEW_REQUIRED=4.0.2
23
LIBPEAS_REQUIRED=1.14.1
24
LIBXML_REQUIRED=2.5.0
25
GSPELL_REQUIRED=0.2.5
26
PYGOBJECT_REQUIRED=3.0.0
27 28

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

32 33 34 35 36 37 38
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)

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

AM_SILENT_RULES([yes])
43

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

53 54 55 56
# Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT(disable-static)

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

59
dnl active plugins for gedit.schemas
60
ACTIVE_PLUGINS="'docinfo', 'modelines', 'filebrowser', 'spell', 'time'"
61 62
AC_SUBST(ACTIVE_PLUGINS)

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

87 88 89 90
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
91
    AC_CHECK_TOOL(WINDRES, windres)
92
    ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
93 94 95 96 97 98 99 100
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

101 102 103 104 105 106 107 108 109 110 111 112 113
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")

114
dnl check for native osx
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
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
130

131 132 133
AC_MSG_CHECKING([for native Mac OS X])
if test "$gdk_windowing" = "quartz"; then
	os_osx=yes
134
	ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
135 136 137 138 139
else
	os_osx=no
fi
AC_MSG_RESULT([$os_osx])
AM_CONDITIONAL(OS_OSX, test "$os_osx" = "yes")
140

141 142
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing" = "x11")

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-gtk3 >= 2.0.8)
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
Matthias Clasen's avatar
Matthias Clasen committed
169
dnl in data/org.gnome.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
AM_GNU_GETTEXT_VERSION([0.19.8])
178 179
AM_GNU_GETTEXT([external])

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

183 184 185 186
dnl ================================================================
dnl Use gvfs metadata or the old xml file store.
dnl ================================================================

187
if test "x$os_win32" != "xno" || test "x$os_osx" != "xno"; then
188
	gvfs_metadata_default="no"
189
else
190
	gvfs_metadata_default="yes"
191 192
fi

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

198 199
if test "x$enable_gvfs_metadata" != "xno"; then
	AC_DEFINE([ENABLE_GVFS_METADATA], [1], [Define to enable using gvfs metadata])
200 201
fi

202
dnl ================================================================
203
dnl checkupdate plugin
204 205 206 207 208 209 210 211 212 213 214 215
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)
216

217
	if test "x$have_libsoup" = "xyes"; then
218
		if test "x$os_win32" = "xyes"; then
219
			enable_updater=yes
220
		elif test "x$os_osx" = "xyes"; then
221 222 223 224 225 226 227 228 229 230
			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
231 232

dnl ================================================================
233
dnl spell plugin checks
Paolo Borelli's avatar
Paolo Borelli committed
234 235
dnl ================================================================

236
AC_ARG_ENABLE([spell],
237 238 239
              AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
              [enable_spell=$enableval],
              [enable_spell=yes])
240

241 242 243 244 245 246 247
if test "x$enable_spell" = "xyes" ; then

	PKG_CHECK_MODULES(GSPELL, gspell-1 >= $GSPELL_REQUIRED, \
	                  have_gspell=yes, have_gspell=no)

	if test "x$have_gspell" = "xno"; then
		AC_MSG_ERROR([gspell library not found or too old. Use --disable-spell to build without spell plugin.])
Paolo Borelli's avatar
Paolo Borelli committed
248 249 250
	fi
fi

251
AM_CONDITIONAL(ENABLE_SPELL, test x"$enable_spell" = "xyes")
Paolo Borelli's avatar
Paolo Borelli committed
252

253 254 255 256
dnl ================================================================
dnl Check Python support
dnl ================================================================

257 258 259 260 261 262
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
263
	PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
264 265 266 267
	                 [enable_python=yes],[enable_python=no])
fi

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

271
	pyoverridesdir="\$(pyexecdir)/gi/overrides"
272 273 274 275 276
	AC_SUBST(pyoverridesdir)
fi

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

Paolo Borelli's avatar
Paolo Borelli committed
277 278 279 280
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================

281 282
# Dependencies

Paolo Borelli's avatar
Paolo Borelli committed
283
PKG_CHECK_MODULES(GEDIT, [
284 285 286
	libxml-2.0 >= $LIBXML_REQUIRED
	glib-2.0 >= $GLIB_REQUIRED
	gio-2.0 >= $GLIB_REQUIRED
287
	gmodule-2.0
288
	gtk+-3.0 >= $GTK_REQUIRED
289
	gtksourceview-4 >= $GTKSOURCEVIEW_REQUIRED
290 291
	libpeas-1.0 >= $LIBPEAS_REQUIRED
	libpeas-gtk-1.0 >= $LIBPEAS_REQUIRED
292
	gsettings-desktop-schemas
Paolo Borelli's avatar
Paolo Borelli committed
293 294
])

295 296 297 298 299 300 301 302 303 304
if test "$os_osx" = "no" &&
   test "$os_win32" = "no"; then
	PKG_CHECK_MODULES(X11, [
		x11
	])
else
	X11_CFLAGS=
	X11_LIBS=
fi

305 306
GEDIT_CFLAGS="$GEDIT_CFLAGS $X11_CFLAGS"
GEDIT_LIBS="$GEDIT_LIBS $X11_LIBS"
307 308 309 310

AC_SUBST(GEDIT_CFLAGS)
AC_SUBST(GEDIT_LIBS)

311
dnl ================================================================
312
dnl Deprecations
Paolo Borelli's avatar
Paolo Borelli committed
313 314 315
dnl ================================================================

AC_ARG_ENABLE(deprecations,
316
              [AS_HELP_STRING([--enable-deprecations],
317
                              [show error when a deprecated API is used [default=no]])],
318
              [enable_deprecations=$enableval], [])
Paolo Borelli's avatar
Paolo Borelli committed
319

320
AC_MSG_CHECKING([whether to forbid deprecated symbols])
321
if test "$enable_deprecations" = "yes"; then
322
	AC_MSG_RESULT(yes)
323
	DISABLE_DEPRECATED_CFLAGS="\
Paolo Borelli's avatar
Paolo Borelli committed
324 325 326 327
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
328
-DPEAS_DISABLE_DEPRECATED"
329 330

	AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
331 332
else
	AC_MSG_RESULT(no)
Paolo Borelli's avatar
Paolo Borelli committed
333 334
fi

335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
dnl ================================================================
dnl User help
dnl ================================================================

YELP_HELP_INIT

# Hack: since non-recursive make is used, it can be useful to disable the user
# help since it takes a lot of time to build and install. On the other hand
# with recursive make it's usually possible to build and install only what we
# need...
AC_ARG_ENABLE([user_help],
	      AS_HELP_STRING([--disable-user-help],[Disable the user help to speed the build (default: enabled)]),
	      [enable_user_help=$enableval],
	      [enable_user_help=yes])

AM_CONDITIONAL(ENABLE_USER_HELP, test x"$enable_user_help" = "xyes")

352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
dnl ================================================================
dnl GObject Introspection
dnl ================================================================

GOBJECT_INTROSPECTION_CHECK([0.9.3])

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

dnl ================================================================
dnl Internal lib on win32
dnl ================================================================

369 370 371
# on win32 plugins must be able to resolve all symbols at link time
# so we create a lib
if test "$platform_win32" = yes; then
372
	GEDIT_IMPLIB='-L${libdir}/gedit -lgedit'
373
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version -no-undefined"
374 375 376
	if test "$os_win32" = yes; then
		PLUGIN_LIBTOOL_FLAGS="${PLUGIN_LIBTOOL_FLAGS} -mwindows"
	fi
377 378 379 380 381
else
	GEDIT_IMPLIB=""
	PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
fi
AC_SUBST(GEDIT_IMPLIB)
Paolo Borelli's avatar
Paolo Borelli committed
382
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
383

384 385 386
dnl ================================================================
dnl Resource files depending on the OS
dnl ================================================================
Evan Nemerson's avatar
Evan Nemerson committed
387

388
if test "$os_osx" = "yes"; then
389
	os_style_css=gedit-style-osx.css
390
else
391
	os_style_css=
392

393 394
	OS_DEPENDENT_RESOURCE_FILES='<file preprocess="xml-stripblanks">gtk/menus-traditional.ui</file>'
fi
395

396 397 398 399
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
400

401
AC_SUBST(OS_DEPENDENT_RESOURCE_FILES)
402

403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
dnl ================================================================
dnl Misc
dnl ================================================================

LIBGD_INIT([tagged-entry static])

GLIB_GSETTINGS

# Vala
VAPIGEN_CHECK([0.25.1])

AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)

GNOME_COMPILE_WARNINGS([maximum])

GEDIT_PLUGINS_DATA_DIR="$datadir/gedit/plugins"
AC_SUBST(GEDIT_PLUGINS_DATA_DIR)

GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit/plugins"
AC_SUBST(GEDIT_PLUGINS_LIBS_DIR)

425
AC_CONFIG_FILES([
Paolo Borelli's avatar
Paolo Borelli committed
426
Makefile
427
gedit/resources/gedit.gresource.xml
Matthias Clasen's avatar
Matthias Clasen committed
428
data/org.gnome.gedit.desktop.in
Paolo Borelli's avatar
Paolo Borelli committed
429
data/gedit.pc
430
data/org.gnome.gedit.gschema.xml
431 432
docs/Makefile
docs/reference/Makefile
433
help/Makefile
434
libgd/Makefile
435 436 437 438 439
plugins/checkupdate/org.gnome.gedit.plugins.checkupdate.gschema.xml
plugins/externaltools/org.gnome.gedit.plugins.externaltools.gschema.xml
plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml
plugins/time/org.gnome.gedit.plugins.time.gschema.xml
440
po/Makefile.in
441
osx/bundle/data/Info.plist])
Paolo Borelli's avatar
Paolo Borelli committed
442

443
AC_OUTPUT
Paolo Borelli's avatar
Paolo Borelli committed
444 445 446 447 448 449 450

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
451
	Spell Plugin enabled:	$enable_spell
452
	Gvfs metadata enabled:	$enable_gvfs_metadata
453 454
	Deprecations enabled:	$enable_deprecations
	GObject Introspection:	$enable_introspection
455
	GDK Backend:            $gdk_windowing
456
	Python support:         $enable_python
Evan Nemerson's avatar
Evan Nemerson committed
457
	Vala support:           $enable_vala
Paolo Borelli's avatar
Paolo Borelli committed
458 459
"

460 461 462 463
if expr ${GEDIT_MINOR_VERSION} % 2 > /dev/null; then
	stable_version=`expr ${GEDIT_MINOR_VERSION} - 1`

cat << EOF
464
 *** IMPORTANT ***
465

466
This is an unstable version of gedit.
467 468 469 470 471 472 473 474
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:

Jeremy Bicha's avatar
Jeremy Bicha committed
475
  https://download.gnome.org/sources/gedit/${GEDIT_MAJOR_VERSION}.${stable_version}/
476

477
Or checkout the gnome-${GEDIT_MAJOR_VERSION}-${stable_version} branch of the gedit module from:
478

Jeremy Bicha's avatar
Jeremy Bicha committed
479
  https://gitlab.gnome.org/GNOME/gedit
480 481 482 483 484 485 486

Thanks,
The gedit team

 *** END OF WARNING ***
EOF

487
fi