+# ------------------------------------------------------------------
+
+if test "x${UNCOMPRESS}" = "xgzip"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_GZIP 1
+_ACEOF
+
+fi
+
+
+# ------------------------------------------------------------------
+
+
+{ $as_echo "$as_me:$LINENO: checking for Python.h" >&5
+$as_echo_n "checking for Python.h... " >&6; }
+
+if test "x$PYTHON_LIB" '!=' "x" -a "x$PYTHON_INCLUDES" '!=' "x";then
+ PY_VERSION=unknown
+else
+ if test "x$PYTHON_LIB" '!=' "x" -o "x$PYTHON_INCLUDES" '!=' "x";then
+ echo "Set both PYTHON_LIB and PYTHON_INCLUDES, or none at all"
+ fi
+ # iterate through version 2.2 to 2.6
+ for v in 2 3 4 5 6; do
+ # Linux
+ if test -f "/usr/include/python2.$v/Python.h";then
+ PY_VERSION=2.$v
+ PYTHON_LIB="-lpython$PY_VERSION"
+ if test -f "/usr/lib/python2.$v/site-packages/PIL/_imaging.so";then
+ PYTHON_LIB2="$PYTHON_LIB /usr/lib/python2.$v/site-packages/PIL/_imaging.so"
+ HAVE_PYTHON_IMAGING_LIB=1
+ else
+ PYTHON_LIB2="$PYTHON_LIB"
+ fi
+ PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
+ # Mac OS X
+ elif test -f "/Library/Frameworks/Python.framework/Versions/2.$v/include/python2.$v/Python.h";then
+ PY_VERSION=2.$v
+ PYTHON_LIB="-framework Python"
+ if test -f "/Library/Frameworks/Python.framework/Versions/2.$v/site-packages/PIL/_imaging.so";then
+ PYTHON_LIB2="$PYTHON_LIB /Library/Python/2.$v/PIL/_imaging.so"
+ HAVE_PYTHON_IMAGING_LIB=1
+ else
+ PYTHON_LIB2="$PYTHON_LIB"
+ fi
+ PYTHON_INCLUDES="-I/Library/Frameworks/Python.framework/Versions/2.$v/include/python2.$v/"
+ # Mac OS X [Fink]:
+ elif test "(" -f "/sw/lib/python2.$v/config/libpython2.$v.dylib" \
+ -o -f "/sw/lib/python2.$v/config/libpython2.$v.a" \
+ -o -f "/sw/lib/python2.$v/config/libpython2.$v.so" \
+ ")" \
+ -a -f "/sw/include/python2.$v/Python.h"; then
+ PY_VERSION=2.$v
+ PYTHON_LIB="-L /sw/lib/python2.$v/config/ -lpython$PY_VERSION /sw/lib/python2.$v/site-packages/PIL/_imaging.so"
+ if test -f "/sw/lib/python2.$v/site-packages/PIL/_imaging.so";then
+ PYTHON_LIB2="$PYTHON_LIB /sw/lib/python2.$v/site-packages/PIL/_imaging.so"
+ HAVE_PYTHON_IMAGING_LIB=1
+ else
+ PYTHON_LIB2="$PYTHON_LIB"
+ fi
+ PYTHON_INCLUDES="-I /sw/include/python2.$v/"
+ fi
+ done
+fi
+
+if test "x$PY_VERSION" "!=" "x"; then
+ { $as_echo "$as_me:$LINENO: result: $PY_VERSION" >&5
+$as_echo "$PY_VERSION" >&6; }
+ export PYTHON_INCLUDES PYTHON_LIB
+
+
+ { $as_echo "$as_me:$LINENO: checking whether we can compile the python test program" >&5
+$as_echo_n "checking whether we can compile the python test program... " >&6; }
+
+ cat > conftest.c << EOF
+#include <Python.h>
+
+int main()
+{
+ int ret;
+ ret = Py_Main(0, 0);
+ int x; // check also for gcc 2.95.x incompatibilities
+ return ret;
+}
+EOF
+
+ ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS $PYTHON_LIB $LIBS -o conftest${ac_exeext}'
+ if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ PYTHON_OK=yes
+ else
+ echo "configure: failed program was:" >&5
+ cat conftest.c >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ rm -f conftest*
+ if test "x$PYTHON_OK" = "xyes";then
+ { $as_echo "$as_me:$LINENO: checking for Python-Imaging" >&5
+$as_echo_n "checking for Python-Imaging... " >&6; }
+ cat > conftest.c << EOF
+#include <Python.h>
+#include <Imaging.h>
+
+int main()
+{
+ Py_Main(0, 0);
+ return 0;
+}
+EOF
+ if test "$HAVE_PYTHON_IMAGING_LIB"; then
+ ac_link='$CC $CPPFLAGS $CFLAGS $PYTHON_INCLUDES conftest.c $LDFLAGS ${PYTHON_LIB2} $LIBS -o conftest${ac_exeext}'
+ if { (eval echo python.m4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ PYTHON_LIB="${PYTHON_LIB2}"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PYTHON_IMAGING 1
+_ACEOF
+
+ HAVE_PYTHON_IMAGING=yes
+ export HAVE_PYTHON_IMAGING
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ echo "configure: failed program was:" >&5
+ cat conftest.c >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ else
+ echo "(didn't find the Python-Imaging libraries)" >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ fi
+ rm -f conftest*
+else
+ { $as_echo "$as_me:$LINENO: result: nope" >&5
+$as_echo "nope" >&6; }
+fi
+
+
+if test "x$PYTHON_OK" '!=' "xyes";then
+ echo all install uninstall clean: > lib/python/Makefile
+ # fail silently- the most users won't have any need for the
+ # python interface anyway
+else
+ pythongfx="lib/python/Makefile"
+fi
+
+# ------------------------------------------------------------------
+
+
+# Extract the first word of "ruby", so it can be a program name with args.
+set dummy ruby; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_RUBY+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $RUBY in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_RUBY="$RUBY" # 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_RUBY="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+RUBY=$ac_cv_path_RUBY
+if test -n "$RUBY"; then
+ { $as_echo "$as_me:$LINENO: result: $RUBY" >&5
+$as_echo "$RUBY" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+RUBY_CPPFLAGS=""
+RUBY_LDFLAGS=""
+RUBY_LIBS=""
+
+rubylib=ruby18
+
+{ $as_echo "$as_me:$LINENO: checking for ruby's include directory" >&5
+$as_echo_n "checking for ruby's include directory... " >&6; }
+if test "x$RUBY" '!=' "x";then
+ rubyinc=`$RUBY -e 'require "rbconfig";puts Config::expand(Config::CONFIG.send("\x5b\x5d", "archdir"))' 2>/dev/null`
+ if test -d $rubyinc;then
+ { $as_echo "$as_me:$LINENO: result: $rubyinc" >&5
+$as_echo "$rubyinc" >&6; }
+
+ # If we got a sensible archdir, we also ask ruby to supply us with CPPFLAGS
+ # and LDFLAGS.
+ { $as_echo "$as_me:$LINENO: checking for ruby's cpp flags" >&5
+$as_echo_n "checking for ruby's cpp flags... " >&6; }
+ rubycpp=`$RUBY -e 'require "rbconfig";puts Config::expand(Config::CONFIG.send("\x5b\x5d", "CPPFLAGS"))' 2>/dev/null`
+ { $as_echo "$as_me:$LINENO: result: $rubycpp" >&5
+$as_echo "$rubycpp" >&6; }
+
+ { $as_echo "$as_me:$LINENO: checking for ruby's ld flags" >&5
+$as_echo_n "checking for ruby's ld flags... " >&6; }
+ rubyld=`$RUBY -e 'require "rbconfig";puts Config::expand(Config::CONFIG.send("\x5b\x5d", "LIBRUBYARG_SHARED"))' 2>/dev/null`
+ { $as_echo "$as_me:$LINENO: result: $rubyld" >&5
+$as_echo "$rubyld" >&6; }