+
+NO_OVERRIDE=no
+AC_ARG_WITH(g13,
+ AC_HELP_STRING([--with-g13=PATH],
+ [use g13 binary at PATH]),
+ G13=$withval, NO_OVERRIDE=yes)
+if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
+ G13=
+ NO_OVERRIDE=yes
+ if test "$cross_compiling" != "yes"; then
+ AC_PATH_PROG(G13, g13)
+ fi
+ if test -z "$G13"; then
+ G13="$G13_DEFAULT"
+ fi
+fi
+if test "$G13" = no; then
+ if test "$NO_OVERRIDE" = "yes"; then
+ if test "$cross_compiling" != "yes"; then
+ AC_MSG_WARN([
+***
+*** Could not find g13, install g13 or use --with-g13=PATH to enable it
+***])
+ else
+ AC_MSG_ERROR([
+***
+*** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
+***])
+ fi
+ fi
+else
+ AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
+ AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
+fi
+AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
+
+dnl Check for G13 version requirement.
+G13_VERSION=unknown
+ok=maybe
+if test -z "$G13" -o "x$G13" = "xno"; then
+ ok=no
+else
+ if test "$cross_compiling" = "yes"; then
+ AC_MSG_WARN([G13 version can not be checked when cross compiling])
+ ok=no
+ else
+ if test ! -x "$G13"; then
+ AC_MSG_WARN([G13 not executable, version check disabled])
+ ok=no
+ fi
+ fi
+fi
+if test "$ok" = "maybe"; then
+ AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
+ req_major=`echo $NEED_G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $NEED_G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $NEED_G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
+ major=`echo $G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $G13_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "$ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
+ fi
+fi
+run_g13_test="$ok"
+AC_ARG_ENABLE(g13-test,
+ AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
+ run_g13_test=$enableval)
+AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
+
+
+# Check for funopen