[Mesa-dev] [PATCH] configure.ac: handle llvm built with cmake in one shared library.

Tom Stellard tom at stellard.net
Mon Sep 28 18:26:35 PDT 2015


On Sun, Sep 27, 2015 at 02:21:41PM +0200, Laurent Carlier wrote:
> llvm can be built with cmake in a libray with the name libLLVM.so.$version
> 

Hi,

Thanks for working on this.

> Signed-off-by: Laurent Carlier <lordheavym at gmail.com>
> ---
>  configure.ac | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 217281f..361ffba 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2206,8 +2206,15 @@ if test "x$MESA_LLVM" != x0; then
>              LLVM_LIBS="-l$LLVM_SO_NAME"
>          else
>              dnl If LLVM was built with CMake, there will be one shared object per
> -            dnl component.
> -            AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
> +            dnl component or one shared object since LLVM 3.8.
> +            LLVM_SO_NAME=LLVM.$IMP_LIB_EXT.`$LLVM_CONFIG --version`
> +            AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME"], [llvm_have_one_so=yes])
> +            
> +            if test "x$llvm_have_one_so" = xyes; then
> +                dnl LLVM was built with cmake with only one shared versioned object.
> +                LLVM_LIBS="-l:lib$LLVM_SO_NAME"
> +            else
> +                AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
>                      [AC_MSG_ERROR([Could not find llvm shared libraries:


This is an improvement, but I think we could make this more robust.
With the current code, if you build with autoconf and cmake and
install them to the same prefix, then you would always get the
autoconf libraries.  We can't do anything about this for older versions
of llvm, but with 3.8 and newer, you can pass the --build-system
argument to llvm-config to see which build system was used.

I think we should use this new flag when possible to do the shared
object detection and otherwise fall back to the detection mechanism
you've added in this patch.

-Tom

>  	Please make sure you have built llvm with the --enable-shared option
>  	and that your llvm libraries are installed in $LLVM_LIBDIR
> @@ -2218,9 +2225,10 @@ if test "x$MESA_LLVM" != x0; then
>  	use llvm static libraries then add --disable-llvm-shared-libs to your configure
>  	invocation and rebuild.])])
>  
> -           dnl We don't need to update LLVM_LIBS in this case because the LLVM
> -           dnl install uses a shared object for each component and we have
> -           dnl already added all of these objects to LLVM_LIBS.
> +                dnl We don't need to update LLVM_LIBS in this case because the LLVM
> +                dnl install uses a shared object for each component and we have
> +                dnl already added all of these objects to LLVM_LIBS.
> +            fi
>          fi
>      else
>          AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
> -- 
> 2.5.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list