configure.ac 11.3 KB
Newer Older
1
m4_define([rsvg_major_version],[2])
2
m4_define([rsvg_minor_version],[41])
3
m4_define([rsvg_micro_version],[2])
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://bugzilla.gnome.org/enter_bug.cgi?product=librsvg],[librsvg])
9 10 11

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([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])
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 40
dnl ===========================================================================

41
GLIB_REQUIRED=2.12.0
Christian Persch's avatar
Christian Persch committed
42
GIO_REQUIRED=2.24.0
43
LIBXML_REQUIRED=2.9.0
Dom Lachowicz's avatar
Dom Lachowicz committed
44
CAIRO_REQUIRED=1.2.0
45
PANGO_REQUIRED=1.38.0
46
GDK_PIXBUF_REQUIRED=2.20
47
GTK3_REQUIRED=3.10.0
48
CROCO_REQUIRED=0.6.1
49

Darin Adler's avatar
Darin Adler committed
50 51
dnl ===========================================================================

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

Darin Adler's avatar
Darin Adler committed
60 61
AC_C_BIGENDIAN

62 63
PKG_PROG_PKG_CONFIG

64 65 66
LT_INIT([win32-dll])
LT_LIB_M

Darin Adler's avatar
Darin Adler committed
67 68
dnl ===========================================================================

69 70 71 72 73 74 75 76 77 78 79
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/])
)

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

80 81 82 83 84 85 86 87 88 89 90 91 92 93
#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")

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

106 107
dnl ===========================================================================

108 109 110
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)

111
PKG_CHECK_MODULES(LIBRSVG, \
112
	gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED \
113
	glib-2.0 >= $GLIB_REQUIRED \
Christian Persch's avatar
Christian Persch committed
114
	gio-2.0 >= $GIO_REQUIRED \
115
	libxml-2.0 >= $LIBXML_REQUIRED \
116 117
	pangocairo >= $PANGO_REQUIRED \
	pangoft2 >= $PANGO_REQUIRED \
118
	cairo >= $CAIRO_REQUIRED \
119 120
	cairo-png >= $CAIRO_REQUIRED
        libcroco-0.6 >= $CROCO_REQUIRED)
121

122 123
PKG_CHECK_MODULES([GTHREAD],[gthread-2.0 >= $GLIB_REQUIRED])

124 125
PKG_CHECK_MODULES([GMODULE],[gmodule-2.0])

126 127 128 129 130 131 132 133
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
134

Matthias Clasen's avatar
Matthias Clasen committed
135 136
GLIB_TESTS

Darin Adler's avatar
Darin Adler committed
137
dnl ===========================================================================
Ramiro Estrugo's avatar
Ramiro Estrugo committed
138

139
AC_CHECK_FUNCS(strtok_r)
140

141 142 143
# ===========================================================================
# GTK
# ===========================================================================
144

145
PKG_CHECK_MODULES([GTK3],[gtk+-3.0 >= $GTK3_REQUIRED],[have_gtk_3=yes],[have_gtk_3=no])
146 147 148

GTK3_BINARY_VERSION=

149 150
if test "$have_gtk_3" = "yes"; then
    GTK3_BINARY_VERSION="`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`"
151 152
fi

153
AC_SUBST([GTK3_BINARY_VERSION])
154

155 156 157 158 159
AM_CONDITIONAL([HAVE_GTK_3],[test "$have_gtk_3" = "yes"])

dnl ===========================================================================
dnl GDK-Pixbuf SVG loader
dnl ===========================================================================
160

161 162 163 164 165
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])
166

167 168 169 170
gdk_pixbuf_moduledir=
if test "$enable_pixbuf_loader" = "yes"; then
  PKG_CHECK_MODULES([GDK_PIXBUF],[gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED])

171
  AC_PATH_PROGS([GDK_PIXBUF_QUERYLOADERS],[gdk-pixbuf-query-loaders gdk-pixbuf-query-loaders-64 gdk-pixbuf-query-loaders-32],[none])
172 173 174 175 176 177 178 179 180 181

  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`
182 183
fi

184 185 186 187 188 189
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"])
190

191 192
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)

193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 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])],
  [],[enable_Bsymbolic=yes])

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])

217 218 219
##################################################
# Checks for gtk-doc and docbook-tools
##################################################
Christian Persch's avatar
Christian Persch committed
220 221 222 223

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

AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
224 225
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
226
AC_SUBST([CAIRO_PREFIX],[$($PKG_CONFIG --variable=prefix cairo)])
227

228
dnl ===========================================================================
Matthias Clasen's avatar
Matthias Clasen committed
229
dnl Do we build the miscellaneous tools provided with librsvg ?
230 231 232

AC_ARG_ENABLE(tools,
              AC_HELP_STRING([--disable-tools],
Matthias Clasen's avatar
Matthias Clasen committed
233
                             [do not build miscellaneous tools [default=no]]),
234 235 236
              [build_misc_tools=$enableval],
              [build_misc_tools=yes])

Matthias Clasen's avatar
Matthias Clasen committed
237
AC_MSG_CHECKING(whether to build miscellaneous tools)
238 239 240 241 242 243 244
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"])

245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
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],
	      [debug_release=no])

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"])

AC_SUBST([RUST_TARGET_SUBDIR])

267 268 269 270 271
dnl ===========================================================================
dnl Build introspectable bindings

# No automagic please!
if test -z "$enable_introspection"; then
272
  enable_introspection=yes
273 274 275 276
fi

GOBJECT_INTROSPECTION_CHECK([0.10.8])

Evan Nemerson's avatar
Evan Nemerson committed
277 278 279
# Vala bindings
VAPIGEN_CHECK([0.17.1.26],,,[no])

Darin Adler's avatar
Darin Adler committed
280
dnl ===========================================================================
Dom Lachowicz's avatar
Dom Lachowicz committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297

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
298

299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
# 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 ===========================================================================

316 317 318 319 320 321 322
# 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 ===========================================================================

323 324 325 326
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])

327
AC_CONFIG_FILES([
328 329
librsvg-features.h
Makefile
Tor Lillqvist's avatar
Tor Lillqvist committed
330
librsvg-zip
331
gdk-pixbuf-loader/Makefile
332
tests/Makefile
333
tools/Makefile
334
doc/Makefile
Christian Persch's avatar
Christian Persch committed
335
doc/version.xml
336
config.h.win32
337 338
win32/Makefile
win32/vs12/Makefile
339
win32/vs12/rsvg-version-paths.props
340 341
win32/vs14/Makefile
win32/vs15/Makefile
342
])
343

Christian Persch's avatar
Christian Persch committed
344 345
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])
346

347
AC_OUTPUT
348

349 350
dnl =============================================================================================
echo "
351
librsvg-$VERSION
352 353 354

	prefix:                         ${prefix}
	compiler:                       ${CC}
355 356 357

        Debugging information for Rust: ${debug_release}

358
	Build introspectable bindings:  ${found_introspection}
Evan Nemerson's avatar
Evan Nemerson committed
359
	Build Vala bindings:            ${enable_vala}
360
	Build GdkPixbuf loader:         ${enable_pixbuf_loader}
361
        GTK+ $GTK3_REQUIRED or later:           ${have_gtk_3}
Matthias Clasen's avatar
Matthias Clasen committed
362
	Build miscellaneous tools:      ${build_misc_tools}
363
"