diff --git a/config_office/configure.in b/config_office/configure.in index dfbbb2c75e43..d216c8c2f4fe 100644 --- a/config_office/configure.in +++ b/config_office/configure.in @@ -3,7 +3,7 @@ dnl * vi:set sw=3 ts=3 et: dnl * dnl * Name: configure.in dnl * Auth: Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems Ireland -dnl * Date: $Date: 2005-01-25 12:42:58 $ +dnl * Date: $Date: 2005-01-25 16:54:53 $ dnl * dnl * Desc: This file serves as input for the GNU autoconf package dnl * in order to create a configure script. @@ -12,7 +12,7 @@ dnl * necessary to build OpenOffice.org dnl * dnl * dnl ******************************************************************/ -AC_REVISION( $Revision: 1.86 $ ) +AC_REVISION( $Revision: 1.87 $ ) AC_PREREQ(2.50) AC_INIT() echo "$@" >config.parms @@ -202,11 +202,12 @@ AC_ARG_WITH(gxx_include_path, Usage: --with-gxx-include-path= ],,) -AC_ARG_ENABLE(java, -[ --disable-java Build without Java support. Use if there is no supported JDK - for your platform. The build will have no support for Java - components, applets, accessibility or XML filters. -],,) +AC_ARG_WITH(java, +[ --with-java Build with[out] Java support. If you use --without-java then + the build will have no support for Java components, applets, + accessibility or XML filters. Use --with-java=gij to enable gij/gcj + as java/javac replacements +], WITH_JAVA=$withval, WITH_JAVA=java) AC_ARG_WITH(ant-home, [ --with-ant-home If you have installed Jakarta Ant on your system, please supply the path here. @@ -1566,60 +1567,49 @@ dnl =================================================================== dnl Java support enable dnl =================================================================== AC_MSG_CHECKING([whether to build with Java support]) -if test "$enable_java" != "no"; then +if test "$WITH_JAVA" != "no"; then AC_MSG_RESULT([yes]) SOLAR_JAVA="TRUE" + NEEDXSLTPROC="no" else AC_MSG_RESULT([no]) SOLAR_JAVA="" + NEEDXSLTPROC="yes" + + AC_MSG_WARN([building without java will mean some features will not be available]) + echo "building without java will mean some features will not be available" >>warn fi AC_SUBST(SOLAR_JAVA) dnl =================================================================== -dnl Checks for JDK. +dnl Checks for java dnl =================================================================== -if test "$enable_java" != "no"; then +if test "$SOLAR_JAVA" != ""; then JAVA_HOME=; export JAVA_HOME if test -z "$with_jdk_home"; then - AC_PATH_PROG(JAVAC, javac) - AC_PATH_PROG(JAVA, java) + AC_PATH_PROG(JAVAINTERPRETER, $WITH_JAVA) else - _javac_path="$with_jdk_home/bin/javac" - dnl Check if there is a java compiler at all. - if test -x "$_javac_path"; then - JAVAC=$_javac_path - else - _javac_path="$with_jdk_home/gcj" - dnl Check for gcj - if test -x "$_javac_path"; then - JAVAC=$_javac_path - else - AC_MSG_ERROR([$_javac_path not found set with_jdk_home]) - fi - fi - - _java_path="$with_jdk_home/bin/java" + _java_path="$with_jdk_home/bin/$WITH_JAVA" dnl Check if there is a java interpreter at all. if test -x "$_java_path"; then - JAVA=$_java_path + JAVAINTERPRETER=$_java_path else - _java_path="$with_jdk_home/gij" - dnl Check for gcj - if test -x "$_java_path"; then - JAVA=$_java_path - else - AC_MSG_ERROR([$_java_path not found set with_jdk_home]) - fi + AC_MSG_ERROR([$_java_path not found set with_jdk_home]) fi fi +fi + +dnl =================================================================== +dnl Checks for JDK. +dnl =================================================================== +if test "$SOLAR_JAVA" != ""; then AC_MSG_CHECKING([the installed JDK]) - if test "$JAVA"; then - + if test "$JAVAINTERPRETER"; then dnl java -version sends output to stderr! - if test `$JAVA -version 2>&1 | grep -c "Kaffe"` -gt 0; then + if test `$JAVAINTERPRETER -version 2>&1 | grep -c "Kaffe"` -gt 0; then dnl Kaffe specific tests - KAFFE_VER=`$JAVA -version 2>&1 | $EGREP " Version:" | $SED -r "s/.* Version: ([[0-9\.]]*).*/\1/"` + KAFFE_VER=`$JAVAINTERPRETER -version 2>&1 | $EGREP " Version:" | $SED -r "s/.* Version: ([[0-9\.]]*).*/\1/"` if test -z "$KAFFE_VER"; then AC_MSG_ERROR([looks like Kaffe but version detection failed]) fi @@ -1634,46 +1624,118 @@ if test "$enable_java" != "no"; then AC_MSG_RESULT([checked (Kaffe $KAFFE_VER)]) AC_MSG_WARN([EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile]) echo "EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile" >>warn - JAVA_HOME=`echo $JAVAC | $SED -n "s,//*bin//*javac,,p"` - elif test `$JAVAC -v 2>&1 | grep -c "gcc version"` -gt 0; then - - dnl gcj specific tests - - GCJ_VER=`$JAVAC -dumpversion 2>&1` - if test -z "$GCJ_VER"; then - AC_MSG_ERROR([looks like gcj but version detection failed]) - fi - _gcj_ver=$GCJ_VER - + JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"` + elif test `$JAVAINTERPRETER --version 2>&1 | grep -c "GNU libgcj"` -gt 0; then JDK=gcj - AC_MSG_RESULT([checked (gcj $GCJ_VER)]) - AC_MSG_WARN([EXPERIMENTAL: gcj is not a full JDK replacement - some projects will fail to compile]) - echo "EXPERIMENTAL: gcj is not a full JDK replacement - some projects will fail to compile" >>warn - JAVA_HOME=`echo $JAVAC | $SED -n "s,//*gcj,,p"` + AC_MSG_RESULT([checked (gcj)]) + AC_MSG_WARN([EXPERIMENTAL: gij/gcj is not a full JDK replacement - some projects will fail to compile]) + echo "EXPERIMENTAL: gij/gcj is not a full JDK replacement - some projects will fail to compile" >>warn + JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*gij,,p"` else - dnl SUN JDK specific tests - _jdk=`$JAVAC -J-version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//` + _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//` _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'` if test "$_jdk_ver" -lt 10300; then AC_MSG_ERROR([JDK is too old, you need at least 1.3]) fi AC_MSG_RESULT([checked (JDK $_jdk)]) - JAVA_HOME=`echo $JAVAC | $SED -n "s,//*bin//*javac,,p"` + JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"` fi else AC_MSG_ERROR([JAVA not found. You need at least jdk-1.3, Kaffee 1.01, or gcj]) fi - dnl xsltproc not needed with JDK present. - XSLTPROC=NO_XSLTPROC else dnl Java disabled JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME +fi + +dnl =================================================================== +dnl Checks for javac +dnl =================================================================== +if test "$SOLAR_JAVA" != ""; then + if test "$JDK" == "gcj"; then + javacompiler="gcj" + else + javacompiler="javac" + fi + if test -z "$with_jdk_home"; then + AC_PATH_PROG(JAVACOMPILER, $javacompiler) + else + _javac_path="$with_jdk_home/bin/$javacompiler" + dnl Check if there is a java compiler at all. + if test -x "$_javac_path"; then + JAVACOMPILER=$_javac_path + fi + fi + if test -z "$JAVACOMPILER"; then + AC_MSG_ERROR([$javacompiler not found set with_jdk_home]) + fi +fi + +dnl =================================================================== +dnl Checks for javadoc +dnl =================================================================== +if test "$SOLAR_JAVA" != ""; then + if test -z "$with_jdk_home"; then + AC_PATH_PROG(JAVADOC, javadoc) + else + _javadoc_path="$with_jdk_home/bin/javadoc" + dnl Check if there is a javadoc at all. + if test -x "$_javadoc_path"; then + JAVADOC=$_javadoc_path + else + AC_PATH_PROG(JAVADOC, javadoc) + fi + fi + if test -z "$JAVADOC"; then + AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home]) + fi +fi + +if test "$SOLAR_JAVA" != ""; then + if test "$JDK" != "gcj"; then + # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr + if test "$JAVA_HOME" == "/usr" -a "x$with_jdk_home" == "x"; then + + if basename $(readlink $(readlink $JAVAC)) >/dev/null 2>/dev/null; then + # try to recover first by looking whether we have a alternatives + # system as in Debian or newer SuSEs where following /usr/bin/javac + # over /etc/alternatives/javac leads to the right bindir where we + # just need to strip a bit away to get a valid JAVA_HOME + JAVA_HOME=$(readlink $(readlink $JAVAC) | $SED -e s,/bin/javac$,,) + else + # else warn + AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect]) + AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home]) + echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn + echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn + fi + fi + # now check if $JAVA_HOME is really valid + if test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" == "x"; then + AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script]) + AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed]) + AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly]) + echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn + echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn + echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn + fi + fi +fi +AC_SUBST(JAVA_HOME) +AC_SUBST(JDK) +AC_SUBST(JAVAINTERPRETER) +AC_SUBST(JAVACOMPILER) +AC_SUBST(JAVADOC) + +if test "$NEEDXSLTPROC" = "no"; then + XSLTPROC=NO_XSLTPROC +else dnl Check for xsltproc AC_PATH_PROG(XSLTPROC, xsltproc, no) if test "$XSLTPROC" = "no"; then - AC_MSG_ERROR([xsltproc is required when building with --disable-java.]) + AC_MSG_ERROR([xsltproc is required]) fi fi # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr @@ -2929,7 +2991,8 @@ AC_SUBST(XINERAMA_LINK) dnl =================================================================== dnl Test for the presence of Ant and that it works dnl =================================================================== -if test "$enable_java" != "no"; then + +if test "$SOLAR_JAVA" != ""; then ANT_HOME=; export ANT_HOME WITH_ANT_HOME=; export WITH_ANT_HOME if test -z "$with_ant_home"; then @@ -2939,7 +3002,6 @@ else WITH_ANT_HOME=$with_ant_home fi - if test -z "$ANT"; then AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home]) else @@ -2971,7 +3033,11 @@ cat > conftest.xml << EOF EOF - ant_cmd="$ANT -buildfile conftest.xml 1>&2" + if test "$JDK" == "gcj"; then + ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2" + else + ant_cmd="$ANT -buildfile conftest.xml 1>&2" + fi AC_TRY_EVAL(ant_cmd) if test $? = 0 && test -f ./conftest.class ; then AC_MSG_RESULT([Ant works]) @@ -3008,7 +3074,11 @@ if test "$ANT_HOME" != "NO_ANT_HOME"; then if test -f /usr/share/java/ant.jar; then ANT_LIB=/usr/share/java else - AC_MSG_ERROR([Ant libraries not found!]) + if test -f /usr/share/ant-core/lib/ant.jar; then + ANT_LIB=/usr/share/ant-core/lib + else + AC_MSG_ERROR([Ant libraries not found!]) + fi fi fi fi