diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 90bec4233..fc4337fe5 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -545,12 +545,15 @@ fi # OT-SVG checks # Librsvg is the default for now! AC_ARG_WITH([svg], - [AS_HELP_STRING([--with-svg=@<:@yes|no|auto@:>@], + [AS_HELP_STRING([--with-svg=@<:@yes|no|auto|no-default@:>@], [support OpenType SVG fonts @<:@default=auto@:>@])], [], [with_svg=auto]) have_librsvg=no -if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then +have_librsvg_simple=no +with_svg_simple=no +if test x"$with_svg" = xyes -o x"$with_svg" = xauto; then + with_svg_simple=yes librsvg_pkg="librsvg-2.0 >= 2.40.0" have_librsvg_pkg=no @@ -558,7 +561,7 @@ if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then PKG_CHECK_EXISTS([$librsvg_pkg], [have_librsvg_pkg=yes]) fi PKG_CHECK_MODULES([LIBRSVG], [$librsvg_pkg], - [have_librsvg="yes (pkg-config)"], [:]) + [have_librsvg="yes (pkg-config)";have_librsvg_simple="yes"], [:]) if test $have_librsvg_pkg = yes; then # we have librsvg pkg-config file @@ -573,10 +576,16 @@ if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then librsvg_libspriv="$LIBRSVG_LIBS" librsvg_libsstaticconf="$LIBRSVG_LIBS" have_librsvg="yes (LIBRSVG_CFLAGS and LIBRSVG_LIBS)" + have_librsvg_simple="yes" fi fi +elif test x"$with_svg" = x"no-default"; then + have_librsvg="no-default" + have_librsvg_simple="no" + with_svg_simple="no-default" +else + with_svg_simple="no" fi - # check for librt # # We need `clock_gettime' for the `ftbench' demo program. @@ -1122,15 +1131,24 @@ else ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi -if test "$have_librsvg" != no; then +COMPILE_SVG_PORT=no +if test "$have_librsvg_simple" = yes -a "$with_svg_simple" = yes; then LIBRSVG_CFLAGS=$(echo $LIBRSVG_CFLAGS | sed -e 's/-I\(.*\?\)freetype2//g') CFLAGS="$CFLAGS $LIBRSVG_CFLAGS" LDFLAGS="$LDFLAGS $LIBRSVG_LIBS" - ftoption_set FT_CONFIG_OPTION_SVG_DEFAULT + COMPILE_SVG_PORT=yes + ftoption_set FT_CONFIG_OPTION_SVG + ftoption_set FT_CONFIG_OPTION_DEFAULT_SVG +elif test "$with_svg_simple" = "no"; then + ftoption_unset FT_CONFIG_OPTION_SVG + ftoption_unset FT_CONFIG_OPTION_DEFAULT_SVG else - ftoption_unset FT_CONFIG_OPTION_SVG_DEFAULT + COMPILE_SVG_PORT=no + ftoption_set FT_CONFIG_OPTION_SVG + ftoption_unset FT_CONFIG_OPTION_DEFAULT_SVG fi +AC_SUBST([COMPILE_SVG_PORT]) AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) @@ -1176,6 +1194,7 @@ Library configuration: bzip2: $have_bzip2 libpng: $have_libpng harfbuzz: $have_harfbuzz + svg support: $have_librsvg ]) # Warn if docwriter is not installed diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in index ed51fde34..6331845ea 100644 --- a/builds/unix/unix-cc.in +++ b/builds/unix/unix-cc.in @@ -81,6 +81,8 @@ T := -o$(space) CPPFLAGS := @CPPFLAGS@ CFLAGS := -c @XX_CFLAGS@ @CFLAGS@ -DFT_CONFIG_CONFIG_H="" +COMPILE_SVG_PORT := @COMPILE_SVG_PORT@ + # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. # ANSIFLAGS := @XX_ANSIFLAGS@ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 6d5739159..fb8d2363b 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -493,6 +493,8 @@ FT_BEGIN_HEADER #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS + + /************************************************************************** * * OpenType SVG Glyph Support @@ -501,8 +503,7 @@ FT_BEGIN_HEADER */ #define FT_CONFIG_OPTION_SVG -/* #define FT_CONFIG_OPTION_SVG_DEFAULT */ - +/* #define FT_CONFIG_OPTION_DEFAULT_SVG */ /************************************************************************** * diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c index df0a702c6..cca8d45bb 100644 --- a/src/svg/ftsvg.c +++ b/src/svg/ftsvg.c @@ -21,7 +21,7 @@ #include FT_SVG_RENDER_H #include FT_BBOX_H -#ifdef FT_CONFIG_OPTION_SVG_DEFAULT +#ifdef FT_CONFIG_OPTION_DEFAULT_SVG #include #endif #include @@ -34,7 +34,7 @@ { FT_Error error = FT_Err_Ok; svg_module->loaded = FALSE; -#ifdef FT_CONFIG_OPTION_SVG_DEFAULT +#ifdef FT_CONFIG_OPTION_DEFAULT_SVG svg_module->hooks.init_svg = (SVG_Lib_Init_Func)rsvg_port_init; svg_module->hooks.free_svg = (SVG_Lib_Free_Func)rsvg_port_free; svg_module->hooks.render_svg = (SVG_Lib_Render_Func)rsvg_port_render; diff --git a/src/svg/rules.mk b/src/svg/rules.mk index c5e5ed95a..33703d594 100644 --- a/src/svg/rules.mk +++ b/src/svg/rules.mk @@ -60,8 +60,10 @@ SVG_DRV_SRC_S := $(SVG_DIR)/svg.c SVG_PORT_SRC_S := $(SVG_DIR)/rsvg_port.c SVG_PORT_OBJ_S := $(OBJ_DIR)/rsvg_port.$O +ifeq ($(COMPILE_SVG_PORT), yes) $(SVG_PORT_OBJ_S): $(SVG_PORT_SRC_S) $(FREETYPE_H) $(SVG_PORT_COMPILE) $T$(subst /,$(COMPILER_SEP), $@ $(SVG_PORT_SRC_S)) +endif $(SVG_DRV_OBJ_S): $(SVG_DRV_SRC_S) $(SVG_DRV_SRC) \ $(FREETYPE_H) $(SVG_DRV_H) @@ -79,6 +81,8 @@ $(OBJ_DIR)/%.$O: $(SVG_DIR)/%.c $(FREETYPE_H) $(SVG_DRV_H) DRV_OBJS_S += $(SVG_DRV_OBJ_S) DRV_OBJS_M += $(SVG_DRV_OBJ_M) +ifeq ($(COMPILE_SVG_PORT), yes) DRV_OBJS_S += $(SVG_PORT_OBJ_S) +endif # EOF