if test -f $MYSQL_LIBDIR/libmysqlclient_r.a \
-o -f $MYSQL_LIBDIR/libmysqlclient_r.so; then
MYSQL_LIBS="-R $MYSQL_LIBDIR -L$MYSQL_LIBDIR -lmysqlclient_r -lz"
+ MYSQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz"
AC_DEFINE(HAVE_THREAD_SAFE_MYSQL, 1, [Set if Thread Safe MySQL can be checked using mysql_thread_safe])
DB_LIBS="${DB_LIBS} ${MYSQL_LIBS}"
fi
else
AC_MSG_RESULT(no)
fi
-]
-)
+],[
+ AC_MSG_RESULT(no)
+])
+AC_MSG_CHECKING(for MySQL embedded support)
AC_ARG_WITH(embedded-mysql,
AC_HELP_STRING([--with-embedded-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the MySQL base install directory, default is to search through a number of common places for the MySQL files.]),
[
fi
MYSQL_INCLUDE=-I$MYSQL_INCDIR
MYSQL_LIBS="-R $MYSQL_LIBDIR -L$MYSQL_LIBDIR -lmysqld -lz -lm -lcrypt"
+ MYSQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqld -lz -lm -lcrypt"
MYSQL_LIB=$MYSQL_LIBDIR/libmysqld.a
DB_LIBS="${DB_LIBS} ${MYSQL_LIBS}"
else
AC_MSG_RESULT(no)
fi
-]
-)
+],[
+ AC_MSG_RESULT(no)
+])
AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_INCLUDE)
fi
SQLITE_INCLUDE=-I$SQLITE_INCDIR
SQLITE_LIBS="-R $SQLITE_LIBDIR -L$SQLITE_LIBDIR -lsqlite3"
+ SQLITE_LFLAGS="-L$SQLITE_LIBDIR -lsqlite3"
SQLITE_LIB=$SQLITE_LIBDIR/libsqlite3.a
DB_LIBS="${DB_LIBS} ${SQLITE_LIBS}"
POSTGRESQL_INCLUDE=-I$POSTGRESQL_INCDIR
POSTGRESQL_LIBS="-R $POSTGRESQL_LIBDIR -L$POSTGRESQL_LIBDIR -lpq"
AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, [POSTGRESQL_LIBS="$POSTGRESQL_LIBS -lcrypt"]))
+ POSTGRESQL_LFLAGS=`echo ${POSTGRESQL_LIBS} | sed -e "s#-R $POSTGRESQL_LIBDIR##"`
POSTGRESQL_LIB=$POSTGRESQL_LIBDIR/libpq.a
DB_LIBS="${DB_LIBS} ${POSTGRESQL_LIBS}"
dnl Check if mysql supports batch mode
dnl -------------------------------------------
if test ! -z "$MYSQL_LIB"; then
- AC_CHECK_LIB(mysql_r, mysql_thread_safe, AC_DEFINE(HAVE_MYSQL_THREAD_SAFE, 1, [Set if have mysql_thread_safe]))
+ dnl For mysql checking
+ saved_LIBS="${LIBS}"
+ LIBS="${saved_LIBS} ${MYSQL_LFLAGS}"
+
+ AC_CHECK_LIB(mysqlclient_r, mysql_thread_safe, AC_DEFINE(HAVE_MYSQL_THREAD_SAFE, 1, [Set if have mysql_thread_safe]))
+
+ dnl Revert after mysql checks
+ LIBS="${saved_LIBS}"
fi
dnl -------------------------------------------
dnl Check if sqlite supports batch mode
dnl -------------------------------------------
if test ! -z "SQLITE_LIB"; then
+ dnl For sqlite checking
+ saved_LIBS="${LIBS}"
+ LIBS="${saved_LIBS} ${SQLITE_LFLAGS}"
+
AC_CHECK_LIB(sqlite3, sqlite3_threadsafe, AC_DEFINE(HAVE_SQLITE3_THREADSAFE, 1, [Set if have sqlite3_threadsafe]))
+
+ dnl Revert after sqlite checks
+ LIBS="${saved_LIBS}"
fi
dnl -------------------------------------------
if test ! -z "$POSTGRESQL_LIB"; then
dnl For postgresql checking
saved_LIBS="${LIBS}"
- LIBS="${saved_LIBS} ${POSTGRESQL_LIB}"
+ LIBS="${saved_LIBS} ${POSTGRESQL_LFLAGS}"
AC_CHECK_LIB(pq, PQisthreadsafe, AC_DEFINE(HAVE_PQISTHREADSAFE, 1, [Set if have PQisthreadsafe]))
AC_CHECK_LIB(pq, PQputCopyData, AC_DEFINE(HAVE_PQ_COPY, 1, [Set if have PQputCopyData]))