Index: trunk/psLib/configure.ac
===================================================================
--- trunk/psLib/configure.ac	(revision 9800)
+++ trunk/psLib/configure.ac	(revision 9802)
@@ -115,61 +115,11 @@
 dnl ----------------- MYSQL options --------------------
 
-dnl save LIBS/CFLAGS/LDFLAGS
-TMP_LIBS=${LIBS}
-TMP_CFLAGS=${CFLAGS}
-TMP_LDFLAGS=${LDFLAGS}
-TMP_CPPFLAGS=${CPPFLAGS}
-
-AC_ARG_ENABLE(mysql,
- [AS_HELP_STRING(--disable-mysql,Disable MySQL functionality)],
- [MYSQL_REQ=$enableval],
- [MYSQL_REQ="yes"])
-
-if test "$MYSQL_REQ" == "yes"
-then
-  AC_MSG_RESULT([enable building MySQL functionality])
-  AC_ARG_WITH(mysql_config,
-    [AS_HELP_STRING(--with-mysql_config=FILE,Specify location of MYSQL configuration script.)],
-    [MYSQL_CONFIG=$withval],
-    [MYSQL_CONFIG=`which mysql_config`])
-  AC_CHECK_FILE($MYSQL_CONFIG,[],
-    [AC_MSG_ERROR([MYSQL 4.1.2 or newer is required.  http://www.mysql.com or use --with-mysql_config to specify location of ocnfiguration script.])])
-
-  AC_MSG_CHECKING([MySQL cflags])
-  MYSQL_CFLAGS="`${MYSQL_CONFIG} --include`"
-  PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${MYSQL_CFLAGS}"
-  AC_MSG_RESULT([${MYSQL_CFLAGS}])
-
-  AC_MSG_CHECKING([MySQL link options])
-  MYSQL_LIBS="`${MYSQL_CONFIG} --libs`"
-  PSLIB_LIBS="${PSLIB_LIBS=} ${MYSQL_LIBS}"
-  AC_MSG_RESULT([${MYSQL_LIBS}])
-  AC_SUBST(TST_PSDB,"tst_psDB") dnl enable the test for psDB
-
-dnl AC_RUN_IFELSE() uses CFLAGS to find mysql_version.h
-  CFLAGS="${CFLAGS} ${MYSQL_CFLAGS}"
-  AC_RUN_IFELSE([AC_LANG_PROGRAM(
-[[#include <stdlib.h>
-#include <stdio.h>
-#include <mysql_version.h>
-]],[[int v=MYSQL_VERSION_ID;
-    if (v < 40102) {
-    exit(1);
-    } else {
-    exit(0);
-    }
-]])], [], [AC_MSG_ERROR([MySQL 4.1.2 or newer is required.  Obtain it at  http://www.mysql.com or use --with-mysql to specify location.])])
-else
-  PSLIB_CFLAGS="${PSLIB_CFLAGS=} -DOMIT_PSDB"
-  AC_MSG_RESULT([disable building MySQL functionality])
-fi
-
-AC_SUBST([MYSQL_CFLAGS])
-
-dnl restore the CFLAGS/LDFLAGS
-LIBS=${TMP_LIBS}
-CFLAGS=${TMP_CFLAGS}
-LDFLAGS=${TMP_LDFLAGS}
-CPPFLAGS=${TMP_CPPFLAGS}
+AX_LIB_MYSQL([4.1.2], [
+    PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${MYSQL_CFLAGS}"
+    PSLIB_LIBS="${PSLIB_LIBS=} ${MYSQL_LIBS}"
+  ], [
+    PSLIB_CFLAGS="${PSLIB_CFLAGS=} -DOMIT_PSDB"
+  ]
+)
 
 dnl ----------------- CFITSIO options --------------------
