Index: /trunk/psLib/configure.ac
===================================================================
--- /trunk/psLib/configure.ac	(revision 3409)
+++ /trunk/psLib/configure.ac	(revision 3410)
@@ -39,4 +39,45 @@
 dnl Setup the info for psLib for pkg-config
 PSLIB_CFLAGS="-I${includedir}"
+
+dnl ----------------- MYSQL options --------------------
+dnl MYSQL_LDFLAGS="-L${libdir}/mysql"
+dnl MYSQL_CFLAGS="-I${includedir}/mysql"
+AC_ARG_ENABLE(mysql, 
+ [AC_HELP_STRING([--enable-mysql],[Build MySQL portions of psLib])],
+ [AC_MSG_RESULT([enable building MySQL portions])
+  MYSQL_REQ="yes"],
+ [AC_MSG_RESULT([disable building MySQL portions])])
+
+if test "$MYSQL_REQ" == "yes"
+then
+  AC_ARG_WITH(mysql,
+  [AC_HELP_STRING([--with-mysql=DIR],[Specify location of MYSQL.])],
+  [MYSQL_CFLAGS="-I$withval/include"
+   MYSQL_LDFLAGS="-L$withval/lib"])
+  AC_ARG_WITH(mysql-include,
+  [AC_HELP_STRING([--with-mysql-include=DIR],[Specify MYSQL include directory.])],
+  [MYSQL_CFLAGS="-I$withval"])
+  AC_ARG_WITH(mysql-lib,
+  [AC_HELP_STRING([--with-mysql-lib=DIR],[Specify MYSQL library directory.])],
+  [MYSQL_LDFLAGS="-L$withval"])
+  CFLAGS="${CFLAGS=} $MYSQL_CFLAGS"
+  PSLIB_LIBS="${PSLIB_LIBS=} $MYSQL_LDFLAGS -lmysql"
+  AC_CHECK_HEADERS([mysql/mysql.h],[],
+     [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.])])
+
+  AC_RUN_IFELSE([AC_LANG_PROGRAM(
+[[#include <stdlib.h>
+#include <stdio.h>
+#include <mysql/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.])])
+
+  CFLAGS="${CFLAGS=} -DBUILD_PSDB"
+fi
 
 dnl ----------------- CFITSIO options --------------------
