Fossil SCM

Add support for disabling sockets in auto.def. This is not wired up to anything else yet.

js 2022-12-15 15:50 trunk
Commit d8609e1e06789b8900986af482b458f6540ddeb754a8e0e525caeb82f90f4e07
1 file changed +104 -97
+104 -97
--- auto.def
+++ auto.def
@@ -19,10 +19,11 @@
1919
with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
2020
with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
2121
with-tcl-private-stubs=0
2222
=> {Enable Tcl integration via private stubs mechanism}
2323
with-mman=0 => {Enable use of POSIX memory APIs from "sys/mman.h"}
24
+ sockets=1 => {Disable use of sockets}
2425
with-see=0 => {Enable the SQLite Encryption Extension (SEE)}
2526
print-minimum-sqlite-version=0
2627
=> {print the minimum SQLite version number required, and exit}
2728
internal-sqlite=1 => {Don't use the internal SQLite, use the system one}
2829
static=0 => {Link a static executable}
@@ -370,83 +371,85 @@
370371
user-error "zlib not found please install it or specify the location with --with-zlib"
371372
}
372373
set ::zlib_lib -lz
373374
}
374375
375
-set ssldirs [opt-val with-openssl]
376
-if {$ssldirs ne "none"} {
377
- set found 0
378
- if {$ssldirs eq "tree"} {
379
- set ssldir [file dirname $autosetup(dir)]/compat/openssl
380
- if {![file isdirectory $ssldir]} {
381
- user-error "The OpenSSL in source tree directory does not exist"
382
- }
383
- set msg "ssl in $ssldir"
384
- set cflags "-I$ssldir/include"
385
- set ldflags "-L$ssldir"
386
- set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
387
- set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
388
- } else {
389
- if {$ssldirs in {auto ""}} {
390
- catch {
391
- set cflags [exec pkg-config openssl --cflags-only-I]
392
- set ldflags [exec pkg-config openssl --libs-only-L]
393
- set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
394
- } msg
395
- if {!$found} {
396
- set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
397
- /usr/pkg /usr/local /usr /usr/local/opt/openssl \
398
- /opt/homebrew/opt/openssl"
399
- }
400
- }
401
- if {!$found} {
402
- foreach dir $ssldirs {
403
- if {$dir eq ""} {
404
- set msg "system ssl"
405
- set cflags ""
406
- set ldflags ""
407
- } else {
408
- set msg "ssl in $dir"
409
- set cflags "-I$dir/include"
410
- set ldflags "-L$dir/lib"
411
- }
412
- if {[check-for-openssl $msg "$cflags $ldflags"]} {
413
- incr found
414
- break
415
- }
416
- }
417
- }
418
- }
419
- if {$found} {
420
- define FOSSIL_ENABLE_SSL
421
- define-append EXTRA_CFLAGS $cflags
422
- define-append EXTRA_LDFLAGS $ldflags
423
- if {[info exists ssllibs]} {
424
- define-append LIBS $ssllibs
425
- } else {
426
- define-append LIBS -lssl -lcrypto
427
- }
428
- if {[info exists ::zlib_lib]} {
429
- define-append LIBS $::zlib_lib
430
- }
431
- if {[is_mingw]} {
432
- define-append LIBS -lgdi32 -lwsock32 -lcrypt32
433
- }
434
- msg-result "HTTPS support enabled"
435
-
436
- # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
437
- if {[string match *-darwin* [get-define host]]} {
438
- if {[cctest -cflags {-Wdeprecated-declarations}]} {
439
- define-append EXTRA_CFLAGS -Wdeprecated-declarations
440
- }
441
- }
442
- } else {
443
- user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
444
- }
445
-} else {
446
- if {[info exists ::zlib_lib]} {
447
- define-append LIBS $::zlib_lib
376
+if {[opt-bool sockets]} {
377
+ set ssldirs [opt-val with-openssl]
378
+ if {$ssldirs ne "none"} {
379
+ set found 0
380
+ if {$ssldirs eq "tree"} {
381
+ set ssldir [file dirname $autosetup(dir)]/compat/openssl
382
+ if {![file isdirectory $ssldir]} {
383
+ user-error "The OpenSSL in source tree directory does not exist"
384
+ }
385
+ set msg "ssl in $ssldir"
386
+ set cflags "-I$ssldir/include"
387
+ set ldflags "-L$ssldir"
388
+ set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
389
+ set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
390
+ } else {
391
+ if {$ssldirs in {auto ""}} {
392
+ catch {
393
+ set cflags [exec pkg-config openssl --cflags-only-I]
394
+ set ldflags [exec pkg-config openssl --libs-only-L]
395
+ set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
396
+ } msg
397
+ if {!$found} {
398
+ set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
399
+ /usr/pkg /usr/local /usr /usr/local/opt/openssl \
400
+ /opt/homebrew/opt/openssl"
401
+ }
402
+ }
403
+ if {!$found} {
404
+ foreach dir $ssldirs {
405
+ if {$dir eq ""} {
406
+ set msg "system ssl"
407
+ set cflags ""
408
+ set ldflags ""
409
+ } else {
410
+ set msg "ssl in $dir"
411
+ set cflags "-I$dir/include"
412
+ set ldflags "-L$dir/lib"
413
+ }
414
+ if {[check-for-openssl $msg "$cflags $ldflags"]} {
415
+ incr found
416
+ break
417
+ }
418
+ }
419
+ }
420
+ }
421
+ if {$found} {
422
+ define FOSSIL_ENABLE_SSL
423
+ define-append EXTRA_CFLAGS $cflags
424
+ define-append EXTRA_LDFLAGS $ldflags
425
+ if {[info exists ssllibs]} {
426
+ define-append LIBS $ssllibs
427
+ } else {
428
+ define-append LIBS -lssl -lcrypto
429
+ }
430
+ if {[info exists ::zlib_lib]} {
431
+ define-append LIBS $::zlib_lib
432
+ }
433
+ if {[is_mingw]} {
434
+ define-append LIBS -lgdi32 -lwsock32 -lcrypt32
435
+ }
436
+ msg-result "HTTPS support enabled"
437
+
438
+ # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
439
+ if {[string match *-darwin* [get-define host]]} {
440
+ if {[cctest -cflags {-Wdeprecated-declarations}]} {
441
+ define-append EXTRA_CFLAGS -Wdeprecated-declarations
442
+ }
443
+ }
444
+ } else {
445
+ user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
446
+ }
447
+ } else {
448
+ if {[info exists ::zlib_lib]} {
449
+ define-append LIBS $::zlib_lib
450
+ }
448451
}
449452
}
450453
451454
452455
@@ -664,34 +667,38 @@
664667
puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
665668
}
666669
}
667670
668671
# Network functions require libraries on some systems
669
-cc-check-function-in-lib gethostbyname nsl
670
-if {![cc-check-function-in-lib socket {socket network}]} {
671
- # Last resort, may be Windows
672
- if {[is_mingw]} {
673
- define-append LIBS -lwsock32
674
- }
675
-}
676
-
677
-# The SMTP module requires special libraries and headers for MX DNS
678
-# record lookups and such.
679
-cc-check-includes arpa/nameser.h
680
-cc-include-needs bind/resolv.h netinet/in.h
681
-cc-check-includes bind/resolv.h
682
-cc-check-includes resolv.h
683
-if { !(([cc-check-function-in-lib dn_expand resolv] ||
684
- [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
685
- [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
686
- ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
687
- [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
688
- ([cc-check-function-in-lib res_query {bind resolv}] ||
689
- [cc-check-function-in-lib __res_query {bind resolv}]))} {
690
- msg-result "WARNING: SMTP feature will not be able to look up local MX."
691
-}
692
-cc-check-function-in-lib res_9_ns_initparse resolv
672
+if {[opt-bool sockets]} {
673
+ cc-check-function-in-lib gethostbyname nsl
674
+ if {![cc-check-function-in-lib socket {socket network}]} {
675
+ # Last resort, may be Windows
676
+ if {[is_mingw]} {
677
+ define-append LIBS -lwsock32
678
+ }
679
+ }
680
+
681
+ # The SMTP module requires special libraries and headers for MX DNS
682
+ # record lookups and such.
683
+ cc-check-includes arpa/nameser.h
684
+ cc-include-needs bind/resolv.h netinet/in.h
685
+ cc-check-includes bind/resolv.h
686
+ cc-check-includes resolv.h
687
+ if { !(([cc-check-function-in-lib dn_expand resolv] ||
688
+ [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
689
+ [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
690
+ ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
691
+ [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
692
+ ([cc-check-function-in-lib res_query {bind resolv}] ||
693
+ [cc-check-function-in-lib __res_query {bind resolv}]))} {
694
+ msg-result "WARNING: SMTP feature will not be able to look up local MX."
695
+ }
696
+ cc-check-function-in-lib res_9_ns_initparse resolv
697
+} else {
698
+ define FOSSIL_DISABLE_SOCKETS
699
+}
693700
694701
# Other nonstandard function checks
695702
cc-check-functions utime
696703
cc-check-functions usleep
697704
cc-check-functions strchrnul
698705
--- auto.def
+++ auto.def
@@ -19,10 +19,11 @@
19 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
20 with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
21 with-tcl-private-stubs=0
22 => {Enable Tcl integration via private stubs mechanism}
23 with-mman=0 => {Enable use of POSIX memory APIs from "sys/mman.h"}
 
24 with-see=0 => {Enable the SQLite Encryption Extension (SEE)}
25 print-minimum-sqlite-version=0
26 => {print the minimum SQLite version number required, and exit}
27 internal-sqlite=1 => {Don't use the internal SQLite, use the system one}
28 static=0 => {Link a static executable}
@@ -370,83 +371,85 @@
370 user-error "zlib not found please install it or specify the location with --with-zlib"
371 }
372 set ::zlib_lib -lz
373 }
374
375 set ssldirs [opt-val with-openssl]
376 if {$ssldirs ne "none"} {
377 set found 0
378 if {$ssldirs eq "tree"} {
379 set ssldir [file dirname $autosetup(dir)]/compat/openssl
380 if {![file isdirectory $ssldir]} {
381 user-error "The OpenSSL in source tree directory does not exist"
382 }
383 set msg "ssl in $ssldir"
384 set cflags "-I$ssldir/include"
385 set ldflags "-L$ssldir"
386 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
387 set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
388 } else {
389 if {$ssldirs in {auto ""}} {
390 catch {
391 set cflags [exec pkg-config openssl --cflags-only-I]
392 set ldflags [exec pkg-config openssl --libs-only-L]
393 set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
394 } msg
395 if {!$found} {
396 set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
397 /usr/pkg /usr/local /usr /usr/local/opt/openssl \
398 /opt/homebrew/opt/openssl"
399 }
400 }
401 if {!$found} {
402 foreach dir $ssldirs {
403 if {$dir eq ""} {
404 set msg "system ssl"
405 set cflags ""
406 set ldflags ""
407 } else {
408 set msg "ssl in $dir"
409 set cflags "-I$dir/include"
410 set ldflags "-L$dir/lib"
411 }
412 if {[check-for-openssl $msg "$cflags $ldflags"]} {
413 incr found
414 break
415 }
416 }
417 }
418 }
419 if {$found} {
420 define FOSSIL_ENABLE_SSL
421 define-append EXTRA_CFLAGS $cflags
422 define-append EXTRA_LDFLAGS $ldflags
423 if {[info exists ssllibs]} {
424 define-append LIBS $ssllibs
425 } else {
426 define-append LIBS -lssl -lcrypto
427 }
428 if {[info exists ::zlib_lib]} {
429 define-append LIBS $::zlib_lib
430 }
431 if {[is_mingw]} {
432 define-append LIBS -lgdi32 -lwsock32 -lcrypt32
433 }
434 msg-result "HTTPS support enabled"
435
436 # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
437 if {[string match *-darwin* [get-define host]]} {
438 if {[cctest -cflags {-Wdeprecated-declarations}]} {
439 define-append EXTRA_CFLAGS -Wdeprecated-declarations
440 }
441 }
442 } else {
443 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
444 }
445 } else {
446 if {[info exists ::zlib_lib]} {
447 define-append LIBS $::zlib_lib
 
 
448 }
449 }
450
451
452
@@ -664,34 +667,38 @@
664 puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
665 }
666 }
667
668 # Network functions require libraries on some systems
669 cc-check-function-in-lib gethostbyname nsl
670 if {![cc-check-function-in-lib socket {socket network}]} {
671 # Last resort, may be Windows
672 if {[is_mingw]} {
673 define-append LIBS -lwsock32
674 }
675 }
676
677 # The SMTP module requires special libraries and headers for MX DNS
678 # record lookups and such.
679 cc-check-includes arpa/nameser.h
680 cc-include-needs bind/resolv.h netinet/in.h
681 cc-check-includes bind/resolv.h
682 cc-check-includes resolv.h
683 if { !(([cc-check-function-in-lib dn_expand resolv] ||
684 [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
685 [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
686 ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
687 [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
688 ([cc-check-function-in-lib res_query {bind resolv}] ||
689 [cc-check-function-in-lib __res_query {bind resolv}]))} {
690 msg-result "WARNING: SMTP feature will not be able to look up local MX."
691 }
692 cc-check-function-in-lib res_9_ns_initparse resolv
 
 
 
 
693
694 # Other nonstandard function checks
695 cc-check-functions utime
696 cc-check-functions usleep
697 cc-check-functions strchrnul
698
--- auto.def
+++ auto.def
@@ -19,10 +19,11 @@
19 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
20 with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
21 with-tcl-private-stubs=0
22 => {Enable Tcl integration via private stubs mechanism}
23 with-mman=0 => {Enable use of POSIX memory APIs from "sys/mman.h"}
24 sockets=1 => {Disable use of sockets}
25 with-see=0 => {Enable the SQLite Encryption Extension (SEE)}
26 print-minimum-sqlite-version=0
27 => {print the minimum SQLite version number required, and exit}
28 internal-sqlite=1 => {Don't use the internal SQLite, use the system one}
29 static=0 => {Link a static executable}
@@ -370,83 +371,85 @@
371 user-error "zlib not found please install it or specify the location with --with-zlib"
372 }
373 set ::zlib_lib -lz
374 }
375
376 if {[opt-bool sockets]} {
377 set ssldirs [opt-val with-openssl]
378 if {$ssldirs ne "none"} {
379 set found 0
380 if {$ssldirs eq "tree"} {
381 set ssldir [file dirname $autosetup(dir)]/compat/openssl
382 if {![file isdirectory $ssldir]} {
383 user-error "The OpenSSL in source tree directory does not exist"
384 }
385 set msg "ssl in $ssldir"
386 set cflags "-I$ssldir/include"
387 set ldflags "-L$ssldir"
388 set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
389 set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
390 } else {
391 if {$ssldirs in {auto ""}} {
392 catch {
393 set cflags [exec pkg-config openssl --cflags-only-I]
394 set ldflags [exec pkg-config openssl --libs-only-L]
395 set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
396 } msg
397 if {!$found} {
398 set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
399 /usr/pkg /usr/local /usr /usr/local/opt/openssl \
400 /opt/homebrew/opt/openssl"
401 }
402 }
403 if {!$found} {
404 foreach dir $ssldirs {
405 if {$dir eq ""} {
406 set msg "system ssl"
407 set cflags ""
408 set ldflags ""
409 } else {
410 set msg "ssl in $dir"
411 set cflags "-I$dir/include"
412 set ldflags "-L$dir/lib"
413 }
414 if {[check-for-openssl $msg "$cflags $ldflags"]} {
415 incr found
416 break
417 }
418 }
419 }
420 }
421 if {$found} {
422 define FOSSIL_ENABLE_SSL
423 define-append EXTRA_CFLAGS $cflags
424 define-append EXTRA_LDFLAGS $ldflags
425 if {[info exists ssllibs]} {
426 define-append LIBS $ssllibs
427 } else {
428 define-append LIBS -lssl -lcrypto
429 }
430 if {[info exists ::zlib_lib]} {
431 define-append LIBS $::zlib_lib
432 }
433 if {[is_mingw]} {
434 define-append LIBS -lgdi32 -lwsock32 -lcrypt32
435 }
436 msg-result "HTTPS support enabled"
437
438 # Silence OpenSSL deprecation warnings on Mac OS X 10.7.
439 if {[string match *-darwin* [get-define host]]} {
440 if {[cctest -cflags {-Wdeprecated-declarations}]} {
441 define-append EXTRA_CFLAGS -Wdeprecated-declarations
442 }
443 }
444 } else {
445 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
446 }
447 } else {
448 if {[info exists ::zlib_lib]} {
449 define-append LIBS $::zlib_lib
450 }
451 }
452 }
453
454
455
@@ -664,34 +667,38 @@
667 puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
668 }
669 }
670
671 # Network functions require libraries on some systems
672 if {[opt-bool sockets]} {
673 cc-check-function-in-lib gethostbyname nsl
674 if {![cc-check-function-in-lib socket {socket network}]} {
675 # Last resort, may be Windows
676 if {[is_mingw]} {
677 define-append LIBS -lwsock32
678 }
679 }
680
681 # The SMTP module requires special libraries and headers for MX DNS
682 # record lookups and such.
683 cc-check-includes arpa/nameser.h
684 cc-include-needs bind/resolv.h netinet/in.h
685 cc-check-includes bind/resolv.h
686 cc-check-includes resolv.h
687 if { !(([cc-check-function-in-lib dn_expand resolv] ||
688 [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
689 [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
690 ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
691 [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
692 ([cc-check-function-in-lib res_query {bind resolv}] ||
693 [cc-check-function-in-lib __res_query {bind resolv}]))} {
694 msg-result "WARNING: SMTP feature will not be able to look up local MX."
695 }
696 cc-check-function-in-lib res_9_ns_initparse resolv
697 } else {
698 define FOSSIL_DISABLE_SOCKETS
699 }
700
701 # Other nonstandard function checks
702 cc-check-functions utime
703 cc-check-functions usleep
704 cc-check-functions strchrnul
705

Keyboard Shortcuts

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