libmonochrome/configure

64 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
#******************************************************************************#
# #
# configure #
# | Project : libmonochrome #
# #
# By: thomas <thomas@touhey.fr> #
# Last updated: 2016/05/22 23:13:42 #
# #
#******************************************************************************#
# Help
usage() {
cat <<EOF
Usage: $0 [OPTION]
Defaults for the options are specified in brackets.
Installation directories:
--prefix=PREFIX main installation prefix [/opt/sh3eb-elf]
Fine tuning of the installation directories:
--libdir=DIR library files of the linker [PREFIX/sh3eb-elf/lib]
--includedir=DIR include files for the compiler [PREFIX/sh3eb-elf/include]
--mandir=DIR man pages [PREFIX/share/man]
EOF
exit 0
}
# Defaults
prefix=/opt/sh3eb-elf
libdir='$(IPREFIX)/sh3eb-elf/lib'
includedir='$(IPREFIX)/sh3eb-elf/include'
mandir='$(IPREFIX)/share/man'
# Args parsing
for arg ; do
case "$arg" in
--help|-h) usage ;;
--prefix=*) prefix=${arg#*=} ;;
--libdir=*) libdir=${arg#*=} ;;
--includedir=*) includedir=${arg#*=} ;;
--mandir=*) mandir=${arg#*=} ;;
-*) echo "$0: unknown option $arg" ;;
*) echo "$0: are you drunk ?" ;;
esac
done
# Create Makefile configuration
exec 3>&1 1>Makefile.cfg
cat <<EOF
# Makefile configuration generated by ./configure
IPREFIX = $prefix
ILIBDIR = $libdir
IINCDIR = $includedir
IMANDIR = $mandir
EOF
exec 1>&3 3>&-
# We're done
echo "Configuration loaded, you can make now."