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 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. EOF
  29. exit
  30. }
  31. if [ "$CURDIR" = "$RUNDIR" ] ; then
  32. usage 1 "Please mkdir some other build directory, and run this script from there."
  33. fi
  34. if ! cmake --version ; then
  35. usage 1 "Unable to find a working cmake, please be sure you have it installed and on your PATH"
  36. fi
  37. while [ $# -gt 0 ] ; do
  38. case "$1" in
  39. -h|--help)
  40. usage 0
  41. ;;
  42. --prefix)
  43. FLAGS+=(-DCMAKE_INSTALL_PREFIX="$2")
  44. shift
  45. ;;
  46. --prefix=*)
  47. FLAGS+=(-DCMAKE_INSTALL_PREFIX="${1##--prefix=}")
  48. ;;
  49. --enable-threading)
  50. FLAGS+=(-DENABLE_THREADING=ON)
  51. ;;
  52. --enable-rdrand)
  53. FLAGS+=(-DENABLE_RDRAND=ON)
  54. ;;
  55. --enable-shared)
  56. FLAGS+=(-DBUILD_SHARED_LIBS=ON)
  57. ;;
  58. --enable-static)
  59. FLAGS+=(-DBUILD_STATIC_LIBS=ON)
  60. ;;
  61. --disable-Bsymbolic)
  62. FLAGS+=(-DDISABLE_BSYMBOLIC=ON)
  63. ;;
  64. --disable-werror)
  65. FLAGS+=(-DDISABLE_WERROR=ON)
  66. ;;
  67. --)
  68. shift
  69. break
  70. ;;
  71. -*)
  72. usage 1 "Unknown arguments: $*"
  73. ;;
  74. *)
  75. break
  76. ;;
  77. esac
  78. shift
  79. done
  80. exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"