configure.ac 12.7 KB
Newer Older
1
m4_define([rsvg_major_version],[2])
2
m4_define([rsvg_minor_version],[45])
3
m4_define([rsvg_micro_version],[0])
4
m4_define([rsvg_extra_version],[])
5 6 7
m4_define([rsvg_version],[rsvg_major_version.rsvg_minor_version.rsvg_micro_version()rsvg_extra_version])
m4_define([rsvg_lt_version_info],m4_eval(rsvg_major_version + rsvg_minor_version):rsvg_micro_version:rsvg_minor_version)

8
AC_INIT([RSVG],[rsvg_version],[https://gitlab.gnome.org/GNOME/librsvg/issues],[librsvg])
9 10

AC_CONFIG_HEADERS([config.h])
11
AC_CONFIG_SRCDIR([librsvg/rsvg.h])
Evan Nemerson's avatar
Evan Nemerson committed
12
AC_CONFIG_MACRO_DIR([m4])
13

14
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz tar-ustar subdir-objects])
15
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
16

17 18
AM_MAINTAINER_MODE([enable])

19 20 21 22 23 24
dnl ===========================================================================
dnl API versioning
dnl ===========================================================================

RSVG_API_VERSION=2.0
RSVG_API_MAJOR_VERSION=2
25
RSVG_API_MINOR_VERSION=0
26 27 28

AC_SUBST([RSVG_API_VERSION])
AC_SUBST([RSVG_API_MAJOR_VERSION])
29 30
AC_SUBST([RSVG_API_MINOR_VERSION])
AC_SUBST([RSVG_API_VERSION_U],[AS_TR_SH([$RSVG_API_VERSION])])
31

32 33 34 35 36 37 38
# ===========================================================================

AC_SUBST([RSVG_LT_VERSION_INFO],[rsvg_lt_version_info])
AC_SUBST([LIBRSVG_MAJOR_VERSION],[rsvg_major_version])
AC_SUBST([LIBRSVG_MINOR_VERSION],[rsvg_minor_version])
AC_SUBST([LIBRSVG_MICRO_VERSION],[rsvg_micro_version])

Darin Adler's avatar
Darin Adler committed
39
dnl ===========================================================================
40
dnl Please update COMPILING.md with version numbers if these change
41
CAIRO_REQUIRED=1.15.12
42 43 44
CROCO_REQUIRED=0.6.1
dnl This corresponds to Freetype2 2.8
FREETYPE2_REQUIRED=20.0.14
45
GDK_PIXBUF_REQUIRED=2.20
46
GIO_REQUIRED=2.24.0
47
GLIB_REQUIRED=2.48.0
48
GTK3_REQUIRED=3.10.0
49 50
LIBXML_REQUIRED=2.9.0
PANGO_REQUIRED=1.38.0
51

Darin Adler's avatar
Darin Adler committed
52 53
dnl ===========================================================================

54
AC_PROG_LN_S
Ramiro Estrugo's avatar
Ramiro Estrugo committed
55
AC_ISC_POSIX
56 57
AC_PROG_CC
AC_PROG_CPP
Ramiro Estrugo's avatar
Ramiro Estrugo committed
58 59
AC_PROG_AWK
AC_STDC_HEADERS
60
AM_PROG_CC_C_O
Ramiro Estrugo's avatar
Ramiro Estrugo committed
61

Darin Adler's avatar
Darin Adler committed
62 63
AC_C_BIGENDIAN

64 65
PKG_PROG_PKG_CONFIG

66 67 68
LT_INIT([win32-dll])
LT_LIB_M

69 70 71 72 73
# Check if -ldl is needed to use dlopen()
AC_CHECK_FUNC(dlopen, [],
              [AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS=-ldl])])
AC_SUBST(DLOPEN_LIBS)

Darin Adler's avatar
Darin Adler committed
74 75
dnl ===========================================================================

76 77 78 79 80 81 82 83 84
AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
AS_IF(test x$CARGO = xno,
    AC_MSG_ERROR([cargo is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
)
AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
AS_IF(test x$RUSTC = xno,
    AC_MSG_ERROR([rustc is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
)

85
dnl Minimum version of rustc that we support
86
dnl If you change this, please update COMPILING.md
87
MINIMUM_RUST_MAJOR=1
88
MINIMUM_RUST_MINOR=27
89 90 91 92 93 94 95 96 97 98

rust_version=`rustc --version`
version=`echo "$rust_version" | sed -e 's/^rustc //g'`
major=`echo "$version" | cut -d. -f1`
minor=`echo "$version" | cut -d. -f2`

AS_IF(test "$major" -lt "$MINIMUM_RUST_MAJOR" -o "$minor" -lt "$MINIMUM_RUST_MINOR",
    AC_MSG_ERROR([librsvg needs at rustc version at least $MINIMUM_RUST_MAJOR.$MINIMUM_RUST_MINOR])
)

99 100
dnl ===========================================================================

101 102 103 104 105 106 107 108 109 110 111 112 113 114
#AC_CANONICAL_HOST

AC_MSG_CHECKING([for some Win32 platform])
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")

115 116 117 118 119 120 121 122 123 124 125 126
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    native_win32=yes
    ;;
  *)
    native_win32=no
    ;;
esac
AC_MSG_RESULT([$native_win32])
AM_CONDITIONAL(OS_WIN32, test "$native_win32" = "yes")

127 128
dnl ===========================================================================

129 130 131
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)

132 133 134 135
PKG_CHECK_MODULES(LIBRSVG,                     \
	cairo >= $CAIRO_REQUIRED               \
	cairo-png >= $CAIRO_REQUIRED           \
	freetype2 >= $FREETYPE2_REQUIRED       \
136
	gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED \
137 138 139 140 141
	gio-2.0 >= $GIO_REQUIRED               \
	glib-2.0 >= $GLIB_REQUIRED             \
	libxml-2.0 >= $LIBXML_REQUIRED         \
	pangocairo >= $PANGO_REQUIRED          \
	pangoft2 >= $PANGO_REQUIRED            \
142
        libcroco-0.6 >= $CROCO_REQUIRED)
143

144 145
PKG_CHECK_MODULES([GTHREAD],[gthread-2.0 >= $GLIB_REQUIRED])

146 147
PKG_CHECK_MODULES([GMODULE],[gmodule-2.0])

148 149 150 151 152 153 154 155
case "$host" in
  *-*-mingw*)
    PKG_CHECK_MODULES([RSVG_CONVERT],[gio-2.0 gio-windows-2.0 gdk-pixbuf-2.0 cairo pangocairo])
    ;;
  *)
    PKG_CHECK_MODULES([RSVG_CONVERT],[gio-2.0 gio-unix-2.0 gdk-pixbuf-2.0 cairo pangocairo])
    ;;
esac
156

Matthias Clasen's avatar
Matthias Clasen committed
157 158
GLIB_TESTS

159 160 161
# ===========================================================================
# GTK
# ===========================================================================
162

163
PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= $GTK3_REQUIRED],[have_gtk_3=yes],[have_gtk_3=no])
164 165 166

GTK3_BINARY_VERSION=

167 168
if test "$have_gtk_3" = "yes"; then
    GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`"
169 170
fi

171
AC_SUBST([GTK3_BINARY_VERSION])
172

173 174 175 176 177
AM_CONDITIONAL([HAVE_GTK_3],[test "$have_gtk_3" = "yes"])

dnl ===========================================================================
dnl GDK-Pixbuf SVG loader
dnl ===========================================================================
178

179 180 181 182 183
AC_MSG_CHECKING([whether to build the GDK-Pixbuf SVG loader])
AC_ARG_ENABLE([pixbuf-loader],
  [AS_HELP_STRING([--disable-pixbuf-loader],[Disable a RSVG based GdkPixbuf loader (default=yes)])],
  [],[enable_pixbuf_loader=yes])
AC_MSG_RESULT([$enable_pixbuf_loader])
184

185 186 187 188
gdk_pixbuf_moduledir=
if test "$enable_pixbuf_loader" = "yes"; then
  PKG_CHECK_MODULES([GDK_PIXBUF],[gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED])

189
  AC_PATH_PROGS([GDK_PIXBUF_QUERYLOADERS],[gdk-pixbuf-query-loaders gdk-pixbuf-query-loaders-64 gdk-pixbuf-query-loaders-32],[none])
190 191 192 193 194 195 196 197 198 199

  if test "x$GDK_PIXBUF_QUERYLOADERS" = "xnone"; then
    AC_MSG_ERROR([gdk-pixbuf-query-loaders not found in path])
  fi

  # First try the standalone gdk-pixbuf
  gdk_pixbuf_binary_version="`$PKG_CONFIG --variable=gdk_pixbuf_binary_version gdk-pixbuf-2.0`"
  gdk_pixbuf_binarydir="`$PKG_CONFIG --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0`"
  gdk_pixbuf_moduledir=`$PKG_CONFIG --variable gdk_pixbuf_moduledir gdk-pixbuf-2.0`
  gdk_pixbuf_cache_file=`$PKG_CONFIG --variable gdk_pixbuf_cache_file gdk-pixbuf-2.0`
200 201
fi

202 203 204 205 206 207
AC_SUBST([gdk_pixbuf_binary_version])
AC_SUBST([gdk_pixbuf_binarydir])
AC_SUBST([gdk_pixbuf_moduledir])
AC_SUBST([gdk_pixbuf_cache_file])

AM_CONDITIONAL([ENABLE_PIXBUF_LOADER],[test "$enable_pixbuf_loader" = "yes"])
208

209 210 211 212 213 214 215 216
##########################################################
# Check for -Bsymbolic-functions linker flag used to avoid
# intra-library PLT jumps, if available.
##########################################################

AC_ARG_ENABLE([Bsymbolic],
  [AS_HELP_STRING([--disable-Bsymbolic],
                  [disable linking with -Bsymbolic])],
217
  [enable_Bsymbolic=no],[enable_Bsymbolic=auto])
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232

BSYMBOLIC_LDFLAG=
if test "$enable_Bsymbolic" != "no"; then
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
    [BSYMBOLIC_LDFLAG="-Wl,-Bsymbolic-functions"],
    [if test "$enable_Bsymbolic" = "auto"; then
       AC_MSG_WARN([-Bsymbolic not supported by ld; disabling])
       enable_Bsymbolic=no
     else
       AC_MSG_ERROR([-Bsymbolic requested but not supported by ld. Use --disable-Bsymbolic to disable])
     fi])
fi

AC_SUBST([BSYMBOLIC_LDFLAG])

233 234 235
##################################################
# Checks for gtk-doc and docbook-tools
##################################################
Christian Persch's avatar
Christian Persch committed
236 237 238 239

GTK_DOC_CHECK([1.13],[--flavour no-tmpl])

AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
240 241
AC_SUBST([GDK_PIXBUF_PREFIX],[$($PKG_CONFIG --variable=prefix gdk-pixbuf-2.0)])
AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gdk-pixbuf-2.0)])
Christian Persch's avatar
Christian Persch committed
242
AC_SUBST([CAIRO_PREFIX],[$($PKG_CONFIG --variable=prefix cairo)])
243

244
dnl ===========================================================================
Matthias Clasen's avatar
Matthias Clasen committed
245
dnl Do we build the miscellaneous tools provided with librsvg ?
246 247 248

AC_ARG_ENABLE(tools,
              AC_HELP_STRING([--disable-tools],
Matthias Clasen's avatar
Matthias Clasen committed
249
                             [do not build miscellaneous tools [default=no]]),
250 251 252
              [build_misc_tools=$enableval],
              [build_misc_tools=yes])

Matthias Clasen's avatar
Matthias Clasen committed
253
AC_MSG_CHECKING(whether to build miscellaneous tools)
254 255 256 257 258 259 260
if test "x$build_misc_tools" = "xyes" ; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([BUILD_MISC_TOOLS], [test "x$build_misc_tools" = "xyes"])

261 262 263 264 265 266 267 268
dnl ===========================================================================
dnl Specify --enable-debug to make a development release.  By default,
dnl we build in public release mode.

AC_ARG_ENABLE(debug,
              AC_HELP_STRING([--enable-debug],
                             [Build Rust code with debugging information [default=no]]),
              [debug_release=$enableval],
269 270 271 272 273 274 275 276 277
	      [
	        if test "x$LIBRSVG_DEBUG" == "x"; then
		  debug_release="no"
		elif test "x$LIBRSVG_DEBUG" = "xyes"; then
		  debug_release="yes"
		elif test "x$LIBRSVG_DEBUG" = "xno"; then
		  debug_release="no"
		fi
	      ])
278 279 280 281 282 283 284 285 286 287 288

AC_MSG_CHECKING(whether to build Rust code with debugging information)
if test "x$debug_release" = "xyes" ; then
	AC_MSG_RESULT(yes)
	RUST_TARGET_SUBDIR=debug
else
	AC_MSG_RESULT(no)
	RUST_TARGET_SUBDIR=release
fi
AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"])

289 290 291 292 293
AC_ARG_VAR(RUST_TARGET, [Set rust target (default=$host)])
if test "x$RUST_TARGET" == x; then
	RUST_TARGET=$host
fi

294
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
295
if test "x$cross_compiling" = "xyes" ; then
296
	RUST_TARGET_SUBDIR="$RUST_TARGET/$RUST_TARGET_SUBDIR"
297
fi
298 299
AC_SUBST([RUST_TARGET_SUBDIR])

300 301 302 303 304
dnl ===========================================================================
dnl Build introspectable bindings

# No automagic please!
if test -z "$enable_introspection"; then
305
  enable_introspection=yes
306 307 308 309
fi

GOBJECT_INTROSPECTION_CHECK([0.10.8])

Evan Nemerson's avatar
Evan Nemerson committed
310 311 312
# Vala bindings
VAPIGEN_CHECK([0.17.1.26],,,[no])

Darin Adler's avatar
Darin Adler committed
313
dnl ===========================================================================
Dom Lachowicz's avatar
Dom Lachowicz committed
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330

m4_copy([AC_DEFUN],[glib_DEFUN])
glib_DEFUN([GLIB_LC_MESSAGES],
  [AC_CHECK_HEADERS([locale.h])
    if test $ac_cv_header_locale_h = yes; then
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
    if test $am_cv_val_LC_MESSAGES = yes; then
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
        [Define if your <locale.h> file defines LC_MESSAGES.])
    fi
  fi])

GLIB_LC_MESSAGES

dnl ===========================================================================
Darin Adler's avatar
Darin Adler committed
331

332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
# Check for pangoft2 and fontconfig, which is optional on Windows

PKG_CHECK_MODULES([PANGOFT2],[pangoft2 >= $PANGO_REQUIRED],[have_pangoft2=yes],[have_pangoft2=no])
PKG_CHECK_MODULES([FONTCONFIG],[fontconfig],[have_fontconfig=yes],[have_fontconfig=no])

if test "x$native_win32" != "xyes"; then
  if test "x$have_pangoft2" != "xyes" -o "x$have_fontconfig" != "xyes"; then
    AC_MSG_ERROR([pangoft2 and fontconfig are required for non-Windows platforms.])
  fi
fi

if test "x$have_pangoft2" = "xyes" -a "x$have_fontconfig" = "xyes"; then
  AC_DEFINE(HAVE_PANGOFT2, 1, [Have the pangoft2 library])
fi

dnl ===========================================================================

349 350 351 352 353 354 355
# Check whether MSVC toolset is explicitly set

AM_CONDITIONAL(MSVC_BASE_NO_TOOLSET_SET, [test x$MSVC_BASE_TOOLSET = x])
AM_CONDITIONAL(MSVC_NO_TOOLSET_SET, [test x$MSVC_TOOLSET = x])

dnl ===========================================================================

356 357 358 359
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])

360
AC_CONFIG_FILES([
361
librsvg/librsvg-features.h
362
Makefile
Tor Lillqvist's avatar
Tor Lillqvist committed
363
librsvg-zip
364
gdk-pixbuf-loader/Makefile
365
tests/Makefile
366
tools/Makefile
367
doc/Makefile
Christian Persch's avatar
Christian Persch committed
368
doc/version.xml
369
config.h.win32
370 371
win32/Makefile
win32/vs12/Makefile
372
win32/vs12/rsvg-version-paths.props
373 374
win32/vs14/Makefile
win32/vs15/Makefile
375
])
376

Christian Persch's avatar
Christian Persch committed
377 378
AC_CONFIG_FILES([librsvg-${RSVG_API_VERSION}.pc:librsvg.pc.in],[],[RSVG_API_VERSION=$RSVG_API_VERSION])
AC_CONFIG_FILES([librsvg-${RSVG_API_VERSION}-uninstalled.pc:librsvg-uninstalled.pc.in],[],[RSVG_API_VERSION=$RSVG_API_VERSION])
379

380
AC_OUTPUT
381

382 383
dnl =============================================================================================
echo "
384
librsvg-$VERSION
385 386

	prefix:                         ${prefix}
387 388
	C compiler:                     ${CC}
	rustc:                          ${rust_version}
389 390 391

        Debugging information for Rust: ${debug_release}

392
	Build introspectable bindings:  ${found_introspection}
Evan Nemerson's avatar
Evan Nemerson committed
393
	Build Vala bindings:            ${enable_vala}
394
	Build GdkPixbuf loader:         ${enable_pixbuf_loader}
395
        GTK+ $GTK3_REQUIRED or later:           ${have_gtk_3}
Matthias Clasen's avatar
Matthias Clasen committed
396
	Build miscellaneous tools:      ${build_misc_tools}
397
	Build HTML documentation:       ${enable_gtk_doc}
398
"