| 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=@_PKG_MAJOR_VERSION@ |
| 45 | prefix=@TERMUX_PREFIX@ |
| 46 | has_rtti=NO |
| 47 | CPPFLAGS="-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 | |
| 56 | show_components () { |
| 57 | if [ "$arch" == "x86_64" -o "$arch" == "i686" ]; then arch="x86"; fi |
| 58 | components="all all-targets analysis $arch ${arch}asmparser ${arch}asmprinter ${arch}codegen ${arch}desc" |
| 59 | components="$components ${arch}disassembler ${arch}info asmparser asmprinter bitreader bitwriter codegen" |
| 60 | components="$components core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb" |
| 61 | components="$components demangle engine executionengine globalisel instcombine instrumentation interpreter" |
| 62 | components="$components ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser" |
| 63 | components="$components mirparser native nativecodegen objcarcopts object objectyaml option orcjit passes" |
| 64 | components="$components profiledata runtimedyld scalaropts selectiondag support symbolize tablegen target" |
| 65 | components="$components transformutils vectorize" |
| 66 | if [ "$arch" != "arm" ]; then components="$components ${arch}utils"; fi |
| 67 | echo "$components" |
| 68 | } |
| 69 | |
| 70 | handle_args () { |
| 71 | case "${1##--}" in |
| 72 | version) echo "$version";; |
| 73 | prefix) echo "$prefix";; |
| 74 | src-root) echo "@TERMUX_PKG_SRCDIR@";; |
| 75 | obj-root) echo "$prefix";; |
| 76 | bindir) echo "$prefix/bin";; |
| 77 | includedir) echo "$prefix/include";; |
| 78 | libdir) echo "$prefix/lib";; |
| 79 | cppflags) echo "$CPPFLAGS";; |
| 80 | cflags) echo "$CFLAGS";; |
| 81 | cxxflags) echo "$CXXFLAGS";; |
| 82 | ldflags) echo "$LDFLAGS";; |
| 83 | system-libs) echo "-lc -ldl -lcurses -lz -lm";; |
| 84 | libs) echo "-l$LIBFILE";; |
| 85 | libnames) echo "libLLVM-$version.so";; |
| 86 | libfiles) echo "$LIBFILE";; |
| 87 | components) show_components;; |
| 88 | targets-built) echo "@LLVM_TARGET_ARCH@";; |
| 89 | host-target) echo "@LLVM_DEFAULT_TARGET_TRIPLE@";; |
| 90 | build-mode) echo "Release";; |
| 91 | assertion-mode) echo "OFF";; |
| 92 | build-system) echo "cmake";; |
| 93 | has-rtti) echo "$has_rtti";; |
| 94 | has-global-isel) echo "OFF";; |
| 95 | shared-mode) echo "shared";; |
| 96 | cmakedir) echo "$prefix/lib/cmake/llvm";; |
| 97 | # don't know what these do |
| 98 | link-shared) ;; |
| 99 | link-static) ;; |
| 100 | *) show_help >&2;; |
| 101 | esac |
| 102 | } |
| 103 | |
| 104 | for arg in $@; do handle_args $arg; done |
| 105 | |