#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/bigloo/bigloo/pcre2/install-pcre2           */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Wed Dec 19 07:52:02 2007                          */
#*    Last change :  Thu Apr  8 09:29:18 2021 (serrano)                */
#*    Copyright   :  2007-21 Manuel Serrano                            */
#*    -------------------------------------------------------------    */
#*    This shell script installs a new PCRE2.                          */
#*=====================================================================*/

src=$PCRE2
bglversion=`grep release ../configure | head -n 1 | awk -F= '{ print $2 }'`

tar=$TAR
wget=$WGET

if [ "$tar " = " " ]; then
  tar=tar
fi

if [ "$wget " = " " ]; then
  wget=wget
fi

remote=

if [ -f `basename $src` ]; then
  src=`basename $src`;
else
  if [ "`echo $src | grep '^http://'` " != " " \
       -o "`echo $src | grep '^ftp://'` " != " " ]; then
    if [ ! -f $src ]; then
      if [ ! -f `basename $src` ]; then
        $wget $src -O `basename $src`
      fi
      src=`basename $src`;
    fi
  fi
fi

if [ ! -f $src ]; then
  echo "*** ERROR:configure:--pcre2src. Cannot find pcre2 \"$src\" library."
  echo "Aborting";
  exit 1;
fi

tar xf $src || (echo "tar xf $src failed"; exit 1)

