/[meta-cvs]/meta-cvs/F-4948435BE08AA37BF07EE55E790D14D9
ViewVC logotype

Contents of /meta-cvs/F-4948435BE08AA37BF07EE55E790D14D9

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Mon Mar 10 07:52:46 2008 UTC (6 years, 1 month ago) by kaz
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
* configure: When testing for GNU make, handle the situation
that the minor number has a non-numeric suffix, e.g. 3.81beta4.
1 kaz 1.1 #!/bin/sh
2    
3     #
4     # Save command line in a way that can be re-run.
5     # This takes care of spaces, but if there are shell-meta characters
6     # in the arguments, oops.
7     #
8    
9     cmdline=
10     for arg in "$0" "$@" ; do
11     [ -n "$cmdline" ] && cmdline="$cmdline "
12     case $arg in
13     *" "* | " "* | *" " )
14     cmdline=$cmdline$(printf "\"%s\"" "$arg")
15     ;;
16     * )
17     cmdline=$cmdline$arg
18     ;;
19     esac
20     done
21    
22     #
23     # Default variables
24     #
25    
26     prefix=/usr/local
27    
28     #
29     # Parse configuration variables
30     #
31     while [ $# -gt 0 ] ; do
32     case $1 in
33     --no-* )
34     var=${1#--no-}
35     val=
36     ;;
37     --*=* )
38     var=${1%=*}
39     var=${var#--}
40     val=${1#*=}
41     ;;
42     --*= )
43     var=${1%=*}
44     var=${var#--}
45     val=
46     ;; --* )
47     var=${1#--}
48     val=y
49     ;;
50     *=* )
51     var=${1%=*}
52     val=${1#*=}
53     ;;
54     *= )
55     var=${1%=*}
56     val=
57     ;;
58     * )
59     printf "$0: '$1' doesn't look like a configuration variable assignment\n"
60     printf "$0: use --help to get help\n"
61     exit 1
62     esac
63    
64     if ! printf $var | grep -q -E '^[[:alpha:]][[:alnum:]]*$' ; then
65     printf "$0: '$var' isn't a proper configuration variable name\n"
66     exit 1;
67     fi
68    
69     eval "$var=\"$val\""
70     shift
71     done
72    
73     #
74     # If --help was given (or --help=<nonempty> or help=<nonempty>) then
75     # print help and exit. The termination status is failed, to indicate
76     # that configuration was not done.
77     #
78    
79     if [ -n "$help" ] ; then
80     cat <<!
81    
82     usage: $0 { variable=value }*\n"
83    
84     The configure script prepares Meta-CVS for building and installation.
85     To configure a program means to establish the values of kakefile variables
86     which influence how the software is built, where it is installed.
87     These variables can also influence what features are present in the
88     software, and can determine various defaults for those behaviors which are
89     dynamically configurable when the software is run.
90    
91     Configuration variables are recorded in a file called config.make. This is a
92     GNU makefile, and consequently uses the GNU make syntax. It is included in the
93     main Makefile by an include statement.
94    
95     The configure script is flexible. It allows variables to be entered in any
96     of these forms:
97    
98     Canonical:
99    
100     variable=value Defines the given variable as having the given value.
101     variable= Defines the variable as having an empty value.
102     An empty value serves as boolean false.
103    
104     Long-option style:
105    
106     --variable=value Same as 'variable=value', but resembles a GNU-style
107     long option.
108     --variable Same as 'variable=y'.
109     --no-variable Same as 'variable='.
110    
111     No variables are required. The configure script establishes default values
112     for any variables which are needed by the build, but which are not specified
113     on the command line.
114    
115     After running $0, check that the config.make contents are sane.
116    
117     !
118     exit 1
119     fi
120    
121     #
122     # Variables are read, --help wasn't given, so let's configure!
123     #
124    
125     #
126 kaz 1.2 # Grok software version from CVS varaible
127     #
128    
129 kaz 1.3 name_key="$Name: $"
130 kaz 1.2 save_ifs=$IFS ; IFS=":-$ " ; set -- $name_key ; IFS=$save_ifs
131     mcvs_ver_major=$3
132     mcvs_ver_minor=$4
133     mcvs_ver_patch=$5
134    
135     #
136     # The all important banner.
137     #
138    
139     if [ $3 ] ; then
140     banner_text=$(printf " Configuring Meta-CVS %d.%d.%d \n" $3 $4 $5)
141     else
142     banner_text=" Configuring Meta-CVS (unknown version) "
143     fi
144     banner_box=$(printf "%.*s\n" ${#banner_text} \
145     "-------------------------------------------")
146     printf "+%s+\n|%s|\n+%s+\n" $banner_box "$banner_text" $banner_box
147    
148     #
149 kaz 1.1 # From here on in, we bail if any command fails.
150     #
151    
152     set -e
153    
154     #
155     # Verify sanity of --prefix
156     #
157    
158     printf "Checking prefix %s ... " "$prefix"
159     case $prefix in
160     "" )
161     ;;
162     " "* | *" "* | *" " )
163     printf "incorrect (contains spaces)\n"
164     exit 1
165     ;;
166     -* )
167     printf "incorrect (resembles a command option)\n"
168     exit 1
169     ;;
170     /* )
171     ;;
172     * )
173     printf "incorrect (must be absolute path)\n"
174     exit 1
175     ;;
176     esac
177    
178     test_prefix=$prefix
179    
180     while true ; do
181     if [ -e $test_prefix ] ; then
182     if [ ! -d $test_prefix ] ; then
183     printf "incorrect ('%s' is not a directory)!\n" $test_prefix
184     exit 1
185     fi
186     if [ ! -w $test_prefix ] ; then
187     printf "okay (but no write access to '%s')\n" \
188     "$test_prefix"
189     else
190     printf "okay\n"
191     fi
192     break
193     fi
194     test_prefix=$(dirname $test_prefix)
195     done
196    
197     #
198     # Check for GNU make
199     #
200    
201     printf "Checking for GNU Make ... "
202    
203     output=$(make --version 2>&1)
204     set -- $output
205    
206     if [ $1 != "GNU" -o $2 != "Make" ] ; then
207     printf "missing\n"
208     exit 1
209     fi
210    
211     make_version=$3
212    
213     save_ifs=$IFS ; IFS=. ; set -- $make_version ; IFS=$save_ifs
214    
215 kaz 1.4 if [ $1 -lt 3 -o \( $1 -eq 3 -a ${2%%[^0-9]*} -lt 80 \) ] ; then
216 kaz 1.1 printf "too old (%s found, 3.80 or newer needed)\n" $make_version
217     exit 1
218     else
219     printf "yes (%s found)\n" $make_version
220     fi
221    
222     #
223     # Check for CLISP
224     #
225    
226     printf "Checking for CLISP ... "
227    
228     output=$(clisp --version 2>&1)
229     set -- $output
230    
231     if [ $1 != "GNU" -o $2 != "CLISP" ] ; then
232     printf "missing\n"
233     exit 1
234     fi
235    
236     clisp_version=$3
237    
238     save_ifs=$IFS ; IFS=. ; set -- $clisp_version ; IFS=$save_ifs
239    
240     if [ $1 -lt 2 -o \( $1 -eq 2 -a $2 -lt 38 \) ] ; then
241     printf "too old (%s found, 2.38 or newer needed)\n" $clisp_version
242     exit 1
243     else
244     printf "yes (%s found)\n" $clisp_version
245     fi
246    
247     #
248     # First, we have to figure out whether we are configured straight
249     # in the source directory, or whether we are in a separate build directory.
250     # In the latter case, we set up a symbolic link to the Makefile.
251     #
252     source_dir=$(dirname $0)
253    
254     #
255     # Compute an absolute path to the source directory.
256     #
257     top_srcdir="$(cd "$source_dir" ; pwd -P)"
258    
259     if [ "$source_dir" != "." ] ; then
260     printf "symlinking Makefile -> $source_dir/Makefile\n"
261     ln -sf "$source_dir/Makefile" .
262     else
263     printf "warning: its recommended to build in a separate directory\n"
264     fi
265    
266     #
267     # Establish default values for any variables that are not specified
268     # on the command line.
269     #
270     prefix=${prefix-/usr/local}
271    
272     #
273     # Save configuration in config.log
274     #
275     cat > config.log <<!
276    
277     Configured on $(date) using
278    
279     $cmdline
280    
281     !
282    
283     #
284     # Finally, we generate config.make
285     #
286     printf "generating config.make\n"
287    
288     cat > config.make <<!
289     # absolute path to source code directory
290     top_srcdir := $top_srcdir
291    
292     # installation prefix
293     prefix := $prefix
294     !

  ViewVC Help
Powered by ViewVC 1.1.5