annotate configure @ 48:3d5adf5a59d0

Fix python2.7 syntax errors.
author David A. Holland
date Sat, 02 Apr 2022 18:05:27 -0400
parents 923ea629c29f
children 62d82881799f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
1 #!/bin/sh
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
2 # configure - configure swallowtail
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
3 # usage: see configure --help
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
4 # note: this is not an autoconf-generated script
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
5
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
6 help() {
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
7 cat <<EOF
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
8 Usage: $0 [args]
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
9 where args can be:
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
10 --help Print usage
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
11 --destdir=DIR Set install chroot [none]
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
12 --prefix=DIR Set install prefix [/usr/local]
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
13 --python=FILE Set path to Python interpreter [probed]
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
14 --sh=FILE Set path to Bourne shell [/bin/sh]
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
15 EOF
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
16 }
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
17
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
18 usage() {
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
19 echo "Usage: $0 [args}" 1>&2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
20 echo "Try --help" 1>&2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
21 }
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
22
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
23 ############################################################
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
24 # args
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
25
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
26 DESTDIR=
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
27 PREFIX=/usr/local
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
28 PYTHON=probed
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
29 SH=/bin/sh
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
30
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
31 for ARG in "$@"; do
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
32 case "$ARG" in
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
33 --help) help; exit;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
34 --destdir=*) DESTDIR=`echo "$ARG" | sed 's/^[^=]*=//'`;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
35 --prefix=*) PREFIX=`echo "$ARG" | sed 's/^[^=]*=//'`;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
36 --python=*) PYTHON=`echo "$ARG" | sed 's/^[^=]*=//'`;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
37 --sh=*) SHELL=`echo "$ARG" | sed 's/^[^=]*=//'`;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
38 *) usage; exit 1;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
39 esac
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
40 done
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
41
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
42 ############################################################
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
43 # check for python
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
44
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
45 echo -n 'Checking for python... '
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
46
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
47 nopython() {
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
48 echo "failed"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
49 echo "$0: $1" 1>&2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
50 echo "$0: Install python or use --python=PATH option" 1>&2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
51 exit 1
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
52 }
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
53
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
54 testpython() {
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
55 if [ ! -x "$1" ]; then
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
56 return 1
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
57 fi
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
58 VER=$("$1" -V 2>&1)
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
59 case "$VER" in
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
60 "Python "*.*.*) return 0;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
61 "Python "*.*) return 0;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
62 *) ;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
63 esac
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
64 return 1
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
65 }
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
66
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
67 FOUND=0
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
68 case "$PYTHON" in
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
69 probed)
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
70 for D in \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
71 /usr/local/bin \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
72 /usr/pkg/bin \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
73 /usr/contrib/bin \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
74 /usr/bin \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
75 /opt/bin \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
76 ; do
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
77 for PY in \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
78 python \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
79 python2.7 python27 \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
80 python2.6 python26 \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
81 python2.5 python25 \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
82 python2.4 python24 \
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
83 ; do
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
84 if testpython $D/$PY; then
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
85 PYTHON="$D/$PY"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
86 FOUND=1
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
87 break
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
88 fi
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
89 done
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
90 if [ $FOUND = 1 ]; then
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
91 break
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
92 fi
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
93 done
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
94 if [ $FOUND = 0 ]; then
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
95 nopython "Cannot find python"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
96 fi
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
97 ;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
98 /*)
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
99 if testpython "$PYTHON"; then
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
100 :
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
101 else
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
102 nopython "$PYTHON does not appear to be python"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
103 fi
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
104 ;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
105 *)
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
106 nopython "$PYTHON is not an absolute path"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
107 ;;
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
108 esac
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
109 echo "$PYTHON"
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
110
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
111 ############################################################
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
112 # Generate config.*
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
113
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
114 echo 'Generating config.sed'
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
115
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
116 cat > config.sed.new <<EOF
5
923ea629c29f Use @SYMBOL@, not @@SYMBOL@@.
David A. Holland
parents: 2
diff changeset
117 s,@PYTHON@,$PYTHON,
923ea629c29f Use @SYMBOL@, not @@SYMBOL@@.
David A. Holland
parents: 2
diff changeset
118 s,@SH@,$SH,
2
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
119 EOF
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
120
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
121 mv -f config.sed.new config.sed
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
122
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
123 echo 'Generating config.mk'
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
124
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
125 cat > config.mk.new <<EOF
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
126 DESTDIR=$DESTDIR
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
127 PREFIX=$PREFIX
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
128 EOF
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
129
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
130 mv -f config.mk.new config.mk
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
131
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
132 ############################################################
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
133 # done
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
134
5f36d8d69aba Set up a build framework.
David A. Holland
parents:
diff changeset
135 exit 0