opm-core/configure
Roland Kaufmann 0b4a244a44 Compatibility script for Autotools addicts
This script enables the use of `configure && make && make install` for
those users who have this combination ingrained in their fingers or are
too busy to read the manual.
2013-02-11 22:37:54 +01:00

58 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# display help text
usage () {
cat <<EOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
EOF
}
# report an error regarding the arguments
invalid_arg () {
cat <<EOF
configure: error: unrecognized option: \`$1'
Try \`$0 --help' for more information
EOF
}
# default values
prefix=/usr/local
# long arguments are implemented by putting a dash character followed by
# a colon in the optspec, see trick by Arvid Requate at
# <http://stackoverflow.com/questions/402377/#7680682>
while getopts -- ":-:" optchar; do
case "${optchar}" in
-)
# OPTARG now contains everything after double dashes
case "${OPTARG}" in
prefix=*)
# remove prefix consisting of everything up to equal sign
prefix=${OPTARG#*=}
;;
help)
usage
exit 0
;;
*)
# remove everything *after* the equal sign
arg=${OPTARG%=*}
invalid_arg --$arg
exit 1
;;
esac
;;
*)
invalid_arg -$OPTARG
exit 1
;;
esac
done
# remove all arguments processed by getopts
shift $((OPTIND-1))
# pass everything on to CMake
env "$@" cmake "$(dirname $0)" "-DCMAKE_INSTALL_PREFIX=$prefix"