diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2008-03-10 17:32:19 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2008-03-10 17:32:19 +0000 |
commit | 9eef58fe4c9f5ee5a1c97ba21286fb8a6f9b62bc (patch) | |
tree | b4cbbcfb624fa2ad0171975c607323da23958379 /macros | |
parent | 0b95746ac1e7e7e44afa55b11b5115f8721dc212 (diff) | |
download | lasso-9eef58fe4c9f5ee5a1c97ba21286fb8a6f9b62bc.tar.gz lasso-9eef58fe4c9f5ee5a1c97ba21286fb8a6f9b62bc.tar.xz lasso-9eef58fe4c9f5ee5a1c97ba21286fb8a6f9b62bc.zip |
* configure.ac,macros/ac_*.m4: add new m4 macros to detect more JAVA related
things like junit.jar path to put into the CLASSPATH or desactivate
compilation of java bindings test.
Diffstat (limited to 'macros')
-rw-r--r-- | macros/ac_check_class.m4 | 147 | ||||
-rw-r--r-- | macros/ac_check_classpath.m4 | 63 | ||||
-rw-r--r-- | macros/ac_check_java_home.m4 | 62 | ||||
-rw-r--r-- | macros/ac_check_junit.m4 | 69 | ||||
-rw-r--r-- | macros/ac_check_rqrd_class.m4 | 65 | ||||
-rw-r--r-- | macros/ac_java_options.m4 | 46 | ||||
-rw-r--r-- | macros/ac_prog_jar.m4 | 52 | ||||
-rw-r--r-- | macros/ac_prog_java.m4 | 122 | ||||
-rw-r--r-- | macros/ac_prog_java_cc.m4 | 107 | ||||
-rw-r--r-- | macros/ac_prog_java_works.m4 | 137 | ||||
-rw-r--r-- | macros/ac_prog_javac.m4 | 84 | ||||
-rw-r--r-- | macros/ac_prog_javac_works.m4 | 75 | ||||
-rw-r--r-- | macros/ac_prog_javadoc.m4 | 53 | ||||
-rw-r--r-- | macros/ac_prog_javah.m4 | 43 | ||||
-rw-r--r-- | macros/ac_try_compile_java.m4 | 53 | ||||
-rw-r--r-- | macros/ac_try_run_javac.m4 | 54 | ||||
-rw-r--r-- | macros/check.m4 | 2 | ||||
-rw-r--r-- | macros/dps_java_check_class.m4 | 89 | ||||
-rw-r--r-- | macros/dps_libgcj_jar.m4 | 86 | ||||
-rw-r--r-- | macros/dps_xtra_classpath.m4 | 71 |
20 files changed, 1479 insertions, 1 deletions
diff --git a/macros/ac_check_class.m4 b/macros/ac_check_class.m4 new file mode 100644 index 00000000..264ba4d9 --- /dev/null +++ b/macros/ac_check_class.m4 @@ -0,0 +1,147 @@ +##### http://autoconf-archive.cryp.to/ac_check_class.html +# +# SYNOPSIS +# +# AC_CHECK_CLASS +# +# DESCRIPTION +# +# AC_CHECK_CLASS tests the existence of a given Java class, either in +# a jar or in a '.class' file. +# +# *Warning*: its success or failure can depend on a proper setting of +# the CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_CHECK_CLASS],[ +AC_REQUIRE([AC_PROG_JAVA]) +ac_var_name=`echo $1 | sed 's/\./_/g'` +dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is +dnl dynamic I need an extra level of extraction +AC_MSG_CHECKING([for $1 class]) +AC_CACHE_VAL(ac_cv_class_$ac_var_name, [ +if test x$ac_cv_prog_uudecode_base64 = xyes; then +dnl /** +dnl * Test.java: used to test dynamicaly if a class exists. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl Class lib; +dnl if (argv.length < 1) +dnl { +dnl System.err.println ("Missing argument"); +dnl System.exit (77); +dnl } +dnl try +dnl { +dnl lib = Class.forName (argv[0]); +dnl } +dnl catch (ClassNotFoundException e) +dnl { +dnl System.exit (1); +dnl } +dnl lib = null; +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ +AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt +ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV +ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp +VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM +amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi +AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B +AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA +AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN +uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK +AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA +JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA +JwAAAAIAKA== +==== +EOF + if uudecode$EXEEXT Test.uue; then + : + else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC + echo "configure: failed file was:" >&AC_FD_CC + cat Test.uue >&AC_FD_CC + ac_cv_prog_uudecode_base64=no + fi + rm -f Test.uue + if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then + eval "ac_cv_class_$ac_var_name=yes" + else + eval "ac_cv_class_$ac_var_name=no" + fi + rm -f Test.class +else + AC_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], + [eval "ac_cv_class_$ac_var_name=no"]) +fi +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" +HAVE_LAST_CLASS=$ac_var_val +if test x$ac_var_val = xyes; then + ifelse([$2], , :, [$2]) +else + ifelse([$3], , :, [$3]) +fi +]) +dnl for some reason the above statment didn't fall though here? +dnl do scripts have variable scoping? +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +AC_MSG_RESULT($ac_var_val) +]) diff --git a/macros/ac_check_classpath.m4 b/macros/ac_check_classpath.m4 new file mode 100644 index 00000000..bfbdda4a --- /dev/null +++ b/macros/ac_check_classpath.m4 @@ -0,0 +1,63 @@ +##### http://autoconf-archive.cryp.to/ac_check_classpath.html +# +# SYNOPSIS +# +# AC_CHECK_CLASSPATH +# +# DESCRIPTION +# +# AC_CHECK_CLASSPATH just displays the CLASSPATH, for the edification +# of the user. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_CHECK_CLASSPATH],[ +if test "x$CLASSPATH" = x; then + echo "You have no CLASSPATH, I hope it is good" +else + echo "You have CLASSPATH $CLASSPATH, hope it is correct" +fi +]) diff --git a/macros/ac_check_java_home.m4 b/macros/ac_check_java_home.m4 new file mode 100644 index 00000000..88bfbd18 --- /dev/null +++ b/macros/ac_check_java_home.m4 @@ -0,0 +1,62 @@ +##### http://autoconf-archive.cryp.to/ac_check_java_home.html +# +# SYNOPSIS +# +# AC_CHECK_JAVA_HOME +# +# DESCRIPTION +# +# Check for Sun Java (JDK / JRE) installation, where the 'java' VM is +# in. If found, set environment variable JAVA_HOME = Java +# installation home, else left JAVA_HOME untouch, which in most case +# means JAVA_HOME is empty. +# +# LAST MODIFICATION +# +# 2002-10-10 +# +# COPYLEFT +# +# Copyright (c) 2002 Gleen Salmon <gleensalmon@yahoo.com> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_CHECK_JAVA_HOME],[ +AC_REQUIRE([AC_EXEEXT])dnl +TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1` +if test x$TRY_JAVA_HOME != x; then + PATH=$PATH:$TRY_JAVA_HOME/bin +fi +AC_PATH_PROG(JAVA_PATH_NAME, java$EXEEXT) +if test x$JAVA_PATH_NAME != x; then + JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java$EXEEXT$/\1/"` +fi;dnl +]) diff --git a/macros/ac_check_junit.m4 b/macros/ac_check_junit.m4 new file mode 100644 index 00000000..3214335d --- /dev/null +++ b/macros/ac_check_junit.m4 @@ -0,0 +1,69 @@ +##### http://autoconf-archive.cryp.to/ac_check_junit.html +# +# SYNOPSIS +# +# AC_CHECK_JUNIT +# +# DESCRIPTION +# +# AC_CHECK_JUNIT tests the availability of the Junit testing +# framework, and set some variables for conditional compilation of +# the test suite by automake. +# +# If available, JUNIT is set to a command launching the text based +# user interface of Junit, @JAVA_JUNIT@ is set to $JAVA_JUNIT and +# @TESTS_JUNIT@ is set to $TESTS_JUNIT, otherwise they are set to +# empty values. +# +# You can use these variables in your Makefile.am file like this : +# +# # Some of the following classes are built only if junit is available +# JAVA_JUNIT = Class1Test.java Class2Test.java AllJunitTests.java +# +# noinst_JAVA = Example1.java Example2.java @JAVA_JUNIT@ +# +# EXTRA_JAVA = $(JAVA_JUNIT) +# +# TESTS_JUNIT = AllJunitTests +# +# TESTS = StandaloneTest1 StandaloneTest2 @TESTS_JUNIT@ +# +# EXTRA_TESTS = $(TESTS_JUNIT) +# +# AllJunitTests : +# echo "#! /bin/sh" > $@ +# echo "exec @JUNIT@ my.package.name.AllJunitTests" >> $@ +# chmod +x $@ +# +# LAST MODIFICATION +# +# 2001-03-02 +# +# COPYLEFT +# +# Copyright (c) 2001 Luc Maisonobe <luc@spaceroots.org> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_CHECK_JUNIT],[ +AC_CACHE_VAL(ac_cv_prog_JUNIT,[ +AC_CHECK_CLASS(junit.textui.TestRunner) +if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then + ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner' +fi]) +AC_MSG_CHECKING([for junit]) +if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then + JUNIT="$ac_cv_prog_JUNIT" + JAVA_JUNIT='$(JAVA_JUNIT)' + TESTS_JUNIT='$(TESTS_JUNIT)' +else + JUNIT= + JAVA_JUNIT= + TESTS_JUNIT= +fi +AC_MSG_RESULT($JUNIT) +AC_SUBST(JUNIT) +AC_SUBST(JAVA_JUNIT) +AC_SUBST(TESTS_JUNIT)]) diff --git a/macros/ac_check_rqrd_class.m4 b/macros/ac_check_rqrd_class.m4 new file mode 100644 index 00000000..7157dfe9 --- /dev/null +++ b/macros/ac_check_rqrd_class.m4 @@ -0,0 +1,65 @@ +##### http://autoconf-archive.cryp.to/ac_check_rqrd_class.html +# +# SYNOPSIS +# +# AC_CHECK_RQRD_CLASS +# +# DESCRIPTION +# +# AC_CHECK_RQRD_CLASS tests the existence of a given Java class, +# either in a jar or in a '.class' file and fails if it doesn't +# exist. Its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_CHECK_RQRD_CLASS],[ +CLASS=`echo $1|sed 's/\./_/g'` +AC_CHECK_CLASS($1) +if test "$HAVE_LAST_CLASS" = "no"; then + AC_MSG_ERROR([Required class $1 missing, exiting.]) +fi +]) diff --git a/macros/ac_java_options.m4 b/macros/ac_java_options.m4 new file mode 100644 index 00000000..290406e8 --- /dev/null +++ b/macros/ac_java_options.m4 @@ -0,0 +1,46 @@ +##### http://autoconf-archive.cryp.to/ac_java_options.html +# +# SYNOPSIS +# +# AC_JAVA_OPTIONS +# +# DESCRIPTION +# +# AC_JAVA_OPTIONS adds configure command line options used for Java +# m4 macros. This Macro is optional. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Devin Weaver <ktohg@tritarget.com> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_JAVA_OPTIONS],[ +AC_ARG_WITH(java-prefix, + [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) +AC_ARG_WITH(javac-flags, + [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) +AC_ARG_WITH(java-flags, + [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) +JAVAPREFIX=$with_java_prefix +JAVACFLAGS=$with_javac_flags +JAVAFLAGS=$with_java_flags +AC_SUBST(JAVAPREFIX)dnl +AC_SUBST(JAVACFLAGS)dnl +AC_SUBST(JAVAFLAGS)dnl +AC_SUBST(JAVA)dnl +AC_SUBST(JAVAC)dnl +]) diff --git a/macros/ac_prog_jar.m4 b/macros/ac_prog_jar.m4 new file mode 100644 index 00000000..18d453fc --- /dev/null +++ b/macros/ac_prog_jar.m4 @@ -0,0 +1,52 @@ +##### http://autoconf-archive.cryp.to/ac_prog_jar.html +# +# SYNOPSIS +# +# AC_PROG_JAR +# +# DESCRIPTION +# +# AC_PROG_JAR tests for an existing jar program. It uses the +# environment variable JAR then tests in sequence various common jar +# programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AC_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download that whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Egon Willighagen <e.willighagen@science.ru.nl> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_PROG_JAR],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test "x$JAVAPREFIX" = x; then + test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT) +else + test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX) +fi +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/macros/ac_prog_java.m4 b/macros/ac_prog_java.m4 new file mode 100644 index 00000000..6c0abf33 --- /dev/null +++ b/macros/ac_prog_java.m4 @@ -0,0 +1,122 @@ +##### http://autoconf-archive.cryp.to/ac_prog_java.html +# +# SYNOPSIS +# +# AC_PROG_JAVA +# +# DESCRIPTION +# +# Here is a summary of the main macros: +# +# AC_PROG_JAVAC: finds a Java compiler. +# +# AC_PROG_JAVA: finds a Java virtual machine. +# +# AC_CHECK_CLASS: finds if we have the given class (beware of +# CLASSPATH!). +# +# AC_CHECK_RQRD_CLASS: finds if we have the given class and stops +# otherwise. +# +# AC_TRY_COMPILE_JAVA: attempt to compile user given source. +# +# AC_TRY_RUN_JAVA: attempt to compile and run user given source. +# +# AC_JAVA_OPTIONS: adds Java configure options. +# +# AC_PROG_JAVA tests an existing Java virtual machine. It uses the +# environment variable JAVA then tests in sequence various common +# Java virtual machines. For political reasons, it starts with the +# free ones. You *must* call [AC_PROG_JAVAC] before. +# +# If you want to force a specific VM: +# +# - at the configure.in level, set JAVA=yourvm before calling +# AC_PROG_JAVA +# +# (but after AC_INIT) +# +# - at the configure level, setenv JAVA +# +# You can use the JAVA variable in your Makefile.in, with @JAVA@. +# +# *Warning*: its success or failure can depend on a proper setting of +# the CLASSPATH env. variable. +# +# TODO: allow to exclude virtual machines (rationale: most Java +# programs cannot run with some VM like kaffe). +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. +# +# A Web page, with a link to the latest CVS snapshot is at +# <http://www.internatif.org/bortzmeyer/autoconf-Java/>. +# +# This is a sample configure.in Process this file with autoconf to +# produce a configure script. +# +# AC_INIT(UnTag.java) +# +# dnl Checks for programs. +# AC_CHECK_CLASSPATH +# AC_PROG_JAVAC +# AC_PROG_JAVA +# +# dnl Checks for classes +# AC_CHECK_RQRD_CLASS(org.xml.sax.Parser) +# AC_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) +# +# AC_OUTPUT(Makefile) +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_PROG_JAVA],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test x$JAVAPREFIX = x; then + test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT) +else + test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT, $JAVAPREFIX) +fi +test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +AC_PROG_JAVA_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/macros/ac_prog_java_cc.m4 b/macros/ac_prog_java_cc.m4 new file mode 100644 index 00000000..0ad33f16 --- /dev/null +++ b/macros/ac_prog_java_cc.m4 @@ -0,0 +1,107 @@ +##### http://autoconf-archive.cryp.to/ac_prog_java_cc.html +# +# SYNOPSIS +# +# AC_PROG_JAVA_CC +# +# DESCRIPTION +# +# Finds the appropriate java compiler on your path. By preference the +# java compiler is gcj, then jikes then javac. +# +# The macro can take one argument specifying a space separated list +# of java compiler names. +# +# For example: +# +# AC_PROG_JAVA_CC(javac, gcj) +# +# The macro also sets the compiler options variable: JAVA_CC_OPTS to +# something sensible: +# +# - for GCJ it sets it to: @GCJ_OPTS@ +# (if GCJ_OPTS is not yet defined then it is set to "-C") +# +# - no other compiler has applicable options yet +# +# Here's an example configure.in: +# +# AC_INIT(Makefile.in) +# AC_PROG_JAVA_CC() +# AC_OUTPUT(Makefile) +# dnl End. +# +# And here's the start of the Makefile.in: +# +# PROJECT_ROOT := @srcdir@ +# # Tool definitions. +# JAVAC := @JAVA_CC@ +# JAVAC_OPTS := @JAVA_CC_OPTS@ +# JAR_TOOL := @jar_tool@ +# +# LAST MODIFICATION +# +# 2002-03-04 +# +# COPYLEFT +# +# Copyright (c) 2002 Nic Ferrier <nferrier@tapsellferrier.co.uk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +# AC_PROG_JAVA_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of java compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the java compiler. +AC_DEFUN([AC_PROG_JAVA_CC], +[AC_ARG_VAR([JAVA_CC], [java compiler command])dnl +AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(JAVA_CC, [$1])], +[AC_CHECK_TOOL(JAVA_CC, gcj) +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, javac) +fi +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, jikes) +fi +]) + +if test "$JAVA_CC" = "gcj"; then + if test "$GCJ_OPTS" = ""; then + AC_SUBST(GCJ_OPTS,-C) + fi + AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@, + [Define the compilation options for GCJ]) +fi +test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH]) +])# AC_PROG_JAVA_CC diff --git a/macros/ac_prog_java_works.m4 b/macros/ac_prog_java_works.m4 new file mode 100644 index 00000000..aa9c2ef9 --- /dev/null +++ b/macros/ac_prog_java_works.m4 @@ -0,0 +1,137 @@ +##### http://autoconf-archive.cryp.to/ac_prog_java_works.html +# +# SYNOPSIS +# +# AC_PROG_JAVA_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_PROG_JAVA_WORKS], [ +AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) +if test x$uudecode = xyes; then +AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ +dnl /** +dnl * Test.java: used to test if java compiler works. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s +YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG +aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB +AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB +AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= +==== +EOF +if uudecode$EXEEXT Test.uue; then + ac_cv_prog_uudecode_base64=yes +else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC + echo "configure: failed file was:" >&AC_FD_CC + cat Test.uue >&AC_FD_CC + ac_cv_prog_uudecode_base64=no +fi +rm -f Test.uue]) +fi +if test x$ac_cv_prog_uudecode_base64 != xyes; then + rm -f Test.class + AC_MSG_WARN([I have to compile Test.class from scratch]) + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi + if test x$ac_cv_prog_javac_works = x; then + AC_PROG_JAVAC + fi +fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +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 test x$ac_cv_prog_uudecode_base64 != xyes; then + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +fi +if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -fr $JAVA_TEST $CLASS_TEST Test.uue +]) +AC_PROVIDE([$0])dnl +] +) diff --git a/macros/ac_prog_javac.m4 b/macros/ac_prog_javac.m4 new file mode 100644 index 00000000..6f2989e2 --- /dev/null +++ b/macros/ac_prog_javac.m4 @@ -0,0 +1,84 @@ +##### http://autoconf-archive.cryp.to/ac_prog_javac.html +# +# SYNOPSIS +# +# AC_PROG_JAVAC +# +# DESCRIPTION +# +# AC_PROG_JAVAC tests an existing Java compiler. It uses the +# environment variable JAVAC then tests in sequence various common +# Java compilers. For political reasons, it starts with the free +# ones. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AC_PROG_JAVAC +# +# - at the configure level, setenv JAVAC +# +# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +# +# *Warning*: its success or failure can depend on a proper setting of +# the CLASSPATH env. variable. +# +# TODO: allow to exclude compilers (rationale: most Java programs +# cannot compile with some compilers like guavac). +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_PROG_JAVAC],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test "x$JAVAPREFIX" = x; then + test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" jikes$EXEEXT guavac$EXEEXT javac$EXEEXT) +else + test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" jikes$EXEEXT guavac$EXEEXT javac$EXEEXT, $JAVAPREFIX) +fi +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AC_PROG_JAVAC_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/macros/ac_prog_javac_works.m4 b/macros/ac_prog_javac_works.m4 new file mode 100644 index 00000000..5a16ca7f --- /dev/null +++ b/macros/ac_prog_javac_works.m4 @@ -0,0 +1,75 @@ +##### http://autoconf-archive.cryp.to/ac_prog_javac_works.html +# +# SYNOPSIS +# +# AC_PROG_JAVAC_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([AC_PROG_JAVAC_WORKS],[ +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) diff --git a/macros/ac_prog_javadoc.m4 b/macros/ac_prog_javadoc.m4 new file mode 100644 index 00000000..357a4a0e --- /dev/null +++ b/macros/ac_prog_javadoc.m4 @@ -0,0 +1,53 @@ +##### http://autoconf-archive.cryp.to/ac_prog_javadoc.html +# +# SYNOPSIS +# +# AC_PROG_JAVADOC +# +# DESCRIPTION +# +# AC_PROG_JAVADOC tests for an existing javadoc generator. It uses +# the environment variable JAVADOC then tests in sequence various +# common javadoc generator. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVADOC=yourgenerator before +# calling AC_PROG_JAVADOC +# +# - at the configure level, setenv JAVADOC +# +# You can use the JAVADOC variable in your Makefile.in, with +# @JAVADOC@. +# +# Note: This macro depends on the autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download that whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Egon Willighagen <e.willighagen@science.ru.nl> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_PROG_JAVADOC],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test "x$JAVAPREFIX" = x; then + test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc$EXEEXT) +else + test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc, $JAVAPREFIX) +fi +test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/macros/ac_prog_javah.m4 b/macros/ac_prog_javah.m4 new file mode 100644 index 00000000..3285ba74 --- /dev/null +++ b/macros/ac_prog_javah.m4 @@ -0,0 +1,43 @@ +##### http://autoconf-archive.cryp.to/ac_prog_javah.html +# +# SYNOPSIS +# +# AC_PROG_JAVAH +# +# DESCRIPTION +# +# AC_PROG_JAVAH tests the availability of the javah header generator +# and looks for the jni.h header file. If available, JAVAH is set to +# the full path of javah and CPPFLAGS is updated accordingly. +# +# LAST MODIFICATION +# +# 2002-03-25 +# +# COPYLEFT +# +# Copyright (c) 2002 Luc Maisonobe <luc@spaceroots.org> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_PROG_JAVAH],[ +AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +test "x$JAVAH" = x && AC_CHECK_PROGS(JAVAH,gjavah gcjh javah) +if test "x$JAVAH" != x ; then + AC_TRY_CPP([#include <jni.h>],,[ + ac_save_CPPFLAGS="$CPPFLAGS" +changequote(, )dnl + ac_dir=`echo $ac_cv_path_JAVAH | sed 's,\(.*\)/[^/]*/[^/]*$,\1/include,'` + ac_machdep=`echo $build_os | sed 's,[-0-9].*,,' | sed 's,cygwin,win32,'` +changequote([, ])dnl + CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" + AC_TRY_CPP([#include <jni.h>], + ac_save_CPPFLAGS="$CPPFLAGS", + AC_MSG_WARN([unable to include <jni.h>])) + CPPFLAGS="$ac_save_CPPFLAGS"]) +else + AC_MSG_ERROR([no acceptable Javah compiler found in \$PATH]) +fi]) diff --git a/macros/ac_try_compile_java.m4 b/macros/ac_try_compile_java.m4 new file mode 100644 index 00000000..ab49aae5 --- /dev/null +++ b/macros/ac_try_compile_java.m4 @@ -0,0 +1,53 @@ +##### http://autoconf-archive.cryp.to/ac_try_compile_java.html +# +# SYNOPSIS +# +# AC_TRY_COMPILE_JAVA +# +# DESCRIPTION +# +# AC_TRY_COMPILE_JAVA attempt to compile user given source. +# +# *Warning*: its success or failure can depend on a proper setting of +# the CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Devin Weaver <ktohg@tritarget.com> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_TRY_COMPILE_JAVA],[ +AC_REQUIRE([AC_PROG_JAVAC])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [import $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat Test.java >&AC_FD_CC +ifelse([$4], , , [ rm -fr Test* + $4 +])dnl +fi +rm -fr Test*]) diff --git a/macros/ac_try_run_javac.m4 b/macros/ac_try_run_javac.m4 new file mode 100644 index 00000000..188c414a --- /dev/null +++ b/macros/ac_try_run_javac.m4 @@ -0,0 +1,54 @@ +##### http://autoconf-archive.cryp.to/ac_try_run_javac.html +# +# SYNOPSIS +# +# AC_TRY_RUN_JAVA +# +# DESCRIPTION +# +# AC_TRY_RUN_JAVA attempt to compile and run user given source. +# +# *Warning*: its success or failure can depend on a proper setting of +# the CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java +# programs. It is VERY IMPORTANT that you download the whole set, +# some macros depend on other. Unfortunately, the autoconf archive +# does not support the concept of set of macros, so I had to break it +# for submission. The general documentation, as well as the sample +# configure.in, is included in the AC_PROG_JAVA macro. +# +# LAST MODIFICATION +# +# 2000-07-19 +# +# COPYLEFT +# +# Copyright (c) 2000 Devin Weaver <ktohg@tritarget.com> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_TRY_RUN_JAVA],[ +AC_REQUIRE([AC_PROG_JAVAC])dnl +AC_REQUIRE([AC_PROG_JAVA])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [include $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat Test.java >&AC_FD_CC +ifelse([$4], , , [ rm -fr Test* + $4 +])dnl +fi +rm -fr Test*]) diff --git a/macros/check.m4 b/macros/check.m4 index 97bfd9c4..a2e0812d 100644 --- a/macros/check.m4 +++ b/macros/check.m4 @@ -2,7 +2,7 @@ dnl AM_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS dnl -AC_DEFUN(AM_PATH_CHECK, +AC_DEFUN([AM_PATH_CHECK], [ AC_ARG_WITH(check, [ --with-check=PATH prefix where check is installed [default=auto]]) diff --git a/macros/dps_java_check_class.m4 b/macros/dps_java_check_class.m4 new file mode 100644 index 00000000..a86d6416 --- /dev/null +++ b/macros/dps_java_check_class.m4 @@ -0,0 +1,89 @@ +##### http://autoconf-archive.cryp.to/dps_java_check_class.html +# +# SYNOPSIS +# +# DPS_JAVA_CHECK_CLASS(<class>,<action-if-found>,<action-if-not-found>) +# +# DESCRIPTION +# +# Test if a Java class is available. Based on AC_PROG_JAVAC_WORKS. +# This version uses a cache variable which is both compiler, options +# and classpath dependent (so if you switch from javac to gcj it +# correctly notices and redoes the test). +# +# The macro tries to compile a minimal program importing <class>. +# Some newer compilers moan about the failure to use this but fail or +# produce a class file anyway. All moaing is sunk to /dev/null since +# I only wanted to know if the class could be imported. This is a +# recommended followup to DPS_CHECK_JAVA_PLUGIN with classpath +# appropriately adjusted. +# +# LAST MODIFICATION +# +# 2008-01-28 +# +# COPYLEFT +# +# Copyright (c) 2008 Duncan Simpson <dps@simpson.demon.co.uk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([DPS_JAVA_CHECK_CLASS],[ +m4_define([cache_val],[m4_translit(dps_cv_have_java_class_$1, " ." ,"__")]) +if test "x$CLASSPATH" != "x"; then +xtra=" with classpath ${CLASSPATH}" +xopts=`echo ${CLASSPATH} | ${SED} 's/^ *://'` +xopts="-classpath $xopts" +else xtra=""; xopts=""; fi +cache_var="cache_val"AS_TR_SH([_Jc_${JAVAC}_Cp_${CLASSPATH}]) +AC_CACHE_CHECK([if the $1 class is available$xtra], [$cache_var], [ +JAVA_TEST=Testing.java +CLASS_TEST=Testing.class +cat << \EOF > $JAVA_TEST +/* [#]xline __oline__ "configure" */ +import $1; +public class Testing { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $xopts $JAVA_TEST) >/dev/null 2>&1; then + eval "${cache_var}=yes" +else + eval "${cache_var}=no" + echo "configure: failed program was:" >&AC_FD_CC + cat $JAVA_TEST >&AC_FD_CC +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +if eval 'test "x$'${cache_var}'" = "xyes"'; then +$2 +true; else +$3 +false; fi]) diff --git a/macros/dps_libgcj_jar.m4 b/macros/dps_libgcj_jar.m4 new file mode 100644 index 00000000..777cd5c6 --- /dev/null +++ b/macros/dps_libgcj_jar.m4 @@ -0,0 +1,86 @@ +##### http://autoconf-archive.cryp.to/dps_libgcj_jar.html +# +# SYNOPSIS +# +# DPS_LIBGCJ_JAR +# +# DESCRIPTION +# +# Locate libgcj.jar so you can place it before everything else when +# using gcj. +# +# LAST MODIFICATION +# +# 2008-01-28 +# +# COPYLEFT +# +# Copyright (c) 2008 Duncan Simpson <dps@simpson.demon.co.uk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([DPS_LIBGCJ_JAR], +[ +AC_REQUIRE([AC_EXEEXT]) +AC_REQUIRE([AC_PROG_JAVAC]) +AC_REQUIRE([AC_PROG_FGREP]) +AC_CHECK_PROG(SED, sed) +if test "x$SED" = "x"; then +AC_MSG_WARN([sed not avaiable, so libgcj.jar test skipped]) +else +AC_MSG_CHECKING([if $JAVAC is gcj]); +jc=`eval "[echo x$JAVAC | $SED 's/^x.*\\/\\([^/]*\\)\$/x\\1/;s/^ *\\([^ ]*\\) .*$/\\1/;s/"$EXEEXT"$//']"` +if test "x$jc" != "xxgcj"; then +AC_MSG_RESULT(no) +else +AC_MSG_RESULT(yes) +AC_MSG_CHECKING([libgcj.jar location]) +save_cp="$CLASSPATH"; +unset CLASSPATH; +AC_MSG_CHECKING([gcj default classpath]) +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +lgcj=`eval "[$JAVAC -v -C Test.java 2>&1 | $FGREP \\(system\\) | $SED 's/^ *\\([^ ]*\\) .*$/\\1/;s/\\.jar\\//.jar/']"`; +if test -f Test.class && test "x$lgcj" != "x"; then +AC_MSG_RESULT($lgcj) +$1="$lgcj:" +else +AC_MSG_RESULT(failed) +$1="" +fi +if test "x$save_cp" != "x"; then CLASSPATH="$save_cp"; fi +rm -f Test.java Test.class +fi +fi +]) diff --git a/macros/dps_xtra_classpath.m4 b/macros/dps_xtra_classpath.m4 new file mode 100644 index 00000000..83cc37e8 --- /dev/null +++ b/macros/dps_xtra_classpath.m4 @@ -0,0 +1,71 @@ +##### http://autoconf-archive.cryp.to/dps_xtra_classpath.html +# +# SYNOPSIS +# +# DPS_XTRA_CLASSPATH(<classpath>,<class>,<jarfile>,<action-if-found>,<action-if-not-found>) +# +# DESCRIPTION +# +# Set $1 to extra classpath components required for class $2 found in +# a jar file in $3. If the class is found do $4 and otherwise do $5. +# Uses DPS_JAVA_CHECK_CLASS for testing whether a class is avialable +# +# LAST MODIFICATION +# +# 2008-01-28 +# +# COPYLEFT +# +# Copyright (c) 2008 Duncan Simpson <dps@simpson.demon.co.uk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the respective Autoconf Macro's copyright +# owner gives unlimited permission to copy, distribute and modify the +# configure scripts that are the output of Autoconf when processing +# the Macro. You need not follow the terms of the GNU General Public +# License when using or distributing such scripts, even though +# portions of the text of the Macro appear in them. The GNU General +# Public License (GPL) does govern all other use of the material that +# constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the +# Autoconf Macro released by the Autoconf Macro Archive. When you +# make and distribute a modified version of the Autoconf Macro, you +# may extend this special exception to the GPL to apply to your +# modified version as well. + +AC_DEFUN([DPS_XTRA_CLASSPATH],[ +AC_CHECK_PROG(SED, sed) +DPS_JAVA_CHECK_CLASS([$2],[got="yes"],[got="no"]) +cpxtra=""; saved_cp="${CLASSPATH}"; +for jhome in `ls -dr /usr/share/java /usr/java/* /usr/local/java/* 2> /dev/null`; do +for jdir in lib jre/lib . ; do +for jfile in $3; do +if test "x$got" != "xyes" && test -f "$jhome/$jdir/$jfile"; then +CLASSPATH="${saved_cp}:$jhome/$jdir/$jfile" +DPS_JAVA_CHECK_CLASS([$2],[got="yes"; cpxtra="$jhome/$jdir/$jfile:"],[got="no"]) +fi; done; done; done +if test "x${saved_cp}" != "x"; then +CLASSPATH="${saved_cp}" +else unset CLASSPATH; fi +if test "x$got" = "xyes"; then +$1="$cpxtra" +$4 +true; else +$5 +false; fi +]) |