Rev 74461 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
### cairo.m4 -- extra macros for configuring R for cairo -*- Autoconf -*-###### Copyright (C) 2008 R Core Team###### This file is part of R.###### R is free software; you can redistribute it and/or modify it under### the terms of the GNU General Public License as published by the Free### Software Foundation; either version 2 of the License, or (at your### option) any later version.###### R is distributed in the hope that it will be useful, but WITHOUT ANY### WARRANTY; without even the implied warranty of MERCHANTABILITY or### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public### License for more details.###### You should have received a copy of the GNU General Public License### along with R; if not, a copy is available at### https://www.r-project.org/Licenses/AC_DEFUN([R_PANGO_CAIRO], [if test "x${PKGCONF}" = "x"; thenAC_MSG_NOTICE([not checking for cairo as pkg-config is not present])elsesave_CPPFLAGS=${CPPFLAGS}save_LIBS=${LIBS}AC_CACHE_CHECK([whether pkg-config knows about cairo and pango],[r_cv_has_pangocairo],[if "${PKGCONF}" --exists pangocairo; thenr_cv_has_pangocairo="yes"elser_cv_has_pangocairo="no"fi])if test "x${r_cv_has_pangocairo}" = "xyes"; thenmodlist="pangocairo"for module in cairo-png; doif "${PKGCONF}" --exists ${module}; thenmodlist="${modlist} ${module}"fidoneif "${PKGCONF}" --exists cairo-pdf; thenmodlist="${modlist} cairo-pdf"r_cairo_pdf=yesfiif "${PKGCONF}" --exists cairo-ps; thenmodlist="${modlist} cairo-ps"r_cairo_ps=yesfiif "${PKGCONF}" --exists cairo-svg; thenmodlist="${modlist} cairo-svg"r_cairo_svg=yesfiif "${PKGCONF}" --exists cairo-xlib; thenxmodlist="${modlist} cairo-xlib"elsexmodlist="${modlist}"fiCAIRO_CPPFLAGS=`"${PKGCONF}" --cflags ${modlist}`CAIROX11_CPPFLAGS=`"${PKGCONF}" --cflags ${xmodlist}`CAIRO_LIBS=`"${PKGCONF}" --libs ${modlist}`CAIROX11_LIBS=`"${PKGCONF}" --libs ${xmodlist}`CPPFLAGS="${CPPFLAGS} ${CAIRO_CPPFLAGS}"LIBS="${LIBS} ${CAIRO_LIBS}"AC_CACHE_CHECK([whether cairo including pango is >= 1.2 and works],[r_cv_cairo_works],[AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <pango/pango.h>#include <pango/pangocairo.h>#include <cairo-xlib.h>#if CAIRO_VERSION < 10200#error cairo version >= 1.2 required#endifint main(void) {cairo_t *CC = NULL; // silence picky compilerscairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);pango_cairo_create_layout(CC);pango_font_description_new();return 0;}]])],[r_cv_cairo_works=yes],[r_cv_cairo_works=noCAIRO_LIBS=CAIRO_CFLAGS=])])CPPFLAGS=${save_CPPFLAGS}LIBS=${save_LIBS}else ## no pangocairo, check for just cairoAC_CACHE_CHECK([whether pkg-config knows about cairo], [r_cv_has_cairo],[if "${PKGCONF}" --exists cairo; thenr_cv_has_cairo="yes"elser_cv_has_cairo="no"fi])if test "x${r_cv_has_cairo}" = "xyes"; thenmodlist="cairo"## on Linux, cairo-ft brings in header paths <cairo-ft.h>:## the code which needs this is currently conditionalizedfor module in cairo-png cairo-ft; doif "${PKGCONF}" --exists ${module}; thenmodlist="${modlist} ${module}"fidoneif "${PKGCONF}" --exists cairo-pdf; thenmodlist="${modlist} cairo-pdf"r_cairo_pdf=yesfiif "${PKGCONF}" --exists cairo-ps; thenmodlist="${modlist} cairo-ps"r_cairo_ps=yesfiif "${PKGCONF}" --exists cairo-svg; thenmodlist="${modlist} cairo-svg"r_cairo_svg=yesfiif "${PKGCONF}" --exists cairo-xlib; thenxmodlist="${modlist} cairo-xlib"elsexmodlist="${modlist}"fiCAIRO_CPPFLAGS=`"${PKGCONF}" --cflags ${modlist}`CAIROX11_CPPFLAGS=`"${PKGCONF}" --cflags ${xmodlist}`case "${host_os}" indarwin*)## This is for static macOS build## FIXME: doing that unconditionally is really not a good ideaCAIRO_LIBS=`"${PKGCONF}" --static --libs ${modlist}`CAIROX11_LIBS=`"${PKGCONF}" --static --libs ${xmodlist}`;;*)CAIRO_LIBS=`"${PKGCONF}" --libs ${modlist}`CAIROX11_LIBS=`"${PKGCONF}" --libs ${xmodlist}`;;esacCPPFLAGS="${CPPFLAGS} ${CAIRO_CPPFLAGS}"LIBS="${LIBS} ${CAIRO_LIBS}"AC_CACHE_CHECK([whether cairo is >= 1.2 and works],[r_cv_cairo_works],[AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <cairo.h>#include <cairo-xlib.h>#if CAIRO_VERSION < 10200#error cairo version >= 1.2 required#endifint main(void) {cairo_t *CC;cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);cairo_select_font_face (CC, "Helvetica", CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);return 0;}]])],[r_cv_cairo_works=yes],[r_cv_cairo_works=noCAIRO_LIBS=CAIRO_CFLAGS=])])CPPFLAGS=${save_CPPFLAGS}LIBS=${save_LIBS}fififiif test "x${r_cv_has_pangocairo}" = xyes; thenAC_DEFINE(HAVE_PANGOCAIRO, 1, [Define to 1 if you have pangocairo.])fiif test "x${r_cv_cairo_works}" = xyes; thenAC_DEFINE(HAVE_WORKING_CAIRO, 1, [Define to 1 if you have cairo.])fiif test "x${r_cairo_pdf}" = xyes; thenAC_DEFINE(HAVE_CAIRO_PDF, 1, [Define to 1 if you have cairo-ps.])fiif test "x${r_cairo_ps}" = xyes; thenAC_DEFINE(HAVE_CAIRO_PS, 1, [Define to 1 if you have cairo-pdf.])fiif test "x${r_cairo_svg}" = xyes; thenAC_DEFINE(HAVE_CAIRO_SVG, 1, [Define to 1 if you have cairo-svg.])fiAC_SUBST(CAIRO_CPPFLAGS)AC_SUBST(CAIROX11_CPPFLAGS)AC_SUBST(CAIRO_LIBS)AC_SUBST(CAIROX11_LIBS)])