123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- #! /bin/sh -
- #
- # Simple `configure' script for Qi.
- #
- # Copyright (c) 2016-2018 Matias Fonzo, <selk@dragora.org>.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- usage() {
- printf "%s\n" \
- "Usage: configure [options]" \
- "" \
- "Defaults for the options are specified in brackets." \
- "" \
- "Options:" \
- " --prefix=DIR install files in DIR [${prefix}]" \
- " --exec-prefix=DIR base DIR for arch-dependent files [${exec_prefix}]" \
- " --bindir=DIR user executables [${bindir}]" \
- " --sbindir=DIR system admin executables [${sbindir}]" \
- " --libexecdir=DIR program executables [${libexecdir}]" \
- " --sysconfdir=DIR read-only single-machine data [${sysconfdir}]" \
- " --localstatedir=DIR modifiable single-machine data [${localstatedir}]" \
- " --datarootdir=DIR read-only arch-independent data root [${datarootdir}]" \
- " --infodir=DIR info documentation [${infodir}]" \
- " --mandir=DIR man documentation [${mandir}]" \
- " --docdir=DIR documentation root [${docdir}]" \
- " --packagedir=DIR package installation directory [${packagedir}]" \
- " --targetdir=DIR target directory for linking [${targetdir}]" \
- ""
- }
- # Defaults
- prefix=/usr/local
- exec_prefix='$(prefix)'
- bindir='$(exec_prefix)/bin'
- sbindir='$(exec_prefix)/sbin'
- libexecdir='$(exec_prefix)/libexec'
- sysconfdir='$(prefix)/etc'
- localstatedir='$(prefix)/var'
- datarootdir='$(prefix)/share'
- infodir='$(datarootdir)/info'
- mandir='$(datarootdir)/man'
- docdir='$(datarootdir)/doc'
- packagedir='$(prefix)/pkg'
- targetdir='/'
- return_variables() {
- printf "%s\n" \
- "prefix = $prefix" \
- "exec_prefix = $exec_prefix" \
- "bindir = $bindir" \
- "sbindir = $sbindir" \
- "libexecdir = $libexecdir" \
- "sysconfdir = $sysconfdir" \
- "localstatedir = $localstatedir" \
- "datarootdir = $datarootdir" \
- "infodir = $infodir" \
- "mandir = $mandir" \
- "docdir = $docdir" \
- "packagedir = $packagedir" \
- "targetdir = $targetdir" \
- ""
- }
- # Handle options
- while test $# -gt 0
- do
- case $1 in
- --prefix)
- prefix="$2"
- shift
- ;;
- --prefix=*)
- prefix="${1#*=}"
- ;;
- --exec-prefix)
- exec_prefix="$2"
- shift
- ;;
- --exec-prefix=*)
- exec_prefix="${1#*=}"
- ;;
- --bindir)
- bindir="$2"
- shift
- ;;
- --bindir=*)
- bindir="${1#*=}"
- ;;
- --sbindir)
- sbindir="$2"
- shift
- ;;
- --sbindir=*)
- sbindir="${1#*=}"
- ;;
- --libexecdir)
- libexecdir="$2"
- shift
- ;;
- --libexecdir=*)
- libexecdir="${1#*=}"
- ;;
- --sysconfdir)
- sysconfdir="$2"
- shift
- ;;
- --sysconfdir=*)
- sysconfdir="${1#*=}"
- ;;
- --localstatedir)
- localstatedir="$2"
- shift
- ;;
- --localstatedir=*)
- localstatedir="${1#*=}"
- ;;
- --datarootdir)
- datarootdir="$2"
- shift
- ;;
- --datarootdir=*)
- datarootdir="${1#*=}"
- ;;
- --infodir)
- infodir="$2"
- shift
- ;;
- --infodir=*)
- infodir="${1#*=}"
- ;;
- --mandir)
- mandir="$2"
- shift
- ;;
- --mandir=*)
- mandir="${1#*=}"
- ;;
- --docdir)
- docdir="$2"
- shift
- ;;
- --docdir=*)
- docdir="${1#*=}"
- ;;
- --packagedir)
- packagedir="$2"
- shift
- ;;
- --packagedir=*)
- packagedir="${1#*=}"
- ;;
- --targetdir)
- targetdir="$2"
- shift
- ;;
- --targetdir=*)
- targetdir="${1#*=}"
- ;;
- -h | --help)
- usage
- exit
- ;;
- --) # End of options
- shift
- break
- ;;
- -*)
- echo "configure: WARNING: unrecognized option '${1}'" 1>&2
- ;;
- *)
- break
- ;;
- esac
- shift
- done
- echo "Creating config.mak ..."
- # Show variales and clean up the config.mak file
- return_variables; : > config.mak
- # To populate config.mak
- return_variables > config.mak
- echo "OK, now you can run \`make'"
|