forked from gracelang/minigrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·160 lines (148 loc) · 3.5 KB
/
configure
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env bash
export unset CDPATH
DISTRIB=tree
PLATFORM=$(uname)
PREFIX="/usr"
LDFLAGS=
UNICODE_LDFLAGS=
OTHER_MODULES=
INCLUDE_PATH='$(PREFIX)/include'
MODULE_PATH='$(PREFIX)/lib/grace/modules'
OBJECT_PATH='$(PREFIX)/lib/grace'
other_modules=(
mirrors
)
ADVISE_END=
advise() {
why=$1
ADVISE_END=$why
echo
echo "Problem configuring $why."
if [ -e "environ-$PLATFORM" ]
then
echo
echo Running the environ-$PLATFORM script may help to diagnose or
echo solve this problem.
echo
if ! [ "$IN_ENVIRON_SCRIPT" ]
then
echo Re-running configure inside environ-$PLATFORM.
echo
if ./environ-$PLATFORM ./configure
then
echo
echo As configure succeeded, launching a suitable environment
echo in which to run other programs. To obtain this environment
echo in future, run ./environ-$PLATFORM.
echo
exec ./environ-$PLATFORM
fi
exit $?
fi
fi
}
fail() {
advise "$@"
echo Failed.
exit 1
}
while [ $# -gt 0 ]
do
if [ "$1" = "--prefix" ]
then
PREFIX=`readlink -f $2`
shift
elif [ "$1" = "--static" ]
then
STATIC=y
elif [ "$1" = "--includedir" ]
then
INCLUDE_PATH=`readlink -f $2` #convert the potentially relative path to absolute before storing it
shift
elif [ "$1" = "--libdir" ]
then
MODULE_PATH=`readlink -f $2`/grace/modules
OBJECT_PATH=`readlink -f $2`/grace
shift
elif [ "$1" = "--objectpath" ]
then
OBJECT_PATH=`readlink -f $2`
shift
elif [ "$1" = "--help" ]
then
echo "Available flags:"
echo " --prefix <path>"
echo " --static {tarball only}"
echo " --includedir <path>"
echo " --libdir <path>"
echo " --objectpath <path>"
exit 0
else
echo "Unknown argument '$1'."
exit 1
fi
shift
done
if [ "$INCLUDE_PATH" = "" ]
then
INCLUDE_PATH="$PREFIX/include" #These are the defaults, relative to PREFIX
fi
if [ "$MODULE_PATH" = "" ]
then
MODULE_PATH="$PREFIX/lib/grace/modules"
fi
if [ "$OBJECT_PATH" = "" ]
then
OBJECT_PATH=`dirname $MODULE_PATH`
fi
echo -n "Locating GNU make... "
GMAKE_PATH=$(which gmake 2>/dev/null)
if [ "$GMAKE_PATH" ]
then
echo $GMAKE_PATH
else
GMAKE_PATH=$(which make 2>/dev/null)
if [ "$GMAKE_PATH" ]
then
echo $GMAKE_PATH
else
echo "none."
advise "GNU make"
fi
fi
MK=make
if gmake -v 2>&1 | grep -q GNU
then
MK=gmake
elif make -v 2>&1 | grep -q GNU
then
MK=make
else
echo "This software requires GNU make to build."
echo "Substitute the path to your GNU make below."
fi
STUBS=$(cd stubs; ls *.grace | tr \\n ' ')
LIBRARY_MODULES=$(cd modules; ls *.grace | grep -v Test | tr \\n ' ')
ICONS=$(cd js; ls *.png | tr \\n ' ')
cat <<EOT > Makefile.conf
PREFIX ?= $PREFIX
LDFLAGS = $LDFLAGS -lm
UNICODE_LDFLAGS = $UNICODE_LDFLAGS
UNICODE_MODULE = $UNICODE_MODULE
STATIC_MODULES = $STATIC_MODULES
OTHER_MODULES = ${OTHER_MODULES[@]}
STUBS = $STUBS
LIBRARY_MODULES = $LIBRARY_MODULES
ICONS = $ICONS
INCLUDE_PATH = $INCLUDE_PATH
MODULE_PATH = $MODULE_PATH
OBJECT_PATH = $OBJECT_PATH
EOT
if [ "$ADVISE_END" ]
then
echo configure encountered a non-fatal configuration problem.
advise "$ADVISE_END"
echo
echo This issue did not cause configure to fail, but you may wish to
echo investigate it.
fi