File: llnl_check_java_addclasspath_flag.m4

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (50 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download | duplicates (5)
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
dnl @synopsis LLNL_CHECK_JAVA_ADDCLASSPATH_FLAG
dnl  
dnl Defines JAVA_ADDCLASSPATH_FLAG to be either 
dnl -addclasspath or -classpath.  Kaffe prefers former
dnl Sun and GCJ the latter
dnl
dnl @author Gary Kumfert

AC_DEFUN([LLNL_CHECK_JAVA_ADDCLASSPATH_FLAG], 
[AC_REQUIRE([LLNL_PROG_JAVA])dnl
  AC_CACHE_CHECK(if $JAVA uses -addclasspath or -classpath, 
	         llnl_cv_check_java_addclasspath, [
    JAVA_TEST=Test.java
    CLASS_TEST=Test.class
    TEST=Test
changequote(, )dnl
cat << \EOF > $JAVA_TEST
/* [#]line __oline__ "configure" */
public class Test {
public static void main (String args[]) {
        System.exit (0);
} }
EOF
changequote([, ])dnl
    if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
      :
    else
      echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD()
      cat $JAVA_TEST >&AS_MESSAGE_LOG_FD()
      AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
    fi
    if AC_TRY_COMMAND($JAVA $JAVAFLAGS -addclasspath . $TEST) >/dev/null 2>&1; then
      llnl_cv_check_java_addclasspath="-addclasspath"
      rm -fr $JAVA_TEST $CLASS_TEST
    elif AC_TRY_COMMAND($JAVA $JAVAFLAGS -classpath . $TEST) >/dev/null 2>&1; then
      llnl_cv_check_java_addclasspath="-classpath"
      rm -fr $JAVA_TEST $CLASS_TEST
    elif AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then
      echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD()
      cat $JAVA_TEST >&AS_MESSAGE_LOG_FD()
      AC_MSG_ERROR($JAVA $JAVAFLAGS $TEST failed with both -classpath and -addclasspath )
    else 
      llnl_cv_check_java_addclasspath=
      rm -fr $JAVA_TEST $CLASS_TEST
    fi
  ])
  JAVA_ADDCLASSPATH_FLAG=$llnl_cv_check_java_addclasspath
  AC_SUBST(JAVA_ADDCLASSPATH_FLAG)
])