From 581b94b3bdf9f129a15dc3ca01558c4af6dc53c4 Mon Sep 17 00:00:00 2001 From: Eric Haszlakiewicz Date: Sun, 1 Dec 2019 23:42:40 -0500 Subject: [PATCH] Add a shim script to ease shift from autoconf to cmake. --- cmake-configure | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 cmake-configure diff --git a/cmake-configure b/cmake-configure new file mode 100755 index 0000000..7a06b66 --- /dev/null +++ b/cmake-configure @@ -0,0 +1,87 @@ +#!/bin/bash + +# Wrapper around cmake to emulate useful options +# from the previous autoconf-based configure script. + +RUNDIR=$(dirname "$0") +RUNDIR=$(cd "$RUNDIR" && pwd) +CURDIR=$(pwd) + +FLAGS=() + +usage() +{ + exitval="$1" + errmsg="$2" + + if [ $exitval -ne 0 ] ; then + exec 1>&2 + fi + if [ ! -z "$errmsg" ] ; then + echo "ERROR: $errmsg" 1>&2 + fi + cat <] [-- []] + --prefix=PREFIX install architecture-independent files in PREFIX + --enable-threading Enable code to support partly multi-threaded use + --enable-rdrand Enable RDRAND Hardware RNG Hash Seed generation on + supported x86/x64 platforms. + --enable-shared build shared libraries [default=yes] + --enable-static build static libraries [default=yes] + --disable-Bsymbolic Avoid linking with -Bsymbolic-function + --disable-werror Avoid treating compiler warnings as fatal errors + +EOF + exit +} + +if [ "$CURDIR" = "$RUNDIR" ] ; then + usage 1 "Please mkdir some other build directory, and run this script from there." +fi + +if ! cmake --version ; then + usage 1 "Unable to find a working cmake, please be sure you have it installed and on your PATH" +fi + +while [ $# -gt 0 ] ; do + case "$1" in + -h|--help) + usage 0 + ;; + --prefix) + FLAGS+=(-DCMAKE_INSTALL_PREFIX="$2") + shift + ;; + --enable-threading) + FLAGS+=(-DENABLE_THREADING=ON) + ;; + --enable-rdrand) + FLAGS+=(-DENABLE_RDRAND=ON) + ;; + --enable-shared) + FLAGS+=(-DBUILD_SHARED_LIBS=ON) + ;; + --enable-static) + FLAGS+=(-DBUILD_SHARED_LIBS=OFF) + ;; + --disable-Bsymbolic) + FLAGS+=(-DDISABLE_BSYMBOLIC=ON) + ;; + --disable-werror) + FLAGS+=(-DDISABLE_WERROR=ON) + ;; + --) + shift + break + ;; + -*) + usage 1 "Unknown arguments: $*" + ;; + *) + break + ;; + esac + shift +done + +exec cmake "${FLAGS[@]}" "$@" "${RUNDIR}"