taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

configure.sh (1385B)


      1 #!/bin/sh
      2 
      3 # This file has been placed in the public domain.
      4 
      5 set -eu
      6 
      7 prefix=/usr/local
      8 
      9 usage() {
     10   cat <<EOF
     11 Usage: ./configure [--prefix=DIR] [VARIABLE=VALUE]...
     12 
     13 Configure the installation prefix (default: /usr/local).
     14 Unsupported build variables are ignored with a warning.
     15 EOF
     16 }
     17 
     18 while test $# -gt 0; do
     19   case $1 in
     20     --prefix=*)
     21       prefix=${1#*=}
     22       ;;
     23     --prefix)
     24       if test $# -lt 2; then
     25         echo "configure: option '--prefix' requires an argument" >&2
     26         exit 2
     27       fi
     28       prefix=$2
     29       shift
     30       ;;
     31     -h|--help)
     32       usage
     33       exit 0
     34       ;;
     35     *=*)
     36       variable=${1%%=*}
     37       case $variable in
     38         ""|[!A-Za-z_]*|*[!A-Za-z0-9_]*)
     39           echo "configure: unrecognized option '$1'" >&2
     40           echo "Try './configure --help' for more information." >&2
     41           exit 2
     42           ;;
     43         *)
     44           echo "configure: WARNING: unsupported variable '$variable' is ignored" >&2
     45           ;;
     46       esac
     47       ;;
     48     *)
     49       echo "configure: unrecognized option '$1'" >&2
     50       echo "Try './configure --help' for more information." >&2
     51       exit 2
     52       ;;
     53   esac
     54   shift
     55 done
     56 
     57 if test -z "$prefix"; then
     58   echo "configure: installation prefix must not be empty" >&2
     59   exit 2
     60 fi
     61 
     62 cat >.config.mk <<EOF
     63 # This makefile fragment is generated by configure.
     64 prefix = $prefix
     65 EOF
     66 
     67 echo "configured installation prefix: $prefix"