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.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. --disable-shared)
  60. FLAGS+=(-DBUILD_SHARED_LIBS=OFF)
  61. ;;
  62. --enable-static)
  63. FLAGS+=(-DBUILD_STATIC_LIBS=ON)
  64. ;;
  65. --disable-static)
  66. FLAGS+=(-DBUILD_STATIC_LIBS=OFF)
  67. ;;
  68. --disable-Bsymbolic)
  69. FLAGS+=(-DDISABLE_BSYMBOLIC=ON)
  70. ;;
  71. --disable-werror)
  72. FLAGS+=(-DDISABLE_WERROR=ON)
  73. ;;
  74. --disable-extra-libs)
  75. FLAGS+=(-DDISABLE_EXTRA_LIBS=ON)
  76. ;;
  77. --)
  78. shift
  79. break
  80. ;;
  81. -*)
  82. usage 1 "Unknown arguments: $*"
  83. ;;
  84. *)
  85. break
  86. ;;
  87. esac
  88. shift
  89. done
  90. exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"