SQLite

Check-in [4e81e2c7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:configure: in several places where support for -Wl,... linker flags are checked, ensure that the check invokes the linker (not just the compiler) to avoid false positives. This allows us to remove the AIX-specific handling and --disable-rpath bits added in [a15e0f680], as well as make several similar checks more robust.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739
User & Date: stephan 2025-02-21 03:19:21
Context
2025-02-21
17:03
Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would need to use more than SQLITE_LIMIT_COLUMN columns and raise an error. Also include some unrelated compiler warning fixes. (check-in: d7729dbb user: drh tags: trunk)
03:22
configure: in several places where support for -Wl,... linker flags are checked, ensure that the check invokes the linker (not just the compiler) to avoid false positives. This allows us to remove the AIX-specific handling and --disable-rpath bits added in [a15e0f680], as well as make several similar checks more robust. (Leaf check-in: 47c43fcb user: stephan tags: branch-3.49)
03:19
configure: in several places where support for -Wl,... linker flags are checked, ensure that the check invokes the linker (not just the compiler) to avoid false positives. This allows us to remove the AIX-specific handling and --disable-rpath bits added in [a15e0f680], as well as make several similar checks more robust. (check-in: 4e81e2c7 user: stephan tags: trunk)
2025-02-20
17:14
configure: automatically fail the check for rpath on AIX systems and provide a --disable-rpath flag as a fallback for use on platforms which pass the configure-time rpath check but then fail at link-time. Based on discussion in forum thread ae5bd8a84b. (check-in: a15e0f68 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to auto.def.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  "test-runner flags:" {--status} {}

proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \
  "Use #line macros in the amalgamation:"

define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]

sqlite-handle-rpath
sqlite-handle-soname
sqlite-handle-debug
sqlite-handle-tcl
sqlite-handle-threadsafe
sqlite-handle-tempstore
sqlite-handle-line-editing
sqlite-handle-load-extension







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  "test-runner flags:" {--status} {}

proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \
  "Use #line macros in the amalgamation:"

define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]

proj-check-rpath
sqlite-handle-soname
sqlite-handle-debug
sqlite-handle-tcl
sqlite-handle-threadsafe
sqlite-handle-tempstore
sqlite-handle-line-editing
sqlite-handle-load-extension
Changes to autoconf/auto.def.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# "autoconf" bundle of the SQLite project.
#
# This script must be kept compatible with JimTCL, a copy of which is
# included in this source tree as ./autosetup/jimsh0.c.
#
use sqlite-config
sqlite-config-bootstrap autoconf
sqlite-check-common-bins
sqlite-check-common-system-deps
sqlite-handle-rpath
sqlite-handle-soname
sqlite-setup-default-cflags
sqlite-handle-debug
sqlite-handle-threadsafe
sqlite-handle-tempstore
sqlite-handle-line-editing
sqlite-handle-load-extension













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# "autoconf" bundle of the SQLite project.
#
# This script must be kept compatible with JimTCL, a copy of which is
# included in this source tree as ./autosetup/jimsh0.c.
#
use sqlite-config
sqlite-config-bootstrap autoconf
sqlite-check-common-bins
sqlite-check-common-system-deps
proj-check-rpath
sqlite-handle-soname
sqlite-setup-default-cflags
sqlite-handle-debug
sqlite-handle-threadsafe
sqlite-handle-tempstore
sqlite-handle-line-editing
sqlite-handle-load-extension
Changes to autosetup/proj.tcl.
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
# flag. Defines LDFLAGS_RPATH to that/those flag(s) or an empty
# string. Returns 1 if it finds an option, else 0.
#
# By default, the rpath is set to $prefix/lib. However, if either of
# --exec-prefix=... or --libdir=...  are explicitly passed to
# configure then [get-define libdir] is used (noting that it derives
# from exec-prefix by default).
#
# Achtung: we have seen platforms which report that a given option
# checked here will work but then fails at build-time, and the current
# order of checks reflects that. Similarly, platforms which are known
# to report success here but fail to handle this flag at link-time are
# special-cased here to behave as if the check failed.
proc proj-check-rpath {} {
  switch -glob -- [get-define host] {
    *-*-aix* {
      # Skip this check on platform(s) where we know it to pass at
      # this step but fail at build-time, as a workaround for
      # https://sqlite.org/forum/forumpost/ae5bd8a84b until we can
      # find a more reliable approach.
      define LDFLAGS_RPATH ""
      return 0
    }
  }
  if {[proj-opt-was-provided libdir]
      || [proj-opt-was-provided exec-prefix]} {
    set lp "[get-define libdir]"
  } else {
    set lp "[get-define prefix]/lib"
  }
  # If we _don't_ use cc-with {} here (to avoid updating the global
  # CFLAGS or LIBS or whatever it is that cc-check-flags updates) then
  # downstream tests may fail because the resulting rpath gets
  # implicitly injected into them.
  cc-with {} {
    if {[cc-check-flags "-rpath $lp"]} {
      define LDFLAGS_RPATH "-rpath $lp"
    } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} {
      define LDFLAGS_RPATH "-Wl,-rpath,$lp"
    } elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} {
      define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
    } elseif {[cc-check-flags -Wl,-R$lp]} {







<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<










|







940
941
942
943
944
945
946






947










948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
# flag. Defines LDFLAGS_RPATH to that/those flag(s) or an empty
# string. Returns 1 if it finds an option, else 0.
#
# By default, the rpath is set to $prefix/lib. However, if either of
# --exec-prefix=... or --libdir=...  are explicitly passed to
# configure then [get-define libdir] is used (noting that it derives
# from exec-prefix by default).






proc proj-check-rpath {} {










  if {[proj-opt-was-provided libdir]
      || [proj-opt-was-provided exec-prefix]} {
    set lp "[get-define libdir]"
  } else {
    set lp "[get-define prefix]/lib"
  }
  # If we _don't_ use cc-with {} here (to avoid updating the global
  # CFLAGS or LIBS or whatever it is that cc-check-flags updates) then
  # downstream tests may fail because the resulting rpath gets
  # implicitly injected into them.
  cc-with {-link 1} {
    if {[cc-check-flags "-rpath $lp"]} {
      define LDFLAGS_RPATH "-rpath $lp"
    } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} {
      define LDFLAGS_RPATH "-Wl,-rpath,$lp"
    } elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} {
      define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
    } elseif {[cc-check-flags -Wl,-R$lp]} {
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
#
# The libname argument is only for purposes of running the flag
# compatibility test, and is not included in the resulting
# LDFLAGS_SONAME_PREFIX. It is provided so that clients may
# potentially avoid some end-user confusion by using their own lib's
# name here (which shows up in the "checking..." output).
proc proj-check-soname {{libname "libfoo.so.0"}} {
  cc-with {} {
    if {[cc-check-flags "-Wl,-soname,${libname}"]} {
      define LDFLAGS_SONAME_PREFIX "-Wl,-soname,"
      return 1
    } else {
      define LDFLAGS_SONAME_PREFIX ""
      return 0
    }







|







981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
#
# The libname argument is only for purposes of running the flag
# compatibility test, and is not included in the resulting
# LDFLAGS_SONAME_PREFIX. It is provided so that clients may
# potentially avoid some end-user confusion by using their own lib's
# name here (which shows up in the "checking..." output).
proc proj-check-soname {{libname "libfoo.so.0"}} {
  cc-with {-link 1} {
    if {[cc-check-flags "-Wl,-soname,${libname}"]} {
      define LDFLAGS_SONAME_PREFIX "-Wl,-soname,"
      return 1
    } else {
      define LDFLAGS_SONAME_PREFIX ""
      return 0
    }
Changes to autosetup/sqlite-config.tcl.
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
    # Options primarily for downstream packagers/package maintainers
    packaging {
      {autoconf} {
        # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704
        static-shell=1       => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c}
      }
      {*} {
        # rpath: https://sqlite.org/forum/forumpost/fa3a6ed858
        rpath=1
          => {Disable checking for rpath support}
        # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
        soname:=legacy
          => {SONAME for libsqlite3.so. "none", or not using this flag, sets no
              soname. "legacy" sets it to its historical value of
              libsqlite3.so.0.  A value matching the glob "libsqlite3.*" sets
              it to that literal value. Any other value is assumed to be a
              suffix which gets applied to "libsqlite3.so.",







<
<
<







240
241
242
243
244
245
246



247
248
249
250
251
252
253
    # Options primarily for downstream packagers/package maintainers
    packaging {
      {autoconf} {
        # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704
        static-shell=1       => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c}
      }
      {*} {



        # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
        soname:=legacy
          => {SONAME for libsqlite3.so. "none", or not using this flag, sets no
              soname. "legacy" sets it to its historical value of
              libsqlite3.so.0.  A value matching the glob "libsqlite3.*" sets
              it to that literal value. Any other value is assumed to be a
              suffix which gets applied to "libsqlite3.so.",
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
    msg-result yes
  } {
    define TARGET_DEBUG {-DNDEBUG}
    msg-result no
  }
}

########################################################################
# If the --disable-rpath flag is used, this [define]s LDFLAGS_RPATH to
# an empty string, else it invokes [proj-check-rpath].
proc sqlite-handle-rpath {} {
  proj-if-opt-truthy rpath {
    proj-check-rpath
  } {
    define LDFLAGS_RPATH ""
  }
}

########################################################################
# "soname" for libsqlite3.so. See discussion at:
# https://sqlite.org/src/forumpost/5a3b44f510df8ded
proc sqlite-handle-soname {} {
  define LDFLAGS_LIBSQLITE3_SONAME ""
  if {[proj-opt-was-provided soname]} {
    set soname [join [opt-val soname] ""]







<
<
<
<
<
<
<
<
<
<
<







640
641
642
643
644
645
646











647
648
649
650
651
652
653
    msg-result yes
  } {
    define TARGET_DEBUG {-DNDEBUG}
    msg-result no
  }
}












########################################################################
# "soname" for libsqlite3.so. See discussion at:
# https://sqlite.org/src/forumpost/5a3b44f510df8ded
proc sqlite-handle-soname {} {
  define LDFLAGS_LIBSQLITE3_SONAME ""
  if {[proj-opt-was-provided soname]} {
    set soname [join [opt-val soname] ""]
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
# libtool applied only on Mac platforms.
#
# Based on https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7.
proc sqlite-check-mac-cversion {} {
  define LDFLAGS_MAC_CVERSION ""
  set rc 0
  if {[proj-looks-like-mac]} {
    cc-with {} {
      # These version numbers are historical libtool-defined values, not
      # library-defined ones
      if {[cc-check-flags "-Wl,-current_version,9.6.0"]
          && [cc-check-flags "-Wl,-compatibility_version,9.0.0"]} {
        define LDFLAGS_MAC_CVERSION "-Wl,-compatibility_version,9.0.0 -Wl,-current_version,9.6.0"
        set rc 1
      } elseif {[cc-check-flags "-compatibility_version 9.0.0"]







|







1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
# libtool applied only on Mac platforms.
#
# Based on https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7.
proc sqlite-check-mac-cversion {} {
  define LDFLAGS_MAC_CVERSION ""
  set rc 0
  if {[proj-looks-like-mac]} {
    cc-with {-link 1} {
      # These version numbers are historical libtool-defined values, not
      # library-defined ones
      if {[cc-check-flags "-Wl,-current_version,9.6.0"]
          && [cc-check-flags "-Wl,-compatibility_version,9.0.0"]} {
        define LDFLAGS_MAC_CVERSION "-Wl,-compatibility_version,9.0.0 -Wl,-current_version,9.6.0"
        set rc 1
      } elseif {[cc-check-flags "-compatibility_version 9.0.0"]
1260
1261
1262
1263
1264
1265
1266



1267
1268
1269


1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283



1284
1285
1286
1287
1288
1289
1290
########################################################################
# Define LDFLAGS_OUT_IMPLIB to either an empty string or to a
# -Wl,... flag for the platform-specific --out-implib flag, which is
# used for building an "import library .dll.a" file on some platforms
# (e.g. mingw). Returns 1 if supported, else 0.
#
# If the configure flag --out-implib is not used then this is a no-op.



# The feature is specifically opt-in because on some platforms the
# feature test will pass but using that flag will fail at link-time
# (e.g. OpenBSD).


#
# Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2
proc sqlite-check-out-implib {} {
  define LDFLAGS_OUT_IMPLIB ""
  set rc 0
  if {[proj-opt-was-provided out-implib]} {
    cc-with {} {
      set dll "libsqlite3[get-define TARGET_DLLEXT]"
      set flags "-Wl,--out-implib,${dll}.a"
      if {[cc-check-flags $flags]} {
        define LDFLAGS_OUT_IMPLIB $flags
        set rc 1
      }
    }



  }
  return $rc
}

########################################################################
# Performs late-stage config steps common to both the canonical and
# autoconf bundle builds.







>
>
>
|
<
<
>
>






|







>
>
>







1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256


1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
########################################################################
# Define LDFLAGS_OUT_IMPLIB to either an empty string or to a
# -Wl,... flag for the platform-specific --out-implib flag, which is
# used for building an "import library .dll.a" file on some platforms
# (e.g. mingw). Returns 1 if supported, else 0.
#
# If the configure flag --out-implib is not used then this is a no-op.
# If that flag is used but the capability is not available, a fatal
# error is triggered.
#
# This feature is specifically opt-in because it's supported on far


# more platforms than actually need it and enabling it causes creation
# of libsqlite3.so.a files which are unnecessary in most environments.
#
# Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2
proc sqlite-check-out-implib {} {
  define LDFLAGS_OUT_IMPLIB ""
  set rc 0
  if {[proj-opt-was-provided out-implib]} {
    cc-with {-link 1} {
      set dll "libsqlite3[get-define TARGET_DLLEXT]"
      set flags "-Wl,--out-implib,${dll}.a"
      if {[cc-check-flags $flags]} {
        define LDFLAGS_OUT_IMPLIB $flags
        set rc 1
      }
    }
    if {!$rc} {
      user-error "--out-implib is not supported on this platform"
    }
  }
  return $rc
}

########################################################################
# Performs late-stage config steps common to both the canonical and
# autoconf bundle builds.