aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-07-05 16:33:49 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:52 +0100
commit7135bb83dacf088e6613149453a9e51dd005a730 (patch)
treea588a7146cb0ba7dd637a1ee4e990cea9e682ffa
parentd12550ca258bc9c7dbe7d887ed81949e406d5aef (diff)
Test for libPNG
-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;
}