From c9080c923d9ddb00f867823a22637288a1f31d23 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Sun, 16 Apr 2023 20:06:01 +0100 Subject: [PATCH] Add quick and dirty support for specifying desired linking mode --- setup.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/setup.sh b/setup.sh index 7053973..7b26172 100755 --- a/setup.sh +++ b/setup.sh @@ -8,13 +8,13 @@ if test "$(dirname $0)" != '.'; then exit 1 fi -if test "$#" -ne 1; then - echo "Usage: $0 " +if test "$#" -ne 2; then + echo "Usage: $0 " exit 1 fi llvm_config=$1 -default_mode= +default_mode=$2 support_static_mode=false support_shared_mode=false @@ -29,23 +29,24 @@ if test "$llvm_version" != "$expected_version"; then exit 1 fi -if llvm_config --link-static --libs; then - default_mode=static - support_static_mode=true -fi if llvm_config --link-shared --libs; then - default_mode=shared + default_mode=${default_mode:=shared} support_shared_mode=true fi +if llvm_config --link-static --libs; then + default_mode=${default_mode:=static} + support_static_mode=true +fi + if test -z "$default_mode"; then echo "Something is wrong with the llvm-config command provided." exit 1 fi base_cflags=$(llvm_config --cflags) -ldflags="$(llvm_config --ldflags) -lstdc++" +ldflags="$(pkg-config --libs-only-L libzstd) $(llvm_config --ldflags) -lstdc++" llvm_targets=$(llvm_config --targets-built) rm -rf src