diff --git a/configure b/configure index 5dbc955c9a..f67ea7c6b6 100755 --- a/configure +++ b/configure @@ -922,6 +922,7 @@ with_libncurses_prefix with_libpdcurses_prefix enable_distcheck_werror with_system_llvm +with_llvm_linking enable_llvm enable_sha_collector_for_internal_use with_libcurl @@ -1648,6 +1649,8 @@ Optional Packages: --with-system-llvm use system llvm instead of built-in, uses full path to llvm-config [default=/usr/local or /usr if not found in /usr/local] + --with-llvm-linking specifies method to linking llvm [static|dynamic], + only valid with --with-system-llvm --with-libcurl[=DIR] path to directory containing libcurl [default=/usr/local or /usr if not found in /usr/local] @@ -22721,6 +22724,36 @@ else fi + +# Check whether --with-llvm-linking was given. +if test "${with_llvm_linking+set}" = set; then : + withval=$with_llvm_linking; +if test "x$system_llvm" = "xbuilt-in"; then + as_fn_error $? "Failed to configure LLVM, and LLVM linking was specified without specifying system-llvm" "$LINENO" 5 +else +case "$withval" in + static) + llvm_linking="static" + ;; + dynamic) + llvm_linking="dynamic" + ;; + *) + as_fn_error $? "Invalid argument to --with-llvm-linking" "$LINENO" 5 +esac +fi + +else + +if test "x$system_llvm" = "xbuilt-in"; then + llvm_linking="" +else + llvm_linking="auto" +fi + +fi + + # Check whether --enable-llvm was given. if test "${enable_llvm+set}" = set; then : enableval=$enable_llvm; enable_llvm=$enableval @@ -22749,6 +22782,7 @@ subdirs="$subdirs libclamav/c++" else system_llvm="none" + llvm_linking="" fi # Check whether --enable-sha-collector-for-internal-use was given. @@ -25579,6 +25613,11 @@ fi if test "$enable_llvm" = "yes" && test "$subdirfailed" != "no"; then as_fn_error $? "Failed to configure LLVM, and LLVM was explicitly requested" "$LINENO" 5 fi +if test "$enable_llvm" = "auto" && test "$subdirfailed" != "no"; then + system_llvm="MIA" + llvm_linking="" +fi + if test "$subdirfailed" != "yes" && test "$enable_llvm" != "no"; then ENABLE_LLVM_TRUE= ENABLE_LLVM_FALSE='#' @@ -28227,8 +28266,8 @@ cat <&5 -$as_echo "$as_me: Summary of miscellaneous features" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Summary of miscellaneous features" >&5 +$as_echo "$as_me: Summary of miscellaneous features" >&6;} if test "x$CHECK_LIBS" = "x"; then check_libs="no" else @@ -28345,8 +28384,8 @@ else fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: Summary of engine performance features)" >&5 -$as_echo "$as_me: Summary of engine performance features)" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Summary of engine performance features" >&5 +$as_echo "$as_me: Summary of engine performance features" >&6;} if test "x$enable_debug" = "xyes"; then @@ -28380,6 +28419,7 @@ have_jit="no" if test "$subdirfailed" = "no"; then have_jit="yes" fi +if test "x$llvm_linking" = "x"; then $as_echo_n " llvm : " @@ -28393,6 +28433,21 @@ else $as_echo "$have_jit, from $system_llvm ($enable_llvm)" fi +else + + + $as_echo_n " llvm : " + if test "x$enable_llvm" = "xno"; then : + $as_echo "$have_jit, from $system_llvm ($llvm_linking) (disabled)" +elif test "x$enable_llvm" = "xyes"; then : + $as_echo "$have_jit, from $system_llvm ($llvm_linking)" +elif test "x$enable_llvm" = "x"; then : + $as_echo "$have_jit, from $system_llvm ($llvm_linking)" +else + $as_echo "$have_jit, from $system_llvm ($llvm_linking) ($enable_llvm)" +fi + +fi $as_echo_n " mempool : " diff --git a/libclamav/c++/configure b/libclamav/c++/configure index f7831e2793..d467bc1e83 100755 --- a/libclamav/c++/configure +++ b/libclamav/c++/configure @@ -595,7 +595,6 @@ PACKAGE_STRING='libclamavc++ devel' PACKAGE_BUGREPORT='http://bugs.clamav.net' PACKAGE_URL='' -ac_unique_file="llvm/configure" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -796,6 +795,7 @@ with_gnu_ld with_sysroot enable_libtool_lock with_system_llvm +with_llvm_linking enable_llvm enable_optimized enable_all_jit_targets @@ -1462,6 +1462,8 @@ Optional Packages: --with-system-llvm Use system llvm instead of built-in, uses full path to llvm-config (default= search /usr/local or /usr if not found in /usr/local) + --with-llvm-linking specifies method to linking llvm [static|dynamic], + only valid with --with-system-llvm Some influential environment variables: CXX C++ compiler command @@ -2361,7 +2363,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - ac_config_headers="$ac_config_headers clamavcxx-config.h" # Make sure we can run config.sub. @@ -15628,6 +15629,29 @@ $as_echo "$as_me: Using external LLVM" >&6;} fi +llvm_linking= + +# Check whether --with-llvm-linking was given. +if test "${with_llvm_linking+set}" = set; then : + withval=$with_llvm_linking; +if test "x$llvmconfig" = "x"; then + as_fn_error $? "Failed to configure LLVM, and LLVM linking was specified without valid llvm-config" "$LINENO" 5 +else +case "$withval" in + static) + llvm_linking="static" + ;; + dynamic) + llvm_linking="dynamic" + ;; + *) + as_fn_error $? "Invalid argument to --with-llvm-linking" "$LINENO" 5 +esac +fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported LLVM version" >&5 $as_echo_n "checking for supported LLVM version... " >&6; } if test "x$llvmconfig" = "x"; then @@ -15668,18 +15692,28 @@ fi if test "x$llvmconfig" != "x"; then LLVMCONFIG_CXXFLAGS=`$llvmconfig --cxxflags` - if test $llvmver_test -ge 350; then - ldflags=`$llvmconfig --ldflags` - syslibs=`$llvmconfig --system-libs` - LLVMCONFIG_LDFLAGS="$ldflags $syslibs" - else + if test "x$llvm_linking" = "xdynamic"; then LLVMCONFIG_LDFLAGS=`$llvmconfig --ldflags` - fi - LLVMCONFIG_LIBS=`$llvmconfig --libs jit nativecodegen scalaropts ipo` + LLVMCONFIG_LIBS=-lLLVM-$llvmver + + + else + if test $llvmver_test -ge 350; then + ldflags=`$llvmconfig --ldflags` + syslibs=`$llvmconfig --system-libs` + LLVMCONFIG_LDFLAGS="$ldflags $syslibs" - LLVMCONFIG_LIBFILES=`$llvmconfig --libfiles jit nativecodegen scalaropts ipo` + else + LLVMCONFIG_LDFLAGS=`$llvmconfig --ldflags` + + fi + LLVMCONFIG_LIBS=`$llvmconfig --libs jit nativecodegen scalaropts ipo` + + LLVMCONFIG_LIBFILES=`$llvmconfig --libfiles jit nativecodegen scalaropts ipo` + + fi { $as_echo "$as_me:${as_lineno-$LINENO}: CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS" >&5 $as_echo "$as_me: CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS" >&6;}