File: configure

package info (click to toggle)
miller 6.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 88,244 kB
  • sloc: ruby: 162; sh: 120; makefile: 87; python: 46
file content (50 lines) | stat: -rwxr-xr-x 1,071 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

set -euo pipefail

usage() {
  echo "Usage: $0 [--prefix {prefix directory}], e.g. /usr/local" 2>&1
  echo "    or $0 [--prefix={prefix directory}], e.g. /usr/local" 2>&1
  exit 1
}

prefix="/usr/local"

if [ $# -eq 0 ]; then
  echo "Using $prefix"
elif [ $# -gt 2 ]; then
  usage
else
  while [ $# -gt 0 ]; do
    case "$1" in
      -p=* | --prefix=*)
        prefix="${1#*=}"
        ;;
      -p | --prefix)
        prefix="$2"
        shift
        ;;
      *)
        printf "Error: unknown option: $1\n"
        usage
    esac
    shift
  done
fi

# Test for read access, not write access, since people can ./configure, make,
# and make check outside of sudo and then make install inside sudo.
if [ ! -d "$prefix" ]; then
  echo "$0: could not find prefix directory \"$prefix\""
  exit 1
fi

ext=".prefix-backup"
sed 's@^PREFIX.*@PREFIX='$prefix'@' Makefile > Makefile.$ext
mv Makefile.$ext Makefile
echo Updated Makefile

sed 's@^PREFIX.*@PREFIX='$prefix'@' man/Makefile > man/Makefile.$ext
mv man/Makefile.$ext man/Makefile
echo Updated man/Makefile