1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#! /bin/sh
### See http://people.gnome.org/~walters/docs/build-api.txt
# buildapi-variable-no-builddir
opt_cflags=${CFLAGS}
opt_cxxflags=${CXXFLAGS}
opt_prefix='/usr/local'
opt_libdir=''
for var in "$@" ; do
case ${var} in
CFLAGS=*) opt_cflags=`echo "${var}" | sed 's/^CFLAGS=//'` ;;
CXXFLAGS=*) opt_cxxflags=`echo "${var}" | sed 's/^CXXFLAGS=//'` ;;
--prefix=*) opt_prefix=`echo "${var}" | sed 's/^--prefix=//'` ;;
--libdir=*) opt_libdir=`echo "${var}" | sed 's/^--libdir=//'` ;;
--help)
cat <<-EOF
usage: $0 [--options]
Available options:
--help This help message.
--prefix=PATH Installation path prefix [default: /usr/local]
--libdir=PATH Library installation path [default: \$prefix/lib]
Also, the following relevant environment variables can be set:
CFLAGS Additional command line flags to be passed to the C compiler
CXXFLAGS Additional command line flags to be passed to the C++ compiler
NOTE: This script tries to mimic the typical usage for configure scripts
generated by autotools, hence it will silently ignore unrecognized
command line options.
EOF
exit
;;
*) true ;;
esac
done
if test -z "${opt_libdir}" ; then
opt_libdir="${opt_prefix}/lib"
fi
tee config.mk <<EOF
#---------------#
# Build options #
#---------------#
PREFIX = ${opt_prefix}
LIBDIR = ${opt_libdir}
CFLAGS = ${opt_cflags}
CXXFLAGS = ${opt_cxxflags}
EOF
|