configure.in 12.3 KB
Newer Older
1
AC_INIT(rsvg.h)
2

Darin Adler's avatar
Darin Adler committed
3 4
dnl ===========================================================================

5
GDK_PIXBUF_REQUIRED=1.3.7
Alexander Larsson's avatar
Alexander Larsson committed
6
GLIB_REQUIRED=2.0.0
7
LIBART_REQUIRED=2.3.10
Alexander Larsson's avatar
Alexander Larsson committed
8
LIBXML_REQUIRED=2.4.7
9
PANGOFT2_REQUIRED=1.2.0
10 11 12 13
POPT_REQUIRED=1.5

AC_SUBST(GDK_PIXBUF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
14 15
AC_SUBST(LIBART_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
16 17 18 19 20
AC_SUBST(PANGOFT2_REQUIRED)
AC_SUBST(POPT_REQUIRED)

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

Alexander Larsson's avatar
Alexander Larsson committed
21
LIBRSVG_MAJOR_VERSION=2
Dom Lachowicz's avatar
Dom Lachowicz committed
22
LIBRSVG_MINOR_VERSION=9
Dom Lachowicz's avatar
Dom Lachowicz committed
23
LIBRSVG_MICRO_VERSION=5
24 25 26 27
AC_SUBST(LIBRSVG_MAJOR_VERSION)
AC_SUBST(LIBRSVG_MINOR_VERSION)
AC_SUBST(LIBRSVG_MICRO_VERSION)

Dom Lachowicz's avatar
Dom Lachowicz committed
28
LIBRSVG_VERSION=$LIBRSVG_MAJOR_VERSION.$LIBRSVG_MINOR_VERSION.$LIBRSVG_MICRO_VERSION
29

30 31
VERSION_INFO=`expr $LIBRSVG_MAJOR_VERSION + $LIBRSVG_MINOR_VERSION`:$LIBRSVG_MICRO_VERSION:$LIBRSVG_MINOR_VERSION
AC_SUBST(VERSION_INFO)
32

Darin Adler's avatar
Darin Adler committed
33 34
dnl ===========================================================================

35 36 37
AM_INIT_AUTOMAKE(librsvg, $LIBRSVG_VERSION)
AM_CONFIG_HEADER(config.h)

38 39
AM_MAINTAINER_MODE

Ramiro Estrugo's avatar
Ramiro Estrugo committed
40
AC_ISC_POSIX
41 42
AC_PROG_CC
AC_PROG_CPP
Ramiro Estrugo's avatar
Ramiro Estrugo committed
43
AC_PROG_AWK
44
AC_LIBTOOL_WIN32_DLL
45
AM_PROG_LIBTOOL
Ramiro Estrugo's avatar
Ramiro Estrugo committed
46 47
AC_STDC_HEADERS

Darin Adler's avatar
Darin Adler committed
48 49
AC_C_BIGENDIAN

Ramiro Estrugo's avatar
Ramiro Estrugo committed
50 51
GNOME_REQUIRE_PKGCONFIG

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

54 55 56 57 58 59 60 61 62 63 64 65 66 67
#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")

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

80 81
dnl ===========================================================================

82 83 84 85 86 87
PKG_CHECK_MODULES(LIBRSVG, \
	gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED \
	glib-2.0 >= $GLIB_REQUIRED \
	libart-2.0 >= $LIBART_REQUIRED \
	libxml-2.0 >= $LIBXML_REQUIRED \
	pangoft2 >= $PANGOFT2_REQUIRED)
Darin Adler's avatar
Darin Adler committed
88 89 90 91
AC_SUBST(LIBRSVG_LIBS)
AC_SUBST(LIBRSVG_CFLAGS)

dnl ===========================================================================
Ramiro Estrugo's avatar
Ramiro Estrugo committed
92

93 94 95
AC_CHECK_LIB(popt, poptParseArgvString, [POPT_LIBS="-lpopt"],
AC_MSG_ERROR([popt 1.5 or newer is required to build librsvg.
You can download the latest version from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/]))
96 97
AC_SUBST(POPT_LIBS)

Darin Adler's avatar
Darin Adler committed
98
dnl ===========================================================================
99

100 101 102
LIBGSF_CFLAGS=""
LIBGSF_LIBS=""

103
LIBGSFPKG=""
104 105 106 107
test_gsf=true
AC_ARG_WITH(svgz,[  --with-svgz  Use libgsf for run-time decompression],[
	if test "x$withval" = "xno"; then
		test_gsf=false
108 109
	fi
])
110
if test "x$test_gsf" = "xtrue"; then
111
	PKG_CHECK_MODULES(LIBGSF,[libgsf-1 >= 1.6.0], test_gsf=true, test_gsf=false)
Dom Lachowicz's avatar
Dom Lachowicz committed
112 113 114
fi

if test "x$test_gsf" = "xtrue"; then
115
	LIBGSF_CFLAGS="$LIBGSF_CFLAGS -DHAVE_SVGZ=1"
116
	LIBGSFPKG="libgsf-1"
Dom Lachowicz's avatar
Dom Lachowicz committed
117 118
else
	AC_MSG_WARN([SVGZ support disabled, as requested (Use --with-svgz to enable)])
119 120
	gsf_warning="
	You are building without libgsf support. LibRSVG will not be able to handle GZipped SVGs, as is required per the SVG specification. If you are a library vendor or distributor, you are doing the world a disservice and should strongly consider shipping libgsf."
121 122 123 124 125 126 127 128 129 130
fi
AM_CONDITIONAL(WITH_LIBGSF,[test "$LIBGSFPKG" != ""])

AC_SUBST(LIBGSFPKG)

AC_SUBST(LIBGSF_CFLAGS)
AC_SUBST(LIBGSF_LIBS)

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

131 132 133 134 135
LIBGNOME_VFS_CFLAGS=""
LIBGNOME_VFS_LIBS=""

LIBGNOME_VFS_PKG=""
test_gnome_vfs=true
136 137 138 139
AC_ARG_ENABLE(gnome-vfs, [  --enable-gnome-vfs  Use Gnome VFS for reading remote files [default = auto]],
			 test_gnome_vfs="$enableval")

if test "x$test_gnome_vfs" != "xno"; then
140 141 142 143 144 145 146
	PKG_CHECK_MODULES(LIBGNOME_VFS,[gnome-vfs-2.0 >= 1.9.16], test_gnome_vfs=true, test_gnome_vfs=false)
fi

if test "x$test_gnome_vfs" = "xtrue"; then
	LIBGNOME_VFS_CFLAGS="$LIBGNOME_VFS_CFLAGS -DHAVE_GNOME_VFS=1"
	LIBGNOME_VFS_PKG="gnome-vfs-2.0"
else
147
	AC_MSG_WARN([Gnome VFS support disabled, as requested (Use --with-gnome-vfs to enable)])
148 149 150 151 152 153 154 155
fi
AM_CONDITIONAL(WITH_LIBGNOME_VFS,[test "$LIBGNOME_VFS_PKG" != ""])

AC_SUBST(LIBGNOME_VFSPKG)

AC_SUBST(LIBGNOME_VFS_CFLAGS)
AC_SUBST(LIBGNOME_VFS_LIBS)

156 157 158 159 160 161
dnl ===========================================================================

LIBCROCO_CFLAGS=""
LIBCROCO_LIBS=""
LIBCROCOPKG=""

162
test_croco=true
163 164 165 166 167 168
AC_ARG_WITH(croco,[  --with-croco  Use libcroco for CSS parsing],[
	if test "x$withval" = "xno"; then
		test_croco=false
	fi
])
if test "x$test_croco" = "xtrue"; then
169
	PKG_CHECK_MODULES(LIBCROCO,[libcroco-0.6 >= 0.6.0], test_croco=true, test_croco=false)
170 171 172 173
fi

if test "x$test_croco" = "xtrue"; then
	LIBCROCO_CFLAGS="$LIBCROCO_CFLAGS -DHAVE_LIBCROCO=1"
174
	LIBCROCOPKG="libcroco-0.6"
175 176
else
	AC_MSG_WARN([LibCroco support disabled, as requested (Use --with-croco to enable)])
177
        croco_warning="
178
You are building without libcroco support. LibRSVG will not be able to handle embedded CSS, as is required per the SVG specification. If you are a library vendor or distributor, you are doing the world a disservice and should strongly consider shipping libcroco. Even KSVG needs libcroco now..."
179 180 181 182 183 184 185 186
fi

AC_SUBST(LIBCROCOPKG)
AC_SUBST(LIBCROCO_CFLAGS)
AC_SUBST(LIBCROCO_LIBS)

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

187 188 189 190
AC_CHECK_FUNCS(strtok_r)

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

191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.

AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
if test -f $srcdir/CVSVERSION; then
        is_cvs_version=true
        set_more_warnings=yes
else
        set_more_warnings=no
fi
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
        AC_MSG_RESULT(yes)
        CFLAGS="\
        -Wall \
        -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
        -Wnested-externs -Wpointer-arith \
        -Wcast-align -Wsign-compare \
211
	-Werror \
212 213
        $CFLAGS"

Dom Lachowicz's avatar
Dom Lachowicz committed
214
        for option in -Wsign-promo; do
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
                SAVE_CFLAGS="$CFLAGS"
                CFLAGS="$option $CFLAGS"
                AC_MSG_CHECKING([whether gcc understands $option])
                AC_TRY_COMPILE([], [],
                        has_option=yes,
                        has_option=no,)
                if test $has_option = no; then
			CFLAGS="$SAVE_CFLAGS"
                fi
                AC_MSG_RESULT($has_option)
                unset has_option
                unset SAVE_CFLAGS
        done
        unset option
else
        AC_MSG_RESULT(no)
fi

233 234 235 236 237 238 239 240 241 242 243 244 245
have_gtk=no
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 1.3.12, have_gtk=yes,
		       have_gtk=no)

GTK_VERSION=
if test "x$have_gtk" = "xyes"; then
   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_VERSION)
AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")

246 247 248 249 250 251 252 253 254 255 256 257 258 259
have_gnome_print=no
PKG_CHECK_MODULES(GNOME_PRINT, \
		libgnomeprint-2.2 >= 2.2.0	\
		libgnomeprintui-2.2 >= 2.2.0,	\ 
		have_gnome_print=yes,		\
		have_gnome_print=no)

if test "x$have_gnome_print" = "xyes"; then
   GNOME_PRINT_CFLAGS="$GNOME_PRINT_CFLAGS -DHAVE_GNOME_PRINT=1"
fi

AC_SUBST(GNOME_PRINT_CFLAGS)
AC_SUBST(GNOME_PRINT_LIBS)

260 261 262 263
have_gdk_x11=no
PKG_CHECK_MODULES(GDK_X11, gdk-x11-2.0 >= 2.0.0, have_gdk_x11=yes, have_gdk_x11=no)

if test "x$have_gdk_x11" = "xyes"; then
Dom Lachowicz's avatar
Dom Lachowicz committed
264 265 266 267 268 269 270 271 272 273
	AC_PATH_XTRA

	if test "x$have_x" != "xyes"; then
		GDK_X11_LIBS=""
		GDK_X11_CFLAGS=""
	else
		GDK_X11_LIBS="$GDK_X11_LIBS $X_LIBS -lX11"
		GDK_X11_CFLAGS="$GDK_X11_CFLAGS $X_CFLAGS"
		AC_DEFINE(ENABLE_XEMBED, 1, [Is XEmbed available])
	fi
274 275
fi

Dom Lachowicz's avatar
Dom Lachowicz committed
276 277 278
AC_SUBST(GDK_X11_CFLAGS)
AC_SUBST(GDK_X11_LIBS)

279
AC_ARG_ENABLE(gtk-theme,
Dom Lachowicz's avatar
Dom Lachowicz committed
280 281 282 283
    [  --enable-gtk-theme  Enable a RSVG based GTK+ theme engine [default=auto]],,
    enable_gtk_theme=yes)

if test "x$enable_gtk_theme" = "xyes"; then
284 285 286
   if test "x$have_gtk" = "xno"; then
      enable_gtk_theme=no;
   fi
287 288
fi

Dom Lachowicz's avatar
Dom Lachowicz committed
289
AM_CONDITIONAL(ENABLE_GTK_ENGINE, test "x$enable_gtk_theme" = "xyes")
290

291
AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, true)
292 293 294 295 296

AC_ARG_ENABLE(pixbuf-loader,
    [  --enable-pixbuf-loader  Enable a RSVG based GdkPixbuf loader [default=auto]],
    enable_pixbuf_loader="$enableval", enable_pixbuf_loader=auto)

297
if test "x$enable_pixbuf_loader" = xauto ; then
Dom Lachowicz's avatar
Dom Lachowicz committed
298
    if test x$QUERYLOADERS != x ; then 
299
        enable_pixbuf_loader=yes
300 301
    else
        enable_pixbuf_loader=no
302 303 304 305 306
    fi
fi

AM_CONDITIONAL(ENABLE_PIXBUF_LOADER, test x$enable_pixbuf_loader = xyes)

307 308 309 310 311 312 313 314 315 316 317
##################################################
##################################################

MOZILLA_CFLAGS=
if test -z "$MOZILLA_CONFIG"; then
  AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
fi
if test "x$MOZILLA_CONFIG" != "xno"; then
  _mozilla_include_dir=`mozilla-config --cflags|sed 's/-I\(.*\) .*/\1/'`
  MOZILLA_CFLAGS="-I$_mozilla_include_dir/plugin -I$_mozilla_include_dir/java -I$_mozilla_include_dir/nspr"
else
Dom Lachowicz's avatar
Dom Lachowicz committed
318
  PKG_CHECK_MODULES(MOZILLA, mozilla-plugin, build_mozilla_plugin=yes, 
319
					[AC_MSG_WARN([mozilla-config not found. Mozilla/Netscape plugin will not be built])])
320 321 322 323 324 325 326 327
fi
build_mozilla_plugin=no
if test "x$MOZILLA_CFLAGS" != "x"; then
   build_mozilla_plugin=yes
fi
AM_CONDITIONAL(WITH_MOZILLA,[test "x$build_mozilla_plugin" = "xyes"])
AC_SUBST(MOZILLA_CFLAGS)

328 329 330 331 332 333 334
##################################################
# Checks for gtk-doc and docbook-tools
##################################################

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH    path to installed docs ])

if test "x$with_html_dir" = "x" ; then
335
  HTML_DIR='${datadir}/gtk-doc/html/rsvg'
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)

AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)

gtk_doc_min_version=0.9
if $GTKDOC ; then 
    gtk_doc_version=`gtkdoc-mkdb --version`
    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])

    IFS="${IFS= 	}"; gtk_save_IFS="$IFS"; IFS="."
    set $gtk_doc_version
    for min in $gtk_doc_min_version ; do
        cur=$1; shift
        if test -z $min ; then break; fi
        if test -z $cur ; then GTKDOC=false; break; fi
        if test $cur -gt $min ; then break ; fi
        if test $cur -lt $min ; then GTKDOC=false; break ; fi
    done
    IFS="$gtk_save_IFS"

    if $GTKDOC ; then
      AC_MSG_RESULT(yes)
   else
      AC_MSG_RESULT(no)
   fi
fi

AC_CHECK_PROG(DB2HTML, db2html, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)

dnl Make people enable the gtk-doc stuff explicitely.
Dom Lachowicz's avatar
Dom Lachowicz committed
371
AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc        use gtk-doc to build documentation [default=yes]], enable_gtk_doc="$enableval", enable_gtk_doc=yes)
372 373 374 375 376 377 378 379 380 381 382

if test x$enable_gtk_doc = xyes ; then
  if test x$GTKDOC != xtrue ; then
    enable_gtk_doc=no 
  fi
fi

dnl NOTE: We need to use a separate automake conditional for this
dnl       to make this work with the tarballs.
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)

Darin Adler's avatar
Darin Adler committed
383
dnl ===========================================================================
Dom Lachowicz's avatar
Dom Lachowicz committed
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400

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
401

402
AC_OUTPUT([
403
librsvg.spec
404 405
librsvg-features.h
Makefile
406
librsvg-2.0.pc
407
librsvg-2.0-uninstalled.pc
Tor Lillqvist's avatar
Tor Lillqvist committed
408
librsvg-zip
409
data/Makefile
410
doc/Makefile
411
gtk-engine/Makefile
412 413 414
gtk-engine/examples/Makefile
gtk-engine/examples/bubble/Makefile
gtk-engine/examples/bubble/gtk-2.0/Makefile
415
gdk-pixbuf-loader/Makefile
416
moz-plugin/Makefile
417
])
418 419 420 421 422 423 424 425 426 427

dnl =============================================================================================
echo "
librsvg-$LIBRSVG_VERSION

	prefix:                         ${prefix}
	compiler:                       ${CC}
	
	Build GdkPixbuf loader:         ${enable_pixbuf_loader}
	Build theme engine:             ${enable_gtk_theme}
428
	Build Netscape plugin:          ${build_mozilla_plugin}
429
	Handle svgz files:              ${test_gsf}
430
	Use Gnome VFS:                  ${test_gnome_vfs}
431
	Use libcroco for css parsing:   ${test_croco}
Dom Lachowicz's avatar
Dom Lachowicz committed
432
	Build documentation:            ${enable_gtk_doc}
433
"
434

435
AC_MSG_RESULT([$croco_warning]);
436
AC_MSG_RESULT([$gsf_warning]);