Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Link against LLVM shared library where possible

  • Loading branch information...
commit eed2d86b4da402ccbe19986d15f0b4b957e77411 1 parent 693d505
Nick Gasson authored March 24, 2012

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  m4/ax_llvm_c.m4
21  m4/ax_llvm_c.m4
@@ -63,6 +63,7 @@ AC_DEFUN([AX_LLVM_C],
63 63
                 LLVM_LIBS="$($ac_llvm_config_path --libs $1)"
64 64
                 LLVM_VERSION="$($ac_llvm_config_path --version)"
65 65
                 LLVM_CONFIG_BINDIR="$($ac_llvm_config_path --bindir)"
  66
+                LLVM_LIBDIR="$($ac_llvm_config_path --libdir)"
66 67
 
67 68
                 llvm_ver_num="$(echo $LLVM_VERSION | sed s/\\.// | sed s/svn//g)"
68 69
                 if test "$llvm_ver_num" -lt "30"; then
@@ -102,6 +103,26 @@ AC_DEFUN([AX_LLVM_C],
102 103
                     succeeded=yes
103 104
                 fi
104 105
 
  106
+                shlib="-Wl,-rpath $LLVM_LIBDIR -lLLVM-$LLVM_VERSION"
  107
+
  108
+                LIBS="$LIBS_SAVED $shlib"
  109
+                export LIBS
  110
+
  111
+                AC_CACHE_CHECK(for LLVM shared library,
  112
+                    ax_cv_llvm_shared,
  113
+                    [AC_LANG_PUSH([C++])
  114
+                        AC_RUN_IFELSE(
  115
+                            [AC_LANG_PROGRAM(
  116
+                                    [[@%:@include <llvm-c/Core.h>]],
  117
+                                    [[LLVMModuleCreateWithName("test"); return 0;]])],
  118
+                            ax_cv_llvm_shared=yes,
  119
+                            ax_cv_llvm_shared=no)
  120
+                        AC_LANG_POP([C++])])
  121
+
  122
+                if test "x$ax_cv_llvm_shared" = "xyes"; then
  123
+                    LLVM_LIBS="$shlib"
  124
+                fi
  125
+
105 126
                 CFLAGS="$CFLAGS_SAVED"
106 127
                 CXXFLAGS="$CXXFLAGS_SAVED"
107 128
                 LDFLAGS="$LDFLAGS_SAVED"

0 notes on commit eed2d86

Please sign in to comment.
Something went wrong with that request. Please try again.