xref: /openbsd-src/gnu/llvm/llvm/docs/CommandGuide/llvm-config.rst (revision d415bd752c734aee168c4ee86ff32e8cc249eb16)
109467b48Spatrickllvm-config - Print LLVM compilation options
209467b48Spatrick============================================
309467b48Spatrick
409467b48Spatrick.. program:: llvm-config
509467b48Spatrick
609467b48SpatrickSYNOPSIS
709467b48Spatrick--------
809467b48Spatrick
909467b48Spatrick**llvm-config** *option* [*components*...]
1009467b48Spatrick
1109467b48SpatrickDESCRIPTION
1209467b48Spatrick-----------
1309467b48Spatrick
1409467b48Spatrick**llvm-config** makes it easier to build applications that use LLVM.  It can
1509467b48Spatrickprint the compiler flags, linker flags and object libraries needed to link
1609467b48Spatrickagainst LLVM.
1709467b48Spatrick
1809467b48SpatrickEXAMPLES
1909467b48Spatrick--------
2009467b48Spatrick
2109467b48SpatrickTo link against the JIT:
2209467b48Spatrick
2309467b48Spatrick.. code-block:: sh
2409467b48Spatrick
2509467b48Spatrick   g++ `llvm-config --cxxflags` -o HowToUseJIT.o -c HowToUseJIT.cpp
2609467b48Spatrick   g++ `llvm-config --ldflags` -o HowToUseJIT HowToUseJIT.o \
2709467b48Spatrick       `llvm-config --libs engine bcreader scalaropts`
2809467b48Spatrick
2909467b48SpatrickOPTIONS
3009467b48Spatrick-------
3109467b48Spatrick
32*d415bd75Srobert**--assertion-mode**
3309467b48Spatrick
34*d415bd75Srobert Print the assertion mode used when LLVM was built (ON or OFF).
3509467b48Spatrick
3609467b48Spatrick**--bindir**
3709467b48Spatrick
3809467b48Spatrick Print the installation directory for LLVM binaries.
3909467b48Spatrick
40*d415bd75Srobert**--build-mode**
4109467b48Spatrick
42*d415bd75Srobert Print the build mode used when LLVM was built (e.g. Debug or Release).
4309467b48Spatrick
44*d415bd75Srobert**--build-system**
4509467b48Spatrick
46*d415bd75Srobert Print the build system used to build LLVM (e.g. `cmake` or `gn`).
47*d415bd75Srobert
48*d415bd75Srobert**--cflags**
49*d415bd75Srobert
50*d415bd75Srobert Print the C compiler flags needed to use LLVM headers.
51*d415bd75Srobert
52*d415bd75Srobert**--cmakedir**
53*d415bd75Srobert
54*d415bd75Srobert Print the installation directory for LLVM CMake modules.
55*d415bd75Srobert
56*d415bd75Srobert**--components**
57*d415bd75Srobert
58*d415bd75Srobert Print all valid component names.
59*d415bd75Srobert
60*d415bd75Srobert**--cppflags**
61*d415bd75Srobert
62*d415bd75Srobert Print the C preprocessor flags needed to use LLVM headers.
6309467b48Spatrick
6409467b48Spatrick**--cxxflags**
6509467b48Spatrick
6609467b48Spatrick Print the C++ compiler flags needed to use LLVM headers.
6709467b48Spatrick
68*d415bd75Srobert**--has-rtti**
69*d415bd75Srobert
70*d415bd75Srobert Print whether or not LLVM was built with rtti (YES or NO).
71*d415bd75Srobert
72*d415bd75Srobert**--help**
73*d415bd75Srobert
74*d415bd75Srobert Print a summary of **llvm-config** arguments.
75*d415bd75Srobert
76*d415bd75Srobert**--host-target**
77*d415bd75Srobert
78*d415bd75Srobert Print the target triple used to configure LLVM.
79*d415bd75Srobert
80*d415bd75Srobert**--ignore-libllvm**
81*d415bd75Srobert
82*d415bd75Srobert Ignore libLLVM and link component libraries instead.
83*d415bd75Srobert
84*d415bd75Srobert**--includedir**
85*d415bd75Srobert
86*d415bd75Srobert Print the installation directory for LLVM headers.
87*d415bd75Srobert
8809467b48Spatrick**--ldflags**
8909467b48Spatrick
9009467b48Spatrick Print the flags needed to link against LLVM libraries.
9109467b48Spatrick
92*d415bd75Srobert**--libdir**
9309467b48Spatrick
94*d415bd75Srobert Print the installation directory for LLVM libraries.
9509467b48Spatrick
9609467b48Spatrick**--libfiles**
9709467b48Spatrick
9809467b48Spatrick Similar to **--libs**, but print the full path to each library file.  This is
9909467b48Spatrick useful when creating makefile dependencies, to ensure that a tool is relinked if
10009467b48Spatrick any library it uses changes.
10109467b48Spatrick
102*d415bd75Srobert**--libnames**
10309467b48Spatrick
104*d415bd75Srobert Similar to **--libs**, but prints the bare filenames of the libraries
105*d415bd75Srobert without **-l** or pathnames.  Useful for linking against a not-yet-installed
106*d415bd75Srobert copy of LLVM.
107*d415bd75Srobert
108*d415bd75Srobert**--libs**
109*d415bd75Srobert
110*d415bd75Srobert Print all the libraries needed to link against the specified LLVM
111*d415bd75Srobert *components*, including any dependencies.
112*d415bd75Srobert
113*d415bd75Srobert**--link-shared**
114*d415bd75Srobert
115*d415bd75Srobert Link the components as shared libraries.
116*d415bd75Srobert
117*d415bd75Srobert**--link-static**
118*d415bd75Srobert
119*d415bd75Srobert Link the component libraries statically.
120*d415bd75Srobert
121*d415bd75Srobert**--obj-root**
122*d415bd75Srobert
123*d415bd75Srobert Print the object root used to build LLVM.
124*d415bd75Srobert
125*d415bd75Srobert**--prefix**
126*d415bd75Srobert
127*d415bd75Srobert Print the installation prefix for LLVM.
128*d415bd75Srobert
129*d415bd75Srobert**--shared-mode**
130*d415bd75Srobert
131*d415bd75Srobert Print how the provided components can be collectively linked (`shared` or `static`).
132*d415bd75Srobert
133*d415bd75Srobert**--system-libs**
134*d415bd75Srobert
135*d415bd75Srobert Print all the system libraries needed to link against the specified LLVM
136*d415bd75Srobert *components*, including any dependencies.
13709467b48Spatrick
13809467b48Spatrick**--targets-built**
13909467b48Spatrick
14009467b48Spatrick Print the component names for all targets supported by this copy of LLVM.
14109467b48Spatrick
142*d415bd75Srobert**--version**
14309467b48Spatrick
144*d415bd75Srobert Print the version number of LLVM.
14509467b48Spatrick
14609467b48Spatrick
14709467b48SpatrickCOMPONENTS
14809467b48Spatrick----------
14909467b48Spatrick
15009467b48SpatrickTo print a list of all available components, run **llvm-config
15109467b48Spatrick--components**.  In most cases, components correspond directly to LLVM
15209467b48Spatricklibraries.  Useful "virtual" components include:
15309467b48Spatrick
15409467b48Spatrick**all**
15509467b48Spatrick
15609467b48Spatrick Includes all LLVM libraries.  The default if no components are specified.
15709467b48Spatrick
15809467b48Spatrick**backend**
15909467b48Spatrick
16009467b48Spatrick Includes either a native backend or the C backend.
16109467b48Spatrick
16209467b48Spatrick**engine**
16309467b48Spatrick
16409467b48Spatrick Includes either a native JIT or the bitcode interpreter.
16509467b48Spatrick
16609467b48Spatrick
16709467b48SpatrickEXIT STATUS
16809467b48Spatrick-----------
16909467b48Spatrick
17009467b48SpatrickIf **llvm-config** succeeds, it will exit with 0.  Otherwise, if an error
17109467b48Spatrickoccurs, it will exit with a non-zero value.
172