1 | dnl --*- sh -*-- |
---|
2 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
3 | ## This file is part of ANTLR. See LICENSE.txt for licence ## |
---|
4 | ## details. Written by W. Haefelinger - initial version by ## |
---|
5 | ## R. Laren. ## |
---|
6 | ## ...............Copyright (C) Wolfgang Haefelinger, 2004 ## |
---|
7 | ## ## |
---|
8 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
9 | |
---|
10 | dnl |
---|
11 | dnl =============================================================== |
---|
12 | dnl A couple of Macros have been copied from the GNU Autoconf Macro |
---|
13 | dnl Archive: |
---|
14 | dnl http://www.gnu.org/software/ac-archive |
---|
15 | dnl =============================================================== |
---|
16 | dnl |
---|
17 | |
---|
18 | AC_DEFUN( |
---|
19 | [AC_CHECK_CLASSPATH], |
---|
20 | [ |
---|
21 | test "x$CLASSPATH" = x && AC_MSG_ERROR( |
---|
22 | [CLASSPATH not set. Please set it to include the directory containing configure.]) |
---|
23 | if test "x$CLASSPATH" = x; then |
---|
24 | : |
---|
25 | else |
---|
26 | echo "CLASSPATH set to:" |
---|
27 | echo "$CLASSPATH" |
---|
28 | echo "IMPORTANT: make sure the current directory containing configure" |
---|
29 | echo "is in the CLASSPATH" |
---|
30 | fi |
---|
31 | ] |
---|
32 | ) |
---|
33 | |
---|
34 | #dnl /** |
---|
35 | #dnl * Test.java: used to test dynamicaly if a class exists. |
---|
36 | #dnl */ |
---|
37 | #dnl public class Test |
---|
38 | #dnl { |
---|
39 | #dnl |
---|
40 | #dnl public static void |
---|
41 | #dnl main( String[] argv ) |
---|
42 | #dnl { |
---|
43 | #dnl Class lib; |
---|
44 | #dnl if (argv.length < 1) |
---|
45 | #dnl { |
---|
46 | #dnl System.err.println ("Missing argument"); |
---|
47 | #dnl System.exit (77); |
---|
48 | #dnl } |
---|
49 | #dnl try |
---|
50 | #dnl { |
---|
51 | #dnl lib = Class.forName (argv[0]); |
---|
52 | #dnl } |
---|
53 | #dnl catch (ClassNotFoundException e) |
---|
54 | #dnl { |
---|
55 | #dnl System.exit (1); |
---|
56 | #dnl } |
---|
57 | #dnl lib = null; |
---|
58 | #dnl System.exit (0); |
---|
59 | #dnl } |
---|
60 | #dnl |
---|
61 | #dnl } |
---|
62 | |
---|
63 | AC_DEFUN( |
---|
64 | [AC_CHECK_CLASS],[ |
---|
65 | AC_REQUIRE([AC_PROG_JAVA]) |
---|
66 | ac_var_name=`echo $1 | sed 's/\./_/g'` |
---|
67 | #dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is |
---|
68 | #dnl dynamic I need an extra level of extraction |
---|
69 | AC_MSG_CHECKING([for $1 class]) |
---|
70 | AC_CACHE_VAL(ac_cv_class_$ac_var_name,[ |
---|
71 | if test x$ac_cv_prog_uudecode_base64 = xyes; then |
---|
72 | cat << \EOF > Test.uue |
---|
73 | begin-base64 644 Test.class |
---|
74 | yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE |
---|
75 | bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 |
---|
76 | bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ |
---|
77 | AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt |
---|
78 | ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV |
---|
79 | ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp |
---|
80 | VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM |
---|
81 | amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi |
---|
82 | AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B |
---|
83 | AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA |
---|
84 | AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN |
---|
85 | uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK |
---|
86 | AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA |
---|
87 | JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA |
---|
88 | JwAAAAIAKA== |
---|
89 | ==== |
---|
90 | EOF |
---|
91 | if uudecode$EXEEXT Test.uue; then |
---|
92 | : |
---|
93 | else |
---|
94 | echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC |
---|
95 | echo "configure: failed file was:" >&AC_FD_CC |
---|
96 | cat Test.uue >&AC_FD_CC |
---|
97 | ac_cv_prog_uudecode_base64=no |
---|
98 | fi |
---|
99 | rm -f Test.uue |
---|
100 | |
---|
101 | if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then |
---|
102 | eval "ac_cv_class_$ac_var_name=yes" |
---|
103 | else |
---|
104 | eval "ac_cv_class_$ac_var_name=no" |
---|
105 | fi |
---|
106 | rm -f Test.class |
---|
107 | else |
---|
108 | AC_TRY_COMPILE_JAVA([$1], , |
---|
109 | [eval "ac_cv_class_$ac_var_name=yes"], |
---|
110 | [eval "ac_cv_class_$ac_var_name=no"]) |
---|
111 | fi |
---|
112 | eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" |
---|
113 | eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" |
---|
114 | HAVE_LAST_CLASS=$ac_var_val |
---|
115 | if test x$ac_var_val = xyes; then |
---|
116 | ifelse([$2], , :, [$2]) |
---|
117 | else |
---|
118 | ifelse([$3], , :, [$3]) |
---|
119 | fi |
---|
120 | ] |
---|
121 | ) |
---|
122 | #dnl for some reason the above statment didn't fall though here? |
---|
123 | #dnl do scripts have variable scoping? |
---|
124 | eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" |
---|
125 | AC_MSG_RESULT($ac_var_val) |
---|
126 | ] |
---|
127 | ) |
---|
128 | |
---|
129 | AC_DEFUN([AC_CHECK_JAVA_HOME],[ |
---|
130 | AC_REQUIRE([AC_EXEEXT])dnl |
---|
131 | TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1` |
---|
132 | if test x$TRY_JAVA_HOME != x; then |
---|
133 | PATH=$PATH:$TRY_JAVA_HOME/bin |
---|
134 | fi |
---|
135 | AC_PATH_PROG(JAVA_PATH_NAME, java$EXEEXT) |
---|
136 | if test x$JAVA_PATH_NAME != x; then |
---|
137 | JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java$EXEEXT$/\1/"` |
---|
138 | fi;dnl |
---|
139 | ] |
---|
140 | ) |
---|
141 | |
---|
142 | |
---|
143 | AC_DEFUN([AC_PROG_JAR], |
---|
144 | [ |
---|
145 | AC_REQUIRE([AC_EXEEXT])dnl |
---|
146 | if test "x$JAVAPREFIX" = x; then |
---|
147 | test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT) |
---|
148 | else |
---|
149 | test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX) |
---|
150 | fi |
---|
151 | test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) |
---|
152 | AC_PROVIDE([$0])dnl |
---|
153 | ] |
---|
154 | ) |
---|
155 | |
---|
156 | AC_DEFUN([AC_PROG_JAVA],[ |
---|
157 | AC_REQUIRE([AC_EXEEXT])dnl |
---|
158 | if test x$JAVAPREFIX = x; then |
---|
159 | test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT) |
---|
160 | else |
---|
161 | test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT, $JAVAPREFIX) |
---|
162 | fi |
---|
163 | test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) |
---|
164 | AC_PROG_JAVA_WORKS |
---|
165 | AC_PROVIDE([$0])dnl |
---|
166 | ] |
---|
167 | ) |
---|
168 | |
---|
169 | |
---|
170 | #dnl /** |
---|
171 | #dnl * Test.java: used to test if java compiler works. |
---|
172 | #dnl */ |
---|
173 | #dnl public class Test |
---|
174 | #dnl { |
---|
175 | #dnl |
---|
176 | #dnl public static void |
---|
177 | #dnl main( String[] argv ) |
---|
178 | #dnl { |
---|
179 | #dnl System.exit (0); |
---|
180 | #dnl } |
---|
181 | #dnl |
---|
182 | #dnl } |
---|
183 | |
---|
184 | AC_DEFUN([AC_PROG_JAVA_WORKS], |
---|
185 | [ |
---|
186 | AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) |
---|
187 | if test x$uudecode = xyes; then |
---|
188 | AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ |
---|
189 | cat << \EOF > Test.uue |
---|
190 | begin-base64 644 Test.class |
---|
191 | yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE |
---|
192 | bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 |
---|
193 | bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s |
---|
194 | YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG |
---|
195 | aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB |
---|
196 | AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB |
---|
197 | AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= |
---|
198 | ==== |
---|
199 | EOF |
---|
200 | if uudecode$EXEEXT Test.uue; then |
---|
201 | ac_cv_prog_uudecode_base64=yes |
---|
202 | else |
---|
203 | echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC |
---|
204 | echo "configure: failed file was:" >&AC_FD_CC |
---|
205 | cat Test.uue >&AC_FD_CC |
---|
206 | ac_cv_prog_uudecode_base64=no |
---|
207 | fi |
---|
208 | rm -f Test.uue]) |
---|
209 | fi |
---|
210 | if test x$ac_cv_prog_uudecode_base64 != xyes; then |
---|
211 | rm -f Test.class |
---|
212 | AC_MSG_WARN([I have to compile Test.class from scratch]) |
---|
213 | if test x$ac_cv_prog_javac_works = xno; then |
---|
214 | AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) |
---|
215 | fi |
---|
216 | if test x$ac_cv_prog_javac_works = x; then |
---|
217 | AC_PROG_JAVAC |
---|
218 | fi |
---|
219 | fi |
---|
220 | AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ |
---|
221 | JAVA_TEST=Test.java |
---|
222 | CLASS_TEST=Test.class |
---|
223 | TEST=Test |
---|
224 | changequote(, )dnl |
---|
225 | cat << \EOF > $JAVA_TEST |
---|
226 | /* [#]line __oline__ "configure" */ |
---|
227 | public class Test { |
---|
228 | public static void main (String args[]) { |
---|
229 | System.exit (0); |
---|
230 | } } |
---|
231 | EOF |
---|
232 | changequote([, ])dnl |
---|
233 | if test x$ac_cv_prog_uudecode_base64 != xyes; then |
---|
234 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then |
---|
235 | : |
---|
236 | else |
---|
237 | echo "configure: failed program was:" >&AC_FD_CC |
---|
238 | cat $JAVA_TEST >&AC_FD_CC |
---|
239 | AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) |
---|
240 | fi |
---|
241 | fi |
---|
242 | if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then |
---|
243 | ac_cv_prog_java_works=yes |
---|
244 | else |
---|
245 | echo "configure: failed program was:" >&AC_FD_CC |
---|
246 | cat $JAVA_TEST >&AC_FD_CC |
---|
247 | AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) |
---|
248 | fi |
---|
249 | rm -fr $JAVA_TEST $CLASS_TEST Test.uue |
---|
250 | ]) |
---|
251 | AC_PROVIDE([$0])dnl |
---|
252 | ] |
---|
253 | ) |
---|
254 | |
---|
255 | AC_DEFUN([AC_PROG_JAVAC], |
---|
256 | [ |
---|
257 | AC_REQUIRE([AC_EXEEXT])dnl |
---|
258 | if test "x$JAVAPREFIX" = x; then |
---|
259 | test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT) |
---|
260 | else |
---|
261 | test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT, $JAVAPREFIX) |
---|
262 | fi |
---|
263 | test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) |
---|
264 | AC_PROG_JAVAC_WORKS |
---|
265 | AC_PROVIDE([$0])dnl |
---|
266 | ] |
---|
267 | ) |
---|
268 | |
---|
269 | AC_DEFUN([AC_PROG_JAVAC_WORKS],[ |
---|
270 | AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ |
---|
271 | JAVA_TEST=Test.java |
---|
272 | CLASS_TEST=Test.class |
---|
273 | cat << \EOF > $JAVA_TEST |
---|
274 | /* [#]line __oline__ "configure" */ |
---|
275 | public class Test { |
---|
276 | } |
---|
277 | EOF |
---|
278 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then |
---|
279 | ac_cv_prog_javac_works=yes |
---|
280 | else |
---|
281 | AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) |
---|
282 | echo "configure: failed program was:" >&AC_FD_CC |
---|
283 | cat $JAVA_TEST >&AC_FD_CC |
---|
284 | fi |
---|
285 | rm -f $JAVA_TEST $CLASS_TEST |
---|
286 | ]) |
---|
287 | AC_PROVIDE([$0])dnl |
---|
288 | ]) |
---|
289 | |
---|
290 | AC_DEFUN([AC_TRY_COMPILE_JAVA],[ |
---|
291 | AC_REQUIRE([AC_PROG_JAVAC])dnl |
---|
292 | cat << \EOF > Test.java |
---|
293 | /* [#]line __oline__ "configure" */ |
---|
294 | ifelse([$1], , , [import $1;]) |
---|
295 | public class Test { |
---|
296 | [$2] |
---|
297 | } |
---|
298 | EOF |
---|
299 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class ; then |
---|
300 | #dnl Don't remove the temporary files here, so they can be examined. |
---|
301 | ifelse([$3], , :, [$3]) |
---|
302 | else |
---|
303 | echo "configure: failed program was:" >&AC_FD_CC |
---|
304 | cat Test.java >&AC_FD_CC |
---|
305 | ifelse([$4], , , [ rm -fr Test* |
---|
306 | $4 |
---|
307 | ])dnl |
---|
308 | fi |
---|
309 | rm -fr Test* |
---|
310 | ] |
---|
311 | ) |
---|
312 | |
---|
313 | AC_DEFUN([AC_TRY_RUN_JAVA],[ |
---|
314 | AC_REQUIRE([AC_PROG_JAVAC])dnl |
---|
315 | AC_REQUIRE([AC_PROG_JAVA])dnl |
---|
316 | cat << \EOF > Test.java |
---|
317 | /* [#]line __oline__ "configure" */ |
---|
318 | ifelse([$1], , , [include $1;]) |
---|
319 | public class Test { |
---|
320 | [$2] |
---|
321 | } |
---|
322 | EOF |
---|
323 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null |
---|
324 | then |
---|
325 | #dnl Don't remove the temporary files here, so they can be examined. |
---|
326 | ifelse([$3], , :, [$3]) |
---|
327 | else |
---|
328 | echo "configure: failed program was:" >&AC_FD_CC |
---|
329 | cat Test.java >&AC_FD_CC |
---|
330 | ifelse([$4], , , [ rm -fr Test* |
---|
331 | $4 |
---|
332 | ])dnl |
---|
333 | fi |
---|
334 | rm -fr Test*]) |
---|
335 | |
---|
336 | #dnl#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
---|
337 | #dnl# AX_TRY_COMPILE_JAVA |
---|
338 | #dnl#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
---|
339 | #dnl $1 => import section |
---|
340 | #dnl $2 => class body section |
---|
341 | #dnl $3 => if_good_action |
---|
342 | #dnl $4 => if_fails_action [implicit action: candidate is removed from |
---|
343 | #dnl list]. This cannot be overridden by providing a action. |
---|
344 | |
---|
345 | AC_DEFUN([AX_TRY_COMPILE_JAVA], |
---|
346 | [ |
---|
347 | ## make sure that we do not use an existing file |
---|
348 | i=0;cn="Test\${i}"; eval "fj=${cn}.java" |
---|
349 | while test -f "${fj}" |
---|
350 | do |
---|
351 | i=`expr $i + 1` |
---|
352 | eval "fj=${cn}.java" |
---|
353 | done |
---|
354 | eval "fc=${cn}.class" |
---|
355 | eval "cn=${cn}" |
---|
356 | |
---|
357 | cat << [_ACEOF] > ${fj} |
---|
358 | [$1] |
---|
359 | public class ${cn} { |
---|
360 | [$2] |
---|
361 | } |
---|
362 | [_ACEOF] |
---|
363 | ## wh: how do I check that a file has a non-zero size (test -s) |
---|
364 | ## wh: is not portable. |
---|
365 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS ${fj}) && test -f "${fc}" |
---|
366 | then |
---|
367 | $3 |
---|
368 | else |
---|
369 | ifelse([$4], ,[ |
---|
370 | echo "" |
---|
371 | echo "@configure:__oline__: failed to compile java input ...." |
---|
372 | echo "=======================================================" |
---|
373 | cat ${fj} |
---|
374 | echo "=======================================================" |
---|
375 | echo "exec $JAVAC $JAVACFLAGS ${fj}" |
---|
376 | echo "" |
---|
377 | rm -rf "${fc}" "${fj}" |
---|
378 | ],[$4]) |
---|
379 | fi |
---|
380 | rm -rf "${fc}" "${fj}" |
---|
381 | ## eof [AX_TRY_COMPILE_JAVA] |
---|
382 | ])dnl |
---|
383 | |
---|
384 | #dnl AX_GNU_MAKE |
---|
385 | #dnl $1->var that contains list of suitable candidates [not empty] |
---|
386 | #dnl $2->action_if_not_found || empty |
---|
387 | #dnl $3->action_if_found || empty |
---|
388 | #dnl => $MAKE |
---|
389 | |
---|
390 | AC_DEFUN( |
---|
391 | [AX_GNU_MAKE], |
---|
392 | [ |
---|
393 | #Search all the common names for GNU make |
---|
394 | ax_gnu_make_list="${[$1]}" |
---|
395 | [$1]= |
---|
396 | for a in . ${ax_gnu_make_list} ; do |
---|
397 | if test "$a" == "." ; then |
---|
398 | continue |
---|
399 | fi |
---|
400 | AC_MSG_CHECKING([whether ${a} is GNU make]) |
---|
401 | if (/bin/sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ); then |
---|
402 | [$1]="$a" |
---|
403 | AC_MSG_RESULT(yes) |
---|
404 | break |
---|
405 | else |
---|
406 | AC_MSG_RESULT(no) |
---|
407 | fi |
---|
408 | done |
---|
409 | ## handle search result |
---|
410 | if test "x${[$1]}" == "x" ; then |
---|
411 | : |
---|
412 | $2 |
---|
413 | else |
---|
414 | : |
---|
415 | $3 |
---|
416 | fi |
---|
417 | ] |
---|
418 | )dnl |
---|
419 | |
---|
420 | |
---|
421 | ###dnl Like AC_PATH_PROGS. However, each argument in $2 will be checked. |
---|
422 | ###dnl The result will be added to $1. There's no caching etc. |
---|
423 | ###dnl |
---|
424 | |
---|
425 | AC_DEFUN( |
---|
426 | [AX_TYPE_DASHA], |
---|
427 | [ |
---|
428 | for ac_prog in [$2] ; do |
---|
429 | set dummy $ac_prog; ac_word=${2} |
---|
430 | ## if argument is absolute we check whether such a file exists, |
---|
431 | ## otherwise we lookup PATH. Each hit will be added to main |
---|
432 | ## variable. |
---|
433 | case $ac_word in |
---|
434 | @<:@\\/@:>@* | ?:@<:@\\/@:>@*) |
---|
435 | AC_MSG_CHECKING([for $ac_word]) |
---|
436 | if test -f $ac_word ; then |
---|
437 | [$1]="${[$1]} ${ac_word}" |
---|
438 | AC_MSG_RESULT(yes) |
---|
439 | else |
---|
440 | AC_MSG_RESULT(no) |
---|
441 | fi |
---|
442 | ;; |
---|
443 | *) |
---|
444 | as_found= |
---|
445 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
---|
446 | for as_dir in $PATH |
---|
447 | do |
---|
448 | IFS=$as_save_IFS |
---|
449 | test -z "$as_dir" && as_dir=. |
---|
450 | for ac_exec_ext in '' $ac_executable_extensions; do |
---|
451 | if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then |
---|
452 | [$1]="${[$1]} $as_dir/$ac_word$ac_exec_ext" |
---|
453 | AC_MSG_CHECKING([for $ac_word]) |
---|
454 | AC_MSG_RESULT([$as_dir/$ac_word$ac_exec_ext]) |
---|
455 | as_found=1 |
---|
456 | fi |
---|
457 | done |
---|
458 | done |
---|
459 | test "x$as_found" == "x" && { |
---|
460 | AC_MSG_CHECKING([for $ac_word]) |
---|
461 | AC_MSG_RESULT([no]) |
---|
462 | } |
---|
463 | ;; |
---|
464 | esac |
---|
465 | done |
---|
466 | ] |
---|
467 | )dnl |
---|
468 | |
---|
469 | ###dnl Like AC_PATH_PROGS but if <variable> is given, then it's argument |
---|
470 | ###dnl is taken unconditionally(?). |
---|
471 | AC_DEFUN( |
---|
472 | [AX_PATH_PROGS], |
---|
473 | [ |
---|
474 | ax_arg_list="[$2]" |
---|
475 | if test "x${[$1]}" != "x" ; then |
---|
476 | ax_arg_list="${[$1]}" |
---|
477 | fi |
---|
478 | [$1]="" |
---|
479 | AX_TYPE_DASHA([$1],[${ax_arg_list}]) |
---|
480 | if test "x${[$1]}" != "x" ; then |
---|
481 | ifelse([$3], ,[:],$3) |
---|
482 | else |
---|
483 | ifelse([$4], ,[ |
---|
484 | AC_MSG_ERROR([no suitable value has been found for [$1]]) |
---|
485 | ],$4) |
---|
486 | fi |
---|
487 | ] |
---|
488 | ) |
---|
489 | |
---|
490 | |
---|
491 | AC_DEFUN([AX_JAVAC], |
---|
492 | [ |
---|
493 | ## make sure that we do not use an existing file |
---|
494 | i=0;cn="Test\${i}"; eval "fj=${cn}.java" |
---|
495 | while test -f "${fj}" |
---|
496 | do |
---|
497 | i=`expr $i + 1` |
---|
498 | eval "fj=${cn}.java" |
---|
499 | done |
---|
500 | eval "fc=${cn}.class" |
---|
501 | eval "cn=${cn}" |
---|
502 | |
---|
503 | cat << [_ACEOF] > ${fj} |
---|
504 | [$1] |
---|
505 | public class ${cn} { |
---|
506 | [$2] |
---|
507 | } |
---|
508 | [_ACEOF] |
---|
509 | ## wh: how do I check that a file has a non-zero size (test -s) |
---|
510 | ## wh: is not portable. |
---|
511 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS ${fj}) && test -f "${fc}" |
---|
512 | then |
---|
513 | $3 |
---|
514 | else |
---|
515 | ifelse([$4], ,[ |
---|
516 | echo "" |
---|
517 | echo "@configure:__oline__: failed to compile java input ...." |
---|
518 | echo "=======================================================" |
---|
519 | cat ${fj} |
---|
520 | echo "=======================================================" |
---|
521 | echo "exec $JAVAC $JAVACFLAGS ${fj}" |
---|
522 | echo "" |
---|
523 | rm -rf "${fc}" "${fj}" |
---|
524 | ],[$4]) |
---|
525 | fi |
---|
526 | rm -rf "${fc}" "${fj}" |
---|
527 | ## eof [AX_TRY_COMPILE_JAVA] |
---|
528 | ])dnl |
---|
529 | |
---|
530 | AC_DEFUN([AX_WHICH_JAVAC],[ |
---|
531 | AC_SUBST([$1]) |
---|
532 | if (/bin/sh -c "$JAVAC --version" 2>&1 | grep -i 'GCC' 2>&1 > /dev/null ) ; then |
---|
533 | [$1]=gcj |
---|
534 | elif (/bin/sh -c "$JAVAC --version" 2>&1 | grep -i 'jikes' 2>&1 > /dev/null ) ; then |
---|
535 | [$1]=jikes |
---|
536 | else |
---|
537 | [$1]=javac |
---|
538 | fi |
---|
539 | ] |
---|
540 | ) |
---|
541 | |
---|
542 | AC_DEFUN([AX_VAR_HEAD],[ |
---|
543 | set x ${[$1]} |
---|
544 | [$1]="${2}" |
---|
545 | ] |
---|
546 | ) |
---|
547 | |
---|
548 | AC_DEFUN([AX_VAR_ADD],[ |
---|
549 | ifelse([$3], ,,[$1=$3]) |
---|
550 | $1="${[$1]} $2" |
---|
551 | ] |
---|
552 | ) |
---|
553 | |
---|
554 | |
---|
555 | AC_DEFUN([AX_JAVA_PROGS],[ |
---|
556 | case $LANG_JAVA in |
---|
557 | 1) |
---|
558 | AX_PATH_PROGS([$1],[$2],[$3],[ |
---|
559 | LANG_JAVA=0 |
---|
560 | cat <<EOF |
---|
561 | |
---|
562 | ============================================================ |
---|
563 | Warning: |
---|
564 | Support for JAVA has been disabled as I have not been able |
---|
565 | locate to locate a mandatory program. Please change \$PATH or run |
---|
566 | with option --help on how to overcome this problem. |
---|
567 | ============================================================ |
---|
568 | |
---|
569 | EOF |
---|
570 | ] |
---|
571 | ) |
---|
572 | ;; |
---|
573 | esac |
---|
574 | ] |
---|
575 | ) |
---|
576 | |
---|
577 | AC_DEFUN([AX_PYTHON_PROGS],[ |
---|
578 | case $LANG_PY in |
---|
579 | 1) |
---|
580 | AX_PATH_PROGS([$1],[$2],[$3],[ |
---|
581 | LANG_PY=0 |
---|
582 | cat <<EOF |
---|
583 | |
---|
584 | ============================================================ |
---|
585 | Warning: |
---|
586 | Support for Python has been disabled as I have not been able |
---|
587 | to locate a mandatory program. Please change \$PATH or run |
---|
588 | with option --help on how to overcome this problem. |
---|
589 | ============================================================ |
---|
590 | |
---|
591 | EOF |
---|
592 | ] |
---|
593 | ) |
---|
594 | ;; |
---|
595 | esac |
---|
596 | ] |
---|
597 | ) |
---|
598 | |
---|
599 | AC_DEFUN([AX_CSHARP_PROGS],[ |
---|
600 | case $LANG_CS in |
---|
601 | 1) |
---|
602 | AX_PATH_PROGS([$1],[$2],[$3],[ |
---|
603 | LANG_CS=0 |
---|
604 | cat <<EOF |
---|
605 | |
---|
606 | ============================================================ |
---|
607 | Warning: |
---|
608 | Support for C# has been disabled as I have not been able to |
---|
609 | locate a mandatory program. Please change \$PATH or run |
---|
610 | with option --help on how to overcome this problem. |
---|
611 | ============================================================ |
---|
612 | |
---|
613 | EOF |
---|
614 | ] |
---|
615 | ) |
---|
616 | ;; |
---|
617 | esac |
---|
618 | ] |
---|
619 | ) |
---|
620 | |
---|
621 | AC_DEFUN([AX_CXX_PROGS],[ |
---|
622 | case $LANG_CXX in |
---|
623 | 1) |
---|
624 | AX_PATH_PROGS([$1],[$2],[$3],[ |
---|
625 | LANG_CXX=0 |
---|
626 | cat <<EOF |
---|
627 | |
---|
628 | ============================================================ |
---|
629 | Warning: |
---|
630 | Support for C++ has been disabled as I have not been able to |
---|
631 | locate a mandatory program. Please change \$PATH or run |
---|
632 | with option --help on how to overcome this problem. |
---|
633 | ============================================================ |
---|
634 | |
---|
635 | EOF |
---|
636 | ] |
---|
637 | ) |
---|
638 | ;; |
---|
639 | esac |
---|
640 | ] |
---|
641 | ) |
---|
642 | |
---|
643 | AC_DEFUN([AX_LANG_JAVA],[ |
---|
644 | case $LANG_JAVA in |
---|
645 | 1) |
---|
646 | ifelse([$1], ,[:],$1) |
---|
647 | ;; |
---|
648 | esac |
---|
649 | ] |
---|
650 | ) |
---|
651 | AC_DEFUN([AX_LANG_CXX],[ |
---|
652 | case $LANG_CXX in |
---|
653 | 1) |
---|
654 | ifelse([$1], ,[:],$1) |
---|
655 | ;; |
---|
656 | esac |
---|
657 | ] |
---|
658 | ) |
---|
659 | AC_DEFUN([AX_LANG_PYTHON],[ |
---|
660 | case $LANG_PY in |
---|
661 | 1) |
---|
662 | ifelse([$1], ,[:],$1) |
---|
663 | ;; |
---|
664 | esac |
---|
665 | ] |
---|
666 | ) |
---|
667 | AC_DEFUN([AX_LANG_CSHARP],[ |
---|
668 | case $LANG_CS in |
---|
669 | 1) |
---|
670 | ifelse([$1], ,[:],$1) |
---|
671 | ;; |
---|
672 | esac |
---|
673 | ] |
---|
674 | ) |
---|
675 | |
---|
676 | AC_DEFUN([AX_MSG_UNKOWN_CXX],[ |
---|
677 | AC_MSG_WARN([ |
---|
678 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
679 | U N K N O W N C++ COMPILER: ${cxx} |
---|
680 | ============================================================ |
---|
681 | Compilation is very likely to fail as we are not aware of |
---|
682 | this compiler yet. In case of problems please try to set |
---|
683 | additional flags by using environment variable CXXFLAGS. |
---|
684 | |
---|
685 | If CXXFLAGS does not help you, please edit either |
---|
686 | |
---|
687 | ${srcdir}/scripts/cxx.sh.in ; or |
---|
688 | ${srcdir}/scripts/link.sh.in |
---|
689 | |
---|
690 | Those scripts are getting called for compilation of all C++ |
---|
691 | source code (cxx.sh.in) or for linking binaries (link.sh.in). |
---|
692 | |
---|
693 | In very obscure cases, building the library may also fail.If |
---|
694 | so, please try variable ARFLAGS or edit |
---|
695 | |
---|
696 | ${srcdir}/scripts/lib.sh.in |
---|
697 | |
---|
698 | ============================================================ |
---|
699 | |
---|
700 | *** PLEASE PROVIDE FEEDBACK TO antlr.org - THANK YOU *** |
---|
701 | |
---|
702 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
703 | ]) |
---|
704 | ] |
---|
705 | ) |
---|
706 | |
---|
707 | |
---|
708 | AC_DEFUN([AX_ARG_WITH],[ |
---|
709 | AC_ARG_WITH( |
---|
710 | [$1], |
---|
711 | [AC_HELP_STRING( |
---|
712 | [--with-$1=ARG], |
---|
713 | [given argument will override variable $$2. For a detailed |
---|
714 | description of $$2 see below.]) |
---|
715 | ], |
---|
716 | [[$2]="${withval}"] |
---|
717 | ) |
---|
718 | AC_ARG_WITH( |
---|
719 | [$1flags], |
---|
720 | [AC_HELP_STRING( |
---|
721 | [--with-$1flags=ARG], |
---|
722 | [given argument will override variable $$2FLAGS. For a detailed |
---|
723 | description of $$2FLAGS see below.]) |
---|
724 | ], |
---|
725 | [[$2FLAGS]="${withval}"] |
---|
726 | ) |
---|
727 | ] |
---|
728 | ) |
---|
729 | |
---|
730 | |
---|
731 | AC_DEFUN([AX_ARG_ENABLE],[ |
---|
732 | $2=$4 |
---|
733 | AC_ARG_ENABLE( |
---|
734 | [$1], |
---|
735 | [AC_HELP_STRING( |
---|
736 | [--enable-$1], |
---|
737 | [$3]) |
---|
738 | ],[ |
---|
739 | $2="${enableval}" |
---|
740 | case "${$2}" in |
---|
741 | no|0|false) $2=0;; |
---|
742 | * ) $2=1;; |
---|
743 | esac |
---|
744 | ] |
---|
745 | ) |
---|
746 | ] |
---|
747 | ) |
---|
748 | |
---|
749 | |
---|
750 | AC_DEFUN([AX_MAKEVARS_ADD],[ |
---|
751 | cat >> "$[$1]" <<EOF |
---|
752 | $2 |
---|
753 | EOF |
---|
754 | ] |
---|
755 | ) |
---|
756 | |
---|
757 | AC_DEFUN([AX_BASENAME],[ |
---|
758 | test -n "$1" && { |
---|
759 | $1=`basename ${$1}` |
---|
760 | } |
---|
761 | ] |
---|
762 | ) |
---|