On 5 October 2017 at 18:47, Tobias Droste <tdro...@gmx.de> wrote: > Am Donnerstag, 5. Oktober 2017, 12:19:05 CEST schrieb Emil Velikov: >> From: Emil Velikov <emil.veli...@collabora.com> >> >> Earlier versions need different quirks, but as of LLVM 3.9 llvm-config >> provides --link-shared/link-static toggles. >> >> The output of which seems to be reliable - looking at LLVM 3.9, 4.0 and >> 5.0. >> >> Note that there are earlier code will be used for pre LLVM 3.9 and is >> unchanged. >> >> This effectively fixes LLVM static linking, while providing a clearer >> and more robust solution for future versions. >> >> Mildly interesting side notes: >> >> - build-mode (introduced with 3.8) was buggy with 3.8 >> It shows "static" when build with -DLLVM_LINK_LLVM_DYLIB=ON, yet it was >> consistent with --libs. The latter shows the static libraries. >> >> - libnames and libfiles are broken with LVM 3.9 >> The library prefix and extension is printed twice liblibLLVM-3.9.so.so >> >> Cc: mesa-sta...@lists.freedesktop.org >> Cc: Dieter Nützel <die...@nuetzel-hh.de> >> Cc: Michel Dänzer <michel.daen...@amd.com> >> Signed-off-by: Emil Velikov <emil.veli...@collabora.com> >> --- >> configure.ac | 29 +++++++++++++++++++---------- >> 1 file changed, 19 insertions(+), 10 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 308938a5a88..dbaa6569e4e 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -2684,18 +2684,27 @@ if test "x$enable_llvm" = xyes; then >> dnl this was causing the same libraries to be appear multiple times >> dnl in LLVM_LIBS. >> >> - LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`" >> - >> - if test "x$enable_llvm_shared_libs" = xyes; then >> - if test $LLVM_VERSION_MAJOR -lt 4 -o "`$LLVM_CONFIG --shared-mode >> ${LLVM_COMPONENTS}`" = static; then >> - detect_old_buggy_llvm >> + if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a >> $LLVM_VERSION_MINOR -ge 9; then >> + if test "x$enable_llvm_shared_libs" = xyes; then >> + LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs >> ${LLVM_COMPONENTS}`" >> + else >> + LLVM_LIBS="`$LLVM_CONFIG --link-static --libs >> ${LLVM_COMPONENTS} --system-libs`" >> + dnl llvm-config lists the system libs on a separate line. While >> + dnl invoking --system-libs without --link-static assumes shared >> link. >> + dnl Everybody now, say - Thank you LLVM developers >> + LLVM_LIBS="`echo $LLVM_LIBS | $SED 's/\n//g'`" > > Split this into two calls? > > LLVM_LIBS="`$LLVM_CONFIG --link-static --libs ${LLVM_COMPONENTS}`" > dnl We need to link to llvm system libs when using static libs > LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --link-static --system-libs`" > Seems wasteful to invoke llvm-config twice considering it's capable of doing it in one go. Modulo bugs that is...
> Either way: > Reviewed-by: Tobias Droste <tdro...@gmx.de> > Thanks. Barring any objections, I'll opt for your suggestion but will keep a comment why. Invoking llvm-config with both -libs and --system-libs produces the two separate lines - each for the set of libraries. Call the program twice, effectively folding them into a single line. Thanks Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev