aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-12-02 22:42:54 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:07 +0100
commitde010513c22947a905b27a164fa9975d6a8b5d63 (patch)
tree4eff34327102ea12cbb28bc2e4c8f2f738351f8b
parent4560e69b51b9e517bc5c7edbb80bc567f5bae2fd (diff)
Improve autoconf conditionals (i.e. make them work..)
-rw-r--r--Makefile.in4
-rw-r--r--aclocal.m4156
-rw-r--r--config.h.in9
-rwxr-xr-xconfigure387
-rw-r--r--configure.ac37
-rw-r--r--data/Makefile.in4
-rw-r--r--doc/Makefile.in4
-rw-r--r--doc/examples/Makefile.in4
-rw-r--r--scripts/Makefile.in4
-rw-r--r--src/Makefile.in4
-rw-r--r--src/render.c2
-rw-r--r--src/render.h7
-rw-r--r--src/render_hkl.c37
13 files changed, 589 insertions, 70 deletions
diff --git a/Makefile.in b/Makefile.in
index 5fb89822..1fd928a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -118,6 +118,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -177,6 +179,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/aclocal.m4 b/aclocal.m4
index 393b3129..51ebd936 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -216,6 +216,162 @@ main ()
rm -f conf.gtktest
])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+ [$4])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
diff --git a/config.h.in b/config.h.in
index b762cefe..3acd3c5c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,12 +15,12 @@
/* Define to 1 if a Linux-style forkpty is available */
#undef HAVE_FORKPTY_LINUX
+/* Define to 1 if GTK and GDK are available */
+#undef HAVE_GTK
+
/* 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
@@ -46,6 +46,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the `strndup' function. */
+#undef HAVE_STRNDUP
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
diff --git a/configure b/configure
index 00ee9b6f..cb26682f 100755
--- a/configure
+++ b/configure
@@ -596,6 +596,14 @@ ac_includes_default="\
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
+HAVE_CAIRO_FALSE
+HAVE_CAIRO_TRUE
+Cairo_LIBS
+Cairo_CFLAGS
+HAVE_LIBPNG_FALSE
+HAVE_LIBPNG_TRUE
+libPNG_LIBS
+libPNG_CFLAGS
HAVE_GTK_FALSE
HAVE_GTK_TRUE
GTK_LIBS
@@ -710,7 +718,12 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP'
+CPP
+PKG_CONFIG
+libPNG_CFLAGS
+libPNG_LIBS
+Cairo_CFLAGS
+Cairo_LIBS'
# Initialize some variables set by options.
@@ -1353,6 +1366,13 @@ Some influential environment variables:
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
+ PKG_CONFIG path to pkg-config utility
+ libPNG_CFLAGS
+ C compiler flags for libPNG, overriding pkg-config
+ libPNG_LIBS linker flags for libPNG, overriding pkg-config
+ Cairo_CFLAGS
+ C compiler flags for Cairo, overriding pkg-config
+ Cairo_LIBS linker flags for Cairo, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -4285,12 +4305,14 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-for ac_func in strdup
+for ac_func in strdup strndup
do :
- ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
-if test "x$ac_cv_func_strdup" = x""yes; then :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_STRDUP 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
@@ -4587,7 +4609,9 @@ fi
$as_echo "yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6; }
havegtk=true
- GTK_LIBS="$GTK_LIBS"
+
+$as_echo "#define HAVE_GTK 1" >>confdefs.h
+
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -4656,7 +4680,7 @@ else
$as_echo "no" >&6; }
fi
- if test x$havegtk = xtrue; then
+ if test "x$havegtk" = "xtrue"; then
HAVE_GTK_TRUE=
HAVE_GTK_FALSE='#'
else
@@ -4735,25 +4759,212 @@ if test "${enable_png+set}" = set; then :
enableval=$enable_png;
fi
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+
+fi
if test "x$enable_png" != "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking libpng" >&5
-$as_echo_n "checking libpng... " >&6; }
- if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
- LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPNG_VERSION" >&5
-$as_echo "$LIBPNG_VERSION" >&6; }
- LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
- LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
-$as_echo "#define HAVE_LIBPNG 1" >>confdefs.h
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libPNG" >&5
+$as_echo_n "checking for libPNG... " >&6; }
+
+if test -n "$libPNG_CFLAGS"; then
+ pkg_cv_libPNG_CFLAGS="$libPNG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_libPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng >= 1.2.0" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$libPNG_LIBS"; then
+ pkg_cv_libPNG_LIBS="$libPNG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_libPNG_LIBS=`$PKG_CONFIG --libs "libpng >= 1.2.0" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Lower than 1.2.0 or not found" >&5
-$as_echo "Lower than 1.2.0 or not found" >&6; }
- fi
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ libPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpng >= 1.2.0" 2>&1`
+ else
+ libPNG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpng >= 1.2.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$libPNG_PKG_ERRORS" >&5
+
+ as_fn_error "Package requirements (libpng >= 1.2.0) were not met:
+
+$libPNG_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables libPNG_CFLAGS
+and libPNG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables libPNG_CFLAGS
+and libPNG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." "$LINENO" 5; }
+else
+ libPNG_CFLAGS=$pkg_cv_libPNG_CFLAGS
+ libPNG_LIBS=$pkg_cv_libPNG_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ havelibpng=true
+fi
else
@@ -4761,6 +4972,14 @@ else
$as_echo "no" >&6; }
fi
+ if test x$havelibpng = xtrue; then
+ HAVE_LIBPNG_TRUE=
+ HAVE_LIBPNG_FALSE='#'
+else
+ HAVE_LIBPNG_TRUE='#'
+ HAVE_LIBPNG_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use TIFF" >&5
@@ -4803,21 +5022,97 @@ if test "x$enable_cairo" != "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- { $as_echo "$as_me:${as_lineno-$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`
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cairo" >&5
+$as_echo_n "checking for Cairo... " >&6; }
+
+if test -n "$Cairo_CFLAGS"; then
+ pkg_cv_Cairo_CFLAGS="$Cairo_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_Cairo_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 1.2.0" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$Cairo_LIBS"; then
+ pkg_cv_Cairo_LIBS="$Cairo_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_Cairo_LIBS=`$PKG_CONFIG --libs "cairo >= 1.2.0" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ Cairo_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "cairo >= 1.2.0" 2>&1`
+ else
+ Cairo_PKG_ERRORS=`$PKG_CONFIG --print-errors "cairo >= 1.2.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$Cairo_PKG_ERRORS" >&5
+
+ as_fn_error "Package requirements (cairo >= 1.2.0) were not met:
+
+$Cairo_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables Cairo_CFLAGS
+and Cairo_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables Cairo_CFLAGS
+and Cairo_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." "$LINENO" 5; }
+else
+ Cairo_CFLAGS=$pkg_cv_Cairo_CFLAGS
+ Cairo_LIBS=$pkg_cv_Cairo_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+ havecairo=true
$as_echo "#define HAVE_CAIRO 1" >>confdefs.h
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAIRO_VERSION" >&5
-$as_echo "$CAIRO_VERSION" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found. Some functions will be unavailable." >&5
-$as_echo "not found. Some functions will be unavailable." >&6; }
- fi
+
+fi
else
@@ -4825,12 +5120,20 @@ else
$as_echo "no" >&6; }
fi
+ if test x$havecairo = xtrue; then
+ HAVE_CAIRO_TRUE=
+ HAVE_CAIRO_FALSE='#'
+else
+ HAVE_CAIRO_TRUE='#'
+ HAVE_CAIRO_FALSE=
+fi
+
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
-CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $LIBPNG_CFLAGS"
+CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
-LIBS="$LIBS $LIBTIFF_LIBS $LIBPNG_LIBS"
+LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS"
ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile doc/Makefile scripts/Makefile"
@@ -4955,6 +5258,14 @@ if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then
as_fn_error "conditional \"HAVE_GTK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
+ as_fn_error "conditional \"HAVE_LIBPNG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_CAIRO_TRUE}" && test -z "${HAVE_CAIRO_FALSE}"; then
+ as_fn_error "conditional \"HAVE_CAIRO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -6399,6 +6710,14 @@ if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then
as_fn_error "conditional \"HAVE_GTK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
+ as_fn_error "conditional \"HAVE_LIBPNG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_CAIRO_TRUE}" && test -z "${HAVE_CAIRO_FALSE}"; then
+ as_fn_error "conditional \"HAVE_CAIRO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then
as_fn_error "conditional \"am__EXEEXT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 8ddc5350..5a862aed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
AC_C_CONST
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([strdup strndup])
AC_ARG_WITH(hdf5,
@@ -67,7 +67,7 @@ AS_IF([test "x$enable_gtk" != "xno"],
AM_PATH_GTK_2_0(2.0.0,
[
havegtk=true
- GTK_LIBS="$GTK_LIBS"
+ AC_DEFINE([HAVE_GTK], [1], [Define to 1 if GTK and GDK are available])
],
[
AC_MSG_WARN([GTK not found. hdfsee will not be built.])
@@ -76,7 +76,7 @@ AS_IF([test "x$enable_gtk" != "xno"],
[
AC_MSG_RESULT([no])
])
-AM_CONDITIONAL([HAVE_GTK], test x$havegtk = xtrue)
+AM_CONDITIONAL([HAVE_GTK], test "x$havegtk" = "xtrue")
AC_CHECK_FUNCS(forkpty,
@@ -97,16 +97,7 @@ AC_ARG_ENABLE([png],
AS_IF([test "x$enable_png" != "xno"],
[
AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([libpng])
- if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
- LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng`
- 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])
- fi
+ PKG_CHECK_MODULES([libPNG], [libpng >= 1.2.0], [havelibpng=true])
],[
AC_MSG_RESULT([no])
])
@@ -135,26 +126,22 @@ AC_ARG_ENABLE([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
+ PKG_CHECK_MODULES([Cairo], [cairo >= 1.2.0],
+ [
+ havecairo=true
+ AC_DEFINE([HAVE_CAIRO], [1], [Define to 1 if Cairo is available])
+ ])
],
[
AC_MSG_RESULT([no])
])
+AM_CONDITIONAL([HAVE_CAIRO], test x$havecairo = xtrue)
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
-CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $LIBPNG_CFLAGS"
+CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
-LIBS="$LIBS $LIBTIFF_LIBS $LIBPNG_LIBS"
+LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS"
AC_OUTPUT(Makefile src/Makefile data/Makefile doc/Makefile scripts/Makefile)
AC_OUTPUT(doc/examples/Makefile)
diff --git a/data/Makefile.in b/data/Makefile.in
index 264646a7..c5847a36 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -87,6 +87,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -146,6 +148,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/doc/Makefile.in b/doc/Makefile.in
index d989900a..2200f7ea 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -87,6 +87,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -146,6 +148,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in
index 2fac3317..e5464ef5 100644
--- a/doc/examples/Makefile.in
+++ b/doc/examples/Makefile.in
@@ -87,6 +87,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -146,6 +148,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 0c4c03e6..ae50b344 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -87,6 +87,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -146,6 +148,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/src/Makefile.in b/src/Makefile.in
index 4cc04b36..d7833b13 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -203,6 +203,8 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
+Cairo_CFLAGS = @Cairo_CFLAGS@
+Cairo_LIBS = @Cairo_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
@@ -262,6 +264,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libPNG_CFLAGS = @libPNG_CFLAGS@
+libPNG_LIBS = @libPNG_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
diff --git a/src/render.c b/src/render.c
index 128ede3a..2cc6a63b 100644
--- a/src/render.c
+++ b/src/render.c
@@ -250,6 +250,7 @@ static void show_marked_features(struct image *image, guchar *data,
}
+#ifdef HAVE_GTK
/* Return a pixbuf containing a rendered version of the image after binning.
* This pixbuf might be scaled later - hopefully mostly in a downward
* direction. */
@@ -344,6 +345,7 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale)
return gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB, FALSE, 8,
w, h, w*3, render_free_data, NULL);
}
+#endif /* HAVE_GTK */
int render_png(DisplayWindow *dw, const char *filename)
diff --git a/src/render.h b/src/render.h
index 0be9ae97..902ec278 100644
--- a/src/render.h
+++ b/src/render.h
@@ -18,7 +18,6 @@
#define RENDER_H
-#include <gdk-pixbuf/gdk-pixbuf.h>
#include <stddef.h>
#include "displaywindow.h"
@@ -33,9 +32,15 @@ enum {
extern void render_scale(float val, float max, int scale,
float *rp, float *gp, float *bp);
+#ifdef HAVE_GTK
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
extern GdkPixbuf *render_get_image(DisplayWindow *dw);
extern GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale);
+#endif /* HAVE_GTK */
+
extern int render_png(DisplayWindow *dw, const char *filename);
extern int render_tiff_fp(DisplayWindow *dw, const char *filename);
extern int render_tiff_int16(DisplayWindow *dw, const char *filename);
diff --git a/src/render_hkl.c b/src/render_hkl.c
index a4ad340a..bfe40260 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -76,6 +76,8 @@ static void show_help(const char *s)
#ifdef HAVE_CAIRO
+
+
static void draw_circles(signed int xh, signed int xk, signed int xl,
signed int yh, signed int yk, signed int yl,
signed int zh, signed int zk, signed int zl,
@@ -426,7 +428,34 @@ static int render_key(int colscale)
return 0;
}
-#endif
+
+
+#else /* HAVE_CAIRO */
+
+
+static int render_key(int colscale)
+{
+ ERROR("This version of CrystFEL was compiled without Cairo");
+ ERROR(" support, which is required to draw the colour");
+ ERROR(" scale. Sorry!\n");
+ return 1;
+}
+
+
+static void render_za(UnitCell *cell, ReflItemList *items,
+ double *ref, unsigned int *counts,
+ double boost, const char *sym, int wght, int colscale,
+ signed int xh, signed int xk, signed int xl,
+ signed int yh, signed int yk, signed int yl,
+ const char *outfile)
+{
+ ERROR("This version of CrystFEL was compiled without Cairo");
+ ERROR(" support, which is required to plot a zone axis");
+ ERROR(" pattern. Sorry!\n");
+}
+
+
+#endif /* HAVE_CAIRO */
int main(int argc, char *argv[])
@@ -624,14 +653,8 @@ int main(int argc, char *argv[])
r = povray_render_animation(cell, ref, cts, items,
nproc, sym, wght, boost);
} else if ( config_zoneaxis ) {
-#ifdef HAVE_CAIRO
render_za(cell, items, ref, cts, boost, sym, wght, colscale,
rh, rk, rl, dh, dk, dl, outfile);
-#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");
}