Fossil SCM

Reindent auto.def to the project-conventional 2 spaces instead of 4. No functional changes.

stephan 2025-02-26 06:50 trunk
Commit a76b48cd532a05a976f230856c71810d7fdce7e4023533fad7e4c6c038506e8c
1 file changed +395 -395
+395 -395
--- auto.def
+++ auto.def
@@ -41,12 +41,12 @@
4141
define MINIMUM_SQLITE_VERSION "3.46.0"
4242
4343
# This is useful for people wanting Fossil to use an external SQLite library
4444
# to compare the one they have against the minimum required
4545
if {[opt-bool print-minimum-sqlite-version]} {
46
- puts [get-define MINIMUM_SQLITE_VERSION]
47
- exit 0
46
+ puts [get-define MINIMUM_SQLITE_VERSION]
47
+ exit 0
4848
}
4949
5050
# Space characters have never been allowed in either the source
5151
# tree nor the build directory. But the resulting error messages
5252
# could be confusing. The following checks make the reason for the
@@ -67,21 +67,21 @@
6767
set outOfTreeBuild 1
6868
}
6969
7070
# sqlite wants these types if possible
7171
cc-with {-includes {stdint.h inttypes.h}} {
72
- cc-check-types uint32_t uint16_t int16_t uint8_t
72
+ cc-check-types uint32_t uint16_t int16_t uint8_t
7373
}
7474
7575
# Use pread/pwrite system calls in place of seek + read/write if possible
7676
define USE_PREAD [cc-check-functions pread]
7777
7878
# If we have cscope here, we'll use it in the "tags" target
7979
if {[cc-check-progs cscope]} {
80
- define COLLECT_CSCOPE_DATA "cscope -bR $::autosetup(srcdir)/src/*.\[ch\]"
80
+ define COLLECT_CSCOPE_DATA "cscope -bR $::autosetup(srcdir)/src/*.\[ch\]"
8181
} else {
82
- define COLLECT_CSCOPE_DATA ""
82
+ define COLLECT_CSCOPE_DATA ""
8383
}
8484
8585
# Find tclsh for the test suite.
8686
#
8787
# We can't use jimsh for this: the test suite uses features of Tcl that
@@ -94,32 +94,32 @@
9494
# Ironically, this means we may right now be running under either jimsh0
9595
# or a version of tclsh that we find unsuitable below!
9696
cc-check-progs tclsh
9797
set hbtd /usr/local/Cellar/tcl-tk
9898
if {[string equal false [get-define TCLSH]]} {
99
- msg-result "WARNING: 'make test' will not run here."
100
-} else {
101
- set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
102
- if {[expr {$v >= 8.6}]} {
103
- msg-result "Found Tclsh version $v in the PATH."
104
- define TCLSH tclsh
105
- } elseif {[file isdirectory $hbtd]} {
106
- # This is a macOS system with the Homebrew version of Tcl/Tk
107
- # installed. Select the newest version. It won't normally be
108
- # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
109
- # were in the PATH, it's bad practice to put /usr/local/bin (the
110
- # Homebrew default) ahead of /usr/bin, especially given that
111
- # it's user-writeable by default with Homebrew. Thus, we can be
112
- # pretty sure the only way to call it is with an absolute path.
113
- set v [exec ls -tr $hbtd | tail -1]
114
- set path "$hbtd/$v/bin/tclsh"
115
- define TCLSH $path
116
- msg-result "Using Homebrew Tcl/Tk version $path."
117
- } else {
118
- msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
119
- define TCLSH false ;# force "make test" failure via /usr/bin/false
120
- }
99
+ msg-result "WARNING: 'make test' will not run here."
100
+} else {
101
+ set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
102
+ if {[expr {$v >= 8.6}]} {
103
+ msg-result "Found Tclsh version $v in the PATH."
104
+ define TCLSH tclsh
105
+ } elseif {[file isdirectory $hbtd]} {
106
+ # This is a macOS system with the Homebrew version of Tcl/Tk
107
+ # installed. Select the newest version. It won't normally be
108
+ # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
109
+ # were in the PATH, it's bad practice to put /usr/local/bin (the
110
+ # Homebrew default) ahead of /usr/bin, especially given that
111
+ # it's user-writeable by default with Homebrew. Thus, we can be
112
+ # pretty sure the only way to call it is with an absolute path.
113
+ set v [exec ls -tr $hbtd | tail -1]
114
+ set path "$hbtd/$v/bin/tclsh"
115
+ define TCLSH $path
116
+ msg-result "Using Homebrew Tcl/Tk version $path."
117
+ } else {
118
+ msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
119
+ define TCLSH false ;# force "make test" failure via /usr/bin/false
120
+ }
121121
}
122122
123123
define CFLAGS [get-env CFLAGS "-g -Os"]
124124
define EXTRA_CFLAGS "-Wall"
125125
define EXTRA_LDFLAGS ""
@@ -133,48 +133,48 @@
133133
# SQLITE_OPTIONS_EXT => build-dependent CFLAGS for sqlite3.c and shell.c
134134
135135
# Maintain the C89/C90-style order of variable declarations before statements.
136136
# Check if the compiler supports the respective warning flag.
137137
if {[cctest -cflags -Wdeclaration-after-statement]} {
138
- define-append EXTRA_CFLAGS -Wdeclaration-after-statement
138
+ define-append EXTRA_CFLAGS -Wdeclaration-after-statement
139139
}
140140
141141
142142
# This procedure is a customized version of "cc-check-function-in-lib",
143143
# that does not modify the LIBS variable. Its use prevents prematurely
144144
# pulling in libraries that will be added later anyhow (e.g. "-ldl").
145145
proc check-function-in-lib {function libs {otherlibs {}}} {
146
- if {[string length $otherlibs]} {
147
- msg-checking "Checking for $function in $libs with $otherlibs..."
148
- } else {
149
- msg-checking "Checking for $function in $libs..."
150
- }
151
- set found 0
152
- cc-with [list -libs $otherlibs] {
153
- if {[cctest_function $function]} {
154
- msg-result "none needed"
155
- define lib_$function ""
156
- incr found
157
- } else {
158
- foreach lib $libs {
159
- cc-with [list -libs -l$lib] {
160
- if {[cctest_function $function]} {
161
- msg-result -l$lib
162
- define lib_$function -l$lib
163
- incr found
164
- break
165
- }
166
- }
167
- }
168
- }
169
- }
170
- if {$found} {
171
- define [feature-define-name $function]
172
- } else {
173
- msg-result "no"
174
- }
175
- return $found
146
+ if {[string length $otherlibs]} {
147
+ msg-checking "Checking for $function in $libs with $otherlibs..."
148
+ } else {
149
+ msg-checking "Checking for $function in $libs..."
150
+ }
151
+ set found 0
152
+ cc-with [list -libs $otherlibs] {
153
+ if {[cctest_function $function]} {
154
+ msg-result "none needed"
155
+ define lib_$function ""
156
+ incr found
157
+ } else {
158
+ foreach lib $libs {
159
+ cc-with [list -libs -l$lib] {
160
+ if {[cctest_function $function]} {
161
+ msg-result -l$lib
162
+ define lib_$function -l$lib
163
+ incr found
164
+ break
165
+ }
166
+ }
167
+ }
168
+ }
169
+ }
170
+ if {$found} {
171
+ define [feature-define-name $function]
172
+ } else {
173
+ msg-result "no"
174
+ }
175
+ return $found
176176
}
177177
178178
if {![opt-bool internal-sqlite]} {
179179
proc find_system_sqlite {} {
180180
@@ -219,17 +219,17 @@
219219
set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
220220
lappend cmdline {*}[set sqlite-version]
221221
set ok 1
222222
set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
223223
if {$err} {
224
- configlog "Failed: [join $cmdline]"
225
- if {[string length $result]>0} {configlog $result}
226
- configlog "============"
227
- set ok 0
224
+ configlog "Failed: [join $cmdline]"
225
+ if {[string length $result]>0} {configlog $result}
226
+ configlog "============"
227
+ set ok 0
228228
} elseif {$::autosetup(debug)} {
229
- configlog "Compiled OK: [join $cmdline]"
230
- configlog "============"
229
+ configlog "Compiled OK: [join $cmdline]"
230
+ configlog "============"
231231
}
232232
if {!$ok} {
233233
user-error "unable to compile SQLite compatibility test program"
234234
}
235235
set err [catch {exec-with-stderr ./conftest__} result errinfo]
@@ -251,91 +251,91 @@
251251
![file exists "/dev/null"]
252252
}]
253253
}
254254
255255
if {[is_mingw]} {
256
- define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
257
- define-append LIBS -lkernel32 -lws2_32
258
-} else {
259
- #
260
- # NOTE: All platforms except MinGW should use the linenoise
261
- # package. It is currently unsupported on Win32.
262
- #
263
- define USE_LINENOISE 1
264
-}
265
-
266
-if {[string match *-solaris* [get-define host]]} {
267
- define-append EXTRA_CFLAGS {-D__EXTENSIONS__}
268
-}
269
-
270
-if {[opt-bool fossil-debug]} {
271
- define CFLAGS {-g -O0 -Wall}
272
- define-append CFLAGS -DFOSSIL_DEBUG
273
- msg-result "Debugging support enabled"
274
-}
275
-
276
-if {[opt-bool no-opt]} {
277
- define CFLAGS {-g -O0 -Wall}
278
- msg-result "Builting without compiler optimization"
279
- if {[opt-bool fossil-debug]} {
280
- define-append CFLAGS -DFOSSIL_DEBUG
281
- }
282
-}
283
-
284
-if {[opt-bool with-mman]} {
285
- define-append EXTRA_CFLAGS -DUSE_MMAN_H
286
- define USE_MMAN_H 1
287
- msg-result "Enabling \"sys/mman.h\" support"
256
+ define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
257
+ define-append LIBS -lkernel32 -lws2_32
258
+} else {
259
+ #
260
+ # NOTE: All platforms except MinGW should use the linenoise
261
+ # package. It is currently unsupported on Win32.
262
+ #
263
+ define USE_LINENOISE 1
264
+}
265
+
266
+if {[string match *-solaris* [get-define host]]} {
267
+ define-append EXTRA_CFLAGS {-D__EXTENSIONS__}
268
+}
269
+
270
+if {[opt-bool fossil-debug]} {
271
+ define CFLAGS {-g -O0 -Wall}
272
+ define-append CFLAGS -DFOSSIL_DEBUG
273
+ msg-result "Debugging support enabled"
274
+}
275
+
276
+if {[opt-bool no-opt]} {
277
+ define CFLAGS {-g -O0 -Wall}
278
+ msg-result "Builting without compiler optimization"
279
+ if {[opt-bool fossil-debug]} {
280
+ define-append CFLAGS -DFOSSIL_DEBUG
281
+ }
282
+}
283
+
284
+if {[opt-bool with-mman]} {
285
+ define-append EXTRA_CFLAGS -DUSE_MMAN_H
286
+ define USE_MMAN_H 1
287
+ msg-result "Enabling \"sys/mman.h\" support"
288288
}
289289
290290
if {[opt-bool with-see]} {
291
- define-append EXTRA_CFLAGS -DUSE_SEE
292
- define USE_SEE 1
293
- define SQLITE3_ORIGIN 1
294
- msg-result "Enabling encryption support"
291
+ define-append EXTRA_CFLAGS -DUSE_SEE
292
+ define USE_SEE 1
293
+ define SQLITE3_ORIGIN 1
294
+ msg-result "Enabling encryption support"
295295
}
296296
297297
if {[opt-bool json]} {
298
- # Reminder/FIXME (stephan): FOSSIL_ENABLE_JSON
299
- # is required in the CFLAGS because json*.c
300
- # have #ifdef guards around the whole file without
301
- # reading config.h first.
302
- define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
303
- define FOSSIL_ENABLE_JSON
304
- msg-result "JSON support enabled"
298
+ # Reminder/FIXME (stephan): FOSSIL_ENABLE_JSON
299
+ # is required in the CFLAGS because json*.c
300
+ # have #ifdef guards around the whole file without
301
+ # reading config.h first.
302
+ define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
303
+ define FOSSIL_ENABLE_JSON
304
+ msg-result "JSON support enabled"
305305
}
306306
307307
if {[opt-bool with-exec-rel-paths]} {
308
- define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_EXEC_REL_PATHS
309
- define FOSSIL_ENABLE_EXEC_REL_PATHS
310
- msg-result "Relative paths in external diff/gdiff enabled"
308
+ define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_EXEC_REL_PATHS
309
+ define FOSSIL_ENABLE_EXEC_REL_PATHS
310
+ msg-result "Relative paths in external diff/gdiff enabled"
311311
}
312312
313313
if {[opt-bool with-th1-docs]} {
314
- define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_DOCS
315
- define FOSSIL_ENABLE_TH1_DOCS
316
- msg-result "TH1 embedded documentation support enabled"
314
+ define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_DOCS
315
+ define FOSSIL_ENABLE_TH1_DOCS
316
+ msg-result "TH1 embedded documentation support enabled"
317317
}
318318
319319
if {[opt-bool with-th1-hooks]} {
320
- define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS
321
- define FOSSIL_ENABLE_TH1_HOOKS
322
- msg-result "TH1 hooks support enabled"
320
+ define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS
321
+ define FOSSIL_ENABLE_TH1_HOOKS
322
+ msg-result "TH1 hooks support enabled"
323323
}
324324
325325
#if {[opt-bool markdown]} {
326326
# # no-op. Markdown is now enabled by default.
327327
# msg-result "Markdown support enabled"
328328
#}
329329
330330
if {[opt-bool static]} {
331
- # XXX: This will not work on all systems.
332
- define-append EXTRA_LDFLAGS -static
333
- msg-result "Trying to link statically"
331
+ # XXX: This will not work on all systems.
332
+ define-append EXTRA_LDFLAGS -static
333
+ msg-result "Trying to link statically"
334334
} else {
335
- define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1
336
- define FOSSIL_DYNAMIC_BUILD
335
+ define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1
336
+ define FOSSIL_DYNAMIC_BUILD
337337
}
338338
339339
# Check for libraries that need to be sorted out early
340340
cc-check-function-in-lib iconv iconv
341341
@@ -342,41 +342,41 @@
342342
cc-check-function-in-lib sin m ;# must come before ssl check:
343343
# https://fossil-scm.org/forum/forumpost/afcd42b7fd
344344
345345
# Helper for OpenSSL checking
346346
proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto -lpthread}}} {
347
- msg-checking "Checking for $msg..."
348
- set rc 0
349
- if {[is_mingw]} {
350
- lappend libs -lgdi32 -lwsock32 -lcrypt32
351
- }
352
- if {[info exists ::zlib_lib]} {
353
- lappend libs $::zlib_lib
354
- }
355
- msg-quiet cc-with [list -cflags $cflags -libs $libs] {
356
- if {[cc-check-includes openssl/ssl.h] && \
357
- [cc-check-functions SSL_new]} {
358
- incr rc
359
- }
360
- }
361
- if {!$rc && ![is_mingw]} {
362
- # On some systems, OpenSSL appears to require -ldl to link.
363
- lappend libs -ldl
364
- msg-quiet cc-with [list -cflags $cflags -libs $libs] {
365
- if {[cc-check-includes openssl/ssl.h] && \
366
- [cc-check-functions SSL_new]} {
367
- incr rc
368
- }
369
- }
370
- }
371
- if {$rc} {
372
- msg-result "ok"
373
- return 1
374
- } else {
375
- msg-result "no"
376
- return 0
377
- }
347
+ msg-checking "Checking for $msg..."
348
+ set rc 0
349
+ if {[is_mingw]} {
350
+ lappend libs -lgdi32 -lwsock32 -lcrypt32
351
+ }
352
+ if {[info exists ::zlib_lib]} {
353
+ lappend libs $::zlib_lib
354
+ }
355
+ msg-quiet cc-with [list -cflags $cflags -libs $libs] {
356
+ if {[cc-check-includes openssl/ssl.h] && \
357
+ [cc-check-functions SSL_new]} {
358
+ incr rc
359
+ }
360
+ }
361
+ if {!$rc && ![is_mingw]} {
362
+ # On some systems, OpenSSL appears to require -ldl to link.
363
+ lappend libs -ldl
364
+ msg-quiet cc-with [list -cflags $cflags -libs $libs] {
365
+ if {[cc-check-includes openssl/ssl.h] && \
366
+ [cc-check-functions SSL_new]} {
367
+ incr rc
368
+ }
369
+ }
370
+ }
371
+ if {$rc} {
372
+ msg-result "ok"
373
+ return 1
374
+ } else {
375
+ msg-result "no"
376
+ return 0
377
+ }
378378
}
379379
380380
# Check for zlib, using the given location if specified
381381
set zlibpath [opt-val with-zlib]
382382
if {$zlibpath eq "tree"} {
@@ -436,99 +436,99 @@
436436
set ::zlib_lib -lz
437437
}
438438
439439
set ssldirs [opt-val with-openssl]
440440
if {$ssldirs ne "none"} {
441
- set found 0
442
- if {$ssldirs eq "tree"} {
443
- set ssldir [file dirname $autosetup(dir)]/compat/openssl
444
- if {![file isdirectory $ssldir]} {
445
- user-error "The OpenSSL in source tree directory does not exist"
446
- }
447
- set msg "openssl in $ssldir"
448
- set cflags "-I$ssldir/include"
449
- set ldflags "-L$ssldir"
450
- set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
451
- set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
452
- } else {
453
- if {$ssldirs in {auto ""}} {
454
- catch {
455
- set cflags [exec pkg-config openssl --cflags-only-I]
456
- set ldflags [exec pkg-config openssl --libs-only-L]
457
- set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
458
- } msg
459
- if {!$found} {
460
- set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
441
+ set found 0
442
+ if {$ssldirs eq "tree"} {
443
+ set ssldir [file dirname $autosetup(dir)]/compat/openssl
444
+ if {![file isdirectory $ssldir]} {
445
+ user-error "The OpenSSL in source tree directory does not exist"
446
+ }
447
+ set msg "openssl in $ssldir"
448
+ set cflags "-I$ssldir/include"
449
+ set ldflags "-L$ssldir"
450
+ set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
451
+ set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
452
+ } else {
453
+ if {$ssldirs in {auto ""}} {
454
+ catch {
455
+ set cflags [exec pkg-config openssl --cflags-only-I]
456
+ set ldflags [exec pkg-config openssl --libs-only-L]
457
+ set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
458
+ } msg
459
+ if {!$found} {
460
+ set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
461461
/usr/pkg /usr/local /usr /usr/local/opt/openssl \
462462
/opt/homebrew/opt/openssl"
463
- }
464
- }
465
- if {!$found} {
466
- foreach dir $ssldirs {
467
- if {$dir eq ""} {
468
- set msg "system openssl"
469
- set cflags ""
470
- set ldflags ""
471
- } else {
472
- set msg "openssl in $dir"
473
- set cflags "-I$dir/include"
474
- if {[file readable $dir/libssl.a]} {
475
- set ldflags -L$dir
476
- } elseif {[file readable $dir/lib/libssl.a]} {
477
- set ldflags -L$dir/lib
478
- } elseif {[file isdir $dir/lib]} {
479
- set ldflags "-L$dir -L$dir/lib"
480
- } else {
481
- set ldflags -L$dir
482
- }
483
- }
484
- if {[check-for-openssl $msg "$cflags $ldflags"]} {
485
- incr found
486
- break
487
- }
488
- if {$dir ne ""} {
489
- set ldflags ""
490
- set msg "static build of openssl in $dir"
491
- set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
492
- if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
493
- incr found
494
- break
495
- }
496
- }
497
- }
498
- }
499
- }
500
- if {$found} {
501
- define FOSSIL_ENABLE_SSL
502
- define-append EXTRA_CFLAGS $cflags
503
- define-append EXTRA_LDFLAGS $ldflags
504
- if {[info exists ssllibs]} {
505
- define-append LIBS $ssllibs
506
- } else {
507
- define-append LIBS -lssl -lcrypto
508
- }
509
- if {[info exists ::zlib_lib]} {
510
- define-append LIBS $::zlib_lib
511
- }
512
- if {[is_mingw]} {
513
- define-append LIBS -lgdi32 -lwsock32 -lcrypt32
514
- }
515
- msg-result "HTTPS support enabled"
516
-
517
- # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
518
- if {[string match *-darwin* [get-define host]]} {
519
- if {[cctest -cflags {-Wdeprecated-declarations}]} {
520
- define-append EXTRA_CFLAGS -Wdeprecated-declarations
521
- }
522
- }
523
- } else {
524
- user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
525
- }
526
-} else {
527
- if {[info exists ::zlib_lib]} {
528
- define-append LIBS $::zlib_lib
529
- }
463
+ }
464
+ }
465
+ if {!$found} {
466
+ foreach dir $ssldirs {
467
+ if {$dir eq ""} {
468
+ set msg "system openssl"
469
+ set cflags ""
470
+ set ldflags ""
471
+ } else {
472
+ set msg "openssl in $dir"
473
+ set cflags "-I$dir/include"
474
+ if {[file readable $dir/libssl.a]} {
475
+ set ldflags -L$dir
476
+ } elseif {[file readable $dir/lib/libssl.a]} {
477
+ set ldflags -L$dir/lib
478
+ } elseif {[file isdir $dir/lib]} {
479
+ set ldflags "-L$dir -L$dir/lib"
480
+ } else {
481
+ set ldflags -L$dir
482
+ }
483
+ }
484
+ if {[check-for-openssl $msg "$cflags $ldflags"]} {
485
+ incr found
486
+ break
487
+ }
488
+ if {$dir ne ""} {
489
+ set ldflags ""
490
+ set msg "static build of openssl in $dir"
491
+ set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
492
+ if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
493
+ incr found
494
+ break
495
+ }
496
+ }
497
+ }
498
+ }
499
+ }
500
+ if {$found} {
501
+ define FOSSIL_ENABLE_SSL
502
+ define-append EXTRA_CFLAGS $cflags
503
+ define-append EXTRA_LDFLAGS $ldflags
504
+ if {[info exists ssllibs]} {
505
+ define-append LIBS $ssllibs
506
+ } else {
507
+ define-append LIBS -lssl -lcrypto
508
+ }
509
+ if {[info exists ::zlib_lib]} {
510
+ define-append LIBS $::zlib_lib
511
+ }
512
+ if {[is_mingw]} {
513
+ define-append LIBS -lgdi32 -lwsock32 -lcrypt32
514
+ }
515
+ msg-result "HTTPS support enabled"
516
+
517
+ # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
518
+ if {[string match *-darwin* [get-define host]]} {
519
+ if {[cctest -cflags {-Wdeprecated-declarations}]} {
520
+ define-append EXTRA_CFLAGS -Wdeprecated-declarations
521
+ }
522
+ }
523
+ } else {
524
+ user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
525
+ }
526
+} else {
527
+ if {[info exists ::zlib_lib]} {
528
+ define-append LIBS $::zlib_lib
529
+ }
530530
}
531531
532532
533533
534534
########################################################################
@@ -554,11 +554,11 @@
554554
# 1 = use external lib or sqlite3.o
555555
# 2 = use external sqlite3.c and (if found) shell.c
556556
define USE_SYSTEM_SQLITE 1
557557
define SQLITE3_ORIGIN 2
558558
if {$sq3path != "auto"} {
559
- if {([file exists $sq3path/sqlite3.c]) && \
559
+ if {([file exists $sq3path/sqlite3.c]) &&
560560
([file exists $sq3path/sqlite3.h]) } {
561561
# Prefer sqlite3.[ch] if found.
562562
define SQLITE3_SRC.2 $sq3path/sqlite3.c
563563
define SQLITE3_OBJ.2 {$(SQLITE3_OBJ.0)}
564564
define USE_SYSTEM_SQLITE 2
@@ -599,136 +599,136 @@
599599
}
600600
define-append CFLAGS_INCLUDE {-I. -I$(SRCDIR) -I$(SRCDIR_extsrc)}
601601
602602
set tclpath [opt-val with-tcl]
603603
if {$tclpath ne ""} {
604
- set tclprivatestubs [opt-bool with-tcl-private-stubs]
605
- # Note parse-tclconfig-sh is in autosetup/local.tcl
606
- if {$tclpath eq "1"} {
607
- set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
608
- if {$tclprivatestubs} {
609
- set tclconfig(TCL_INCLUDE_SPEC) -I$tcldir/generic
610
- set tclconfig(TCL_VERSION) {Private Stubs}
611
- set tclconfig(TCL_PATCH_LEVEL) {}
612
- set tclconfig(TCL_PREFIX) $tcldir
613
- set tclconfig(TCL_LD_FLAGS) { }
614
- } else {
615
- # Use the system Tcl. Look in some likely places.
616
- array set tclconfig [parse-tclconfig-sh \
617
- $tcldir/unix $tcldir/win \
618
- /usr /usr/local /usr/share /opt/local]
619
- set msg "on your system"
620
- }
621
- } else {
622
- array set tclconfig [parse-tclconfig-sh $tclpath]
623
- set msg "at $tclpath"
624
- }
625
- if {[opt-bool static]} {
626
- set tclconfig(TCL_LD_FLAGS) { }
627
- }
628
- if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
629
- user-error "Cannot find Tcl $msg"
630
- }
631
- set tclstubs [opt-bool with-tcl-stubs]
632
- if {$tclprivatestubs} {
633
- define FOSSIL_ENABLE_TCL_PRIVATE_STUBS
634
- define USE_TCL_STUBS
635
- } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
636
- set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
637
- define FOSSIL_ENABLE_TCL_STUBS
638
- define USE_TCL_STUBS
639
- } else {
640
- set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
641
- }
642
- set cflags $tclconfig(TCL_INCLUDE_SPEC)
643
- if {!$tclprivatestubs} {
644
- set foundtcl 0; # Did we find a working Tcl library?
645
- cc-with [list -cflags $cflags -libs $libs] {
646
- if {$tclstubs} {
647
- if {[cc-check-functions Tcl_InitStubs]} {
648
- set foundtcl 1
649
- }
650
- } else {
651
- if {[cc-check-functions Tcl_CreateInterp]} {
652
- set foundtcl 1
653
- }
654
- }
655
- }
656
- if {!$foundtcl && [string match *-lieee* $libs]} {
657
- # On some systems, using "-lieee" from TCL_LIB_SPEC appears
658
- # to cause issues.
659
- msg-result "Removing \"-lieee\" and retrying for Tcl..."
660
- set libs [string map [list -lieee ""] $libs]
661
- cc-with [list -cflags $cflags -libs $libs] {
662
- if {$tclstubs} {
663
- if {[cc-check-functions Tcl_InitStubs]} {
664
- set foundtcl 1
665
- }
666
- } else {
667
- if {[cc-check-functions Tcl_CreateInterp]} {
668
- set foundtcl 1
669
- }
670
- }
671
- }
672
- }
673
- if {!$foundtcl && ![string match *-lpthread* $libs]} {
674
- # On some systems, TCL_LIB_SPEC appears to be missing
675
- # "-lpthread". Try adding it.
676
- msg-result "Adding \"-lpthread\" and retrying for Tcl..."
677
- set libs "$libs -lpthread"
678
- cc-with [list -cflags $cflags -libs $libs] {
679
- if {$tclstubs} {
680
- if {[cc-check-functions Tcl_InitStubs]} {
681
- set foundtcl 1
682
- }
683
- } else {
684
- if {[cc-check-functions Tcl_CreateInterp]} {
685
- set foundtcl 1
686
- }
687
- }
688
- }
689
- }
690
- if {!$foundtcl} {
691
- if {$tclstubs} {
692
- user-error "Cannot find a usable Tcl stubs library $msg"
693
- } else {
694
- user-error "Cannot find a usable Tcl library $msg"
695
- }
696
- }
697
- }
698
- set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
699
- msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
700
- if {!$tclprivatestubs} {
701
- define-append LIBS $libs
702
- }
703
- define-append EXTRA_CFLAGS $cflags
704
- define-append CFLAGS $cflags
705
- if {[info exists zlibpath] && $zlibpath eq "tree"} {
706
- #
707
- # NOTE: When using zlib in the source tree, prevent Tcl from
708
- # pulling in the system one.
709
- #
710
- set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \
711
- $tclconfig(TCL_LD_FLAGS)]
712
- }
713
- #
714
- # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be
715
- # be checked for near the bottom of this file.
716
- #
717
- set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
718
- $tclconfig(TCL_LD_FLAGS)]
719
- define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
720
- define FOSSIL_ENABLE_TCL
604
+ set tclprivatestubs [opt-bool with-tcl-private-stubs]
605
+ # Note parse-tclconfig-sh is in autosetup/local.tcl
606
+ if {$tclpath eq "1"} {
607
+ set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
608
+ if {$tclprivatestubs} {
609
+ set tclconfig(TCL_INCLUDE_SPEC) -I$tcldir/generic
610
+ set tclconfig(TCL_VERSION) {Private Stubs}
611
+ set tclconfig(TCL_PATCH_LEVEL) {}
612
+ set tclconfig(TCL_PREFIX) $tcldir
613
+ set tclconfig(TCL_LD_FLAGS) { }
614
+ } else {
615
+ # Use the system Tcl. Look in some likely places.
616
+ array set tclconfig [parse-tclconfig-sh \
617
+ $tcldir/unix $tcldir/win \
618
+ /usr /usr/local /usr/share /opt/local]
619
+ set msg "on your system"
620
+ }
621
+ } else {
622
+ array set tclconfig [parse-tclconfig-sh $tclpath]
623
+ set msg "at $tclpath"
624
+ }
625
+ if {[opt-bool static]} {
626
+ set tclconfig(TCL_LD_FLAGS) { }
627
+ }
628
+ if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
629
+ user-error "Cannot find Tcl $msg"
630
+ }
631
+ set tclstubs [opt-bool with-tcl-stubs]
632
+ if {$tclprivatestubs} {
633
+ define FOSSIL_ENABLE_TCL_PRIVATE_STUBS
634
+ define USE_TCL_STUBS
635
+ } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
636
+ set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
637
+ define FOSSIL_ENABLE_TCL_STUBS
638
+ define USE_TCL_STUBS
639
+ } else {
640
+ set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
641
+ }
642
+ set cflags $tclconfig(TCL_INCLUDE_SPEC)
643
+ if {!$tclprivatestubs} {
644
+ set foundtcl 0; # Did we find a working Tcl library?
645
+ cc-with [list -cflags $cflags -libs $libs] {
646
+ if {$tclstubs} {
647
+ if {[cc-check-functions Tcl_InitStubs]} {
648
+ set foundtcl 1
649
+ }
650
+ } else {
651
+ if {[cc-check-functions Tcl_CreateInterp]} {
652
+ set foundtcl 1
653
+ }
654
+ }
655
+ }
656
+ if {!$foundtcl && [string match *-lieee* $libs]} {
657
+ # On some systems, using "-lieee" from TCL_LIB_SPEC appears
658
+ # to cause issues.
659
+ msg-result "Removing \"-lieee\" and retrying for Tcl..."
660
+ set libs [string map [list -lieee ""] $libs]
661
+ cc-with [list -cflags $cflags -libs $libs] {
662
+ if {$tclstubs} {
663
+ if {[cc-check-functions Tcl_InitStubs]} {
664
+ set foundtcl 1
665
+ }
666
+ } else {
667
+ if {[cc-check-functions Tcl_CreateInterp]} {
668
+ set foundtcl 1
669
+ }
670
+ }
671
+ }
672
+ }
673
+ if {!$foundtcl && ![string match *-lpthread* $libs]} {
674
+ # On some systems, TCL_LIB_SPEC appears to be missing
675
+ # "-lpthread". Try adding it.
676
+ msg-result "Adding \"-lpthread\" and retrying for Tcl..."
677
+ set libs "$libs -lpthread"
678
+ cc-with [list -cflags $cflags -libs $libs] {
679
+ if {$tclstubs} {
680
+ if {[cc-check-functions Tcl_InitStubs]} {
681
+ set foundtcl 1
682
+ }
683
+ } else {
684
+ if {[cc-check-functions Tcl_CreateInterp]} {
685
+ set foundtcl 1
686
+ }
687
+ }
688
+ }
689
+ }
690
+ if {!$foundtcl} {
691
+ if {$tclstubs} {
692
+ user-error "Cannot find a usable Tcl stubs library $msg"
693
+ } else {
694
+ user-error "Cannot find a usable Tcl library $msg"
695
+ }
696
+ }
697
+ }
698
+ set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
699
+ msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
700
+ if {!$tclprivatestubs} {
701
+ define-append LIBS $libs
702
+ }
703
+ define-append EXTRA_CFLAGS $cflags
704
+ define-append CFLAGS $cflags
705
+ if {[info exists zlibpath] && $zlibpath eq "tree"} {
706
+ #
707
+ # NOTE: When using zlib in the source tree, prevent Tcl from
708
+ # pulling in the system one.
709
+ #
710
+ set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \
711
+ $tclconfig(TCL_LD_FLAGS)]
712
+ }
713
+ #
714
+ # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be
715
+ # be checked for near the bottom of this file.
716
+ #
717
+ set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
718
+ $tclconfig(TCL_LD_FLAGS)]
719
+ define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
720
+ define FOSSIL_ENABLE_TCL
721721
}
722722
723723
# Network functions require libraries on some systems
724724
cc-check-function-in-lib gethostbyname nsl
725725
if {![cc-check-function-in-lib socket {socket network}]} {
726
- # Last resort, may be Windows
727
- if {[is_mingw]} {
728
- define-append LIBS -lwsock32
729
- }
726
+ # Last resort, may be Windows
727
+ if {[is_mingw]} {
728
+ define-append LIBS -lwsock32
729
+ }
730730
}
731731
732732
# Some systems (ex: SunOS) require -lrt in order to use nanosleep
733733
cc-check-function-in-lib nanosleep rt
734734
@@ -743,11 +743,11 @@
743743
[cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
744744
([cc-check-function-in-lib ns_parserr {bind resolv}] ||
745745
[cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
746746
([cc-check-function-in-lib res_query {bind resolv}] ||
747747
[cc-check-function-in-lib __res_query {bind resolv}]))} {
748
- msg-result "WARNING: SMTP feature will not be able to look up local MX."
748
+ msg-result "WARNING: SMTP feature will not be able to look up local MX."
749749
}
750750
cc-check-function-in-lib res_9_ns_initparse resolv
751751
752752
# Other nonstandard function checks
753753
cc-check-functions utime
@@ -758,12 +758,12 @@
758758
759759
# Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
760760
# guard against including it again; use cctest as cc-check-functions and
761761
# cctest_function check for "getpass()" with no args and fail
762762
if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
763
- define FOSSIL_HAVE_GETPASS 1
764
- msg-result "Found getpass() with unistd.h"
763
+ define FOSSIL_HAVE_GETPASS 1
764
+ msg-result "Found getpass() with unistd.h"
765765
}
766766
767767
# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
768768
if {![cc-check-functions getloadavg] ||
769769
![cctest -link 1 -includes {unistd.h} -code "double a\[3\]; getloadavg(a,3);"]} {
@@ -771,43 +771,43 @@
771771
msg-result "Load average support unavailable"
772772
}
773773
774774
# Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars
775775
if {![cc-check-functions getpassphrase]} {
776
- # Haiku needs this
777
- cc-check-function-in-lib getpass bsd
776
+ # Haiku needs this
777
+ cc-check-function-in-lib getpass bsd
778778
}
779779
780780
# Check for the FuseFS library
781781
if {[opt-bool fusefs]} {
782782
if {[opt-bool static]} {
783
- msg-result "FuseFS support disabled due to -static"
783
+ msg-result "FuseFS support disabled due to -static"
784784
} elseif {[cc-check-function-in-lib fuse_mount fuse]} {
785
- define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
786
- define FOSSIL_HAVE_FUSEFS 1
787
- msg-result "FuseFS support enabled"
785
+ define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
786
+ define FOSSIL_HAVE_FUSEFS 1
787
+ msg-result "FuseFS support enabled"
788788
}
789789
}
790790
791791
########################################################################
792792
# Checks the compiler for compile_commands.json support.
793793
#
794794
# Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
795795
# if supported, "no" if not.
796796
proc check-compile-commands {} {
797
- msg-checking "compile_commands.json support... "
798
- if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
799
- # This test reportedly incorrectly succeeds on one of
800
- # Martin G.'s older systems.
801
- msg-result "compiler supports compile_commands.json"
802
- define MAKE_COMPILATION_DB yes
803
- return 1
804
- } else {
805
- msg-result "compiler does not support compile_commands.json"
806
- define MAKE_COMPILATION_DB no
807
- return 0
808
- }
797
+ msg-checking "compile_commands.json support... "
798
+ if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
799
+ # This test reportedly incorrectly succeeds on one of
800
+ # Martin G.'s older systems.
801
+ msg-result "compiler supports compile_commands.json"
802
+ define MAKE_COMPILATION_DB yes
803
+ return 1
804
+ } else {
805
+ msg-result "compiler does not support compile_commands.json"
806
+ define MAKE_COMPILATION_DB no
807
+ return 0
808
+ }
809809
}
810810
811811
define MAKE_COMPILATION_DB no
812812
if {!$outOfTreeBuild} {
813813
if {[opt-bool compile-commands]} {
@@ -824,30 +824,30 @@
824824
# Add -fsanitize compile and link options late: we don't want the C
825825
# checks above to run with those sanitizers enabled. It can not only
826826
# be pointless, it can actually break correct tests.
827827
set fsan [opt-val with-sanitizer]
828828
if {[string length $fsan]} {
829
- define-append EXTRA_CFLAGS -fsanitize=$fsan
830
- define-append EXTRA_LDFLAGS -fsanitize=$fsan
831
- if {[string first "undefined" $fsan] != -1} {
832
- # We need to link with libubsan if we're compiling under
833
- # GCC with -fsanitize=undefined.
834
- cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
835
- }
829
+ define-append EXTRA_CFLAGS -fsanitize=$fsan
830
+ define-append EXTRA_LDFLAGS -fsanitize=$fsan
831
+ if {[string first "undefined" $fsan] != -1} {
832
+ # We need to link with libubsan if we're compiling under
833
+ # GCC with -fsanitize=undefined.
834
+ cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
835
+ }
836836
}
837837
838838
# Finally, append libraries that must be last. This matters more on some
839839
# OSes than others, but is most broadly required for static linking.
840840
if {[check-function-in-lib dlopen dl]} {
841
- # Some platforms (*BSD) have the dl functions already in libc and no libdl.
842
- # In such case we can link directly without -ldl.
843
- define-append LIBS [get-define lib_dlopen]
841
+ # Some platforms (*BSD) have the dl functions already in libc and no libdl.
842
+ # In such case we can link directly without -ldl.
843
+ define-append LIBS [get-define lib_dlopen]
844844
}
845845
if {[opt-bool static]} {
846
- # Linux can only infer the dependency on pthread from OpenSSL when
847
- # doing dynamic linkage.
848
- define-append LIBS -lpthread
846
+ # Linux can only infer the dependency on pthread from OpenSSL when
847
+ # doing dynamic linkage.
848
+ define-append LIBS -lpthread
849849
}
850850
851851
852852
########################################################################
853853
# @proj-check-emsdk
854854
--- auto.def
+++ auto.def
@@ -41,12 +41,12 @@
41 define MINIMUM_SQLITE_VERSION "3.46.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
49
50 # Space characters have never been allowed in either the source
51 # tree nor the build directory. But the resulting error messages
52 # could be confusing. The following checks make the reason for the
@@ -67,21 +67,21 @@
67 set outOfTreeBuild 1
68 }
69
70 # sqlite wants these types if possible
71 cc-with {-includes {stdint.h inttypes.h}} {
72 cc-check-types uint32_t uint16_t int16_t uint8_t
73 }
74
75 # Use pread/pwrite system calls in place of seek + read/write if possible
76 define USE_PREAD [cc-check-functions pread]
77
78 # If we have cscope here, we'll use it in the "tags" target
79 if {[cc-check-progs cscope]} {
80 define COLLECT_CSCOPE_DATA "cscope -bR $::autosetup(srcdir)/src/*.\[ch\]"
81 } else {
82 define COLLECT_CSCOPE_DATA ""
83 }
84
85 # Find tclsh for the test suite.
86 #
87 # We can't use jimsh for this: the test suite uses features of Tcl that
@@ -94,32 +94,32 @@
94 # Ironically, this means we may right now be running under either jimsh0
95 # or a version of tclsh that we find unsuitable below!
96 cc-check-progs tclsh
97 set hbtd /usr/local/Cellar/tcl-tk
98 if {[string equal false [get-define TCLSH]]} {
99 msg-result "WARNING: 'make test' will not run here."
100 } else {
101 set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
102 if {[expr {$v >= 8.6}]} {
103 msg-result "Found Tclsh version $v in the PATH."
104 define TCLSH tclsh
105 } elseif {[file isdirectory $hbtd]} {
106 # This is a macOS system with the Homebrew version of Tcl/Tk
107 # installed. Select the newest version. It won't normally be
108 # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
109 # were in the PATH, it's bad practice to put /usr/local/bin (the
110 # Homebrew default) ahead of /usr/bin, especially given that
111 # it's user-writeable by default with Homebrew. Thus, we can be
112 # pretty sure the only way to call it is with an absolute path.
113 set v [exec ls -tr $hbtd | tail -1]
114 set path "$hbtd/$v/bin/tclsh"
115 define TCLSH $path
116 msg-result "Using Homebrew Tcl/Tk version $path."
117 } else {
118 msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
119 define TCLSH false ;# force "make test" failure via /usr/bin/false
120 }
121 }
122
123 define CFLAGS [get-env CFLAGS "-g -Os"]
124 define EXTRA_CFLAGS "-Wall"
125 define EXTRA_LDFLAGS ""
@@ -133,48 +133,48 @@
133 # SQLITE_OPTIONS_EXT => build-dependent CFLAGS for sqlite3.c and shell.c
134
135 # Maintain the C89/C90-style order of variable declarations before statements.
136 # Check if the compiler supports the respective warning flag.
137 if {[cctest -cflags -Wdeclaration-after-statement]} {
138 define-append EXTRA_CFLAGS -Wdeclaration-after-statement
139 }
140
141
142 # This procedure is a customized version of "cc-check-function-in-lib",
143 # that does not modify the LIBS variable. Its use prevents prematurely
144 # pulling in libraries that will be added later anyhow (e.g. "-ldl").
145 proc check-function-in-lib {function libs {otherlibs {}}} {
146 if {[string length $otherlibs]} {
147 msg-checking "Checking for $function in $libs with $otherlibs..."
148 } else {
149 msg-checking "Checking for $function in $libs..."
150 }
151 set found 0
152 cc-with [list -libs $otherlibs] {
153 if {[cctest_function $function]} {
154 msg-result "none needed"
155 define lib_$function ""
156 incr found
157 } else {
158 foreach lib $libs {
159 cc-with [list -libs -l$lib] {
160 if {[cctest_function $function]} {
161 msg-result -l$lib
162 define lib_$function -l$lib
163 incr found
164 break
165 }
166 }
167 }
168 }
169 }
170 if {$found} {
171 define [feature-define-name $function]
172 } else {
173 msg-result "no"
174 }
175 return $found
176 }
177
178 if {![opt-bool internal-sqlite]} {
179 proc find_system_sqlite {} {
180
@@ -219,17 +219,17 @@
219 set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
220 lappend cmdline {*}[set sqlite-version]
221 set ok 1
222 set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
223 if {$err} {
224 configlog "Failed: [join $cmdline]"
225 if {[string length $result]>0} {configlog $result}
226 configlog "============"
227 set ok 0
228 } elseif {$::autosetup(debug)} {
229 configlog "Compiled OK: [join $cmdline]"
230 configlog "============"
231 }
232 if {!$ok} {
233 user-error "unable to compile SQLite compatibility test program"
234 }
235 set err [catch {exec-with-stderr ./conftest__} result errinfo]
@@ -251,91 +251,91 @@
251 ![file exists "/dev/null"]
252 }]
253 }
254
255 if {[is_mingw]} {
256 define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
257 define-append LIBS -lkernel32 -lws2_32
258 } else {
259 #
260 # NOTE: All platforms except MinGW should use the linenoise
261 # package. It is currently unsupported on Win32.
262 #
263 define USE_LINENOISE 1
264 }
265
266 if {[string match *-solaris* [get-define host]]} {
267 define-append EXTRA_CFLAGS {-D__EXTENSIONS__}
268 }
269
270 if {[opt-bool fossil-debug]} {
271 define CFLAGS {-g -O0 -Wall}
272 define-append CFLAGS -DFOSSIL_DEBUG
273 msg-result "Debugging support enabled"
274 }
275
276 if {[opt-bool no-opt]} {
277 define CFLAGS {-g -O0 -Wall}
278 msg-result "Builting without compiler optimization"
279 if {[opt-bool fossil-debug]} {
280 define-append CFLAGS -DFOSSIL_DEBUG
281 }
282 }
283
284 if {[opt-bool with-mman]} {
285 define-append EXTRA_CFLAGS -DUSE_MMAN_H
286 define USE_MMAN_H 1
287 msg-result "Enabling \"sys/mman.h\" support"
288 }
289
290 if {[opt-bool with-see]} {
291 define-append EXTRA_CFLAGS -DUSE_SEE
292 define USE_SEE 1
293 define SQLITE3_ORIGIN 1
294 msg-result "Enabling encryption support"
295 }
296
297 if {[opt-bool json]} {
298 # Reminder/FIXME (stephan): FOSSIL_ENABLE_JSON
299 # is required in the CFLAGS because json*.c
300 # have #ifdef guards around the whole file without
301 # reading config.h first.
302 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
303 define FOSSIL_ENABLE_JSON
304 msg-result "JSON support enabled"
305 }
306
307 if {[opt-bool with-exec-rel-paths]} {
308 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_EXEC_REL_PATHS
309 define FOSSIL_ENABLE_EXEC_REL_PATHS
310 msg-result "Relative paths in external diff/gdiff enabled"
311 }
312
313 if {[opt-bool with-th1-docs]} {
314 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_DOCS
315 define FOSSIL_ENABLE_TH1_DOCS
316 msg-result "TH1 embedded documentation support enabled"
317 }
318
319 if {[opt-bool with-th1-hooks]} {
320 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS
321 define FOSSIL_ENABLE_TH1_HOOKS
322 msg-result "TH1 hooks support enabled"
323 }
324
325 #if {[opt-bool markdown]} {
326 # # no-op. Markdown is now enabled by default.
327 # msg-result "Markdown support enabled"
328 #}
329
330 if {[opt-bool static]} {
331 # XXX: This will not work on all systems.
332 define-append EXTRA_LDFLAGS -static
333 msg-result "Trying to link statically"
334 } else {
335 define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1
336 define FOSSIL_DYNAMIC_BUILD
337 }
338
339 # Check for libraries that need to be sorted out early
340 cc-check-function-in-lib iconv iconv
341
@@ -342,41 +342,41 @@
342 cc-check-function-in-lib sin m ;# must come before ssl check:
343 # https://fossil-scm.org/forum/forumpost/afcd42b7fd
344
345 # Helper for OpenSSL checking
346 proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto -lpthread}}} {
347 msg-checking "Checking for $msg..."
348 set rc 0
349 if {[is_mingw]} {
350 lappend libs -lgdi32 -lwsock32 -lcrypt32
351 }
352 if {[info exists ::zlib_lib]} {
353 lappend libs $::zlib_lib
354 }
355 msg-quiet cc-with [list -cflags $cflags -libs $libs] {
356 if {[cc-check-includes openssl/ssl.h] && \
357 [cc-check-functions SSL_new]} {
358 incr rc
359 }
360 }
361 if {!$rc && ![is_mingw]} {
362 # On some systems, OpenSSL appears to require -ldl to link.
363 lappend libs -ldl
364 msg-quiet cc-with [list -cflags $cflags -libs $libs] {
365 if {[cc-check-includes openssl/ssl.h] && \
366 [cc-check-functions SSL_new]} {
367 incr rc
368 }
369 }
370 }
371 if {$rc} {
372 msg-result "ok"
373 return 1
374 } else {
375 msg-result "no"
376 return 0
377 }
378 }
379
380 # Check for zlib, using the given location if specified
381 set zlibpath [opt-val with-zlib]
382 if {$zlibpath eq "tree"} {
@@ -436,99 +436,99 @@
436 set ::zlib_lib -lz
437 }
438
439 set ssldirs [opt-val with-openssl]
440 if {$ssldirs ne "none"} {
441 set found 0
442 if {$ssldirs eq "tree"} {
443 set ssldir [file dirname $autosetup(dir)]/compat/openssl
444 if {![file isdirectory $ssldir]} {
445 user-error "The OpenSSL in source tree directory does not exist"
446 }
447 set msg "openssl in $ssldir"
448 set cflags "-I$ssldir/include"
449 set ldflags "-L$ssldir"
450 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
451 set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
452 } else {
453 if {$ssldirs in {auto ""}} {
454 catch {
455 set cflags [exec pkg-config openssl --cflags-only-I]
456 set ldflags [exec pkg-config openssl --libs-only-L]
457 set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
458 } msg
459 if {!$found} {
460 set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
461 /usr/pkg /usr/local /usr /usr/local/opt/openssl \
462 /opt/homebrew/opt/openssl"
463 }
464 }
465 if {!$found} {
466 foreach dir $ssldirs {
467 if {$dir eq ""} {
468 set msg "system openssl"
469 set cflags ""
470 set ldflags ""
471 } else {
472 set msg "openssl in $dir"
473 set cflags "-I$dir/include"
474 if {[file readable $dir/libssl.a]} {
475 set ldflags -L$dir
476 } elseif {[file readable $dir/lib/libssl.a]} {
477 set ldflags -L$dir/lib
478 } elseif {[file isdir $dir/lib]} {
479 set ldflags "-L$dir -L$dir/lib"
480 } else {
481 set ldflags -L$dir
482 }
483 }
484 if {[check-for-openssl $msg "$cflags $ldflags"]} {
485 incr found
486 break
487 }
488 if {$dir ne ""} {
489 set ldflags ""
490 set msg "static build of openssl in $dir"
491 set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
492 if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
493 incr found
494 break
495 }
496 }
497 }
498 }
499 }
500 if {$found} {
501 define FOSSIL_ENABLE_SSL
502 define-append EXTRA_CFLAGS $cflags
503 define-append EXTRA_LDFLAGS $ldflags
504 if {[info exists ssllibs]} {
505 define-append LIBS $ssllibs
506 } else {
507 define-append LIBS -lssl -lcrypto
508 }
509 if {[info exists ::zlib_lib]} {
510 define-append LIBS $::zlib_lib
511 }
512 if {[is_mingw]} {
513 define-append LIBS -lgdi32 -lwsock32 -lcrypt32
514 }
515 msg-result "HTTPS support enabled"
516
517 # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
518 if {[string match *-darwin* [get-define host]]} {
519 if {[cctest -cflags {-Wdeprecated-declarations}]} {
520 define-append EXTRA_CFLAGS -Wdeprecated-declarations
521 }
522 }
523 } else {
524 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
525 }
526 } else {
527 if {[info exists ::zlib_lib]} {
528 define-append LIBS $::zlib_lib
529 }
530 }
531
532
533
534 ########################################################################
@@ -554,11 +554,11 @@
554 # 1 = use external lib or sqlite3.o
555 # 2 = use external sqlite3.c and (if found) shell.c
556 define USE_SYSTEM_SQLITE 1
557 define SQLITE3_ORIGIN 2
558 if {$sq3path != "auto"} {
559 if {([file exists $sq3path/sqlite3.c]) && \
560 ([file exists $sq3path/sqlite3.h]) } {
561 # Prefer sqlite3.[ch] if found.
562 define SQLITE3_SRC.2 $sq3path/sqlite3.c
563 define SQLITE3_OBJ.2 {$(SQLITE3_OBJ.0)}
564 define USE_SYSTEM_SQLITE 2
@@ -599,136 +599,136 @@
599 }
600 define-append CFLAGS_INCLUDE {-I. -I$(SRCDIR) -I$(SRCDIR_extsrc)}
601
602 set tclpath [opt-val with-tcl]
603 if {$tclpath ne ""} {
604 set tclprivatestubs [opt-bool with-tcl-private-stubs]
605 # Note parse-tclconfig-sh is in autosetup/local.tcl
606 if {$tclpath eq "1"} {
607 set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
608 if {$tclprivatestubs} {
609 set tclconfig(TCL_INCLUDE_SPEC) -I$tcldir/generic
610 set tclconfig(TCL_VERSION) {Private Stubs}
611 set tclconfig(TCL_PATCH_LEVEL) {}
612 set tclconfig(TCL_PREFIX) $tcldir
613 set tclconfig(TCL_LD_FLAGS) { }
614 } else {
615 # Use the system Tcl. Look in some likely places.
616 array set tclconfig [parse-tclconfig-sh \
617 $tcldir/unix $tcldir/win \
618 /usr /usr/local /usr/share /opt/local]
619 set msg "on your system"
620 }
621 } else {
622 array set tclconfig [parse-tclconfig-sh $tclpath]
623 set msg "at $tclpath"
624 }
625 if {[opt-bool static]} {
626 set tclconfig(TCL_LD_FLAGS) { }
627 }
628 if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
629 user-error "Cannot find Tcl $msg"
630 }
631 set tclstubs [opt-bool with-tcl-stubs]
632 if {$tclprivatestubs} {
633 define FOSSIL_ENABLE_TCL_PRIVATE_STUBS
634 define USE_TCL_STUBS
635 } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
636 set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
637 define FOSSIL_ENABLE_TCL_STUBS
638 define USE_TCL_STUBS
639 } else {
640 set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
641 }
642 set cflags $tclconfig(TCL_INCLUDE_SPEC)
643 if {!$tclprivatestubs} {
644 set foundtcl 0; # Did we find a working Tcl library?
645 cc-with [list -cflags $cflags -libs $libs] {
646 if {$tclstubs} {
647 if {[cc-check-functions Tcl_InitStubs]} {
648 set foundtcl 1
649 }
650 } else {
651 if {[cc-check-functions Tcl_CreateInterp]} {
652 set foundtcl 1
653 }
654 }
655 }
656 if {!$foundtcl && [string match *-lieee* $libs]} {
657 # On some systems, using "-lieee" from TCL_LIB_SPEC appears
658 # to cause issues.
659 msg-result "Removing \"-lieee\" and retrying for Tcl..."
660 set libs [string map [list -lieee ""] $libs]
661 cc-with [list -cflags $cflags -libs $libs] {
662 if {$tclstubs} {
663 if {[cc-check-functions Tcl_InitStubs]} {
664 set foundtcl 1
665 }
666 } else {
667 if {[cc-check-functions Tcl_CreateInterp]} {
668 set foundtcl 1
669 }
670 }
671 }
672 }
673 if {!$foundtcl && ![string match *-lpthread* $libs]} {
674 # On some systems, TCL_LIB_SPEC appears to be missing
675 # "-lpthread". Try adding it.
676 msg-result "Adding \"-lpthread\" and retrying for Tcl..."
677 set libs "$libs -lpthread"
678 cc-with [list -cflags $cflags -libs $libs] {
679 if {$tclstubs} {
680 if {[cc-check-functions Tcl_InitStubs]} {
681 set foundtcl 1
682 }
683 } else {
684 if {[cc-check-functions Tcl_CreateInterp]} {
685 set foundtcl 1
686 }
687 }
688 }
689 }
690 if {!$foundtcl} {
691 if {$tclstubs} {
692 user-error "Cannot find a usable Tcl stubs library $msg"
693 } else {
694 user-error "Cannot find a usable Tcl library $msg"
695 }
696 }
697 }
698 set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
699 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
700 if {!$tclprivatestubs} {
701 define-append LIBS $libs
702 }
703 define-append EXTRA_CFLAGS $cflags
704 define-append CFLAGS $cflags
705 if {[info exists zlibpath] && $zlibpath eq "tree"} {
706 #
707 # NOTE: When using zlib in the source tree, prevent Tcl from
708 # pulling in the system one.
709 #
710 set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \
711 $tclconfig(TCL_LD_FLAGS)]
712 }
713 #
714 # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be
715 # be checked for near the bottom of this file.
716 #
717 set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
718 $tclconfig(TCL_LD_FLAGS)]
719 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
720 define FOSSIL_ENABLE_TCL
721 }
722
723 # Network functions require libraries on some systems
724 cc-check-function-in-lib gethostbyname nsl
725 if {![cc-check-function-in-lib socket {socket network}]} {
726 # Last resort, may be Windows
727 if {[is_mingw]} {
728 define-append LIBS -lwsock32
729 }
730 }
731
732 # Some systems (ex: SunOS) require -lrt in order to use nanosleep
733 cc-check-function-in-lib nanosleep rt
734
@@ -743,11 +743,11 @@
743 [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
744 ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
745 [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
746 ([cc-check-function-in-lib res_query {bind resolv}] ||
747 [cc-check-function-in-lib __res_query {bind resolv}]))} {
748 msg-result "WARNING: SMTP feature will not be able to look up local MX."
749 }
750 cc-check-function-in-lib res_9_ns_initparse resolv
751
752 # Other nonstandard function checks
753 cc-check-functions utime
@@ -758,12 +758,12 @@
758
759 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
760 # guard against including it again; use cctest as cc-check-functions and
761 # cctest_function check for "getpass()" with no args and fail
762 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
763 define FOSSIL_HAVE_GETPASS 1
764 msg-result "Found getpass() with unistd.h"
765 }
766
767 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
768 if {![cc-check-functions getloadavg] ||
769 ![cctest -link 1 -includes {unistd.h} -code "double a\[3\]; getloadavg(a,3);"]} {
@@ -771,43 +771,43 @@
771 msg-result "Load average support unavailable"
772 }
773
774 # Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars
775 if {![cc-check-functions getpassphrase]} {
776 # Haiku needs this
777 cc-check-function-in-lib getpass bsd
778 }
779
780 # Check for the FuseFS library
781 if {[opt-bool fusefs]} {
782 if {[opt-bool static]} {
783 msg-result "FuseFS support disabled due to -static"
784 } elseif {[cc-check-function-in-lib fuse_mount fuse]} {
785 define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
786 define FOSSIL_HAVE_FUSEFS 1
787 msg-result "FuseFS support enabled"
788 }
789 }
790
791 ########################################################################
792 # Checks the compiler for compile_commands.json support.
793 #
794 # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
795 # if supported, "no" if not.
796 proc check-compile-commands {} {
797 msg-checking "compile_commands.json support... "
798 if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
799 # This test reportedly incorrectly succeeds on one of
800 # Martin G.'s older systems.
801 msg-result "compiler supports compile_commands.json"
802 define MAKE_COMPILATION_DB yes
803 return 1
804 } else {
805 msg-result "compiler does not support compile_commands.json"
806 define MAKE_COMPILATION_DB no
807 return 0
808 }
809 }
810
811 define MAKE_COMPILATION_DB no
812 if {!$outOfTreeBuild} {
813 if {[opt-bool compile-commands]} {
@@ -824,30 +824,30 @@
824 # Add -fsanitize compile and link options late: we don't want the C
825 # checks above to run with those sanitizers enabled. It can not only
826 # be pointless, it can actually break correct tests.
827 set fsan [opt-val with-sanitizer]
828 if {[string length $fsan]} {
829 define-append EXTRA_CFLAGS -fsanitize=$fsan
830 define-append EXTRA_LDFLAGS -fsanitize=$fsan
831 if {[string first "undefined" $fsan] != -1} {
832 # We need to link with libubsan if we're compiling under
833 # GCC with -fsanitize=undefined.
834 cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
835 }
836 }
837
838 # Finally, append libraries that must be last. This matters more on some
839 # OSes than others, but is most broadly required for static linking.
840 if {[check-function-in-lib dlopen dl]} {
841 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
842 # In such case we can link directly without -ldl.
843 define-append LIBS [get-define lib_dlopen]
844 }
845 if {[opt-bool static]} {
846 # Linux can only infer the dependency on pthread from OpenSSL when
847 # doing dynamic linkage.
848 define-append LIBS -lpthread
849 }
850
851
852 ########################################################################
853 # @proj-check-emsdk
854
--- auto.def
+++ auto.def
@@ -41,12 +41,12 @@
41 define MINIMUM_SQLITE_VERSION "3.46.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
49
50 # Space characters have never been allowed in either the source
51 # tree nor the build directory. But the resulting error messages
52 # could be confusing. The following checks make the reason for the
@@ -67,21 +67,21 @@
67 set outOfTreeBuild 1
68 }
69
70 # sqlite wants these types if possible
71 cc-with {-includes {stdint.h inttypes.h}} {
72 cc-check-types uint32_t uint16_t int16_t uint8_t
73 }
74
75 # Use pread/pwrite system calls in place of seek + read/write if possible
76 define USE_PREAD [cc-check-functions pread]
77
78 # If we have cscope here, we'll use it in the "tags" target
79 if {[cc-check-progs cscope]} {
80 define COLLECT_CSCOPE_DATA "cscope -bR $::autosetup(srcdir)/src/*.\[ch\]"
81 } else {
82 define COLLECT_CSCOPE_DATA ""
83 }
84
85 # Find tclsh for the test suite.
86 #
87 # We can't use jimsh for this: the test suite uses features of Tcl that
@@ -94,32 +94,32 @@
94 # Ironically, this means we may right now be running under either jimsh0
95 # or a version of tclsh that we find unsuitable below!
96 cc-check-progs tclsh
97 set hbtd /usr/local/Cellar/tcl-tk
98 if {[string equal false [get-define TCLSH]]} {
99 msg-result "WARNING: 'make test' will not run here."
100 } else {
101 set v [exec sh -c "echo 'puts \$tcl_version' | tclsh"]
102 if {[expr {$v >= 8.6}]} {
103 msg-result "Found Tclsh version $v in the PATH."
104 define TCLSH tclsh
105 } elseif {[file isdirectory $hbtd]} {
106 # This is a macOS system with the Homebrew version of Tcl/Tk
107 # installed. Select the newest version. It won't normally be
108 # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
109 # were in the PATH, it's bad practice to put /usr/local/bin (the
110 # Homebrew default) ahead of /usr/bin, especially given that
111 # it's user-writeable by default with Homebrew. Thus, we can be
112 # pretty sure the only way to call it is with an absolute path.
113 set v [exec ls -tr $hbtd | tail -1]
114 set path "$hbtd/$v/bin/tclsh"
115 define TCLSH $path
116 msg-result "Using Homebrew Tcl/Tk version $path."
117 } else {
118 msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
119 define TCLSH false ;# force "make test" failure via /usr/bin/false
120 }
121 }
122
123 define CFLAGS [get-env CFLAGS "-g -Os"]
124 define EXTRA_CFLAGS "-Wall"
125 define EXTRA_LDFLAGS ""
@@ -133,48 +133,48 @@
133 # SQLITE_OPTIONS_EXT => build-dependent CFLAGS for sqlite3.c and shell.c
134
135 # Maintain the C89/C90-style order of variable declarations before statements.
136 # Check if the compiler supports the respective warning flag.
137 if {[cctest -cflags -Wdeclaration-after-statement]} {
138 define-append EXTRA_CFLAGS -Wdeclaration-after-statement
139 }
140
141
142 # This procedure is a customized version of "cc-check-function-in-lib",
143 # that does not modify the LIBS variable. Its use prevents prematurely
144 # pulling in libraries that will be added later anyhow (e.g. "-ldl").
145 proc check-function-in-lib {function libs {otherlibs {}}} {
146 if {[string length $otherlibs]} {
147 msg-checking "Checking for $function in $libs with $otherlibs..."
148 } else {
149 msg-checking "Checking for $function in $libs..."
150 }
151 set found 0
152 cc-with [list -libs $otherlibs] {
153 if {[cctest_function $function]} {
154 msg-result "none needed"
155 define lib_$function ""
156 incr found
157 } else {
158 foreach lib $libs {
159 cc-with [list -libs -l$lib] {
160 if {[cctest_function $function]} {
161 msg-result -l$lib
162 define lib_$function -l$lib
163 incr found
164 break
165 }
166 }
167 }
168 }
169 }
170 if {$found} {
171 define [feature-define-name $function]
172 } else {
173 msg-result "no"
174 }
175 return $found
176 }
177
178 if {![opt-bool internal-sqlite]} {
179 proc find_system_sqlite {} {
180
@@ -219,17 +219,17 @@
219 set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
220 lappend cmdline {*}[set sqlite-version]
221 set ok 1
222 set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
223 if {$err} {
224 configlog "Failed: [join $cmdline]"
225 if {[string length $result]>0} {configlog $result}
226 configlog "============"
227 set ok 0
228 } elseif {$::autosetup(debug)} {
229 configlog "Compiled OK: [join $cmdline]"
230 configlog "============"
231 }
232 if {!$ok} {
233 user-error "unable to compile SQLite compatibility test program"
234 }
235 set err [catch {exec-with-stderr ./conftest__} result errinfo]
@@ -251,91 +251,91 @@
251 ![file exists "/dev/null"]
252 }]
253 }
254
255 if {[is_mingw]} {
256 define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
257 define-append LIBS -lkernel32 -lws2_32
258 } else {
259 #
260 # NOTE: All platforms except MinGW should use the linenoise
261 # package. It is currently unsupported on Win32.
262 #
263 define USE_LINENOISE 1
264 }
265
266 if {[string match *-solaris* [get-define host]]} {
267 define-append EXTRA_CFLAGS {-D__EXTENSIONS__}
268 }
269
270 if {[opt-bool fossil-debug]} {
271 define CFLAGS {-g -O0 -Wall}
272 define-append CFLAGS -DFOSSIL_DEBUG
273 msg-result "Debugging support enabled"
274 }
275
276 if {[opt-bool no-opt]} {
277 define CFLAGS {-g -O0 -Wall}
278 msg-result "Builting without compiler optimization"
279 if {[opt-bool fossil-debug]} {
280 define-append CFLAGS -DFOSSIL_DEBUG
281 }
282 }
283
284 if {[opt-bool with-mman]} {
285 define-append EXTRA_CFLAGS -DUSE_MMAN_H
286 define USE_MMAN_H 1
287 msg-result "Enabling \"sys/mman.h\" support"
288 }
289
290 if {[opt-bool with-see]} {
291 define-append EXTRA_CFLAGS -DUSE_SEE
292 define USE_SEE 1
293 define SQLITE3_ORIGIN 1
294 msg-result "Enabling encryption support"
295 }
296
297 if {[opt-bool json]} {
298 # Reminder/FIXME (stephan): FOSSIL_ENABLE_JSON
299 # is required in the CFLAGS because json*.c
300 # have #ifdef guards around the whole file without
301 # reading config.h first.
302 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
303 define FOSSIL_ENABLE_JSON
304 msg-result "JSON support enabled"
305 }
306
307 if {[opt-bool with-exec-rel-paths]} {
308 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_EXEC_REL_PATHS
309 define FOSSIL_ENABLE_EXEC_REL_PATHS
310 msg-result "Relative paths in external diff/gdiff enabled"
311 }
312
313 if {[opt-bool with-th1-docs]} {
314 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_DOCS
315 define FOSSIL_ENABLE_TH1_DOCS
316 msg-result "TH1 embedded documentation support enabled"
317 }
318
319 if {[opt-bool with-th1-hooks]} {
320 define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS
321 define FOSSIL_ENABLE_TH1_HOOKS
322 msg-result "TH1 hooks support enabled"
323 }
324
325 #if {[opt-bool markdown]} {
326 # # no-op. Markdown is now enabled by default.
327 # msg-result "Markdown support enabled"
328 #}
329
330 if {[opt-bool static]} {
331 # XXX: This will not work on all systems.
332 define-append EXTRA_LDFLAGS -static
333 msg-result "Trying to link statically"
334 } else {
335 define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1
336 define FOSSIL_DYNAMIC_BUILD
337 }
338
339 # Check for libraries that need to be sorted out early
340 cc-check-function-in-lib iconv iconv
341
@@ -342,41 +342,41 @@
342 cc-check-function-in-lib sin m ;# must come before ssl check:
343 # https://fossil-scm.org/forum/forumpost/afcd42b7fd
344
345 # Helper for OpenSSL checking
346 proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto -lpthread}}} {
347 msg-checking "Checking for $msg..."
348 set rc 0
349 if {[is_mingw]} {
350 lappend libs -lgdi32 -lwsock32 -lcrypt32
351 }
352 if {[info exists ::zlib_lib]} {
353 lappend libs $::zlib_lib
354 }
355 msg-quiet cc-with [list -cflags $cflags -libs $libs] {
356 if {[cc-check-includes openssl/ssl.h] && \
357 [cc-check-functions SSL_new]} {
358 incr rc
359 }
360 }
361 if {!$rc && ![is_mingw]} {
362 # On some systems, OpenSSL appears to require -ldl to link.
363 lappend libs -ldl
364 msg-quiet cc-with [list -cflags $cflags -libs $libs] {
365 if {[cc-check-includes openssl/ssl.h] && \
366 [cc-check-functions SSL_new]} {
367 incr rc
368 }
369 }
370 }
371 if {$rc} {
372 msg-result "ok"
373 return 1
374 } else {
375 msg-result "no"
376 return 0
377 }
378 }
379
380 # Check for zlib, using the given location if specified
381 set zlibpath [opt-val with-zlib]
382 if {$zlibpath eq "tree"} {
@@ -436,99 +436,99 @@
436 set ::zlib_lib -lz
437 }
438
439 set ssldirs [opt-val with-openssl]
440 if {$ssldirs ne "none"} {
441 set found 0
442 if {$ssldirs eq "tree"} {
443 set ssldir [file dirname $autosetup(dir)]/compat/openssl
444 if {![file isdirectory $ssldir]} {
445 user-error "The OpenSSL in source tree directory does not exist"
446 }
447 set msg "openssl in $ssldir"
448 set cflags "-I$ssldir/include"
449 set ldflags "-L$ssldir"
450 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
451 set found [check-for-openssl "openssl in source tree" "$cflags $ldflags" $ssllibs]
452 } else {
453 if {$ssldirs in {auto ""}} {
454 catch {
455 set cflags [exec pkg-config openssl --cflags-only-I]
456 set ldflags [exec pkg-config openssl --libs-only-L]
457 set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
458 } msg
459 if {!$found} {
460 set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
461 /usr/pkg /usr/local /usr /usr/local/opt/openssl \
462 /opt/homebrew/opt/openssl"
463 }
464 }
465 if {!$found} {
466 foreach dir $ssldirs {
467 if {$dir eq ""} {
468 set msg "system openssl"
469 set cflags ""
470 set ldflags ""
471 } else {
472 set msg "openssl in $dir"
473 set cflags "-I$dir/include"
474 if {[file readable $dir/libssl.a]} {
475 set ldflags -L$dir
476 } elseif {[file readable $dir/lib/libssl.a]} {
477 set ldflags -L$dir/lib
478 } elseif {[file isdir $dir/lib]} {
479 set ldflags "-L$dir -L$dir/lib"
480 } else {
481 set ldflags -L$dir
482 }
483 }
484 if {[check-for-openssl $msg "$cflags $ldflags"]} {
485 incr found
486 break
487 }
488 if {$dir ne ""} {
489 set ldflags ""
490 set msg "static build of openssl in $dir"
491 set ssllibs "$dir/libssl.a $dir/libcrypto.a -lpthread"
492 if {[check-for-openssl $msg "$cflags $ldflags" $ssllibs]} {
493 incr found
494 break
495 }
496 }
497 }
498 }
499 }
500 if {$found} {
501 define FOSSIL_ENABLE_SSL
502 define-append EXTRA_CFLAGS $cflags
503 define-append EXTRA_LDFLAGS $ldflags
504 if {[info exists ssllibs]} {
505 define-append LIBS $ssllibs
506 } else {
507 define-append LIBS -lssl -lcrypto
508 }
509 if {[info exists ::zlib_lib]} {
510 define-append LIBS $::zlib_lib
511 }
512 if {[is_mingw]} {
513 define-append LIBS -lgdi32 -lwsock32 -lcrypt32
514 }
515 msg-result "HTTPS support enabled"
516
517 # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
518 if {[string match *-darwin* [get-define host]]} {
519 if {[cctest -cflags {-Wdeprecated-declarations}]} {
520 define-append EXTRA_CFLAGS -Wdeprecated-declarations
521 }
522 }
523 } else {
524 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
525 }
526 } else {
527 if {[info exists ::zlib_lib]} {
528 define-append LIBS $::zlib_lib
529 }
530 }
531
532
533
534 ########################################################################
@@ -554,11 +554,11 @@
554 # 1 = use external lib or sqlite3.o
555 # 2 = use external sqlite3.c and (if found) shell.c
556 define USE_SYSTEM_SQLITE 1
557 define SQLITE3_ORIGIN 2
558 if {$sq3path != "auto"} {
559 if {([file exists $sq3path/sqlite3.c]) &&
560 ([file exists $sq3path/sqlite3.h]) } {
561 # Prefer sqlite3.[ch] if found.
562 define SQLITE3_SRC.2 $sq3path/sqlite3.c
563 define SQLITE3_OBJ.2 {$(SQLITE3_OBJ.0)}
564 define USE_SYSTEM_SQLITE 2
@@ -599,136 +599,136 @@
599 }
600 define-append CFLAGS_INCLUDE {-I. -I$(SRCDIR) -I$(SRCDIR_extsrc)}
601
602 set tclpath [opt-val with-tcl]
603 if {$tclpath ne ""} {
604 set tclprivatestubs [opt-bool with-tcl-private-stubs]
605 # Note parse-tclconfig-sh is in autosetup/local.tcl
606 if {$tclpath eq "1"} {
607 set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
608 if {$tclprivatestubs} {
609 set tclconfig(TCL_INCLUDE_SPEC) -I$tcldir/generic
610 set tclconfig(TCL_VERSION) {Private Stubs}
611 set tclconfig(TCL_PATCH_LEVEL) {}
612 set tclconfig(TCL_PREFIX) $tcldir
613 set tclconfig(TCL_LD_FLAGS) { }
614 } else {
615 # Use the system Tcl. Look in some likely places.
616 array set tclconfig [parse-tclconfig-sh \
617 $tcldir/unix $tcldir/win \
618 /usr /usr/local /usr/share /opt/local]
619 set msg "on your system"
620 }
621 } else {
622 array set tclconfig [parse-tclconfig-sh $tclpath]
623 set msg "at $tclpath"
624 }
625 if {[opt-bool static]} {
626 set tclconfig(TCL_LD_FLAGS) { }
627 }
628 if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
629 user-error "Cannot find Tcl $msg"
630 }
631 set tclstubs [opt-bool with-tcl-stubs]
632 if {$tclprivatestubs} {
633 define FOSSIL_ENABLE_TCL_PRIVATE_STUBS
634 define USE_TCL_STUBS
635 } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
636 set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
637 define FOSSIL_ENABLE_TCL_STUBS
638 define USE_TCL_STUBS
639 } else {
640 set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
641 }
642 set cflags $tclconfig(TCL_INCLUDE_SPEC)
643 if {!$tclprivatestubs} {
644 set foundtcl 0; # Did we find a working Tcl library?
645 cc-with [list -cflags $cflags -libs $libs] {
646 if {$tclstubs} {
647 if {[cc-check-functions Tcl_InitStubs]} {
648 set foundtcl 1
649 }
650 } else {
651 if {[cc-check-functions Tcl_CreateInterp]} {
652 set foundtcl 1
653 }
654 }
655 }
656 if {!$foundtcl && [string match *-lieee* $libs]} {
657 # On some systems, using "-lieee" from TCL_LIB_SPEC appears
658 # to cause issues.
659 msg-result "Removing \"-lieee\" and retrying for Tcl..."
660 set libs [string map [list -lieee ""] $libs]
661 cc-with [list -cflags $cflags -libs $libs] {
662 if {$tclstubs} {
663 if {[cc-check-functions Tcl_InitStubs]} {
664 set foundtcl 1
665 }
666 } else {
667 if {[cc-check-functions Tcl_CreateInterp]} {
668 set foundtcl 1
669 }
670 }
671 }
672 }
673 if {!$foundtcl && ![string match *-lpthread* $libs]} {
674 # On some systems, TCL_LIB_SPEC appears to be missing
675 # "-lpthread". Try adding it.
676 msg-result "Adding \"-lpthread\" and retrying for Tcl..."
677 set libs "$libs -lpthread"
678 cc-with [list -cflags $cflags -libs $libs] {
679 if {$tclstubs} {
680 if {[cc-check-functions Tcl_InitStubs]} {
681 set foundtcl 1
682 }
683 } else {
684 if {[cc-check-functions Tcl_CreateInterp]} {
685 set foundtcl 1
686 }
687 }
688 }
689 }
690 if {!$foundtcl} {
691 if {$tclstubs} {
692 user-error "Cannot find a usable Tcl stubs library $msg"
693 } else {
694 user-error "Cannot find a usable Tcl library $msg"
695 }
696 }
697 }
698 set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
699 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
700 if {!$tclprivatestubs} {
701 define-append LIBS $libs
702 }
703 define-append EXTRA_CFLAGS $cflags
704 define-append CFLAGS $cflags
705 if {[info exists zlibpath] && $zlibpath eq "tree"} {
706 #
707 # NOTE: When using zlib in the source tree, prevent Tcl from
708 # pulling in the system one.
709 #
710 set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \
711 $tclconfig(TCL_LD_FLAGS)]
712 }
713 #
714 # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be
715 # be checked for near the bottom of this file.
716 #
717 set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
718 $tclconfig(TCL_LD_FLAGS)]
719 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
720 define FOSSIL_ENABLE_TCL
721 }
722
723 # Network functions require libraries on some systems
724 cc-check-function-in-lib gethostbyname nsl
725 if {![cc-check-function-in-lib socket {socket network}]} {
726 # Last resort, may be Windows
727 if {[is_mingw]} {
728 define-append LIBS -lwsock32
729 }
730 }
731
732 # Some systems (ex: SunOS) require -lrt in order to use nanosleep
733 cc-check-function-in-lib nanosleep rt
734
@@ -743,11 +743,11 @@
743 [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
744 ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
745 [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
746 ([cc-check-function-in-lib res_query {bind resolv}] ||
747 [cc-check-function-in-lib __res_query {bind resolv}]))} {
748 msg-result "WARNING: SMTP feature will not be able to look up local MX."
749 }
750 cc-check-function-in-lib res_9_ns_initparse resolv
751
752 # Other nonstandard function checks
753 cc-check-functions utime
@@ -758,12 +758,12 @@
758
759 # Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
760 # guard against including it again; use cctest as cc-check-functions and
761 # cctest_function check for "getpass()" with no args and fail
762 if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
763 define FOSSIL_HAVE_GETPASS 1
764 msg-result "Found getpass() with unistd.h"
765 }
766
767 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
768 if {![cc-check-functions getloadavg] ||
769 ![cctest -link 1 -includes {unistd.h} -code "double a\[3\]; getloadavg(a,3);"]} {
@@ -771,43 +771,43 @@
771 msg-result "Load average support unavailable"
772 }
773
774 # Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars
775 if {![cc-check-functions getpassphrase]} {
776 # Haiku needs this
777 cc-check-function-in-lib getpass bsd
778 }
779
780 # Check for the FuseFS library
781 if {[opt-bool fusefs]} {
782 if {[opt-bool static]} {
783 msg-result "FuseFS support disabled due to -static"
784 } elseif {[cc-check-function-in-lib fuse_mount fuse]} {
785 define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
786 define FOSSIL_HAVE_FUSEFS 1
787 msg-result "FuseFS support enabled"
788 }
789 }
790
791 ########################################################################
792 # Checks the compiler for compile_commands.json support.
793 #
794 # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
795 # if supported, "no" if not.
796 proc check-compile-commands {} {
797 msg-checking "compile_commands.json support... "
798 if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
799 # This test reportedly incorrectly succeeds on one of
800 # Martin G.'s older systems.
801 msg-result "compiler supports compile_commands.json"
802 define MAKE_COMPILATION_DB yes
803 return 1
804 } else {
805 msg-result "compiler does not support compile_commands.json"
806 define MAKE_COMPILATION_DB no
807 return 0
808 }
809 }
810
811 define MAKE_COMPILATION_DB no
812 if {!$outOfTreeBuild} {
813 if {[opt-bool compile-commands]} {
@@ -824,30 +824,30 @@
824 # Add -fsanitize compile and link options late: we don't want the C
825 # checks above to run with those sanitizers enabled. It can not only
826 # be pointless, it can actually break correct tests.
827 set fsan [opt-val with-sanitizer]
828 if {[string length $fsan]} {
829 define-append EXTRA_CFLAGS -fsanitize=$fsan
830 define-append EXTRA_LDFLAGS -fsanitize=$fsan
831 if {[string first "undefined" $fsan] != -1} {
832 # We need to link with libubsan if we're compiling under
833 # GCC with -fsanitize=undefined.
834 cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
835 }
836 }
837
838 # Finally, append libraries that must be last. This matters more on some
839 # OSes than others, but is most broadly required for static linking.
840 if {[check-function-in-lib dlopen dl]} {
841 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
842 # In such case we can link directly without -ldl.
843 define-append LIBS [get-define lib_dlopen]
844 }
845 if {[opt-bool static]} {
846 # Linux can only infer the dependency on pthread from OpenSSL when
847 # doing dynamic linkage.
848 define-append LIBS -lpthread
849 }
850
851
852 ########################################################################
853 # @proj-check-emsdk
854

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button