Browse code

bb#11106 - with-system-llvm clarity: added additional information to llvm summary added defaults "/usr/local" and "/usr" to with-system-llvm enable-llvm defaults to "yes" if with-system-llvm specified, "auto" otherwise updated help messages, added with-system-llvm to main configure help

Kevin Lin authored on 2014/09/23 02:40:51
Showing 3 changed files
... ...
@@ -216,7 +216,7 @@ have_jit="no"
216 216
 if test "$subdirfailed" = "no"; then
217 217
     have_jit="yes"
218 218
 fi
219
-CL_MSG_STATUS([jit         ],[$have_jit],[$enable_llvm])
219
+CL_MSG_STATUS([llvm        ],[$have_jit, from $system_llvm],[$enable_llvm])
220 220
 CL_MSG_STATUS([mempool     ],[$have_mempool],[$enable_mempool])
221 221
 
222 222
 AC_MSG_NOTICE([Summary of engine detection features])
... ...
@@ -49,27 +49,40 @@ GMAKE="$llvm_cv_gnu_make_command"
49 49
 AC_SUBST([GMAKE])
50 50
 
51 51
 llvmconfig=
52
-AC_ARG_WITH([system-llvm], AC_HELP_STRING([-with-system-llvm],
53
-[Use system llvm instead of built-in, requires full path to llvm-config]),
52
+AC_ARG_WITH([system-llvm], AC_HELP_STRING([--with-system-llvm],
53
+[Use system llvm instead of built-in, uses full path to llvm-config (default=
54
+    search /usr/local or /usr if not found in /usr/local)]),
54 55
 [case "$withval" in
55 56
   yes)
56
-    AC_MSG_ERROR([--with-system-llvm needs full path to llvm-config])
57
-    ;;
57
+     llvmconfig="/usr/local/bin/llvm-config"
58
+     if test ! -x "$llvmconfig"; then
59
+     llvmconfig="/usr/bin/llvm-config"
60
+       if test ! -x "$llvmconfig"; then
61
+         AC_MSG_ERROR([llvm-config cannot be found within defaults])
62
+       fi
63
+     fi
64
+     ;;
58 65
   no) ;;
59 66
   *)
60
-    llvmconfig="$withval"
61
-    llvmver=`$llvmconfig --version`
62
-
63
-    AC_SUBST(LLVMCONFIG_CXXFLAGS, [`$llvmconfig --cxxflags`])
64
-    AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
65
-    AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs jit nativecodegen scalaropts ipo`])
66
-    AC_SUBST(LLVMCONFIG_LIBFILES, [`$llvmconfig --libfiles jit nativecodegen scalaropts ipo`])
67
-    AC_MSG_NOTICE([Using external LLVM])
68
-    AC_MSG_NOTICE([CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS])
69
-    AC_MSG_NOTICE([LDFLAGS from llvm-config: $LLVMCONFIG_LDFLAGS])
70
-    AC_MSG_NOTICE([LIBS from llvm-config: $LLVMCONFIG_LIBS])
71
-    ;;
67
+     llvmconfig="$withval"
68
+     if test ! -x "$llvmconfig"; then
69
+       AC_MSG_ERROR([llvm-config does not exist at $llvmconfig])
70
+     fi
71
+     ;;
72 72
   esac
73
+
74
+ if test "x$llvmconfig" != "x"; then
75
+     llvmver=`$llvmconfig --version`
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
+     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
+ fi
73 86
 ])
74 87
 
75 88
 AC_MSG_CHECKING([for supported LLVM version])
... ...
@@ -1,8 +1,32 @@
1
+AC_ARG_WITH([system-llvm], AC_HELP_STRING([--with-system-llvm],
2
+[Use system llvm instead of built-in, uses full path to llvm-config (default=
3
+/usr/local or /usr if not found in /usr/local)]),
4
+[case "$withval" in
5
+  yes)
6
+    system_llvm="default"
7
+    ;;
8
+  no)
9
+    system_llvm="built-in"
10
+    ;;
11
+  *)
12
+    system_llvm=$withval
13
+ esac
14
+], [system_llvm="built-in"])
15
+
1 16
 AC_ARG_ENABLE([llvm],AC_HELP_STRING([--enable-llvm],
2
-				    [Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
3
-				    [enable_llvm=$enableval], [enable_llvm="auto"])
17
+[Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
18
+[enable_llvm=$enableval],
19
+[
20
+if test "x$system_llvm" != "xbuilt-in"; then
21
+    enable_llvm="yes"
22
+else
23
+    enable_llvm="auto"
24
+fi
25
+])
4 26
 
5 27
 if test "$enable_llvm" != "no"; then
6 28
     dnl Try to configure subdir, optionally
7 29
     AC_CONFIG_SUBDIRS_OPTIONAL([libclamav/c++])
30
+else
31
+    system_llvm="none"
8 32
 fi