Browse code

bb#11172 - fixed c++ configure to properly acquire LLVM 3.5.x linker flags

Kevin Lin authored on 2014/11/07 09:17:02
Showing 1 changed files
... ...
@@ -74,14 +74,7 @@ AC_ARG_WITH([system-llvm], AC_HELP_STRING([--with-system-llvm],
74 74
  if test "x$llvmconfig" != "x"; then
75 75
      llvmver=`$llvmconfig --version`
76 76
 
77
-     AC_SUBST(LLVMCONFIG_CXXFLAGS, [`$llvmconfig --cxxflags`])
78
-     AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
79
-     AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs jit nativecodegen scalaropts ipo`])
80
-     AC_SUBST(LLVMCONFIG_LIBFILES, [`$llvmconfig --libfiles jit nativecodegen scalaropts ipo`])
81 77
      AC_MSG_NOTICE([Using external LLVM])
82
-     AC_MSG_NOTICE([CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS])
83
-     AC_MSG_NOTICE([LDFLAGS from llvm-config: $LLVMCONFIG_LDFLAGS])
84
-     AC_MSG_NOTICE([LIBS from llvm-config: $LLVMCONFIG_LIBS])
85 78
  fi
86 79
 ])
87 80
 
... ...
@@ -117,6 +110,23 @@ else
117 117
     AC_MSG_RESULT([ok ($llvmver)])
118 118
 fi
119 119
 
120
+dnl aquire the required flags to properly link in external LLVM
121
+if test "x$llvmconfig" != "x"; then
122
+    AC_SUBST(LLVMCONFIG_CXXFLAGS, [`$llvmconfig --cxxflags`])
123
+    if test $llvmver_test -ge 350; then
124
+        dnl LLVM 3.5.0 and after splits linker flags into two sets
125
+        ldflags=`$llvmconfig --ldflags`
126
+        syslibs=`$llvmconfig --system-libs`
127
+        AC_SUBST(LLVMCONFIG_LDFLAGS, ["$ldflags $syslibs"])
128
+    else
129
+        AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
130
+    fi
131
+    AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs jit nativecodegen scalaropts ipo`])
132
+    AC_SUBST(LLVMCONFIG_LIBFILES, [`$llvmconfig --libfiles jit nativecodegen scalaropts ipo`])
133
+    AC_MSG_NOTICE([CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS])
134
+    AC_MSG_NOTICE([LDFLAGS from llvm-config: $LLVMCONFIG_LDFLAGS])
135
+    AC_MSG_NOTICE([LIBS from llvm-config: $LLVMCONFIG_LIBS])
136
+fi
120 137
 dnl patch does not affect clamav source (yet)
121 138
 llvmver_int=${llvmver_major}${llvmver_minor}
122 139