Fossil SCM
Commit build fixes for NetBSD, OpenBSD, NixOS
Commit
b99a9977c9f65dabb4a6cfc70e91cb8935be3a6b1a2aa5a307e4f3983ba3b078
Parent
99b0bd8f9d2246d…
1 file changed
+40
-1
M
auto.def
+40
-1
| --- auto.def | ||
| +++ auto.def | ||
| @@ -376,11 +376,34 @@ | ||
| 376 | 376 | } else { |
| 377 | 377 | msg-result "no" |
| 378 | 378 | return 0 |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | - | |
| 381 | +# | |
| 382 | +# Give a runtime search path to every -L directory we added ourselves. | |
| 383 | +# | |
| 384 | +# The probes below look outside the compiler's default paths for various OSs. | |
| 385 | +# A -L will link at build time but the runtime linker needs to find the libs too. | |
| 386 | +# The pkgsrc convention is to add the matching rpath so rtld works. | |
| 387 | +# | |
| 388 | +proc fossil-rpath-ldflags {ldflags} { | |
| 389 | + set rv {} | |
| 390 | + foreach flag $ldflags { | |
| 391 | + if {![string match -L* $flag]} continue | |
| 392 | + set dir [string range $flag 2 end] | |
| 393 | + if {$dir eq "" || ![file isdirectory $dir]} continue | |
| 394 | + set rp "-Wl,-rpath,$dir" | |
| 395 | + if {$rp in $rv} continue | |
| 396 | + if {[cctest -link 1 -cflags $rp]} { | |
| 397 | + lappend rv $rp | |
| 398 | + } | |
| 399 | + } | |
| 400 | + if {[llength $rv]} { | |
| 401 | + define-append EXTRA_LDFLAGS {*}$rv | |
| 402 | + msg-result "Runtime search path: $rv" | |
| 403 | + } | |
| 404 | +} | |
| 382 | 405 | # |
| 383 | 406 | # Check for zlib, using the given location if specified |
| 384 | 407 | # |
| 385 | 408 | proc handle-zlib {} { |
| 386 | 409 | set ::zlibpath [opt-val with-zlib]; # used by downstream tcl tests |
| @@ -428,18 +451,29 @@ | ||
| 428 | 451 | if {$lcheck eq ""} { |
| 429 | 452 | msg-result "Linked to zlib via default library path" |
| 430 | 453 | } else { |
| 431 | 454 | define-append EXTRA_LDFLAGS "$lcheck" |
| 432 | 455 | msg-result "Linked to zlib via $lcheck" |
| 456 | + fossil-rpath-ldflags $lcheck | |
| 433 | 457 | } |
| 458 | + # Keep the flags that worked for every later probe too, in the | |
| 459 | + # persistent form of cc-with, as the --with-zlib=tree branch above | |
| 460 | + # already does. check-for-openssl appends $::zlib_lib to its own link | |
| 461 | + # test, and without these it links a bare -lz against a path autosetup | |
| 462 | + # has not been told about, then reports OpenSSL as missing. | |
| 463 | + cc-with [list -cflags "$cfound $lcheck"] | |
| 464 | + set lfound $lcheck | |
| 434 | 465 | if {![check-function-in-lib compressBound z]} { |
| 435 | 466 | puts "Notice: disabling zlib compression in the SQL shell" |
| 436 | 467 | define-append SQLITE_OPTIONS_EXT {-USQLITE_HAVE_ZLIB} |
| 437 | 468 | } |
| 438 | 469 | break |
| 439 | 470 | } |
| 440 | 471 | } |
| 472 | + if {![info exists lfound]} { | |
| 473 | + user-error "zlib not linkable; either install it or specify its location via --with-zlib" | |
| 474 | + } | |
| 441 | 475 | set ::zlib_lib -lz |
| 442 | 476 | } |
| 443 | 477 | }; # handle-zlib |
| 444 | 478 | handle-zlib |
| 445 | 479 | |
| @@ -519,10 +553,11 @@ | ||
| 519 | 553 | } |
| 520 | 554 | if {$found} { |
| 521 | 555 | define FOSSIL_ENABLE_SSL |
| 522 | 556 | define-append EXTRA_CFLAGS $cflags |
| 523 | 557 | define-append EXTRA_LDFLAGS $ldflags |
| 558 | + fossil-rpath-ldflags $ldflags | |
| 524 | 559 | if {[info exists ssllibs]} { |
| 525 | 560 | define-append LIBS $ssllibs |
| 526 | 561 | } else { |
| 527 | 562 | define-append LIBS -lssl -lcrypto |
| 528 | 563 | } |
| @@ -818,10 +853,14 @@ | ||
| 818 | 853 | |
| 819 | 854 | # Check for the FuseFS library |
| 820 | 855 | if {[opt-bool fusefs]} { |
| 821 | 856 | if {[opt-bool static]} { |
| 822 | 857 | msg-result "FuseFS support disabled due to -static" |
| 858 | + } elseif {![cc-with {-cflags {-DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64}} { | |
| 859 | + cc-check-includes fuse.h | |
| 860 | + }]} { | |
| 861 | + msg-result "FuseFS support disabled: <fuse.h> not found" | |
| 823 | 862 | } elseif {[cc-check-function-in-lib fuse_mount fuse]} { |
| 824 | 863 | define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS |
| 825 | 864 | define FOSSIL_HAVE_FUSEFS 1 |
| 826 | 865 | msg-result "FuseFS support enabled" |
| 827 | 866 | } |
| 828 | 867 |
| --- auto.def | |
| +++ auto.def | |
| @@ -376,11 +376,34 @@ | |
| 376 | } else { |
| 377 | msg-result "no" |
| 378 | return 0 |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | # |
| 383 | # Check for zlib, using the given location if specified |
| 384 | # |
| 385 | proc handle-zlib {} { |
| 386 | set ::zlibpath [opt-val with-zlib]; # used by downstream tcl tests |
| @@ -428,18 +451,29 @@ | |
| 428 | if {$lcheck eq ""} { |
| 429 | msg-result "Linked to zlib via default library path" |
| 430 | } else { |
| 431 | define-append EXTRA_LDFLAGS "$lcheck" |
| 432 | msg-result "Linked to zlib via $lcheck" |
| 433 | } |
| 434 | if {![check-function-in-lib compressBound z]} { |
| 435 | puts "Notice: disabling zlib compression in the SQL shell" |
| 436 | define-append SQLITE_OPTIONS_EXT {-USQLITE_HAVE_ZLIB} |
| 437 | } |
| 438 | break |
| 439 | } |
| 440 | } |
| 441 | set ::zlib_lib -lz |
| 442 | } |
| 443 | }; # handle-zlib |
| 444 | handle-zlib |
| 445 | |
| @@ -519,10 +553,11 @@ | |
| 519 | } |
| 520 | if {$found} { |
| 521 | define FOSSIL_ENABLE_SSL |
| 522 | define-append EXTRA_CFLAGS $cflags |
| 523 | define-append EXTRA_LDFLAGS $ldflags |
| 524 | if {[info exists ssllibs]} { |
| 525 | define-append LIBS $ssllibs |
| 526 | } else { |
| 527 | define-append LIBS -lssl -lcrypto |
| 528 | } |
| @@ -818,10 +853,14 @@ | |
| 818 | |
| 819 | # Check for the FuseFS library |
| 820 | if {[opt-bool fusefs]} { |
| 821 | if {[opt-bool static]} { |
| 822 | msg-result "FuseFS support disabled due to -static" |
| 823 | } elseif {[cc-check-function-in-lib fuse_mount fuse]} { |
| 824 | define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS |
| 825 | define FOSSIL_HAVE_FUSEFS 1 |
| 826 | msg-result "FuseFS support enabled" |
| 827 | } |
| 828 |
| --- auto.def | |
| +++ auto.def | |
| @@ -376,11 +376,34 @@ | |
| 376 | } else { |
| 377 | msg-result "no" |
| 378 | return 0 |
| 379 | } |
| 380 | } |
| 381 | # |
| 382 | # Give a runtime search path to every -L directory we added ourselves. |
| 383 | # |
| 384 | # The probes below look outside the compiler's default paths for various OSs. |
| 385 | # A -L will link at build time but the runtime linker needs to find the libs too. |
| 386 | # The pkgsrc convention is to add the matching rpath so rtld works. |
| 387 | # |
| 388 | proc fossil-rpath-ldflags {ldflags} { |
| 389 | set rv {} |
| 390 | foreach flag $ldflags { |
| 391 | if {![string match -L* $flag]} continue |
| 392 | set dir [string range $flag 2 end] |
| 393 | if {$dir eq "" || ![file isdirectory $dir]} continue |
| 394 | set rp "-Wl,-rpath,$dir" |
| 395 | if {$rp in $rv} continue |
| 396 | if {[cctest -link 1 -cflags $rp]} { |
| 397 | lappend rv $rp |
| 398 | } |
| 399 | } |
| 400 | if {[llength $rv]} { |
| 401 | define-append EXTRA_LDFLAGS {*}$rv |
| 402 | msg-result "Runtime search path: $rv" |
| 403 | } |
| 404 | } |
| 405 | # |
| 406 | # Check for zlib, using the given location if specified |
| 407 | # |
| 408 | proc handle-zlib {} { |
| 409 | set ::zlibpath [opt-val with-zlib]; # used by downstream tcl tests |
| @@ -428,18 +451,29 @@ | |
| 451 | if {$lcheck eq ""} { |
| 452 | msg-result "Linked to zlib via default library path" |
| 453 | } else { |
| 454 | define-append EXTRA_LDFLAGS "$lcheck" |
| 455 | msg-result "Linked to zlib via $lcheck" |
| 456 | fossil-rpath-ldflags $lcheck |
| 457 | } |
| 458 | # Keep the flags that worked for every later probe too, in the |
| 459 | # persistent form of cc-with, as the --with-zlib=tree branch above |
| 460 | # already does. check-for-openssl appends $::zlib_lib to its own link |
| 461 | # test, and without these it links a bare -lz against a path autosetup |
| 462 | # has not been told about, then reports OpenSSL as missing. |
| 463 | cc-with [list -cflags "$cfound $lcheck"] |
| 464 | set lfound $lcheck |
| 465 | if {![check-function-in-lib compressBound z]} { |
| 466 | puts "Notice: disabling zlib compression in the SQL shell" |
| 467 | define-append SQLITE_OPTIONS_EXT {-USQLITE_HAVE_ZLIB} |
| 468 | } |
| 469 | break |
| 470 | } |
| 471 | } |
| 472 | if {![info exists lfound]} { |
| 473 | user-error "zlib not linkable; either install it or specify its location via --with-zlib" |
| 474 | } |
| 475 | set ::zlib_lib -lz |
| 476 | } |
| 477 | }; # handle-zlib |
| 478 | handle-zlib |
| 479 | |
| @@ -519,10 +553,11 @@ | |
| 553 | } |
| 554 | if {$found} { |
| 555 | define FOSSIL_ENABLE_SSL |
| 556 | define-append EXTRA_CFLAGS $cflags |
| 557 | define-append EXTRA_LDFLAGS $ldflags |
| 558 | fossil-rpath-ldflags $ldflags |
| 559 | if {[info exists ssllibs]} { |
| 560 | define-append LIBS $ssllibs |
| 561 | } else { |
| 562 | define-append LIBS -lssl -lcrypto |
| 563 | } |
| @@ -818,10 +853,14 @@ | |
| 853 | |
| 854 | # Check for the FuseFS library |
| 855 | if {[opt-bool fusefs]} { |
| 856 | if {[opt-bool static]} { |
| 857 | msg-result "FuseFS support disabled due to -static" |
| 858 | } elseif {![cc-with {-cflags {-DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64}} { |
| 859 | cc-check-includes fuse.h |
| 860 | }]} { |
| 861 | msg-result "FuseFS support disabled: <fuse.h> not found" |
| 862 | } elseif {[cc-check-function-in-lib fuse_mount fuse]} { |
| 863 | define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS |
| 864 | define FOSSIL_HAVE_FUSEFS 1 |
| 865 | msg-result "FuseFS support enabled" |
| 866 | } |
| 867 |