6fbce41646d46c8cc5a379a1ac7b9bafec20cee4
[termux-packages] / packages / ldc / llvm-config.in
1 #!/bin/sh
2 show_help () {
3 echo "usage: llvm-config <OPTION>... [<COMPONENT>...]
4
5 Get various configuration information needed to compile programs which use
6 LLVM. Typically called from 'configure' scripts. Examples:
7 llvm-config --cxxflags
8 llvm-config --ldflags
9 llvm-config --libs engine bcreader scalaropts
10
11 Options:
12 --version Print LLVM version.
13 --prefix Print the installation prefix.
14 --src-root Print the source root LLVM was built from.
15 --obj-root Print the object root used to build LLVM.
16 --bindir Directory containing LLVM executables.
17 --includedir Directory containing LLVM headers.
18 --libdir Directory containing LLVM libraries.
19 --cppflags C preprocessor flags for files that include LLVM headers.
20 --cflags C compiler flags for files that include LLVM headers.
21 --cxxflags C++ compiler flags for files that include LLVM headers.
22 --ldflags Print Linker flags.
23 --system-libs System Libraries needed to link against LLVM components.
24 --libs Libraries needed to link against LLVM components.
25 --libnames Bare library names for in-tree builds.
26 --libfiles Fully qualified library filenames for makefile depends.
27 --components List of all possible components.
28 --targets-built List of all targets currently built.
29 --host-target Target triple used to configure LLVM.
30 --build-mode Print build mode of LLVM tree (e.g. Debug or Release).
31 --assertion-mode Print assertion mode of LLVM tree (ON or OFF).
32 --build-system Print the build system used to build LLVM (always cmake).
33 --has-rtti Print whether or not LLVM was built with rtti (YES or NO).
34 --has-global-isel Print whether or not LLVM was built with global-isel support (YES or NO).
35 --shared-mode Print how the provided components can be collectively linked (\`shared\` or \`static\`).
36 --link-shared Link the components as shared libraries.
37 --link-static Link the component libraries statically.
38 Typical components:
39 all All LLVM libraries (default).
40 engine Either a native JIT or a bitcode interpreter."
41 }
42
43 arch=@TERMUX_ARCH@
44 version=@LLVM_VERSION@
45 prefix=@LLVM_BUILD_DIR@
46 has_rtti=NO
47 CPPFLAGS="-I@TERMUX_PKG_SRCDIR@/llvm/include -I${prefix}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
48 CFLAGS="${CPPFLAGS} -Os -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers"
49 CFLAGS="${CFLAGS} -pedantic -Wno-long-long -Wdelete-non-virtual-dtor -Werror=date-time -ffunction-sections"
50 CFLAGS="${CFLAGS} -fdata-sections -DNDEBUG"
51 CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -Wcast-qual -Wnon-virtual-dtor -std=c++11 -fno-exceptions"
52 if [ "$has_rtti" != "YES" ]; then CXXFLAGS="$CXXFLAGS -fno-rtti"; fi
53 LDFLAGS="-L${prefix}/lib"
54 LIBFILE="${prefix}/lib/libLLVM-$version.so"
55 LLVM_LIBRARIES="-lLLVMTableGen -lLLVMLibDriver -lLLVMOption -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMTestingSupport -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMLineEditor -lLLVMMIRParser -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMOrcJIT -lLLVMInterpreter -lLLVMObjectYAML -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMRuntimeDyld -lgtest_main -lgtest -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMDlltoolDriver -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMCoverage -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
56
57 show_components () {
58 if [ "$arch" == "x86_64" -o "$arch" == "i686" ]; then arch="x86"; fi
59 components="all all-targets analysis $arch ${arch}asmparser ${arch}asmprinter ${arch}codegen ${arch}desc"
60 components="$components ${arch}disassembler ${arch}info asmparser asmprinter bitreader bitwriter codegen"
61 components="$components core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb"
62 components="$components demangle engine executionengine globalisel instcombine instrumentation interpreter"
63 components="$components ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser"
64 components="$components mirparser native nativecodegen objcarcopts object objectyaml option orcjit passes"
65 components="$components profiledata runtimedyld scalaropts selectiondag support symbolize tablegen target"
66 components="$components transformutils vectorize"
67 if [ "$arch" != "arm" ]; then components="$components ${arch}utils"; fi
68 echo "$components"
69 }
70
71 handle_args () {
72 case "${1##--}" in
73 version) echo "$version";;
74 prefix) echo "$prefix";;
75 src-root) echo "@TERMUX_PKG_SRCDIR@";;
76 obj-root) echo "$prefix";;
77 bindir) echo "$prefix/bin";;
78 includedir) echo "@TERMUX_PKG_SRCDIR@/llvm/include";;
79 libdir) echo "$prefix/lib";;
80 cppflags) echo "$CPPFLAGS";;
81 cflags) echo "$CFLAGS";;
82 cxxflags) echo "$CXXFLAGS";;
83 ldflags) echo "$LDFLAGS";;
84 system-libs) echo "-lc -ldl -lncurses -lz -lm";;
85 libs) echo "$LLVM_LIBRARIES";;
86 libnames) echo "libLLVM-$version.so";;
87 libfiles) echo "$LIBFILE";;
88 components) show_components;;
89 targets-built) echo "@LLVM_TARGETS@";;
90 host-target) echo "@LLVM_DEFAULT_TARGET_TRIPLE@";;
91 build-mode) echo "Release";;
92 assertion-mode) echo "OFF";;
93 build-system) echo "cmake";;
94 has-rtti) echo "$has_rtti";;
95 has-global-isel) echo "OFF";;
96 shared-mode) echo "shared";;
97 cmakedir) echo "$prefix/lib/cmake/llvm";;
98 # don't know what these do
99 link-shared) ;;
100 link-static) ;;
101 *) show_help >&2;;
102 esac
103 }
104
105 for arg in $@; do handle_args $arg; done
106