dnl This file contains autoconf macros used by jogl. -*-sh-*- dnl dnl Copyright (C) 1997 Free Software Foundation, Inc. dnl dnl These are the macros provided: dnl dnl AC_PROG_FALSE dnl AC_PATH_JDK dnl AC_PROG_JAVAC dnl AC_PROG_JAVA dnl AC_PROG_JAVADOC dnl AC_PROG_JAVAVER dnl AC_PATH_APACHE dnl Find the 'false program, I'll need it as a substitute later dnl Result goes in FALSE AC_DEFUN(AC_PROG_FALSE, [ AC_PATH_PROG(FALSE,false,$PATH) ]) dnl Find the JDK dnl Results go in JDK_HOME dnl Also sets JAVA_PLATFORM to 1 for 1.1 and to 2 for 1.2 dnl See also AC_WITH_PLATFORM AC_DEFUN(AC_PATH_JDK, [ dnl The order is: --with-jdk first, environment second, guessed value third. dnl VT: Why was it here? dnl AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_WITH(jdk-home, [ --with-jdk-home=DIR Where is your JDK root directory.], [ JDK_HOME=${withval} ]) AC_MSG_CHECKING(JDK) if test -z "${JDK_HOME}"; then for JDK_PREFIX in \ / \ /usr \ /usr/local \ /usr/lib \ /usr/local/lib \ /opt do for VARIANT in \ java \ jdk do for JAVA_VERSION in \ 1.2.2 \ 1.2.1 \ 1.2 \ 1.1.7 \ 1.1.6 \ 1.1.5 \ 1.1.4 \ 1.1.3 \ 1.1.2 \ 1.1.1 \ 1.1 do if test -d "${JDK_PREFIX}/${VARIANT}${JAVA_VERSION}/bin" \ && test -d "${JDK_PREFIX}/${VARIANT}${JAVA_VERSION}/include" ; then JDK_HOME="${JDK_PREFIX}/${VARIANT}${JAVA_VERSION}" AC_MSG_RESULT(${JDK_HOME}) dnl Let's try to guess the Java version from the pathname, to save an expensive check AC_MSG_CHECKING(Java platform) JAVA_PLATFORM=`echo "$JAVA_VERSION"|cut -c 3` case ${JAVA_PLATFORM} in 1) AC_MSG_RESULT(guess 1.1.x) ;; 2) AC_MSG_RESULT(guess Java 2) ;; *) AC_MSG_WARN(Undefined, presumed 1.1.x, you better check it and/or rename the directory) JAVA_PLATFORM=1 ;; esac AC_SUBST(JAVA_PLATFORM) break fi done done done fi AC_SUBST(JDK_HOME) AC_PROVIDE([$0]) ]) dnl Find the rmic program (useful only for EJBoss (http://www.ejboss.org/), dnl but preserved because doesn't break anything and allows this file to be dnl reused for Jserv, Jukebox and EJBoss. dnl Result goes in RMIC (bare location) and RMICX (with classpath and flag dnl adjustments) dnl The order is: --with-rmic first, environment second, guessed value third. AC_DEFUN(AC_PROG_RMIC, [ AC_REQUIRE([AC_PATH_JDK]) AC_REQUIRE([AC_PROG_FALSE]) AC_MSG_CHECKING(rmic binary) AC_ARG_WITH(rmic, [ --with-rmic=prog Java RMI compiler you want to use, if not the one from JDK], [ if test "$withval" = "yes" || test "$withval" = "no"; then AC_MSG_ERROR(You must specify the rmic binary as the parameter for --with-rmic) fi if test ! -x "$withval"; then AC_MSG_ERROR(Bad value for --with-rmic: $withval) fi ], [ RMIC="${JDK_HOME}/bin/rmic" if test ! -x "${RMIC}"; then AC_MSG_ERROR(rmic binary not found in ${JDK_HOME}) fi ]) AC_MSG_RESULT(${RMIC}) AC_SUBST(RMIC) AC_PROVIDE([$0]) if test "${JAVA_PLATFORM}" = "2"; then RMICX="${RMIC} -classpath \${TARGET_CLASSPATH}:${JDK_HOME}/jre/lib/rt.jar" else RMICX="CLASSPATH=\${CLASSPATH}:\${TARGET_CLASSPATH}:${JDK_HOME}/lib/classes.zip ${RMIC}" fi AC_SUBST(RMICX) ]) dnl Locate the Java tool within a JDK tree or by --with-* option. dnl First parameter is the name of the variable it goes to dnl Second parameter is the name of the binary to look up dnl Third parameter is the --help message (pay attention to alignment) dnl If the forth parameter is present and the binary is not found, just substitute it with $FALSE and dnl display a warning message instead of bailing out. dnl Results go to $1 (bare location) and $1X (with classpath and flag dnl adjustments). AC_DEFUN(AC_PROG_JAVATOOL, [ AC_REQUIRE([AC_PATH_JDK]) AC_REQUIRE([AC_PROG_FALSE]) AC_MSG_CHECKING($2) AC_ARG_WITH($2, [ --with-$2=prog $3 you want to use, if not the one from JDK], [ if test "$withval" = "yes" || test "$withval" = "no"; then AC_MSG_ERROR(You must specify the $2 binary as the parameter for --with-$2) fi if test ! -x "$withval"; then AC_MSG_ERROR(Bad value for --with-$2: $withval) fi ], [ $1="${JDK_HOME}/bin/$2" if test ! -x "${$1}"; then if test -n "$4"; then AC_MSG_WARN($4) $1=${FALSE} else AC_MSG_ERROR($2 binary not found in ${JDK_HOME}) fi fi ]) AC_MSG_RESULT(${$1}) AC_SUBST($1) AC_PROVIDE($1) dnl VT: This ugly bypass is here because autoconf complains about its dnl bug. In the future, I'll be checking it once in a while OPTION=$1 OPTION="${OPTION}_OPT" if test "${JAVA_PLATFORM}" = "2"; then $1X="${$1} \${$OPTION} -classpath \${TARGET_CLASSPATH}" else $1X="CLASSPATH=\${CLASSPATH}:\${TARGET_CLASSPATH}:${JDK_HOME}/lib/classes.zip ${$1} \${$OPTION}" fi AC_SUBST($1X) ]) dnl Find the Java class set. dnl The first parameter is the name of the variable it goes to dnl The second parameter is a guessed location basename dnl The third parameter defines a name of the class that has to be present dnl in the target entity dnl The forth parameter is a --help message dnl The output goes into $1_CLASSES AC_DEFUN(AC_PATH_JAVACLASS, [ AC_MSG_CHECKING($1) dnl Find out if we have a parameter AC_ARG_WITH($1, [ --with-$1=DIR/JAR $4], [ $1_CLASSES=$withval ], [ $1_CLASSES="/usr/local/$2" ]) dnl Find out if it exists at all if test ! -e "${$1_CLASSES}"; then AC_MSG_ERROR(Does not exist: '${$1_CLASSES}') fi dnl Transform the class name into the path name CLASS="`echo $3|tr "." "/"`.class" dnl Find out what it is if test -d "${$1_CLASSES}"; then dnl OK, so this is a directory. AC_PATH_SEARCHCLASS($1,${$1_CLASSES},${CLASS}) if test -z "${$1}"; then AC_PATH_SEARCHJAR($1,${$1_CLASSES},${CLASS}) if test -z "${$1}"; then AC_MSG_ERROR(no $3 class or jar with it in ${$1_CLASSES}) fi fi else AC_PATH_VERIFYJAR($1,${$1_CLASSES},${CLASS}) if test -z "${$1}"; then AC_MSG_ERROR($3 not found in ${$1_CLASSES}) fi fi $1_CLASSES=${$1} AC_MSG_RESULT(${$1_CLASSES}) AC_SUBST($1_CLASSES) AC_PROVIDE($1_CLASSES) ]) dnl This one verifies if the $3 class exists in the $2 jar file and places dnl the $2 in $1 if it is, otherwise sets it to empty string. AC_DEFUN(AC_PATH_VERIFYJAR, [ dnl You may want to call it before, just to make the output look good $1=`${JAR} -tvf $2|grep $3` if test -n "${$1}"; then $1=$2 else $1="" fi AC_SUBST($1) ]) dnl Find a $3 class file in the $2 directory. dnl If the directory is a classpath root, return it in $1. dnl If it is not, but the class is there, bail out. dnl If it doesn't contain the class file at all, return the empty string. AC_DEFUN(AC_PATH_SEARCHCLASS, [ PRESENT=`(cd $2 && find . -name "*.class"|grep "$3"|cut -c 3-)` if test -n "${PRESENT}"; then PRESENT=`echo ${PRESENT}|grep -x "${CLASS}"` if test -z "${PRESENT}"; then dnl OK, here's a misajustment - let's try to fix it later by dnl calculating the length difference, so far - error AC_MSG_ERROR([$2 is not a classpath root for $3 - adjust it]) else $1=$2 fi fi AC_SUBST($1) ]) dnl Find all the jar and zip files below $2 and check them for $3 class until found. dnl Bail out if there's no file in there. dnl If the jar/zip is found, return it in $1. AC_DEFUN(AC_PATH_SEARCHJAR, [ JARS=`find $2 -name "*.jar" -or -name "*.zip"|tr "\n" " "` if test -n "$JARS"; then for JARFILE in ${JARS}; do dnl AC_MSG_CHECKING('$JARFILE' for $3) PRESENT=`${JAR} -tf ${JARFILE}|grep $3` dnl AC_MSG_RESULT(Got '${PRESENT}') if test -n "${PRESENT}"; then $1=${JARFILE} AC_SUBST($1) break fi done fi ])