tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jni/native/build buildcheck.sh get-version.sh lineends.pl mkdir.sh tcnative.m4
Date Fri, 14 Jan 2005 13:47:08 GMT
mturk       2005/01/14 05:47:08

  Added:       jni/native/build buildcheck.sh get-version.sh lineends.pl
                        mkdir.sh tcnative.m4
  Log:
  Initial upload
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-connectors/jni/native/build/buildcheck.sh
  
  Index: buildcheck.sh
  ===================================================================
  #! /bin/sh
  
  echo "buildconf: checking installation..."
  
  # any python
  python=`build/PrintPath python`
  if test -z "$python"; then
  echo "buildconf: python not found."
  echo "           You need python installed"
  echo "           to build APR from CVS."
  exit 1
  else
  py_version=`python -c 'import sys; print sys.version' 2>&1|sed 's/ .*//;q'`
  echo "buildconf: python version $py_version (ok)"
  fi
  
  # autoconf 2.13 or newer
  ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]*
*$//;q'`
  if test -z "$ac_version"; then
  echo "buildconf: autoconf not found."
  echo "           You need autoconf version 2.13 or newer installed"
  echo "           to build Apache from CVS."
  exit 1
  fi
  IFS=.; set $ac_version; IFS=' '
  if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
  echo "buildconf: autoconf version $ac_version found."
  echo "           You need autoconf version 2.13 or newer installed"
  echo "           to build Apache from CVS."
  exit 1
  else
  echo "buildconf: autoconf version $ac_version (ok)"
  fi
  
  # Sample libtool --version outputs:
  # ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
  # ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
  # output is multiline from 1.5 onwards
  
  # Require libtool 1.3.3 or newer
  libtool=`build/PrintPath glibtool libtool libtool15 libtool14`
  lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
  if test -z "$lt_pversion"; then
  echo "buildconf: libtool not found."
  echo "           You need libtool version 1.3.3 or newer installed"
  echo "           to build Apache from CVS."
  exit 1
  fi
  lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
  IFS=.; set $lt_version; IFS=' '
  lt_status="good"
  if test "$1" = "1"; then
     if test "$2" -lt "3"; then
        lt_status="bad"
     else
        if test "$2" = "3"; then
           if test -z "$3" -o "$3" = "1" -o "$3" = "2"; then
              lt_status="bad"
           fi
        fi
     fi
  fi
  if test $lt_status = "good"; then
     echo "buildconf: libtool version $lt_pversion (ok)"
     exit 0
  fi
  
  echo "buildconf: libtool version $lt_pversion found."
  echo "           You need libtool version 1.3.3 or newer installed"
  echo "           to build Apache from CVS."
  
  exit 1
  
  
  
  1.1                  jakarta-tomcat-connectors/jni/native/build/get-version.sh
  
  Index: get-version.sh
  ===================================================================
  #!/bin/sh
  #
  # extract version numbers from a header file
  #
  # USAGE: get-version.sh CMD VERSION_HEADER PREFIX
  #   where CMD is one of: all, major, libtool
  #   where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines
  #
  #   get-version.sh all returns a dotted version number
  #   get-version.sh major returns just the major version number
  #   get-version.sh libtool returns a version "libtool -version-info" format
  #
  
  if test $# != 3; then
    echo "USAGE: $0 CMD VERSION_HEADER PREFIX"
    echo "  where CMD is one of: all, major, libtool"
    exit 1
  fi
  
  major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
  minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
  patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
  major="`sed -n $major_sed $2`"
  minor="`sed -n $minor_sed $2`"
  patch="`sed -n $patch_sed $2`"
  
  if test "$1" = "all"; then
    echo ${major}.${minor}.${patch}
  elif test "$1" = "major"; then
    echo ${major}
  elif test "$1" = "libtool"; then
    # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
    echo ${minor}:${patch}:${minor}
  else
    echo "ERROR: unknown version CMD ($1)"
    exit 1
  fi
  
  
  
  1.1                  jakarta-tomcat-connectors/jni/native/build/lineends.pl
  
  Index: lineends.pl
  ===================================================================
  #!/usr/local/bin/perl
  #
  #  Heuristically converts line endings to the current OS's preferred format
  #  
  #  All existing line endings must be identical (e.g. lf's only, or even
  #  the accedental cr.cr.lf sequence.)  If some lines end lf, and others as
  #  cr.lf, the file is presumed binary.  If the cr character appears anywhere
  #  except prefixed to an lf, the file is presumed binary.  If there is no 
  #  change in the resulting file size, or the file is binary, the conversion 
  #  is discarded.
  #  
  #  Todo: Handle NULL stdin characters gracefully.
  #
  
  use IO::File;
  use File::Find;
  
  # The ignore list is '-' seperated, with this leading hyphen and
  # trailing hyphens in ever concatinated list below.
  $ignore = "-";
  
  # Image formats
  $ignore .= "gif-jpg-jpeg-png-ico-bmp-";
  
  # Archive formats
  $ignore .= "tar-gz-z-zip-jar-war-";
  
  # Many document formats
  $ignore .= "eps-psd-pdf-ai-";
  
  # Some encodings
  $ignore .= "ucs2-ucs4-";
  
  # Some binary objects
  $ignore .= "class-so-dll-exe-obj-";
  
  # Some build env files in NW/Win32
  $ignore .= "mcp-xdc-ncb-opt-pdb-ilk-sbr-";
  
  $preservedate = 1;
  
  $forceending = 0;
  
  $givenpaths = 0;
  
  $notnative = 0;
  
  while (defined @ARGV[0]) {
      if (@ARGV[0] eq '--touch') {
          $preservedate = 0;
      }
      elsif (@ARGV[0] eq '--nocr') {
          $notnative = -1;
      }
      elsif (@ARGV[0] eq '--cr') {
          $notnative = 1;
      }
      elsif (@ARGV[0] eq '--force') {
          $forceending = 1;
      }
      elsif (@ARGV[0] eq '--FORCE') {
          $forceending = 2;
      }
      elsif (@ARGV[0] =~ m/^-/) {
          die "What is " . @ARGV[0] . " supposed to mean?\n\n" 
  	  . "Syntax:\t$0 [option()s] [path(s)]\n\n" . <<'OUTCH'
  Where:	paths specifies the top level directory to convert (default of '.')
  	options are;
  
  	  --cr     keep/add one ^M
  	  --nocr   remove ^M's
  	  --touch  the datestamp (default: keeps date/attribs)
  	  --force  mismatched corrections (unbalanced ^M's)
  	  --FORCE  all files regardless of file name!
  
  OUTCH
      }
      else {
          find(\&totxt, @ARGV[0]);
  	print "scanned " . @ARGV[0] . "\n";
  	$givenpaths = 1;
      }
      shift @ARGV;
  }
  
  if (!$givenpaths) {
      find(\&totxt, '.');
      print "did .\n";
  }
  
  sub totxt {
          $oname = $_;
  	$tname = '.#' . $_;
          if (!-f) {
              return;
          }
  	@exts = split /\./;
  	if ($forceending < 2) {
              while ($#exts && ($ext = pop(@exts))) {
                  if ($ignore =~ m|-$ext-|i) {
                      return;
                  }
  	    }
          }
  	@ostat = stat($oname);
          $srcfl = new IO::File $oname, "r" or die;
  	$dstfl = new IO::File $tname, "w" or die;
          binmode $srcfl; 
  	if ($notnative) {
              binmode $dstfl;
  	} 
  	undef $t;
          while (<$srcfl>) { 
              if (s/(\r*)\n$/\n/) {
  		$n = length $1;
  		if (!defined $t) { 
  		    $t = $n; 
  		}
  		if (!$forceending && (($n != $t) || m/\r/)) {
  		    print "mismatch in " .$oname. ":" .$n. " expected " .$t. "\n";
  		    undef $t;
  		    last;
  		}
  	        elsif ($notnative > 0) {
                      s/\n$/\r\n/; 
                  }
              }
  	    print $dstfl $_; 
  	}
  	if (defined $t && (tell $srcfl == tell $dstfl)) {
  	    undef $t;
  	}
  	undef $srcfl;
  	undef $dstfl;
  	if (defined $t) {
              unlink $oname or die;
              rename $tname, $oname or die;
              @anames = ($oname);
              if ($preservedate) {
                  utime $ostat[9], $ostat[9], @anames;
              }
              chmod $ostat[2] & 07777, @anames;
              chown $ostat[5], $ostat[6], @anames;
              print "Converted file " . $oname . " to text in " . $File::Find::dir . "\n";

  	}
  	else {
  	    unlink $tname or die;
  	}
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/jni/native/build/mkdir.sh
  
  Index: mkdir.sh
  ===================================================================
  #!/bin/sh
  ## 
  ##  mkdir.sh -- make directory hierarchy
  ##
  ##  Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu>
  ##  as of 1994-03-25, which was placed in the Public Domain.
  ##  Cleaned up for Apache's Autoconf-style Interface (APACI)
  ##  by Ralf S. Engelschall <rse@apache.org>
  ##
  #
  # This script falls under the Apache License.
  # See http://www.apache.org/docs/LICENSE
  
  
  umask 022
  errstatus=0
  for file in ${1+"$@"} ; do 
      set fnord `echo ":$file" |\
                 sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
      shift
      pathcomp=
      for d in ${1+"$@"}; do
          pathcomp="$pathcomp$d"
          case "$pathcomp" in
              -* ) pathcomp=./$pathcomp ;;
              ?: ) pathcomp="$pathcomp/" 
                   continue ;;
          esac
          if test ! -d "$pathcomp"; then
              echo "mkdir $pathcomp" 1>&2
              mkdir "$pathcomp" || errstatus=$?
          fi
          pathcomp="$pathcomp/"
      done
  done
  exit $errstatus
  
  
  
  
  1.1                  jakarta-tomcat-connectors/jni/native/build/tcnative.m4
  
  Index: tcnative.m4
  ===================================================================
  dnl
  dnl TCN_FIND_APR: figure out where APR is located
  dnl
  AC_DEFUN(TCN_FIND_APR,[
  
    dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config
    APR_FIND_APR(,,,[1])
    if test "$apr_found" = "no"; then
      AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
    fi
  
    APR_BUILD_DIR="`$apr_config --installbuilddir`"
  
    dnl make APR_BUILD_DIR an absolute directory (we'll need it in the
    dnl sub-projects in some cases)
    APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`"
  
    APR_INCLUDES="`$apr_config --includes`"
    APR_LIBS="`$apr_config --link-libtool --libs`"
    APR_SO_EXT="`$apr_config --apr-so-ext`"
    APR_LIB_TARGET="`$apr_config --apr-lib-target`"
  
    AC_SUBST(APR_INCLUDES)
    AC_SUBST(APR_LIBS)
    AC_SUBST(APR_BUILD_DIR)
  ])
  
  dnl --------------------------------------------------------------------------
  dnl TCN_JDK
  dnl
  dnl Detection of JDK location and Java Platform (1.2, 1.3, 1.4, 1.5, 1.6)
  dnl result goes in JAVA_HOME / JAVA_PLATFORM (2 -> 1.2 and higher)
  dnl 
  dnl --------------------------------------------------------------------------
  AC_DEFUN(
    [TCN_FIND_JDK],
    [
      tempval=""
      AC_MSG_CHECKING([for JDK location (please wait)])
      if test -n "${JAVA_HOME}" ; then
        JAVA_HOME_ENV="${JAVA_HOME}"
      else
        JAVA_HOME_ENV=""
      fi
  
      JAVA_HOME=""
      JAVA_PLATFORM=""
  
      AC_ARG_WITH(
        [java-home],
        [  --with-java-home=DIR     Location of JDK directory.],
        [
  
        # This stuff works if the command line parameter --with-java-home was
        # specified, so it takes priority rightfully.
    
        tempval=${withval}
  
        if test ! -d "${tempval}" ; then
            AC_MSG_ERROR(Not a directory: ${tempval})
        fi
    
        JAVA_HOME=${tempval}
        AC_MSG_RESULT(${JAVA_HOME})
      ],
      [
        # This works if the parameter was NOT specified, so it's a good time
        # to see what the enviroment says.
        # Since Sun uses JAVA_HOME a lot, we check it first and ignore the
        # JAVA_HOME, otherwise just use whatever JAVA_HOME was specified.
  
        if test -n "${JAVA_HOME_ENV}" ; then
          JAVA_HOME=${JAVA_HOME_ENV}
          AC_MSG_RESULT(${JAVA_HOME_ENV} from environment)
        fi
      ])
  
      if test -z "${JAVA_HOME}" ; then
  
        # Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess
        # The following code is based on the code submitted by Henner Zeller
        # for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec
        # Two variables will be set as a result:
        #
        # JAVA_HOME
        # JAVA_PLATFORM
        AC_MSG_CHECKING([Try to guess JDK location])
  
        for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt /usr/java ; do
  
          for JAVA_PLATFORM in 6 5 4 3 2 ; do
  
            for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
  
              for VARIANT in IBMJava2- java java- jdk jdk-; do
                GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
  dnl           AC_MSG_CHECKING([${GUESS}])
                if test -d "${GUESS}/bin" & test -d "${GUESS}/include" ; then
                  JAVA_HOME="${GUESS}"
                  AC_MSG_RESULT([${GUESS}])
                  break
                fi
              done
  
              if test -n "${JAVA_HOME}" ; then
                break;
              fi
  
            done
  
            if test -n "${JAVA_HOME}" ; then
              break;
            fi
  
          done
  
          if test -n "${JAVA_HOME}" ; then
            break;
          fi
  
        done
  
        if test ! -n "${JAVA_HOME}" ; then
          AC_MSG_ERROR(can't locate a valid JDK location)
        fi
  
      fi
  
      if test -n "${JAVA_PLATFORM}"; then
        AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
      else
        AC_MSG_CHECKING(Java platform)
      fi
  
      AC_ARG_WITH(java-platform,
       [  --with-java-platform[=2] Force the Java platorm
                                   (value is 1 for 1.1.x or 2 for 1.2.x or greater)],
       [
          case "${withval}" in
            "1"|"2")
              JAVA_PLATFORM=${withval}
              ;;
            *)
              AC_MSG_ERROR(invalid java platform provided)
              ;;
          esac
       ],
       [
          if test -n "${JAVA_PLATFORM}"; then
            AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
          else
            AC_MSG_CHECKING(Java platform)
          fi
       ])
  
       AC_MSG_RESULT(${JAVA_PLATFORM})
  
      unset tempval
    ])
  
  
  AC_DEFUN(
    [TCN_FIND_JDK_OS],
    [
      tempval=""
      JAVA_OS=""
      AC_ARG_WITH(os-type,
        [  --with-os-type[=SUBDIR]  Location of JDK os-type subdirectory.],
        [
          tempval=${withval}
  
          if test ! -d "${JAVA_HOME}/${tempval}" ; then
            AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
          fi
  
          JAVA_OS = ${tempval}
        ],
        [   
          AC_MSG_CHECKING(os_type directory)
          if test -f ${JAVA_HOME}/include/jni_md.h; then
            JAVA_OS=""
          else
            for f in ${JAVA_HOME}/include/*/jni_md.h; do
              if test -f $f; then
                JAVA_OS=`dirname ${f}`
                JAVA_OS=`basename ${JAVA_OS}`
                echo " ${JAVA_OS}"
              fi
            done
            if test -z "${JAVA_OS}"; then
              AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
              AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
            fi
          fi
        ])
    ])
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message