+db_found=no
+{ echo "$as_me:$LINENO: checking for DBI support" >&5
+echo $ECHO_N "checking for DBI support... $ECHO_C" >&6; }
+
+# Check whether --with-dbi was given.
+if test "${with_dbi+set}" = set; then
+ withval=$with_dbi;
+ if test "$withval" != "no"; then
+ if test "$withval" = "yes"; then
+ if test -f /usr/local/include/dbi/dbi.h; then
+ DBI_INCDIR=/usr/local/dbi/include
+ if test -d /usr/local/lib64; then
+ DBI_LIBDIR=/usr/local/lib64
+ else
+ DBI_LIBDIR=/usr/local/lib
+ fi
+ DBI_BINDIR=/usr/local/bin
+ elif test -f /usr/include/dbi/dbi.h; then
+ DBI_INCDIR=/usr/include
+ if test -d /usr/lib64; then
+ DBI_LIBDIR=/usr/lib64
+ else
+ DBI_LIBDIR=/usr/lib
+ fi
+ DBI_BINDIR=/usr/bin
+ elif test -f $prefix/include/dbi/dbi.h; then
+ DBI_INCDIR=$prefix/include
+ if test -d $prefix/lib64; then
+ DBI_LIBDIR=$prefix/lib64
+ else
+ DBI_LIBDIR=$prefix/lib
+ fi
+ DBI_BINDIR=$prefix/bin
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Unable to find dbi.h in standard locations" >&5
+echo "$as_me: error: Unable to find dbi.h in standard locations" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test -d /usr/local/lib/dbd; then
+ DRIVERDIR=/usr/local/lib/dbd
+ if test -d /usr/local/lib64/dbd; then
+ DRIVERDIR=/usr/local/lib64/dbd
+ else
+ DRIVERDIR=/usr/local/lib/dbd
+ fi
+ elif test -d /usr/lib/dbd; then
+ DRIVERDIR=/usr/lib/dbd
+ if test -d /usr/lib64/dbd; then
+ DRIVERDIR=/usr/lib64/dbd
+ else
+ DRIVERDIR=/usr/lib/dbd
+ fi
+ elif test -d $prefix/lib/dbd; then
+ if test -d $prefix/lib64/dbd; then
+ DRIVERDIR=$prefix/lib64/dbd
+ else
+ DRIVERDIR=$prefix/lib/dbd
+ fi
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Unable to find DBD drivers in standard locations" >&5
+echo "$as_me: error: Unable to find DBD drivers in standard locations" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ else
+ if test -f $withval/dbi.h; then
+ DBI_INCDIR=$withval
+ DBI_LIBDIR=$withval
+ DBI_BINDIR=$withval
+ elif test -f $withval/include/dbi/dbi.h; then
+ DBI_INCDIR=$withval/include
+ if test -d $withval/lib64; then
+ DBI_LIBDIR=$withval/lib64
+ else
+ DBI_LIBDIR=$withval/lib
+ fi
+ DBI_BINDIR=$withval/bin
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Invalid DBI directory $withval - unable to find dbi.h under $withval" >&5
+echo "$as_me: error: Invalid DBI directory $withval - unable to find dbi.h under $withval" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test -d $withval/dbd; then
+ DRIVERDIR=$withval/dbd
+ elif test -d $withval/lib/; then
+ if test -d $withval/lib64/dbd; then
+ DRIVERDIR=$withval/lib64/dbd
+ else
+ DRIVERDIR=$withval/lib/dbd
+ fi
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Invalid DBD driver directory $withval - unable to find DBD drivers under $withval" >&5
+echo "$as_me: error: Invalid DBD driver directory $withval - unable to find DBD drivers under $withval" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+ SQL_INCLUDE=-I$DBI_INCDIR
+ SQL_LFLAGS="-L$DBI_LIBDIR -ldbi"
+ SQL_BINDIR=$DBI_BINDIR
+ SQL_LIB=$DBI_LIBDIR/libdbi.a
+ DBI_DBD_DRIVERDIR="-D DBI_DRIVER_DIR=\\\"$DRIVERDIR\\\""
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DBI 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ db_found=yes
+ support_dbi=yes
+ db_type=DBI
+ DB_TYPE=dbi
+
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ fi
+
+else
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+
+
+
+
+
+
+
+
+db_found=no
+db_prog=no
+{ echo "$as_me:$LINENO: checking for DBI drivers support" >&5
+echo $ECHO_N "checking for DBI drivers support... $ECHO_C" >&6; }
+
+# Check whether --with-dbi-driver was given.
+if test "${with_dbi_driver+set}" = set; then
+ withval=$with_dbi_driver;
+ if test "$withval" != "no"; then
+ case $withval in
+ "mysql")
+ db_prog="mysql"
+ if test -f /usr/local/mysql/bin/mysql; then
+ SQL_BINDIR=/usr/local/mysql/bin
+ elif test -f /usr/bin/mysql; then
+ SQL_BINDIR=/usr/bin
+ elif test -f /usr/local/bin/mysql; then
+ SQL_BINDIR=/usr/local/bin
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Unable to find mysql in standard locations" >&5
+echo "$as_me: error: Unable to find mysql in standard locations" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ ;;
+ "postgresql")
+ db_prog="postgresql"
+ PG_CONFIG=`which pg_config`
+ if test -n "$PG_CONFIG";then
+ SQL_BINDIR=`"$PG_CONFIG" --bindir`
+ elif test -f /usr/local/bin/psql; then
+ SQL_BINDIR=/usr/local/bin
+ elif test -f /usr/bin/psql; then
+ SQL_BINDIR=/usr/bin
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Unable to find psql in standard locations" >&5
+echo "$as_me: error: Unable to find psql in standard locations" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ ;;
+ *)
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error: Unable to set DBI driver. $withval is not supported" >&5
+echo "$as_me: error: Unable to set DBI driver. $withval is not supported" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ DB_PROG=$db_prog
+
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ fi
+
+else
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+
+
+
+
+
+
+
+
+# -------------------------------------------
+# enable batch attribute DB insert (default on)
+# -------------------------------------------
+support_batch_insert=no
+A=`nm $SQL_LIB | grep pthread_mutex_lock`
+pkg=$?
+if test $pkg = 0; then
+ support_batch_insert=yes
+ # Check whether --enable-batch-insert was given.
+if test "${enable_batch_insert+set}" = set; then
+ enableval=$enable_batch_insert; if test x$enableval = xno; then
+ support_batch_insert=no
+ else
+ support_batch_insert=yes
+ fi
+fi
+
+fi
+
+# Check if postgresql support batch mode
+if test x$DB_TYPE = xpostgresql; then
+ A=`nm $SQL_LIB | grep PQputCopyData`
+ pkg=$?
+ if test $pkg != 0; then
+ support_batch_insert=no
+ fi
+fi
+
+if test x$DB_TYPE = xdbi; then
+ DB_TYPE=$DB_PROG
+ db_type=$DB_PROG
+fi
+
+if test $support_batch_insert = yes ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BATCH_FILE_INSERT 1
+_ACEOF
+
+fi