mirror of
https://git.freebsd.org/ports.git
synced 2025-06-18 03:00:42 -04:00
154 lines
5.3 KiB
Text
154 lines
5.3 KiB
Text
Index: auto.def
|
|
==================================================================
|
|
--- auto.def
|
|
+++ auto.def
|
|
@@ -116,11 +116,11 @@
|
|
}
|
|
return $found
|
|
}
|
|
|
|
if {![opt-bool internal-sqlite]} {
|
|
- proc find_internal_sqlite {} {
|
|
+ proc find_system_sqlite {} {
|
|
|
|
# On some systems (slackware), libsqlite3 requires -ldl to link. So
|
|
# search for the system SQLite once with -ldl, and once without. If
|
|
# the library can only be found with $extralibs set to -ldl, then
|
|
# the code below will append -ldl to LIBS.
|
|
@@ -131,14 +131,10 @@
|
|
# if sqlite3_stmt_isexplain can be found as well. If we can find open() but
|
|
# not stmt_isexplain(), then the system SQLite is too old to link against
|
|
# fossil.
|
|
#
|
|
if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
|
|
- if {![check-function-in-lib sqlite3_stmt_isexplain sqlite3 $extralibs]} {
|
|
- user-error "system sqlite3 too old (require >= 3.28.0)"
|
|
- }
|
|
-
|
|
# Success. Update symbols and return.
|
|
#
|
|
define USE_SYSTEM_SQLITE 1
|
|
define-append LIBS -lsqlite3
|
|
define-append LIBS $extralibs
|
|
@@ -146,11 +142,44 @@
|
|
}
|
|
}
|
|
user-error "system sqlite3 not found"
|
|
}
|
|
|
|
- find_internal_sqlite
|
|
+ find_system_sqlite
|
|
+
|
|
+ proc test_system_sqlite {} {
|
|
+ # Check compatibility of the system SQLite library by running the sqlcompttest.c
|
|
+ # program in the source tree
|
|
+ #
|
|
+ set cmdline {}
|
|
+ lappend cmdline {*}[get-define CCACHE]
|
|
+ lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
|
|
+ lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
|
|
+ lappend cmdline {*}[get-define LDFLAGS]
|
|
+ lappend cmdline {*}[get-define LIBS]
|
|
+ set ok 1
|
|
+ set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
|
|
+ if {$err} {
|
|
+ configlog "Failed: [join $cmdline]"
|
|
+ if {[string length $result]>0} {configlog $result}
|
|
+ configlog "============"
|
|
+ set ok 0
|
|
+ } elseif {$::autosetup(debug)} {
|
|
+ configlog "Compiled OK: [join $cmdline]"
|
|
+ configlog "============"
|
|
+ }
|
|
+ if {!$ok} {
|
|
+ user-error "unable to compile SQLite compatibility test program"
|
|
+ }
|
|
+ set err [catch {exec-with-stderr ./conftest__} result errinfo]
|
|
+ if {$err} {
|
|
+ user-error $result
|
|
+ }
|
|
+ file delete ./conftest__
|
|
+ }
|
|
+ test_system_sqlite
|
|
+
|
|
}
|
|
|
|
proc is_mingw {} {
|
|
return [string match *mingw* [get-define host]]
|
|
}
|
|
|
|
ADDED src/sqlcompattest.c
|
|
Index: src/sqlcompattest.c
|
|
==================================================================
|
|
--- src/sqlcompattest.c
|
|
+++ src/sqlcompattest.c
|
|
@@ -0,0 +1,69 @@
|
|
+/*
|
|
+** Copyright (c) 2019 D. Richard Hipp
|
|
+**
|
|
+** This program is free software; you can redistribute it and/or
|
|
+** modify it under the terms of the Simplified BSD License (also
|
|
+** known as the "2-Clause License" or "FreeBSD License".)
|
|
+**
|
|
+** This program is distributed in the hope that it will be useful,
|
|
+** but without any warranty; without even the implied warranty of
|
|
+** merchantability or fitness for a particular purpose.
|
|
+**
|
|
+** Author contact information:
|
|
+** drh@hwaci.com
|
|
+** http://www.hwaci.com/drh/
|
|
+**
|
|
+*******************************************************************************
|
|
+**
|
|
+** This file is NOT part of the Fossil executable
|
|
+**
|
|
+** This file contains a test program used by ../configure with the
|
|
+** the --disable-internal-sqlite option to determine whether or
|
|
+** not the system SQLite library is sufficient to support Fossil.
|
|
+**
|
|
+** It is preferred to statically link Fossil with the sqlite3.c source
|
|
+** file that is part of the source tree and not use any SQLite shared
|
|
+** library that is included with the system. But some packagers do not
|
|
+** like to do this. Hence, we provide the option to link Fossil against
|
|
+** the system SQLite shared library. But Fossil is very particular about
|
|
+** the version and build options for SQLite. Unless a recent version of
|
|
+** SQLite is available, and unless that SQLite is built using some
|
|
+** non-default features, the system library won't meet the needs of
|
|
+** Fossil. This program attempts to determine if the system library
|
|
+** SQLite is sufficient for Fossil.
|
|
+**
|
|
+** Compile this program, linking it against the system SQLite library,
|
|
+** and run it. If it returns with a zero exit code, then all is well.
|
|
+** But if it returns a non-zero exit code, then the system SQLite library
|
|
+** lacks some capability that Fossil uses. A message on stdout describes
|
|
+** the missing feature.
|
|
+*/
|
|
+#include "sqlite3.h"
|
|
+#include <stdio.h>
|
|
+
|
|
+int main(int argc, char **argv){
|
|
+ int i;
|
|
+ static const char *zRequiredOpts[] = {
|
|
+ "ENABLE_FTS4", /* Required for repository search */
|
|
+ "ENABLE_JSON1", /* Required for the check-in locking protocol */
|
|
+ "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
|
|
+ };
|
|
+
|
|
+ /* Check minimum SQLite version number */
|
|
+ if( sqlite3_libversion_number()<3028000 ){
|
|
+ printf("found SQLite version %s but need 3.28.0 or later\n",
|
|
+ sqlite3_libversion());
|
|
+ return 1;
|
|
+ }
|
|
+
|
|
+ for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
|
|
+ if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){
|
|
+ printf("system SQLite library omits required build option -DSQLITE_%s\n",
|
|
+ zRequiredOpts[i]);
|
|
+ return 1;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /* Success! */
|
|
+ return 0;
|
|
+}
|