You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rs...@hyperreal.org on 1998/06/05 09:15:20 UTC

cvs commit: apache-1.3/src/helpers findprg.sh

rse         98/06/05 00:15:20

  Modified:    .        configure
               src      CHANGES
  Added:       src/helpers findprg.sh
  Log:
  Workaround for configure script and old `test' commands which do not support
  the -x flag (for instance under platforms like Ultrix). This is solved by
  another helper script findprg.sh which searches for Perl and Awk like
  PrintPath but _via different names_ (BTW, no I don't wanted to change/enhance
  PrintPath because we also have PrintPathOS2 etc.  and if we merge the stuff we
  have to touch a lot of things. When we want to reduce things later we can use
  findprg.sh instead of PrintPath, but we have to be carefully).
  
  Revision  Changes    Path
  1.31      +9 -30     apache-1.3/configure
  
  Index: configure
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/configure,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- configure	1998/05/29 20:45:52	1.30
  +++ configure	1998/06/05 07:15:16	1.31
  @@ -113,25 +113,14 @@
   fi
   
   ##
  -##  determine optional Perl interpreter
  +##  determine path to (optional) Perl interpreter
   ##
   
   PERL=no-perl-on-this-system
  -OIFS="$IFS" IFS=':'
  -for dir in $PATH; do
  -    OIFS2="$IFS" IFS="$DIFS"
  -    for exe in perl5 perl miniperl; do
  -        if [ -f "$dir/$exe" ]; then
  -            if [ -x "$dir/$exe" ]; then
  -                PERL="$dir/$exe"
  -                break 2
  -            fi
  -        fi
  -    done
  -    IFS="$OIFS2"
  -done
  -IFS="$OIFS"
  -PERL="`echo $PERL | sed -e 's://:/:'`"
  +perlpath="`$aux/findprg.sh perl5 perl miniperl`"
  +if [ ".$perlpath" != . ]; then
  +    PERL="$perlpath"
  +fi
   
   ##
   ##  look for the best Awk we can find because some
  @@ -140,20 +129,10 @@
   ##
   
   AWK=awk
  -OIFS="$IFS" IFS=':'
  -for dir in $PATH; do
  -    OIFS2="$IFS" IFS="$DIFS"
  -    if [ -x "$dir/nawk" ]; then
  -        AWK="$dir/nawk"
  -        break 2
  -    fi
  -    if [ -x "$dir/gawk" ]; then
  -        AWK="$dir/gawk"
  -        break 2
  -    fi
  -    IFS="$OIFS2"
  -done
  -IFS="$OIFS"
  +awkpath="`$aux/findprg.sh nawk gawk awk`"
  +if [ ".$awkpath" != . ]; then
  +    AWK="$awkpath"
  +fi
   
   ##
   ##  determine default parameters
  
  
  
  1.887     +6 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.886
  retrieving revision 1.887
  diff -u -r1.886 -r1.887
  --- CHANGES	1998/06/04 20:28:29	1.886
  +++ CHANGES	1998/06/05 07:15:17	1.887
  @@ -1,5 +1,11 @@
   Changes with Apache 1.3.1
   
  +  *) Workaround for configure script and old `test' commands which do not
  +     support the -x flag (for instance under platforms like Ultrix). This is
  +     solved by another helper script findprg.sh which searches for Perl and
  +     Awk like PrintPath but _via different names_.
  +     [Ralf S. Engelschall]
  +
     *) Remove the system() call from htpasswd.c, which eliminates a system
        dependancy.  ["M.D.Parker" <md...@netcom.com>] PR#2332
   
  
  
  
  1.1                  apache-1.3/src/helpers/findprg.sh
  
  Index: findprg.sh
  ===================================================================
  #!/bin/sh
  ##
  ##  findprg.sh -- find a program
  ##
  ##  Look for one or more programs somewhere in $PATH (or the -p argument).
  ##  Will print out the full pathname unless called with the -s
  ##  (silence) option.
  ##
  ##  Written by Ralf S. Engelschall <rs...@apache.org> for the
  ##  Apache's Autoconf-style Interface (APACI)
  ##
  ##  Usage: findprg.sh [-s] [-pPATH] name [name ...]
  ##
  
  #   parameters
  silent=no
  pathlist=$PATH
  namelist=''
  
  #   parse argument line
  for opt
  do
      case $opt in
          -s  ) silent=yes ;;
          -p* ) pathlist="`echo $opt | cut -c3-`" ;;
          *   ) namelist="$namelist $opt" ;;
      esac
  done
  
  #   check whether the test command supports the -x option
  testfile="findprg.t.$$"
  cat >$testfile <<EOT
  #!/bin/sh
  if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
      exit 0
  fi
  exit 1
  EOT
  if /bin/sh $testfile 2>/dev/null; then
      minusx="-x"
  else
      minusx="-r"
  fi
  rm -f $testfile
  
  #   iterate over paths
  for path in `echo $pathlist |\
               sed -e 's/^:/.:/' \
                   -e 's/::/:.:/g' \
                   -e 's/:$/:./' \
                   -e 's/:/ /g'`; do
      #   iterate over names
      for name in $namelist; do
          if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then
              if [ "$silent" != "yes" ]; then
                  echo "$path/$name"
              fi
              #   found!
              exit 0
          fi
      done
  done
  
  #   not found!
  exit 1