configure: fix linking with shared sqlite on *BSD

This commit is contained in:
Lee Starnes 2014-05-31 22:56:12 -04:00
parent a6ef3156ec
commit cf1001a739
2 changed files with 44 additions and 10 deletions

25
configure vendored
View file

@ -7259,10 +7259,21 @@ fi
if test "$shared_sqlite" = yes; then
saveCPPFLAGS="$CPPFLAGS"
saveLIBS="$LIBS"
OSNAME=`uname -s`
case $OSNAME in
*BSD)
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LIBS="$LIBS -L/usr/local/lib"
;;
esac
ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
if test "x$ac_cv_header_sqlite3_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5
$as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; }
if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then :
$as_echo_n "(cached) " >&6
@ -7300,8 +7311,7 @@ fi
$as_echo "$ac_cv_lib_sqlite3_sqlite3_open" >&6; }
if test "x$ac_cv_lib_sqlite3_sqlite3_open" = xyes; then :
SQLITE_LD=-lsqlite3
SQLITE_LD="$CPPFLAGS $LIBS -lsqlite3"
else
shared_sqlite=no
@ -7317,11 +7327,16 @@ fi
fi
if test "$shared_sqlite" = no; then
SQLITE_SRC=sqlite3.c
SQLITE_SRC="sqlite3.c"
fi
CPPFLAGS="$saveCPPFLAGS"
LIBS="$saveLIBS"
# Check whether --enable-ports was given.
if test "${enable_ports+set}" = set; then :
enableval=$enable_ports; if test $enableval = yes; then

View file

@ -564,25 +564,44 @@ AC_CHECK_HEADER(zlib.h, [
fi
dnl Check for shared sqlite
dnl ======================
AC_ARG_WITH(shared-sqlite,
AC_HELP_STRING([--with-shared-sqlite],[Use shared sqlite]),
[shared_sqlite=$withval],[shared_sqlite=no])
if test "$shared_sqlite" = yes; then
saveCPPFLAGS="$CPPFLAGS"
saveLIBS="$LIBS"
dnl XXX: *BSD uses /usr/local for shared sqlite libs and includes
OSNAME=`uname -s`
case $OSNAME in
*BSD)
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LIBS="$LIBS -L/usr/local/lib"
;;
esac
AC_CHECK_HEADER(sqlite3.h, [
AC_CHECK_LIB(sqlite3, sqlite3_open,
[
AC_SUBST(SQLITE_LD, -lsqlite3)
], shared_sqlite=no)
AC_CHECK_LIB(sqlite3, sqlite3_open, [
SQLITE_LD="$CPPFLAGS $LIBS -lsqlite3"
], shared_sqlite=no)
], shared_sqlite=no)
fi
if test "$shared_sqlite" = no; then
AC_SUBST(SQLITE_SRC, sqlite3.c)
SQLITE_SRC="sqlite3.c"
fi
AC_SUBST(SQLITE_LD)
AC_SUBST(SQLITE_SRC)
CPPFLAGS="$saveCPPFLAGS"
LIBS="$saveLIBS"
dnl IO Loop Selection
dnl =================