-AC_ARG_VAR([FLEX], [Command to invoke flex. Defaults to flex.])
-AC_ARG_VAR([FLEXFLAGS], [Additional options to pass to flex.])
-AC_CHECK_PROGS([FLEX], [flex], [flex])
+DX_PROG_FLEX([], [have_flex=yes], [have_flex=no])
+AM_CONDITIONAL([HAVE_FLEX], [test x"$have_flex" = x"yes"])
+
+DX_PROG_BISON([], [have_bison=yes], [have_bison=no])
+AM_CONDITIONAL([HAVE_BISON], [test x"$have_bison" = x"yes"])
+
+DX_BISON_COMPAT
+BISON_I18N
+
+BISON_COMPAT=
+AS_IF([test x"$dx_cv_bison_api_header_include" = x"yes"],
+ [BISON_COMPAT="'--define=api.header.include={\"\$(*F).h\"}'"])
+AS_IF([test x"$dx_cv_bison_warn_no_deprecated" = x"yes"],
+ [AS_VAR_APPEND([BISON_COMPAT], ["${BISON_COMPAT:+ }-Wno-deprecated"])])
+AC_SUBST([BISON_COMPAT])
+
+AH_TOP([#include <conf_pre.h>])
+AH_BOTTOM([#include <conf_post.h>])
+
+AC_ARG_WITH([gsl],
+ [AS_HELP_STRING([--with-gsl],
+ [specify whether to build test programs requiring the GNU Scientific Library. [default=auto]]
+ )], [with_gsl=$withval], [with_gsl=auto])
+
+AS_CASE([$with_gsl],
+ [no], [have_gsl=no],
+ [yes], [DX_CHECK_GSL([1.0], [have_gsl=yes])],
+ [DX_CHECK_GSL([1.0], [have_gsl=yes], [have_gsl=no])])
+AM_CONDITIONAL([HAVE_GSL], [test x"$have_gsl" = x"yes"])