From 9552ea42bb794cab1c5975c5b578209999011137 Mon Sep 17 00:00:00 2001 From: Arnaud Gardelein Date: Sat, 16 Feb 2013 17:56:58 +0100 Subject: [PATCH] Check for matplotlib in configure.ac And also detect whether ipython executable is present before running it --- configure.ac | 1 + m4/ipython.m4 | 14 +++++++++----- m4/matplotlib.m4 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 m4/matplotlib.m4 diff --git a/configure.ac b/configure.ac index c89096d..ffe02c6 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,7 @@ AC_PATH_PROGS([M4], [gm4 m4], [m4]) AM_PATH_PYTHON([2.5]) AM_PATH_IPYTHON([0.13]) +AM_PATH_MATPLOTLIB([1.1]) ##################################################################### # Check for libraries that use pkg-config diff --git a/m4/ipython.m4 b/m4/ipython.m4 index 110dfc9..e4b96f1 100644 --- a/m4/ipython.m4 +++ b/m4/ipython.m4 @@ -29,6 +29,8 @@ # cause an error if the version of IPYTHON installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. + +# check also matplotlib, numpy, dbus, xdg, gtk AC_DEFUN([AM_PATH_IPYTHON], [ dnl Find a IPYTHON interpreter. @@ -100,8 +102,6 @@ AC_DEFUN([AM_PATH_IPYTHON], dnl Run any user-specified action. $2 fi - - ]) # AM_IPYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) @@ -119,11 +119,15 @@ AC_DEFUN([AM_IPYTHON_CHECK_VERSION], AC_DEFUN([AM_RUN_LOG_IPYTHON], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD # ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - which $1 + # First check whether the program exists + # Probably /dev/null is not portable ouside linux systems... + which `echo $1 | cut -d ' ' -f 1` > /dev/null if test "$?" = 1; then - (exit 1); + ac_status=1 + (exit $ac_status); else ac_status=`$*` echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); - fi }]) + fi + }]) diff --git a/m4/matplotlib.m4 b/m4/matplotlib.m4 new file mode 100644 index 0000000..42fbca3 --- /dev/null +++ b/m4/matplotlib.m4 @@ -0,0 +1,50 @@ +## ipython.m4 - Check for IPython version on a system. -*-Autoconf-*- +## Copyright (C) 2013 Arnaud Gardelein. +## Author: Arnaud Gardelein $1 needed])])]) +]) + +# AM_MATPLOTLIB_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the IPYTHON interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. + +AC_DEFUN([AM_MATPLOTLIB_CHECK_VERSION], + [prog="import sys, matplotlib;minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]];ver = list(map(int, matplotlib.__version__[[0:3]].split('.'))) + [[0, 0, 0]];minverhex = sum([[minver[i]<<((4-i)*8) for i in range(0, 4)]]);verhex = sum([[ver[i]<<((4-i)*8) for i in range(0, 4)]]);sys.stdout.write('1' if verhex < minverhex else '0');" + AS_IF([AM_RUN_LOG_IPYTHON([$1 -c "$prog"])], [$3], [$4])]) + -- 2.11.4.GIT