configure: add --enable-shared-sqlite option

When --enable-shared-sqlite is used, charybdis will be compiled with a shared
sqlite library if it is available.
This commit is contained in:
Lee Starnes 2014-05-27 10:39:55 -04:00
parent 69f4561b39
commit 497e30a0bb
3 changed files with 97 additions and 5 deletions

View file

@ -29,9 +29,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@ PROGRAM_PREFIX = @PROGRAM_PREFIX@
SQLITE_LIB = @SQLITE_LD@
ZIP_LIB = @ZLIB_LD@ ZIP_LIB = @ZLIB_LD@
IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) $(ZIP_LIB) IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) $(ZIP_LIB) $(SQLITE_LIB)
INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES) INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
@ -45,16 +46,22 @@ PROGS = $(pkglibexec_PROGS) $(bin_PROGS)
BANDB_SOURCES = \ BANDB_SOURCES = \
bandb.c \ bandb.c \
rsdb_snprintf.c \ rsdb_snprintf.c \
rsdb_sqlite3.c \ rsdb_sqlite3.c
sqlite3.c
ifndef SQLITE_LIB
BANDB_SOURCES+=sqlite3.c
endif
BANDB_OBJECTS = ${BANDB_SOURCES:.c=.o} BANDB_OBJECTS = ${BANDB_SOURCES:.c=.o}
BANTOOL_SOURCES = \ BANTOOL_SOURCES = \
bantool.c \ bantool.c \
rsdb_snprintf.c \ rsdb_snprintf.c \
rsdb_sqlite3.c \ rsdb_sqlite3.c
sqlite3.c
ifndef SQLITE_LIB
BANTOOL_SOURCES+=sqlite3.c
endif
BANTOOL_OBJECTS = ${BANTOOL_SOURCES:.c=.o} BANTOOL_OBJECTS = ${BANTOOL_SOURCES:.c=.o}

70
configure vendored
View file

@ -642,6 +642,7 @@ HELP_DIR
logdir logdir
LOG_DIR LOG_DIR
ETC_DIR ETC_DIR
SQLITE_LD
ZLIB_LD ZLIB_LD
ENCSPEED ENCSPEED
ALLOCA ALLOCA
@ -732,6 +733,7 @@ enable_ipv6
enable_openssl enable_openssl
with_zlib_path with_zlib_path
enable_zlib enable_zlib
enable_shared_sqlite
enable_ports enable_ports
enable_poll enable_poll
enable_select enable_select
@ -1379,6 +1381,7 @@ Optional Features:
--enable-openssl=DIR Enable OpenSSL support (DIR optional). --enable-openssl=DIR Enable OpenSSL support (DIR optional).
--disable-openssl Disable OpenSSL support. --disable-openssl Disable OpenSSL support.
--disable-zlib Disable ziplinks support --disable-zlib Disable ziplinks support
--enable-shared-sqlite Use shared sqlite
--enable-ports Force solaris I/O ports subsystem usage. --enable-ports Force solaris I/O ports subsystem usage.
--enable-poll Force poll() usage. --enable-poll Force poll() usage.
--enable-select Force select() usage. --enable-select Force select() usage.
@ -7242,6 +7245,73 @@ fi
fi
# Check whether --enable-shared-sqlite was given.
if test "${enable_shared_sqlite+set}" = set; then :
enableval=$enable_shared_sqlite; shared_sqlite=$enableval
else
shared_sqlite=no
fi
if test "$shared_sqlite" = yes; then
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_n "checking for sqlite3_open in -lsqlite3... " >&6; }
if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsqlite3 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char sqlite3_open ();
int
main ()
{
return sqlite3_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_sqlite3_sqlite3_open=yes
else
ac_cv_lib_sqlite3_sqlite3_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_open" >&5
$as_echo "$ac_cv_lib_sqlite3_sqlite3_open" >&6; }
if test "x$ac_cv_lib_sqlite3_sqlite3_open" = xyes; then :
SQLITE_LD=-lsqlite3
else
shared_sqlite=no
fi
else
shared_sqlite=no
fi
fi fi

View file

@ -564,6 +564,21 @@ AC_CHECK_HEADER(zlib.h, [
fi fi
AC_ARG_ENABLE(shared-sqlite,
AC_HELP_STRING([--enable-shared-sqlite],[Use shared sqlite]),
[shared_sqlite=$enableval],[shared_sqlite=no])
if test "$shared_sqlite" = yes; then
AC_CHECK_HEADER(sqlite3.h, [
AC_CHECK_LIB(sqlite3, sqlite3_open,
[
AC_SUBST(SQLITE_LD, -lsqlite3)
], shared_sqlite=no)
], shared_sqlite=no)
fi
dnl IO Loop Selection dnl IO Loop Selection
dnl ================= dnl =================