Ignore:
Timestamp:
2010-11-29T16:49:14+13:00 (12 years ago)
Author:
sjm84
Message:

Updated several configure scripts and Makefiles to make use of the JAVA, JAVAC and JAVACFLAGS environment variables, also added a --disable-java option to several of the configure scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/aclocal.m4

    r16568 r23356  
    139139fi
    140140])
     141dnl @synopsis AC_PROG_JAVAC
     142dnl
     143dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the
     144dnl environment variable JAVAC then tests in sequence various common
     145dnl Java compilers. For political reasons, it starts with the free
     146dnl ones.
     147dnl
     148dnl If you want to force a specific compiler:
     149dnl
     150dnl - at the configure.in level, set JAVAC=yourcompiler before calling
     151dnl AC_PROG_JAVAC
     152dnl
     153dnl - at the configure level, setenv JAVAC
     154dnl
     155dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@.
     156dnl
     157dnl *Warning*: its success or failure can depend on a proper setting of
     158dnl the CLASSPATH env. variable.
     159dnl
     160dnl TODO: allow to exclude compilers (rationale: most Java programs
     161dnl cannot compile with some compilers like guavac).
     162dnl
     163dnl Note: This is part of the set of autoconf M4 macros for Java
     164dnl programs. It is VERY IMPORTANT that you download the whole set,
     165dnl some macros depend on other. Unfortunately, the autoconf archive
     166dnl does not support the concept of set of macros, so I had to break it
     167dnl for submission. The general documentation, as well as the sample
     168dnl configure.in, is included in the AC_PROG_JAVA macro.
     169dnl
     170dnl @category Java
     171dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
     172dnl @version 2000-07-19
     173dnl @license GPLWithACException
     174
     175AC_DEFUN([AC_PROG_JAVAC],[
     176if test "x$JAVAC" = x ; then
     177  AC_REQUIRE([AC_EXEEXT])dnl
     178  if test "x$JAVAPREFIX" = x; then
     179    test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT)
     180  else
     181    test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, javac$EXEEXT, $JAVAPREFIX)
     182  fi
     183  test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
     184else
     185  echo "Checking for javac... $JAVAC"
     186fi
     187
     188AC_SUBST(JAVAC)
     189AC_PROG_JAVAC_WORKS
     190AC_PROVIDE([$0])dnl
     191])
     192
     193dnl @synopsis AC_PROG_JAVAC_WORKS
     194dnl
     195dnl Internal use ONLY.
     196dnl
     197dnl Note: This is part of the set of autoconf M4 macros for Java
     198dnl programs. It is VERY IMPORTANT that you download the whole set,
     199dnl some macros depend on other. Unfortunately, the autoconf archive
     200dnl does not support the concept of set of macros, so I had to break it
     201dnl for submission. The general documentation, as well as the sample
     202dnl configure.in, is included in the AC_PROG_JAVA macro.
     203dnl
     204dnl @category Java
     205dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
     206dnl @version 2000-07-19
     207dnl @license GPLWithACException
     208
     209AC_DEFUN([AC_PROG_JAVAC_WORKS],[
     210AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
     211JAVA_TEST=Test.java
     212CLASS_TEST=Test.class
     213cat << \EOF > $JAVA_TEST
     214/* [#]line __oline__ "configure" */
     215public class Test {
     216}
     217EOF
     218if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
     219  ac_cv_prog_javac_works=yes
     220else
     221  AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
     222  echo "configure: failed program was:" >&AC_FD_CC
     223  cat $JAVA_TEST >&AC_FD_CC
     224fi
     225rm -f $JAVA_TEST $CLASS_TEST
     226])
     227AC_PROVIDE([$0])dnl
     228if test "x$JAVACFLAGS" = x ; then
     229  JAVACFLAGS="-source 1.4 -target 1.4"
     230fi
     231AC_SUBST(JAVACFLAGS)
     232])
     233
     234dnl @synopsis AC_PROG_JAVA
     235dnl
     236dnl Here is a summary of the main macros:
     237dnl
     238dnl AC_PROG_JAVAC: finds a Java compiler.
     239dnl
     240dnl AC_PROG_JAVA: finds a Java virtual machine.
     241dnl
     242dnl AC_CHECK_CLASS: finds if we have the given class (beware of
     243dnl CLASSPATH!).
     244dnl
     245dnl AC_CHECK_RQRD_CLASS: finds if we have the given class and stops
     246dnl otherwise.
     247dnl
     248dnl AC_TRY_COMPILE_JAVA: attempt to compile user given source.
     249dnl
     250dnl AC_TRY_RUN_JAVA: attempt to compile and run user given source.
     251dnl
     252dnl AC_JAVA_OPTIONS: adds Java configure options.
     253dnl
     254dnl AC_PROG_JAVA tests an existing Java virtual machine. It uses the
     255dnl environment variable JAVA then tests in sequence various common
     256dnl Java virtual machines. For political reasons, it starts with the
     257dnl free ones. You *must* call [AC_PROG_JAVAC] before.
     258dnl
     259dnl If you want to force a specific VM:
     260dnl
     261dnl - at the configure.in level, set JAVA=yourvm before calling
     262dnl AC_PROG_JAVA
     263dnl
     264dnl   (but after AC_INIT)
     265dnl
     266dnl - at the configure level, setenv JAVA
     267dnl
     268dnl You can use the JAVA variable in your Makefile.in, with @JAVA@.
     269dnl
     270dnl *Warning*: its success or failure can depend on a proper setting of
     271dnl the CLASSPATH env. variable.
     272dnl
     273dnl TODO: allow to exclude virtual machines (rationale: most Java
     274dnl programs cannot run with some VM like kaffe).
     275dnl
     276dnl Note: This is part of the set of autoconf M4 macros for Java
     277dnl programs. It is VERY IMPORTANT that you download the whole set,
     278dnl some macros depend on other. Unfortunately, the autoconf archive
     279dnl does not support the concept of set of macros, so I had to break it
     280dnl for submission.
     281dnl
     282dnl A Web page, with a link to the latest CVS snapshot is at
     283dnl <http://www.internatif.org/bortzmeyer/autoconf-Java/>.
     284dnl
     285dnl This is a sample configure.in Process this file with autoconf to
     286dnl produce a configure script.
     287dnl
     288dnl    AC_INIT(UnTag.java)
     289dnl
     290dnl    dnl Checks for programs.
     291dnl    AC_CHECK_CLASSPATH
     292dnl    AC_PROG_JAVAC
     293dnl    AC_PROG_JAVA
     294dnl
     295dnl    dnl Checks for classes
     296dnl    AC_CHECK_RQRD_CLASS(org.xml.sax.Parser)
     297dnl    AC_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver)
     298dnl
     299dnl    AC_OUTPUT(Makefile)
     300dnl
     301dnl @category Java
     302dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
     303dnl @version 2000-07-19
     304dnl @license GPLWithACException
     305
     306AC_DEFUN([AC_PROG_JAVA],[
     307if test "x$JAVA" = x ; then
     308    AC_REQUIRE([AC_EXEEXT])dnl
     309    if test x$JAVAPREFIX = x; then
     310        test x$JAVA = x && AC_CHECK_PROGS(JAVA, java$EXEEXT)
     311    else
     312        test x$JAVA = x && AC_CHECK_PROGS(JAVA, java$EXEEXT, $JAVAPREFIX)
     313    fi
     314    test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH])
     315fi
     316AC_SUBST(JAVA)
     317AC_PROG_JAVA_WORKS
     318AC_PROVIDE([$0])dnl
     319])
     320
     321dnl @synopsis AC_PROG_JAVA_WORKS
     322dnl
     323dnl Internal use ONLY.
     324dnl
     325dnl Note: This is part of the set of autoconf M4 macros for Java
     326dnl programs. It is VERY IMPORTANT that you download the whole set,
     327dnl some macros depend on other. Unfortunately, the autoconf archive
     328dnl does not support the concept of set of macros, so I had to break it
     329dnl for submission. The general documentation, as well as the sample
     330dnl configure.in, is included in the AC_PROG_JAVA macro.
     331dnl
     332dnl @category Java
     333dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
     334dnl @version 2000-07-19
     335dnl @license GPLWithACException
     336
     337AC_DEFUN([AC_PROG_JAVA_WORKS], [
     338AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes)
     339if test x$uudecode = xyes; then
     340AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
     341dnl /**
     342dnl  * Test.java: used to test if java compiler works.
     343dnl  */
     344dnl public class Test
     345dnl {
     346dnl
     347dnl public static void
     348dnl main( String[] argv )
     349dnl {
     350dnl     System.exit (0);
     351dnl }
     352dnl
     353dnl }
     354cat << \EOF > Test.uue
     355begin-base64 644 Test.class
     356yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
     357bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
     358bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
     359YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
     360aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
     361AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
     362AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
     363====
     364EOF
     365if uudecode$EXEEXT Test.uue; then
     366        ac_cv_prog_uudecode_base64=yes
     367else
     368        echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
     369        echo "configure: failed file was:" >&AC_FD_CC
     370        cat Test.uue >&AC_FD_CC
     371        ac_cv_prog_uudecode_base64=no
     372fi
     373rm -f Test.uue])
     374fi
     375if test x$ac_cv_prog_uudecode_base64 != xyes; then
     376        rm -f Test.class
     377        AC_MSG_WARN([I have to compile Test.class from scratch])
     378        if test x$ac_cv_prog_javac_works = xno; then
     379                AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
     380        fi
     381        if test x$ac_cv_prog_javac_works = x; then
     382                AC_PROG_JAVAC
     383        fi
     384fi
     385AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
     386JAVA_TEST=Test.java
     387CLASS_TEST=Test.class
     388TEST=Test
     389changequote(, )dnl
     390cat << \EOF > $JAVA_TEST
     391/* [#]line __oline__ "configure" */
     392public class Test {
     393public static void main (String args[]) {
     394        System.exit (0);
     395} }
     396EOF
     397changequote([, ])dnl
     398if test x$ac_cv_prog_uudecode_base64 != xyes; then
     399        if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
     400                :
     401        else
     402          echo "configure: failed program was:" >&AC_FD_CC
     403          cat $JAVA_TEST >&AC_FD_CC
     404          AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
     405        fi
     406fi
     407if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then
     408  ac_cv_prog_java_works=yes
     409else
     410  echo "configure: failed program was:" >&AC_FD_CC
     411  cat $JAVA_TEST >&AC_FD_CC
     412  AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
     413fi
     414rm -fr $JAVA_TEST $CLASS_TEST Test.uue
     415])
     416AC_PROVIDE([$0])dnl
     417]
     418)
Note: See TracChangeset for help on using the changeset viewer.