dnl RTB_EXPAND_DIR(VARNAME, DIR) dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR, dnl and assigns the resulting string to VARNAME dnl example: RTB_EXPAND_DIR(ROBOTDIR, "${RTB_DIR}/Robots") dnl eg, then: AC_DEFINE_UNQUOTED(ROBOTDIR, "$ROBOTDIR") dnl by Alexandre Oliva dnl from http://www.cygnus.com/ml/automake/1998-Aug/0040.html AC_DEFUN([RTB_EXPAND_DIR], [ $1=$2 $1=`( test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" eval echo \""[$]$1"\" )` ]) dnl @synopsis AC_CHECK_CLASS dnl dnl AC_CHECK_CLASS tests the existence of a given Java class, either in dnl a jar or in a '.class' file. dnl dnl *Warning*: its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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) ]) dnl @synopsis AC_CHECK_CLASSPATH dnl dnl AC_CHECK_CLASSPATH just displays the CLASSPATH, for the edification dnl of the user. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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 ]) dnl @synopsis AC_CHECK_JUNIT dnl dnl AC_CHECK_JUNIT tests the availability of the Junit testing dnl framework, and set some variables for conditional compilation dnl of the test suite by automake. dnl dnl If available, JUNIT is set to a command launching the text dnl based user interface of Junit, @JAVA_JUNIT@ is set to $JAVA_JUNIT dnl and @TESTS_JUNIT@ is set to $TESTS_JUNIT, otherwise they are set dnl to empty values. dnl dnl You can use these variables in your Makefile.am file like this : dnl dnl # Some of the following classes are built only if junit is available dnl JAVA_JUNIT = Class1Test.java Class2Test.java AllJunitTests.java dnl dnl noinst_JAVA = Example1.java Example2.java @JAVA_JUNIT@ dnl dnl EXTRA_JAVA = $(JAVA_JUNIT) dnl dnl TESTS_JUNIT = AllJunitTests dnl dnl TESTS = StandaloneTest1 StandaloneTest2 @TESTS_JUNIT@ dnl dnl EXTRA_TESTS = $(TESTS_JUNIT) dnl dnl AllJunitTests : dnl echo "#! /bin/sh" > $@ dnl echo "exec @JUNIT@ my.package.name.AllJunitTests" >> $@ dnl chmod +x $@ dnl dnl @author Luc Maisonobe dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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($JAVA_JUNIT) AC_SUBST(JUNIT) AC_SUBST(JAVA_JUNIT) AC_SUBST(TESTS_JUNIT)]) dnl @synopsis AC_CHECK_RQRD_CLASS dnl dnl AC_CHECK_RQRD_CLASS tests the existence of a given Java class, either in dnl a jar or in a '.class' file and fails if it doesn't exist. dnl Its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([Required class $1 missing, exiting.]) fi ]) dnl @synopsis AC_JAVA_OPTIONS dnl dnl AC_JAVA_OPTIONS adds configure command line options used for Java m4 dnl macros. This Macro is optional. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Devin Weaver dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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 ]) dnl @synopsis AC_PROG_JAR dnl dnl AC_PROG_JAR tests for an existing jar program. It uses the environment dnl variable JAR then tests in sequence various common jar programs. dnl dnl If you want to force a specific compiler: dnl dnl - at the configure.in level, set JAR=yourcompiler before calling dnl AC_PROG_JAR dnl dnl - at the configure level, setenv JAR dnl dnl You can use the JAR variable in your Makefile.in, with @JAR@. dnl dnl Note: This macro depends on the autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download that whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl dnl The general documentation of those macros, as well as the sample dnl configure.in, is included in the AC_PROG_JAVA macro. dnl dnl @author Egon Willighagen dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([no acceptable jar program found in \$PATH]) AC_PROVIDE([$0])dnl ]) dnl @synopsis AC_PROG_JAVA_CC dnl dnl Finds the appropriate java compiler on your path. By preference dnl the java compiler is gcj, then jikes then javac. dnl dnl The macro can take one argument specifying a space separated list dnl of java compiler names. dnl dnl For example: dnl dnl AC_PROG_JAVA_CC(javac, gcj) dnl dnl The macro also sets the compiler options variable: JAVA_CC_OPTS dnl to something sensible: dnl - for GCJ it sets it to: @GCJ_OPTS@ dnl (if GCJ_OPTS is not yet defined then it is set to "-C") dnl dnl - no other compiler has applicable options yet dnl dnl Here's an example configure.in: dnl dnl AC_INIT(Makefile.in) dnl AC_PROG_JAVA_CC() dnl AC_OUTPUT(Makefile) dnl dnl End. dnl dnl And here's the start of the Makefile.in: dnl dnl PROJECT_ROOT := @srcdir@ dnl # Tool definitions. dnl JAVAC := @JAVA_CC@ dnl JAVAC_OPTS := @JAVA_CC_OPTS@ dnl JAR_TOOL := @jar_tool@ dnl dnl dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl @author Nic Ferrier dnl # 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_WARN([no acceptable java compiler found in \$PATH]) ])# AC_PROG_JAVA_CC dnl @synopsis AC_PROG_JAVAC dnl dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the environment dnl variable JAVAC then tests in sequence various common Java compilers. For dnl political reasons, it starts with the free ones. dnl dnl If you want to force a specific compiler: dnl dnl - at the configure.in level, set JAVAC=yourcompiler before calling dnl AC_PROG_JAVAC dnl dnl - at the configure level, setenv JAVAC dnl dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@. dnl dnl *Warning*: its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl TODO: allow to exclude compilers (rationale: most Java programs cannot compile dnl with some compilers like guavac). dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT) else test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT, $JAVAPREFIX) fi test "x$JAVAC" = x && AC_MSG_WARN([no acceptable Java compiler found in \$PATH]) AC_PROG_JAVAC_WORKS AC_PROVIDE([$0])dnl ]) dnl @synopsis AC_PROG_JAVAC_WORKS dnl dnl Internal use ONLY. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([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 ]) dnl @synopsis AC_PROG_JAVADOC dnl dnl AC_PROG_JAVADOC tests for an existing javadoc generator. It uses the environment dnl variable JAVADOC then tests in sequence various common javadoc generator. dnl dnl If you want to force a specific compiler: dnl dnl - at the configure.in level, set JAVADOC=yourgenerator before calling dnl AC_PROG_JAVADOC dnl dnl - at the configure level, setenv JAVADOC dnl dnl You can use the JAVADOC variable in your Makefile.in, with @JAVADOC@. dnl dnl Note: This macro depends on the autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download that whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl dnl The general documentation of those macros, as well as the sample dnl configure.in, is included in the AC_PROG_JAVA macro. dnl dnl @author Egon Willighagen dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([no acceptable javadoc generator found in \$PATH]) AC_PROVIDE([$0])dnl ]) dnl @synopsis AC_PROG_JAVAH dnl dnl AC_PROG_JAVAH tests the availability of the javah header generator dnl and looks for the jni.h header file. If available, JAVAH is set to dnl the full path of javah and CPPFLAGS is updated accordingly. dnl dnl @author Luc Maisonobe dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl AC_DEFUN([AC_PROG_JAVAH],[ AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) if test x"`eval 'echo $ac_cv_path_JAVAH'`" != x ; then AC_TRY_CPP([#include ],,[ 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 ], ac_save_CPPFLAGS="$CPPFLAGS", AC_MSG_WARN([unable to include ])) CPPFLAGS="$ac_save_CPPFLAGS"]) fi]) dnl @synopsis AC_PROG_JAVA dnl dnl Here is a summary of the main macros: dnl dnl AC_PROG_JAVAC: finds a Java compiler. dnl dnl AC_PROG_JAVA: finds a Java virtual machine. dnl dnl AC_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). dnl dnl AC_CHECK_RQRD_CLASS: finds if we have the given class and stops otherwise. dnl dnl AC_TRY_COMPILE_JAVA: attempt to compile user given source. dnl dnl AC_TRY_RUN_JAVA: attempt to compile and run user given source. dnl dnl AC_JAVA_OPTIONS: adds Java configure options. dnl dnl AC_PROG_JAVA tests an existing Java virtual machine. It uses the dnl environment variable JAVA then tests in sequence various common Java dnl virtual machines. For political reasons, it starts with the free ones. dnl You *must* call [AC_PROG_JAVAC] before. dnl dnl If you want to force a specific VM: dnl dnl - at the configure.in level, set JAVA=yourvm before calling AC_PROG_JAVA dnl (but after AC_INIT) dnl dnl - at the configure level, setenv JAVA dnl dnl You can use the JAVA variable in your Makefile.in, with @JAVA@. dnl dnl *Warning*: its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl TODO: allow to exclude virtual machines (rationale: most Java programs dnl cannot run with some VM like kaffe). dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl dnl A Web page, with a link to the latest CVS snapshot is at dnl . dnl dnl This is a sample configure.in dnl Process this file with autoconf to produce a configure script. dnl dnl AC_INIT(UnTag.java) dnl dnl dnl Checks for programs. dnl AC_CHECK_CLASSPATH dnl AC_PROG_JAVAC dnl AC_PROG_JAVA dnl dnl dnl Checks for classes dnl AC_CHECK_RQRD_CLASS(org.xml.sax.Parser) dnl AC_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) dnl dnl AC_OUTPUT(Makefile) dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([no acceptable Java virtual machine found in \$PATH]) AC_PROG_JAVA_WORKS AC_PROVIDE([$0])dnl ]) dnl @synopsis AC_PROG_JAVA_WORKS dnl dnl Internal use ONLY. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Stephane Bortzmeyer dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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_WARN([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_WARN(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_WARN(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi rm -fr $JAVA_TEST $CLASS_TEST Test.uue ]) AC_PROVIDE([$0])dnl ] ) dnl @synopsis AC_TRY_COMPILE_JAVA dnl dnl AC_TRY_COMPILE_JAVA attempt to compile user given source. dnl dnl *Warning*: its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Devin Weaver dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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*]) dnl @synopsis AC_TRY_RUN_JAVA dnl dnl AC_TRY_RUN_JAVA attempt to compile and run user given source. dnl dnl *Warning*: its success or failure can depend on a proper setting of the dnl CLASSPATH env. variable. dnl dnl Note: This is part of the set of autoconf M4 macros for Java programs. dnl It is VERY IMPORTANT that you download the whole set, some dnl macros depend on other. Unfortunately, the autoconf archive does not dnl support the concept of set of macros, so I had to break it for dnl submission. dnl The general documentation, as well as the sample configure.in, is dnl included in the AC_PROG_JAVA macro. dnl dnl @author Devin Weaver dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl 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*]) dnl @synopsis AX_SYS_PERLSHARPBANG dnl Determine how the perl interpreter is located by the OS kernel and make dnl substitution variable PERL_SHEBANG available. Does AC_PATH_PROG to find dnl the path to perl. As a side-effect, that sets PERLINTERP and makes it dnl available as a substitution variable. dnl dnl Note: dnl The macro allows for the possibility (expected to be seldom used) of an dnl explicit user override (the "user" being the operator executing the final dnl 'configure' script, in this context) by making the option argument like: dnl dnl --with-perl-shebang='#! /my/funky/perlpath' # OR dnl --with-perl-shebang='/my/funky/perlpath' # we just throw away the #! anyway dnl # bec it must be absent in Makefile dnl dnl Rationale: The are various ways of starting an interpreter on different dnl *nix-like systems. Many use the simple dnl #!/usr/bin/perl dnl but it could be instead dnl #!/usr/local/bin/perl dnl and there is even the possibility that the user wants dnl #!/usr/bin/env perl dnl to find whichever perl comes first in the current $PATH. This is preferred dnl by some of us because we run multiple perl installations on the same box. dnl Adjusting our $PATH then allows us to set precedence over other perls, even dnl whatever the "house" version is. dnl dnl Users on very non-unix systems like MS Windows do not have a kernel that dnl does this kind of thing from the first line of script files, but instead the dnl perl on their machine is started and merely notices whatever comes after dnl the interpreter path on this first line of the script (options like "-w"). dnl dnl dnl Acknowledgement: this macro was inspired in part by dnl authored by Dean Povey, see the AC-Archive (ac-archive.sf.net). dnl dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl @author Soren Andersen dnl AC_DEFUN([AX_SYS_PERLSHARPBANG],[dnl AC_PATH_PROG(PERLINTERP,perl,perl) ac_cv_path_perlinterp="$PERLINTERP" _sHpB='#!' AC_ARG_WITH(perl-shebang, AC_HELP_STRING([--with-perl-shebang], [override what perl thinks is the way for the kernel to start it (seldom needed)]dnl ), [opt_perl_shebang="$withval"]dnl ,dnl [opt_perl_shebang="not_set"]dnl )dnl AC_CACHE_CHECK([whether explicit instead of detected sharpbang is to be used], ax_cv_opt_perl_shebang, [ case "$opt_perl_shebang" in not_set ) ax_cv_opt_perl_shebang='' ;; * ) ax_cv_opt_perl_shebang=`echo "$opt_perl_shebang" | sed -e's|^#!\s*\(.*\)$|\1|'` esac ]dnl )dnl if test "A$ax_cv_opt_perl_shebang" != "A" then ac_cv_sys_kernshrpbang_perl="$ax_cv_opt_perl_shebang" PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl" AC_SUBST(PERL_SHEBANG)dnl AC_MSG_NOTICE([OK - PERL_SHEBANG is $_sHpB$PERL_SHEBANG.]) # Automatic detection of sharpbang formula starts here else dnl _somian_shbangperl=`$PERLINTERP -V:startperl` negclass="[[^']]"; dnl # must leave this comment: m4 will remove the outer brackets for us, heheh AC_CACHE_CHECK([for kernel sharpbang invocation to start perl], ac_cv_sys_kernshrpbang_perl, [_somian_kspb_perl=`echo "$_somian_shbangperl" | sed -ne"s|.*='\($negclass*\)';$|\1|p"` if test "x$_somian_kspb_perl" == x then _somian_ksbp_warn_empty='durnit' else case "A$_somian_kspb_perl" in A#!*perl* ) ac_cv_sys_kernshrpbang_perl=`echo "$_somian_kspb_perl" | sed -e's|#!\(.*\)$|\1|'` ;; A* ) _somian_ksbp_warn_defau='trouble' ac_cv_sys_kernshrpbang_perl="$PERLINTERP" esac fi ])dnl Done with testing sharpbang # The above prints Checking ... result message to user. PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl" AC_SUBST(PERL_SHEBANG) if test A${_somian_ksbp_warn_empty+set} == Aset then AC_MSG_WARN([dnl In last check, doing $PERLINTERP -V:startperl yielded empty result! That should not happen.]) fi # Inform user after printing result value if test A${_somian_ksbp_warn_defau+set} == Aset then AC_MSG_NOTICE([Maybe Not good -]) AC_MSG_WARN([dnl In last check perl's Config query did not work so we bunted: $_sHpB$PERLINTERP]) else AC_MSG_NOTICE([OK Good result - ]) AC_MSG_NOTICE([dnl In last check we got a proper-looking answer from perl's Config: $_somian_shbangperl]) dnl Done with user info messages fi dnl Outer loop checked for user override term here fi dnl ])dnl EOMACRO DEF dnl @synopsis ETR_SOCKET_NSL dnl dnl This macro figures out what libraries are required on this platform dnl to link sockets programs. It's usually -lsocket and/or -lnsl or dnl neither. We test for all three combinations. dnl dnl @version $Id: acinclude.m4,v 1.2 2005/10/04 15:21:36 jonico Exp $ dnl @author Warren Young dnl AC_DEFUN([ETR_SOCKET_NSL], [ AC_CACHE_CHECK(for libraries containing socket functions, ac_cv_socket_libs, [ oCFLAGS=$CFLAGS AC_TRY_LINK([ #include #include #include #include ], [ struct in_addr add; int sd = socket(AF_INET, SOCK_STREAM, 0); inet_ntoa(add); ], ac_cv_socket_libs=-lc, ac_cv_socket_libs=no) if test x"$ac_cv_socket_libs" = "xno" then CFLAGS="$oCFLAGS -lsocket" AC_TRY_LINK([ #include #include #include #include ], [ struct in_addr add; int sd = socket(AF_INET, SOCK_STREAM, 0); inet_ntoa(add); ], ac_cv_socket_libs=-lsocket, ac_cv_socket_libs=no) fi if test x"$ac_cv_socket_libs" = "xno" then CFLAGS="$oCFLAGS -lsocket -lnsl" AC_TRY_LINK([ #include #include #include #include ], [ struct in_addr add; int sd = socket(AF_INET, SOCK_STREAM, 0); inet_ntoa(add); ], ac_cv_socket_libs="-lsocket -lnsl", ac_cv_socket_libs=no) fi CFLAGS=$oCFLAGS ]) if test x"$ac_cv_socket_libs" = "xno" then AC_MSG_ERROR([Cannot find socket libraries]) elif test x"$ac_cv_socket_libs" = "x-lc" then ETR_SOCKET_LIBS="" else ETR_SOCKET_LIBS="$ac_cv_socket_libs" fi AC_SUBST(ETR_SOCKET_LIBS) ]) dnl ETR_SOCKET_NSL dnl @synopsis AX_WITH_PYTHON([minimum-version], [value-if-not-found], [path]) dnl dnl Locates an installed Python binary, placing the result in the dnl precious variable $PYTHON. Accepts a present $PYTHON, then dnl --with-python, and failing that searches for python in the given dnl path (which defaults to the system path). If python is found, dnl $PYTHON is set to the full path of the binary; if it is not found, dnl $PYTHON is set to VALUE-IF-NOT-FOUND, which defaults to 'python'. dnl dnl Example: dnl dnl AX_WITH_PYTHON(2.2, missing) dnl dnl @category InstalledPackages dnl @author Dustin Mitchell dnl @version 2005-01-22 dnl @license GPLWithACException AC_DEFUN([AX_WITH_PYTHON], [ AC_ARG_VAR([PYTHON]) dnl unless PYTHON was supplied to us (as a precious variable) if test -z "$PYTHON" then AC_MSG_CHECKING(for --with-python) AC_ARG_WITH(python, AC_HELP_STRING([--with-python=PYTHON], [absolute path name of Python executable]), [ if test "$withval" != "yes" then PYTHON="$withval" AC_MSG_RESULT($withval) else AC_MSG_RESULT(no) fi ], [ AC_MSG_RESULT(no) ]) fi dnl if it's still not found, check the paths, or use the fallback if test -z "$PYTHON" then AC_PATH_PROG([PYTHON], python, m4_ifval([$2],[$2],[python]), $3) fi dnl check version if required m4_ifvaln([$1], [ dnl do this only if we didn't fall back if test "$PYTHON" != "m4_ifval([$2],[$2],[python])" then AC_MSG_CHECKING($PYTHON version >= $1) if test `$PYTHON -c ["import sys; print sys.version[:3] >= \"$1\" and \"OK\" or \"OLD\""]` = "OK" then AC_MSG_RESULT(ok) else AC_MSG_RESULT(no) PYTHON="$2" fi fi]) ])