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