diff options
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 40 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | src/render_hkl.c | 12 |
4 files changed, 77 insertions, 0 deletions
diff --git a/config.h.in b/config.h.in index ebef052e..1f653132 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if Cairo is available */ +#undef HAVE_CAIRO + /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H @@ -742,6 +742,7 @@ enable_gtktest enable_png enable_tiff with_libtiff +enable_cairo ' ac_precious_vars='build_alias host_alias @@ -1387,6 +1388,7 @@ Optional Features: --disable-gtktest do not try to compile and run a test GTK+ program --disable-png Disable the use of libPNG --disable-tiff Disable the use of libTIFF + --disable-cairo Disable the use of Cairo Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5774,6 +5776,44 @@ fi +{ $as_echo "$as_me:$LINENO: checking whether to use Cairo" >&5 +$as_echo_n "checking whether to use Cairo... " >&6; } +# Check whether --enable-cairo was given. +if test "${enable_cairo+set}" = set; then + enableval=$enable_cairo; +fi + +if test "x$enable_cairo" != "xno"; then + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:$LINENO: checking Cairo" >&5 +$as_echo_n "checking Cairo... " >&6; } + if $PKG_CONFIG --atleast-version 1.2.0 cairo ; then + CAIRO_VERSION=`$PKG_CONFIG --modversion cairo` + CAIRO_CFLAGS=`$PKG_CONFIG --cflags cairo` + CAIRO_LIBS=`$PKG_CONFIG --libs cairo` + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CAIRO 1 +_ACEOF + + { $as_echo "$as_me:$LINENO: result: $CAIRO_VERSION" >&5 +$as_echo "$CAIRO_VERSION" >&6; } + else + { $as_echo "$as_me:$LINENO: result: not found. Some functions will be unavailable." >&5 +$as_echo "not found. Some functions will be unavailable." >&6; } + fi + +else + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + + + CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread" CFLAGS="$CFLAGS $LIBTIFF_CFLAGS" LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread" diff --git a/configure.ac b/configure.ac index 3dba3c16..465f5b73 100644 --- a/configure.ac +++ b/configure.ac @@ -129,6 +129,28 @@ AS_IF([test "x$enable_tiff" != "xno"], ]) +AC_MSG_CHECKING([whether to use Cairo]) +AC_ARG_ENABLE([cairo], + AS_HELP_STRING([--disable-cairo], [Disable the use of Cairo])) +AS_IF([test "x$enable_cairo" != "xno"], +[ + AC_MSG_RESULT([yes]) + AC_MSG_CHECKING([Cairo]) + if $PKG_CONFIG --atleast-version 1.2.0 cairo ; then + CAIRO_VERSION=`$PKG_CONFIG --modversion cairo` + CAIRO_CFLAGS=`$PKG_CONFIG --cflags cairo` + CAIRO_LIBS=`$PKG_CONFIG --libs cairo` + AC_DEFINE([HAVE_CAIRO], [1], [Define to 1 if Cairo is available]) + AC_MSG_RESULT($CAIRO_VERSION) + else + AC_MSG_RESULT([not found. Some functions will be unavailable.]) + fi +], +[ + AC_MSG_RESULT([no]) +]) + + CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread" CFLAGS="$CFLAGS $LIBTIFF_CFLAGS" LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread" diff --git a/src/render_hkl.c b/src/render_hkl.c index d7a9069e..de8e3021 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -20,8 +20,10 @@ #include <string.h> #include <unistd.h> #include <getopt.h> +#ifdef HAVE_CAIRO #include <cairo.h> #include <cairo-pdf.h> +#endif #include "utils.h" #include "reflections.h" @@ -43,7 +45,9 @@ static void show_help(const char *s) "\n" " -h, --help Display this help message.\n" " --povray Render a 3D animation using POV-ray.\n" +#ifdef HAVE_CAIRO " --zone-axis Render a 2D zone axis pattern.\n" +#endif " --boost=<val> Squash colour scale by <val>.\n" " -j <n> Run <n> instances of POV-ray in parallel.\n" " -p, --pdb=<file> PDB file from which to get the unit cell.\n" @@ -60,6 +64,7 @@ static void show_help(const char *s) } +#ifdef HAVE_CAIRO static void render_za(UnitCell *cell, double *ref, unsigned int *c, double boost, const char *sym, int wght) { @@ -275,6 +280,7 @@ out: cairo_surface_finish(surface); cairo_destroy(dctx); } +#endif int main(int argc, char *argv[]) @@ -393,7 +399,13 @@ int main(int argc, char *argv[]) if ( config_povray ) { r = povray_render_animation(cell, ref, cts, nproc); } else if ( config_zoneaxis ) { +#ifdef HAVE_CAIRO render_za(cell, ref, cts, boost, sym, wght); +#else + ERROR("This version of CrystFEL was compiled without Cairo"); + ERROR(" support, which is required to plot a zone axis"); + ERROR(" pattern. Sorry!\n"); +#endif } else { ERROR("Try again with either --povray or --zone-axis.\n"); } |