source: proiecte/HadoopJUnit/hadoop-0.20.1/src/c++/libhdfs/m4/apjava.m4 @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 4.0 KB
Line 
1dnl
2dnl Licensed to the Apache Software Foundation (ASF) under one or more
3dnl contributor license agreements.  See the NOTICE file distributed with
4dnl this work for additional information regarding copyright ownership.
5dnl The ASF licenses this file to You under the Apache License, Version 2.0
6dnl (the "License"); you may not use this file except in compliance with
7dnl the License.  You may obtain a copy of the License at
8dnl
9dnl     http://www.apache.org/licenses/LICENSE-2.0
10dnl
11dnl Unless required by applicable law or agreed to in writing, software
12dnl distributed under the License is distributed on an "AS IS" BASIS,
13dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14dnl See the License for the specific language governing permissions and
15dnl limitations under the License.
16dnl
17
18dnl -------------------------------------------------------------------------
19dnl Author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
20dnl Version $Id$
21dnl -------------------------------------------------------------------------
22
23AC_DEFUN([AP_PROG_JAVAC_WORKS],[
24  AC_CACHE_CHECK([wether the Java compiler ($JAVAC) works],ap_cv_prog_javac_works,[
25    echo "public class Test {}" > Test.java
26    $JAVAC $JAVACFLAGS Test.java > /dev/null 2>&1
27    if test $? -eq 0
28    then
29      rm -f Test.java Test.class
30      ap_cv_prog_javac_works=yes
31    else
32      rm -f Test.java Test.class
33      AC_MSG_RESULT(no)
34      AC_MSG_ERROR([installation or configuration problem: javac cannot compile])
35    fi
36  ])
37])
38
39dnl Check for JAVA compilers.
40AC_DEFUN([AP_PROG_JAVAC],[
41  if test "$SABLEVM" != "NONE"
42  then
43    AC_PATH_PROG(JAVACSABLE,javac-sablevm,NONE,$JAVA_HOME/bin)
44  else
45    JAVACSABLE="NONE"
46  fi
47  if test "$JAVACSABLE" = "NONE"
48  then
49    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
50    AC_PATH_PROG(JAVAC,javac,NONE,$XPATH)
51  else
52    AC_PATH_PROG(JAVAC,javac-sablevm,NONE,$JAVA_HOME/bin)
53  fi
54  AC_MSG_RESULT([$JAVAC])
55  if test "$JAVAC" = "NONE"
56  then
57    AC_MSG_ERROR([javac not found])
58  fi
59  AP_PROG_JAVAC_WORKS()
60  AC_PROVIDE([$0])
61  AC_SUBST(JAVAC)
62  AC_SUBST(JAVACFLAGS)
63])
64
65dnl Check for jar archivers.
66AC_DEFUN([AP_PROG_JAR],[
67  if test "$SABLEVM" != "NONE"
68  then
69    AC_PATH_PROG(JARSABLE,jar-sablevm,NONE,$JAVA_HOME/bin)
70  else
71    JARSABLE="NONE"
72  fi
73  if test "$JARSABLE" = "NONE"
74  then
75    XPATH="$JAVA_HOME/bin:$JAVA_HOME/Commands:$PATH"
76    AC_PATH_PROG(JAR,jar,NONE,$XPATH)
77  else
78    AC_PATH_PROG(JAR,jar-sablevm,NONE,$JAVA_HOME/bin)
79  fi
80  if test "$JAR" = "NONE"
81  then
82    AC_MSG_ERROR([jar not found])
83  fi
84  AC_PROVIDE([$0])
85  AC_SUBST(JAR)
86])
87
88AC_DEFUN([AP_JAVA],[
89  AC_ARG_WITH(java,[  --with-java=DIR         Specify the location of your JDK installation],[
90    AC_MSG_CHECKING([JAVA_HOME])
91    if test -d "$withval"
92    then
93      JAVA_HOME="$withval"
94      AC_MSG_RESULT([$JAVA_HOME])
95    else
96      AC_MSG_RESULT([failed])
97      AC_MSG_ERROR([$withval is not a directory])
98    fi
99    AC_SUBST(JAVA_HOME)
100  ])
101  if test x"$JAVA_HOME" = x
102  then
103    AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
104  fi
105])
106
107dnl check if the JVM in JAVA_HOME is sableVM
108dnl $JAVA_HOME/bin/sablevm and /opt/java/lib/sablevm/bin are tested.
109AC_DEFUN([AP_SABLEVM],[
110  if test x"$JAVA_HOME" != x
111  then
112    AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin)
113    if test "$SABLEVM" = "NONE"
114    then
115      dnl java may be SableVM.
116      if $JAVA_HOME/bin/java -version 2> /dev/null | grep SableVM > /dev/null
117      then
118        SABLEVM=$JAVA_HOME/bin/java
119      fi
120    fi
121    if test "$SABLEVM" != "NONE"
122    then
123      AC_MSG_RESULT([Using sableVM: $SABLEVM])
124      CFLAGS="$CFLAGS -DHAVE_SABLEVM"
125    fi
126  fi
127])
128
129dnl check if the JVM in JAVA_HOME is kaffe
130dnl $JAVA_HOME/bin/kaffe is tested.
131AC_DEFUN([AP_KAFFE],[
132  if test x"$JAVA_HOME" != x
133  then
134    AC_PATH_PROG(KAFFEVM,kaffe,NONE,$JAVA_HOME/bin)
135    if test "$KAFFEVM" != "NONE"
136    then
137      AC_MSG_RESULT([Using kaffe: $KAFFEVM])
138      CFLAGS="$CFLAGS -DHAVE_KAFFEVM"
139      LDFLAGS="$LDFLAGS -Wl,-rpath $JAVA_HOME/jre/lib/$HOST_CPU -L $JAVA_HOME/jre/lib/$HOST_CPU -lkaffevm"
140    fi
141  fi
142])
Note: See TracBrowser for help on using the repository browser.