Show
Ignore:
Timestamp:
29.11.2010 16:49:14 (9 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

Files:
1 modified

Legend:

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

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