llvm autoconf using LLVM_SRC_ROOT?

Hi

I am trying to create a new LLVM project that uses autoconf to configure it.

the example requires me to define

    * LLVM_SRC_ROOT - The root of the LLVM source tree.
    * LLVM_OBJ_ROOT - The root of the LLVM object tree

Is this required? Why? I just want to use the libraries that were installed using Ubuntu 10.04.

I can compile programs using llvmc
$ llvmc --version
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.7 ( 2.7-0ubuntu1)
  Optimized build.
  Built Apr 28 2010 (14:19:53).
  Host: x86_64-pc-linux-gnu
  Host CPU: penryn

  Registered Targets:
    (none)

here is the /usr/lib/llvm/ tree

3544 ./gcc-4.2/info
756 ./gcc-4.2/bin
964 ./gcc-4.2/man/man1
68 ./gcc-4.2/man/man7
1036 ./gcc-4.2/man
4 ./gcc-4.2/share
24 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/include/ssp
12 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/include/linux
8 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/include/bits
364 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/include
4 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/finclude
300 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/install-tools/include
316 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/install-tools
920 ./gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1
924 ./gcc-4.2/lib/gcc/x86_64-linux-gnu
928 ./gcc-4.2/lib/gcc
1232 ./gcc-4.2/lib
292 ./gcc-4.2/include/c++/4.2.1/debug
24 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/tree_policy
72 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/rb_tree_map_
28 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/unordered_iterator
52 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/thin_heap_
44 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/pairing_heap_
104 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/binary_heap_
48 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/rc_binomial_heap_
20 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/basic_tree_policy
56 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/list_update_map_
64 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/resize_policy
20 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/list_update_policy
124 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/bin_search_tree_
88 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/left_child_next_sibling_heap_
132 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/gp_hash_table_map_
16 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/eq_fn
72 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/hash_fn
72 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/splay_tree_
216 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/pat_trie_
20 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/binomial_heap_
88 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/ov_tree_map_
48 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/trie_policy
136 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/cc_hash_table_map_
48 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail/binomial_heap_base_
1676 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds/detail
1776 ./gcc-4.2/include/c++/4.2.1/ext/pb_ds
2440 ./gcc-4.2/include/c++/4.2.1/ext
58564 ./gcc-4.2/include/c++/4.2.1/x86_64-linux-gnu/bits/stdtr1c++.h.gch
58556 ./gcc-4.2/include/c++/4.2.1/x86_64-linux-gnu/bits/stdc++.h.gch
117284 ./gcc-4.2/include/c++/4.2.1/x86_64-linux-gnu/bits
117288 ./gcc-4.2/include/c++/4.2.1/x86_64-linux-gnu
164 ./gcc-4.2/include/c++/4.2.1/backward
608 ./gcc-4.2/include/c++/4.2.1/tr1
1580 ./gcc-4.2/include/c++/4.2.1/bits
122904 ./gcc-4.2/include/c++/4.2.1
122908 ./gcc-4.2/include/c++
122912 ./gcc-4.2/include
160 ./gcc-4.2/libexec/gcc/x86_64-linux-gnu/4.2.1/install-tools
25068 ./gcc-4.2/libexec/gcc/x86_64-linux-gnu/4.2.1
25072 ./gcc-4.2/libexec/gcc/x86_64-linux-gnu
25076 ./gcc-4.2/libexec/gcc
25080 ./gcc-4.2/libexec
3296 ./gcc-4.2/lib64
157864 ./gcc-4.2
2404 ./bin
29804 ./lib
336 ./build/autoconf/m4
728 ./build/autoconf
1472 ./build
191548 .

Not unless you want to build it as part of the llvm sources.

AC_CHECK_LIB is what you probably want.

http://www.gnu.org/software/hello/manual/autoconf/Libraries.html

-eric

This answer is sort of correct, so I’ll elaborate.

The LLVM build system allows for external LLVM projects to re-use its Makefile infrastructure. In short, it allows external projects (which are not part of the LLVM source tree) to build off of the LLVM build system; this allows external projects to write LLVM-style Makefiles that just specify the library or tool name to build, and the LLVM build system takes care of the rest (like linking in LLVM libraries, using pre-defined rules for compiling C++ code to object files, finding LLVM header files, etc). This whole system is documented at . If you’ve installed LLVM headers and libraries somewhere (such as in /usr/local/include and /usr/local/lib) and don’t wish to reuse the LLVM build system, then you obviously don’t need to worry about writing your autoconf scripts and Makefiles the LLVM way. Instead, you would just use AC_CHECK_LIB to locate the LLVM libraries you need, as Eric has described. – John T.