aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure10
-rw-r--r--configure.ac3
-rw-r--r--src/render.c6
4 files changed, 14 insertions, 8 deletions
diff --git a/config.h.in b/config.h.in
index 0a639f50..ebef052e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,6 +15,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if libPNG is available */
+#undef HAVE_LIBPNG
+
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
diff --git a/configure b/configure
index 4b07d22c..aa57f823 100755
--- a/configure
+++ b/configure
@@ -5710,14 +5710,14 @@ if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
$as_echo "$LIBPNG_VERSION" >&6; }
LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBPNG 1
+_ACEOF
+
else
{ $as_echo "$as_me:$LINENO: result: Lower than 1.2.0 or not found" >&5
$as_echo "Lower than 1.2.0 or not found" >&6; }
- { { $as_echo "$as_me:$LINENO: error:
-*** libPNG is required to build CrystFEL" >&5
-$as_echo "$as_me: error:
-*** libPNG is required to build CrystFEL" >&2;}
- { (exit 1); exit 1; }; }
fi
diff --git a/configure.ac b/configure.ac
index 17caaaae..405f95f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,10 +97,9 @@ if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
AC_MSG_RESULT($LIBPNG_VERSION)
LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
+ AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if libPNG is available])
else
AC_MSG_RESULT([Lower than 1.2.0 or not found])
- AC_MSG_ERROR([
-*** libPNG is required to build CrystFEL])
fi
diff --git a/src/render.c b/src/render.c
index 9546f5cd..72d0d8f0 100644
--- a/src/render.c
+++ b/src/render.c
@@ -24,6 +24,7 @@
#include "render.h"
#include "peaks.h"
#include "filters.h"
+#include "utils.h"
static void *render_bin(float *in, int inw, int inh, int binning, float *maxp)
@@ -361,6 +362,7 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale)
int render_png(DisplayWindow *dw, const char *filename)
{
+#ifdef HAVE_LIBPNG
FILE *fh;
png_structp png_ptr;
png_infop info_ptr;
@@ -465,7 +467,9 @@ int render_png(DisplayWindow *dw, const char *filename)
fclose(fh);
free(hdr);
-
+#else
+ STATUS("No PNG support.\n");
+#endif
return 0;
}