diff --git a/configure.ac b/configure.ac index dc8b98a8d2..4db703b82e 100644 --- a/configure.ac +++ b/configure.ac @@ -325,7 +325,6 @@ fi PKG_CHECK_MODULES([FREETYPE],[freetype2 >= 2.3.7]) PKG_CHECK_MODULES([LIBXML],[libxml-2.0]) -FONTFORGE_ARG_WITH_CAIRO AC_ARG_VAR([FREETYPE_SOURCE], [directory where freetype source code is located for --enable-freetype-debugger; however, if --enable-freetype-debugger=DIR is specified, then DIR overrides @@ -334,6 +333,7 @@ FONTFORGE_ARG_WITH_GIFLIB FONTFORGE_ARG_WITH_LIBJPEG FONTFORGE_ARG_WITH_LIBPNG FONTFORGE_ARG_WITH_LIBTIFF +FONTFORGE_ARG_WITH_CAIRO # do this test only 'after' zlib and png checks FONTFORGE_ARG_WITH_LIBSPIRO FONTFORGE_ARG_WITH_LIBUNINAMESLIST #FONTFORGE_ARG_WITH_LIBUNICODENAMES @@ -761,15 +761,15 @@ Summary of optional features: Summary of optional dependencies: Optional Library UseIt? HaveIt? WebsiteURL - cairo ${i_do_have_cairo} ${cairo_url} - libspiro ${with_libspiro} ${i_do_have_libspiro} ${libspiro_url} + cairo ${with_cairo} ${i_do_have_cairo} ${cairo_url} giflib ${with_giflib} ${i_do_have_giflib} ${giflib_url} libjpeg ${with_libjpeg} ${i_do_have_libjpeg} ${libjpeg_url} libpng ${with_libpng} ${i_do_have_libpng} ${libpng_url} + libreadline ${with_libreadline} ${i_do_have_libreadline} ${libreadline_url} + libspiro ${with_libspiro} ${i_do_have_libspiro} ${libspiro_url} libtiff ${with_libtiff} ${i_do_have_libtiff} ${libtiff_url} libuninameslist ${with_libuninameslist} ${i_do_have_libuninameslist} ${libuninameslist_url} zeromq (libzmq) ${i_do_have_libzmq} ${libzmq_url} - libreadline ${with_libreadline} ${i_do_have_libreadline} ${libreadline_url} X Window System ${i_do_have_x} ]) diff --git a/m4/fontforge_arg_with.m4 b/m4/fontforge_arg_with.m4 index 47c3b1d76a..bcba46bfbc 100644 --- a/m4/fontforge_arg_with.m4 +++ b/m4/fontforge_arg_with.m4 @@ -159,14 +159,55 @@ with_libuninameslist=no dnl FONTFORGE_ARG_WITH_CAIRO dnl ------------------------ -AC_DEFUN([FONTFORGE_ARG_WITH_CAIRO], -[ - FONTFORGE_ARG_WITH([cairo], - [AS_HELP_STRING([--without-cairo], - [build without Cairo graphics (use regular X graphics instead)])], - [cairo >= 1.6], - [FONTFORGE_WARN_PKG_NOT_FOUND([CAIRO])], - [_NO_LIBCAIRO]) +dnl Add with cairo support by default (only if cairo and headers exist). +dnl Additionally, zlib, png and their header files should exist too. +dnl If user defines --without-cairo, then don't use cairo graphics. +dnl If user defines --with-cairo, then fail with error if there is no +dnl cairo or headers available. +dnl You will need to test for zlib and png before running this function. +dnl Latest version here indicated cairo >= 1.6 +dnl function=`cairo_format_stride_for_width` will verify cairo >= 1.6 +AC_DEFUN([FONTFORGE_ARG_WITH_CAIRO],[ +FONTFORGE_ARG_WITHOUT([cairo],[LIBCAIRO],[build without Cairo graphics (use regular X graphics instead)]) + +if test x"${with_cairo}" != xno; then +dnl try the easy path first with PKG_CHECK_MODULES() else check using +dnl lib and header checks for distros/OSes with weak pkg-config setups. + PKG_CHECK_MODULES([LIBCAIRO],[cairo >= 1.6],[i_do_have_cairo=yes], + [if test x"${i_do_have_cairo}" != xno -a x"${LIBCAIRO_CFLAGS}" = x; then + AC_CHECK_HEADER([cairo/cairo.h],[],[i_do_have_cairo=no]) + fi + if test x"${i_do_have_cairo}" != xno -a x"${LIBCAIRO_LIBS}" = x; then + FONTFORGE_SEARCH_LIBS([cairo_format_stride_for_width],[cairo], + [LIBCAIRO_LIBS="${LIBCAIRO_LIBS} ${found_lib}"], + [i_do_have_cairo=no]) + fi]) +fi + +AC_MSG_CHECKING([Build with Cairo support?]) +if test x"${with_cairo}" != xno; then + if test x"${i_do_have_libpng}" != xyes || test x"${with_libpng}" = xno; then + AC_MSG_FAILURE([ERROR: Please install the Developer version of libpng],[1]) + fi +fi +if test x"${with_cairo}" = xyes; then + if test x"${i_do_have_cairo}" != xno; then + AC_MSG_RESULT([yes]) + else + AC_MSG_FAILURE([ERROR: Please install the Developer version of Cairo],[1]) + fi +else + if test x"${i_do_have_cairo}" = xno || test x"${with_cairo}" = xno; then + AC_MSG_RESULT([no]) + AC_DEFINE([_NO_LIBCAIRO],1,[Define if not using cairo]) + AS_TR_SH(LIBCAIRO_CFLAGS)="" + AS_TR_SH(LIBCAIRO_LIBS)="" + else + AC_MSG_RESULT([yes]) + fi +fi +AC_SUBST([LIBCAIRO_CFLAGS]) +AC_SUBST([LIBCAIRO_LIBS]) ]) diff --git a/m4/fontforge_create_pkg-config_files.m4 b/m4/fontforge_create_pkg-config_files.m4 index 9788bdd7e1..2269d31008 100644 --- a/m4/fontforge_create_pkg-config_files.m4 +++ b/m4/fontforge_create_pkg-config_files.m4 @@ -11,7 +11,7 @@ __cleaned_version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" __pkg_deps="" test x"${i_do_have_python_scripting}" = xyes && __pkg_deps="${__pkg_deps} python-${PYTHON_VERSION}" test x"${i_do_have_libxml}" = xyes && __pkg_deps="${__pkg_deps} libxml-2.0" -test x"${i_do_have_cairo}" = xyes && __pkg_deps="${__pkg_deps} cairo" +test x"${i_do_have_cairo}" = xyes && test x"${with_cairo}" != xno && __pkg_deps="${__pkg_deps} cairo" test x"${i_do_have_cairo}" = xyes && my_libs="${my_libs} pangocairo" test x"${i_do_have_gui}" = xyes && __pkg_deps="${__pkg_deps} pango" test x"${i_do_have_gui}" = xyes && my_libs="${my_libs} pangoxft" @@ -22,7 +22,6 @@ __private_deps="" __private_deps="${__private_deps} -lgioftp" __private_deps="${__private_deps} -lgutils" __private_deps="${__private_deps} -lgunicode" -test x"${i_do_have_tifflib}" = xyes -a x"${__have_libtiff_pkg_config}" != xyes && __private_deps="${__private_deps} ${LIBTIFF_LIBS}" test x"${i_do_have_giflib}" = xyes && test x"${with_giflib}" != xno && __private_deps="${__private_deps} ${GIFLIB_LIBS}" test x"${i_do_have_libjpeg}" = xyes && test x"${with_libjpeg}" != xno && __private_deps="${__private_deps} ${LIBJPEG_LIBS}" test x"${i_do_have_libpng}" = xyes && test x"${with_libpng}" != xno && __private_deps="${__private_deps} ${LIBPNG_LIBS}"