configure.ac 11.8 KB
Newer Older
1
2
AC_PREREQ([2.69])

3
# Package version, the "human readable" version
Christian Persch's avatar
Christian Persch committed
4
m4_define([rsvg_major_version],[2])
5
m4_define([rsvg_minor_version],[53])
6
m4_define([rsvg_micro_version],[0]) # Keep this in sync with Cargo.toml and doc/librsvg.toml
7
m4_define([rsvg_version],[rsvg_major_version.rsvg_minor_version.rsvg_micro_version])
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Library version information.  To make a release:
#
# - rsvg_lt_revision += 1
#
# - Added interfaces?
#     rsvg_lt_current += 1
#     rsvg_lt_revision = 0
#     rsvg_lt_age += 1
#
# - Removed/changed interfaces?
#     Don't do that! (except for a major release, and only extra-carefully)
#     rsvg_lt_current += 1
#     rsvg_lt_revision = 0
#     rsvg_lt_age = 0
23
m4_define([rsvg_lt_current],[50])
24
m4_define([rsvg_lt_revision],[0])
25
m4_define([rsvg_lt_age],[48])
26
m4_define([rsvg_lt_version_info],rsvg_lt_current:rsvg_lt_revision:rsvg_lt_age)
Christian Persch's avatar
Christian Persch committed
27

28
AC_INIT([RSVG],[rsvg_version],[https://gitlab.gnome.org/GNOME/librsvg/issues],[librsvg])
Christian Persch's avatar
Christian Persch committed
29
30

AC_CONFIG_HEADERS([config.h])
31
AC_CONFIG_SRCDIR([include/librsvg/rsvg.h])
Evan Nemerson's avatar
Evan Nemerson committed
32
AC_CONFIG_MACRO_DIR([m4])
Christian Persch's avatar
Christian Persch committed
33

34
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz tar-ustar subdir-objects])
35
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36

Christian Persch's avatar
Christian Persch committed
37
38
AM_MAINTAINER_MODE([enable])

Christian Persch's avatar
Christian Persch committed
39
40
41
42
43
44
dnl ===========================================================================
dnl API versioning
dnl ===========================================================================

RSVG_API_VERSION=2.0
RSVG_API_MAJOR_VERSION=2
45
RSVG_API_MINOR_VERSION=0
Christian Persch's avatar
Christian Persch committed
46
47
48

AC_SUBST([RSVG_API_VERSION])
AC_SUBST([RSVG_API_MAJOR_VERSION])
49
50
AC_SUBST([RSVG_API_MINOR_VERSION])
AC_SUBST([RSVG_API_VERSION_U],[AS_TR_SH([$RSVG_API_VERSION])])
Christian Persch's avatar
Christian Persch committed
51

52
53
54
55
56
57
58
# ===========================================================================

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
59
dnl ===========================================================================
60
dnl Please update COMPILING.md with version numbers if these change
61
CAIRO_REQUIRED=1.16.0
62
63
dnl This corresponds to Freetype2 2.8
FREETYPE2_REQUIRED=20.0.14
64
GDK_PIXBUF_REQUIRED=2.20
65
GIO_REQUIRED=2.24.0
66
GLIB_REQUIRED=2.50.0
67
HARFBUZZ_REQUIRED=2.0.0
68
LIBXML_REQUIRED=2.9.0
69
PANGO_REQUIRED=1.46.0
70

Darin Adler's avatar
Darin Adler committed
71
72
dnl ===========================================================================

73
AC_PROG_MKDIR_P
Christian Persch's avatar
Christian Persch committed
74
AC_PROG_LN_S
75
76
AC_PROG_CC
AC_PROG_CPP
Ramiro Estrugo's avatar
Ramiro Estrugo committed
77
AC_PROG_AWK
78
AM_PROG_CC_C_O
79
80
# Check if -lcposix is required (for ISC UNIX)
AC_SEARCH_LIBS([strerror], [cposix])
Ramiro Estrugo's avatar
Ramiro Estrugo committed
81

Darin Adler's avatar
Darin Adler committed
82
83
AC_C_BIGENDIAN

84
PKG_PROG_PKG_CONFIG
85
86
87
AS_IF([test -z "$PKG_CONFIG"],
  [AC_MSG_WARN([pkg-config is needed for auto-configuration of dependencies])
   PKG_CONFIG=false])
88

89
90
91
LT_INIT([win32-dll])
LT_LIB_M

Tim Lunn's avatar
Tim Lunn committed
92
93
94
95
96
# 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
97
98
dnl ===========================================================================

Heiko Becker's avatar
Heiko Becker committed
99
AC_CHECK_TOOL(CARGO, [cargo], [no])
100
101
102
AS_IF(test x$CARGO = xno,
    AC_MSG_ERROR([cargo is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
)
Heiko Becker's avatar
Heiko Becker committed
103
AC_CHECK_TOOL(RUSTC, [rustc], [no])
104
105
106
107
AS_IF(test x$RUSTC = xno,
    AC_MSG_ERROR([rustc is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
)

108
dnl MSRV - Minimum Supported Rust Version
109
dnl If you change this, please update COMPILING.md
110
111
112
113
114
MINIMUM_RUST_VER=1.52
rust_version=`$RUSTC --version | sed -e 's/^rustc //g'`
AX_COMPARE_VERSION([$rust_version],[lt],[$MINIMUM_RUST_VER], [
    AC_MSG_ERROR([librsvg needs at least rustc version $MINIMUM_RUST_VER])
])
115

116
117
dnl Man page generator

118
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], [no])
119
120
121
122
AS_IF(test x$RST2MAN = xno,
    AC_MSG_ERROR([rst2man is required.  Please install python3-docutils.])
)

123
124
125
126
127
128
129
dnl Gi-docgen

AC_CHECK_TOOL(GI_DOCGEN, [gi-docgen], [no])
AS_IF(test x$GI_DOCGEN = xno,
    AC_MSG_ERROR([gi-docgen is required.  Please install it.])
)

130
131
dnl ===========================================================================

Dom Lachowicz's avatar
Dom Lachowicz committed
132
133
#AC_CANONICAL_HOST

Ismael Luceno's avatar
Ismael Luceno committed
134
135
136
137
138
139
140
141
142
143
144
145
146
AC_MSG_CHECKING([platform])
platform=POSIX
gio_backend=unix
AS_CASE(["$host"],
  [*-*-mingw*],  [platform=Windows gio_backend=windows],
  [*-*-cygwin*], [platform=Cygwin],
  [*-*-darwin*], [platform=Darwin],
)
AC_MSG_RESULT([$platform])
AM_CONDITIONAL(PLATFORM_WIN32,
    [test x"$platform" = xWindows || test x"$platform" = xCygwin])
AM_CONDITIONAL(OS_WIN32,  [test x"$platform" = xWindows])
AM_CONDITIONAL(OS_DARWIN, [test x"$platform" = xDarwin])
147
148
149

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

150
151
152
PKG_CHECK_MODULES(LIBRSVG,                     \
	cairo >= $CAIRO_REQUIRED               \
	cairo-png >= $CAIRO_REQUIRED           \
153
	cairo-gobject >= $CAIRO_REQUIRED       \
154
	freetype2 >= $FREETYPE2_REQUIRED       \
Christian Persch's avatar
Christian Persch committed
155
	gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED \
156
157
	gio-2.0 >= $GIO_REQUIRED               \
	glib-2.0 >= $GLIB_REQUIRED             \
158
	harfbuzz >= $HARFBUZZ_REQUIRED         \
159
160
	libxml-2.0 >= $LIBXML_REQUIRED         \
	pangocairo >= $PANGO_REQUIRED          \
161
162
	pangoft2 >= $PANGO_REQUIRED	       \
)
163

164
165
166
167
168
CAIRO_VERSION=`$PKG_CONFIG --modversion cairo`
PANGO_VERSION=`$PKG_CONFIG --modversion pangocairo`
FREETYPE_VERSION=`$PKG_CONFIG --modversion freetype2`
HARFBUZZ_VERSION=`$PKG_CONFIG --modversion harfbuzz`

169
170
PKG_CHECK_MODULES([GTHREAD],[gthread-2.0 >= $GLIB_REQUIRED])

171
172
PKG_CHECK_MODULES([GMODULE],[gmodule-2.0])

Ismael Luceno's avatar
Ismael Luceno committed
173
PKG_CHECK_MODULES([RSVG_CONVERT],[gio-2.0 "gio-${gio_backend}-2.0" gdk-pixbuf-2.0 cairo pangocairo])
174

Matthias Clasen's avatar
Matthias Clasen committed
175
176
GLIB_TESTS

177
178
179
180
181
182
183
184
185
186
187
188
AS_IF([test x"$platform" = xWindows], [
  ## Cannot use AC_CHECK_LIB to check for function with __stdcall
  ## calling convention.  Instead just check for the header and add the
  ## corresponding library to the linker flags.
  AC_CHECK_HEADER([winsock2.h], [WS2_32_LIBS=-lws2_32], [], [#include <windows.h>])
  LIBS="$LIBS $WS2_32_LIBS"
  AC_CHECK_HEADER([userenv.h], [USERENV_LIBS=-luserenv], [], [#include <windows.h>])
  LIBS="$LIBS $USERENV_LIBS"
  AC_CHECK_HEADER([bcrypt.h], [BCRYPT_LIBS=-lbcrypt], [], [#include <windows.h>])
  LIBS="$LIBS $BCRYPT_LIBS"
])

Christian Persch's avatar
Christian Persch committed
189
190
191
dnl ===========================================================================
dnl GDK-Pixbuf SVG loader
dnl ===========================================================================
192

Christian Persch's avatar
Christian Persch committed
193
194
195
196
197
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])
198

Christian Persch's avatar
Christian Persch committed
199
gdk_pixbuf_moduledir=
200
AS_IF([test "x$enable_pixbuf_loader" = "xyes"], [
Christian Persch's avatar
Christian Persch committed
201
202
  PKG_CHECK_MODULES([GDK_PIXBUF],[gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED])

203
  AC_PATH_PROGS([GDK_PIXBUF_QUERYLOADERS],[gdk-pixbuf-query-loaders gdk-pixbuf-query-loaders-64 gdk-pixbuf-query-loaders-32],[none])
Christian Persch's avatar
Christian Persch committed
204

205
  AS_IF([test "x$GDK_PIXBUF_QUERYLOADERS" = "xnone"], [
Christian Persch's avatar
Christian Persch committed
206
    AC_MSG_ERROR([gdk-pixbuf-query-loaders not found in path])
207
  ])
Christian Persch's avatar
Christian Persch committed
208
209
210
211
212
213

  # 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`
214
])
215

Christian Persch's avatar
Christian Persch committed
216
217
218
219
220
221
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"])
222

223
224
225
226
227
228
229
230
##########################################################
# 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])],
231
  [enable_Bsymbolic=no],[enable_Bsymbolic=auto])
232
233

BSYMBOLIC_LDFLAG=
234
AS_IF([test "x$enable_Bsymbolic" != "xno"], [
235
236
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
    [BSYMBOLIC_LDFLAG="-Wl,-Bsymbolic-functions"],
237
    [AS_IF([test "x$enable_Bsymbolic" = "xauto"], [
238
239
       AC_MSG_WARN([-Bsymbolic not supported by ld; disabling])
       enable_Bsymbolic=no
240
     ], [
241
       AC_MSG_ERROR([-Bsymbolic requested but not supported by ld. Use --disable-Bsymbolic to disable])
242
243
     ])])
])
244
245
246

AC_SUBST([BSYMBOLIC_LDFLAG])

Christian Persch's avatar
Christian Persch committed
247
AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
Christian Persch's avatar
Christian Persch committed
248
249
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
250
AC_SUBST([CAIRO_PREFIX],[$($PKG_CONFIG --variable=prefix cairo)])
251

252
253
254
255
256
dnl ===========================================================================
dnl Specify --enable-debug to make a development release.  By default,
dnl we build in public release mode.

AC_ARG_ENABLE(debug,
257
              AS_HELP_STRING([--enable-debug],
258
259
                             [Build Rust code with debugging information [default=no]]),
              [debug_release=$enableval],
260
261
262
	      [AS_CASE(["$LIBRSVG_DEBUG"],
		[yes], [debug_release=yes],
		[no|''], [debug_release=no])
263
	      ])
264
265

AC_MSG_CHECKING(whether to build Rust code with debugging information)
266
AS_IF([test "x$debug_release" = "xyes"], [
267
268
	AC_MSG_RESULT(yes)
	RUST_TARGET_SUBDIR=debug
269
], [
270
271
	AC_MSG_RESULT(no)
	RUST_TARGET_SUBDIR=release
272
])
273
274
AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"])

Fabrice Fontaine's avatar
Fabrice Fontaine committed
275
AC_ARG_VAR(RUST_TARGET, [Set rust target (default=$host)])
276
: ${RUST_TARGET:=$host}
Fabrice Fontaine's avatar
Fabrice Fontaine committed
277

278
279
AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
AS_IF([test "x$cross_compiling" = "xyes"], [
Fabrice Fontaine's avatar
Fabrice Fontaine committed
280
	RUST_TARGET_SUBDIR="$RUST_TARGET/$RUST_TARGET_SUBDIR"
281
])
282
283
AC_SUBST([RUST_TARGET_SUBDIR])

284
285
286
287
dnl ===========================================================================
dnl Build introspectable bindings

# No automagic please!
288
: ${enable_introspection:=yes}
289
290
291

GOBJECT_INTROSPECTION_CHECK([0.10.8])

Evan Nemerson's avatar
Evan Nemerson committed
292
293
294
# Vala bindings
VAPIGEN_CHECK([0.17.1.26],,,[no])

Darin Adler's avatar
Darin Adler committed
295
dnl ===========================================================================
Dom Lachowicz's avatar
Dom Lachowicz committed
296
297
298
299

m4_copy([AC_DEFUN],[glib_DEFUN])
glib_DEFUN([GLIB_LC_MESSAGES],
  [AC_CHECK_HEADERS([locale.h])
300
  AS_IF([test "x$ac_cv_header_locale_h" = xyes], [
Dom Lachowicz's avatar
Dom Lachowicz committed
301
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
302
303
304
305
      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]],
          [[return LC_MESSAGES]])],
	[am_cv_val_LC_MESSAGES=yes],
	[am_cv_val_LC_MESSAGES=no])])
306
    AS_IF([test "x$am_cv_val_LC_MESSAGES" = xyes], [
Dom Lachowicz's avatar
Dom Lachowicz committed
307
308
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
        [Define if your <locale.h> file defines LC_MESSAGES.])
309
  ])])])
Dom Lachowicz's avatar
Dom Lachowicz committed
310
311
312
313

GLIB_LC_MESSAGES

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

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

Christian Persch's avatar
Christian Persch committed
322
323
324
325
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])

326
AC_CONFIG_FILES([
327
include/librsvg/rsvg-version.h
328
Makefile
Tor Lillqvist's avatar
Tor Lillqvist committed
329
librsvg-zip
330
gdk-pixbuf-loader/Makefile
331
tests/Makefile
332
doc/Makefile
333
win32/Makefile
334
win32/config.h.win32
335
win32/config-msvc.mak
Dom Lachowicz's avatar
Dom Lachowicz committed
336
])
337

Christian Persch's avatar
Christian Persch committed
338
AC_CONFIG_FILES([librsvg-${RSVG_API_VERSION}.pc:librsvg.pc.in],[],[RSVG_API_VERSION=$RSVG_API_VERSION])
Christian Persch's avatar
Christian Persch committed
339

340
AC_OUTPUT
341

342
343
dnl =============================================================================================
echo "
Christian Persch's avatar
Christian Persch committed
344
librsvg-$VERSION
345
346

	prefix:                         ${prefix}
347
	C compiler:                     ${CC}
348
	rustc:                          rustc ${rust_version}
349

350
351
352
353
354
	Cairo version:                  ${CAIRO_VERSION}
	Pango version:                  ${PANGO_VERSION}
	Freetype version:               ${FREETYPE_VERSION}
	Harfbuzz version:               ${HARFBUZZ_VERSION}

355
356
        Debugging information for Rust: ${debug_release}

357
	Build introspectable bindings:  ${found_introspection}
Evan Nemerson's avatar
Evan Nemerson committed
358
	Build Vala bindings:            ${enable_vala}
359
360
	Build GdkPixbuf loader:         ${enable_pixbuf_loader}
"