Skip to content

Commit

Permalink
only check when using -lsqlite3
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Nov 6, 2023
1 parent 4909ef6 commit 508d5b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions r/adbcsqlite/configure
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ if [ $? -ne 0 ] || [ ! -z "$FORCE_VENDORED_SQLITE3" ]; then
else
echo "Success!"
PKG_LIBS="$PKG_LIBS -lsqlite3"
fi

echo "Testing SQLite for sqlite3_load_extension()"
PKG_CPPFLAGS="$PKG_CPPFLAGS" PKG_LIBS="$PKG_LIBS -lsqlite3" \
$R_HOME/bin/R CMD SHLIB tools/test_extension.c -o sqlite_test >sqlite_test.log 2>&1
# Apple -lsqlite3 does not contain sqlite3_load_extension()
echo "Testing SQLite for sqlite3_load_extension()"
PKG_CPPFLAGS="$PKG_CPPFLAGS" PKG_LIBS="$PKG_LIBS" \
$R_HOME/bin/R CMD SHLIB tools/test_extension.c -o sqlite_test >sqlite_test.log 2>&1

if [ $? -ne 0 ]; then
PKG_CPPFLAGS="$PKG_CPPFLAGS -DADBC_SQLITE_WITH_NO_LOAD_EXTENSION"
if [ $? -ne 0 ]; then
echo "Compile of sqlite3_load_extension() test failed"
cat sqlite_test.log
PKG_CPPFLAGS="$PKG_CPPFLAGS -DADBC_SQLITE_WITH_NO_LOAD_EXTENSION"
else
echo "Success!"
fi
fi

# Add mingw printf flag if on Windows
Expand Down
1 change: 1 addition & 0 deletions r/adbcsqlite/tools/test_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
// under the License.

#include <sqlite3.h>
#include <stddef.h>

void try_load_extension() { sqlite3_load_extension(NULL, NULL, NULL, NULL); }

0 comments on commit 508d5b0

Please sign in to comment.