You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmake-configure 2.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. # Wrapper around cmake to emulate useful options
  3. # from the previous autoconf-based configure script.
  4. RUNDIR=$(dirname "$0")
  5. RUNDIR=$(cd "$RUNDIR" && pwd)
  6. CURDIR=$(pwd)
  7. FLAGS=()
  8. usage()
  9. {
  10. exitval="$1"
  11. errmsg="$2"
  12. if [ $exitval -ne 0 ] ; then
  13. exec 1>&2
  14. fi
  15. if [ ! -z "$errmsg" ] ; then
  16. echo "ERROR: $errmsg" 1>&2
  17. fi
  18. cat <<EOF
  19. $0 [<configure_options>] [-- [<cmake options>]]
  20. --prefix=PREFIX install architecture-independent files in PREFIX
  21. --enable-threading Enable code to support partly multi-threaded use
  22. --enable-rdrand Enable RDRAND Hardware RNG Hash Seed generation on
  23. supported x86/x64 platforms.
  24. --enable-shared build shared libraries [default=yes]
  25. --enable-static build static libraries [default=yes]
  26. --disable-Bsymbolic Avoid linking with -Bsymbolic-function
  27. --disable-werror Avoid treating compiler warnings as fatal errors
  28. --disable-extra-libs Avoid linking against extra libraries, such as libbsd
  29. EOF
  30. exit
  31. }
  32. if [ "$CURDIR" = "$RUNDIR" ] ; then
  33. usage 1 "Please mkdir some other build directory, and run this script from there."
  34. fi
  35. if ! cmake --version ; then
  36. usage 1 "Unable to find a working cmake, please be sure you have it installed and on your PATH"
  37. fi
  38. while [ $# -gt 0 ] ; do
  39. case "$1" in
  40. -h|--help)
  41. usage 0
  42. ;;
  43. --prefix)
  44. FLAGS+=(-DCMAKE_INSTALL_PREFIX="$2")
  45. shift
  46. ;;
  47. --prefix=*)
  48. FLAGS+=(-DCMAKE_INSTALL_PREFIX="${1##--prefix=}")
  49. ;;
  50. --enable-threading)
  51. FLAGS+=(-DENABLE_THREADING=ON)
  52. ;;
  53. --enable-rdrand)
  54. FLAGS+=(-DENABLE_RDRAND=ON)
  55. ;;
  56. --enable-shared)
  57. FLAGS+=(-DBUILD_SHARED_LIBS=ON)
  58. ;;
  59. --enable-static)
  60. FLAGS+=(-DBUILD_STATIC_LIBS=ON)
  61. ;;
  62. --disable-Bsymbolic)
  63. FLAGS+=(-DDISABLE_BSYMBOLIC=ON)
  64. ;;
  65. --disable-werror)
  66. FLAGS+=(-DDISABLE_WERROR=ON)
  67. ;;
  68. --disable-extra-libs)
  69. FLAGS+=(-DDISABLE_EXTRA_LIBS=ON)
  70. ;;
  71. --)
  72. shift
  73. break
  74. ;;
  75. -*)
  76. usage 1 "Unknown arguments: $*"
  77. ;;
  78. *)
  79. break
  80. ;;
  81. esac
  82. shift
  83. done
  84. exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"