AC_ARG_ENABLE(svg2png-scaling-flag, [ --enable-svg2png-scaling-flag enable conversion of flag svgs to pngs with specified sizes], SVG2PNG_SCALES_FLAG=$enableval, SVG2PNG_SCALES_FLAG="")
AC_ARG_ENABLE(svg2png-scaling-nav, [ --enable-svg2png-scaling-nav enable conversion of nav svgs to pngs with specified sizes], SVG2PNG_SCALES_NAV=$enableval, SVG2PNG_SCALES_NAV="")
if test "x${enable_svg2png}" = "xyes" ; then
- AC_PATH_PROG([KSVGTOPNG], [ksvgtopng], [])
- if test ! -x "$KSVGTOPNG"; then
- enable_svg2png="no"
- fi
+ AC_PATH_PROGS([SVG2PNG], [ksvgtopng ksvgtopng4 rsvg-convert inkscape], [none])
+ if test "x${SVG2PNG}" = "xnone"; then
+ enable_svg2png="no"
+ fi
fi
+AC_SUBST(SVG2PNG)
AC_SUBST(SVG2PNG_SCALES)
AC_SUBST(SVG2PNG_SCALES_FLAG)
AC_SUBST(SVG2PNG_SCALES_NAV)
if USE_SVG2PNG
%.png:$(srcdir)/*.svg
- SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "$@"
+ SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "@SVG2PNG@" "$@"
xpm_DATA += $(addsuffix .png,$(basename $(svgs)))
xsize=$(firstword $(subst x, ,$(scale)))
ysize=$(lastword $(subst x, ,$(scale)))
#! /bin/bash
+
+function svgtopng
+{
+ case $svgtopng in
+ *ksvgtopng|*ksvgtopng4)
+ $svgtopng $*
+ ;;
+ *rsvg-convert)
+ $svgtopng --width=$1 --height=$2 --output $4 $3
+ ;;
+ *inkscape)
+ $svgtopng --without-gui --export-width=$1 --export-height=$2 --export-png=$4 $3
+ ;;
+ esac
+}
+
ulimit -t 5
-png=$1
+svgtopng=$1
+png=$2
if [[ "$png" = *_[1-9]*_[1-9]*.png ]];
then
svg=${png%_*_*.png};
then
h=$(grep 'height="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*height="//' -e 's/[pxt]*".*//')
fi
- ksvgtopng $w $h $svg.svg $png
+ svgtopng $w $h $svg.svg $png
elif [ -f $svg.svgz ]
then
gzip -dc <$svg.svgz >$svg.svg
- ksvgtopng $w $h $svg.svg $png
+ svgtopng $w $h $svg.svg $png
rm -f $svg.svg
fi
fi