#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/bigloo/autoconf/strip                       */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Wed Aug  9 14:04:49 1995                          */
#*    Last change :  Mon Nov 23 14:24:03 2009 (serrano)                */
#*    -------------------------------------------------------------    */
#*    Checking for strip                                               */
#*=====================================================================*/

#*---------------------------------------------------------------------*/
#*    flags                                                            */
#*---------------------------------------------------------------------*/
cflags=
strip=strip

#*---------------------------------------------------------------------*/
#*    We parse the arguments                                           */
#*---------------------------------------------------------------------*/
while : ; do
  case $1 in
    "")
      break;;

    --cflags=*|-cflags=*)
      cflags="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --strip=*)
      strip="`echo $1 | sed 's/^[-a-z]*=//'`";;

    -*)
      echo "Unknown option \"$1\", ignored" >&2;;
  esac
  shift
done

file=$TMP/actest$USER
aout=$TMP/Xactest$USER
err=$TMP/Xactest$USER.err
obj=`basename $file`

#*---------------------------------------------------------------------*/
#*    The test C file                                                  */
#*---------------------------------------------------------------------*/
if test -f $file.c; then
   rm -f $file.c || exit $?
fi

cd $tmp

#*---------------------------------------------------------------------*/
#*    Test                                                             */
#*---------------------------------------------------------------------*/
cat > $file.c <<EOF
int main () { ; }
EOF

#*---------------------------------------------------------------------*/
#*    Compilation test                                                 */
#*---------------------------------------------------------------------*/
if ! eval "$BUILDSH $CC $cflags -c $file.c -o $aout" >/dev/null; then
  if [ "`cat $err` " = " " ]; then
    /bin/rm $err
    /bin/rm $file*
    /bin/rm $aout*
    echo "true"
    exit 0
  else
    /bin/rm $err
    /bin/rm $file*
    /bin/rm $aout*
    echo "true"
    exit 0
  fi
fi

#*---------------------------------------------------------------------*/
#*    We test strip                                                    */
#*---------------------------------------------------------------------*/
if ! eval "$BUILDSH $strip $aout > /dev/null" >/dev/null; then
  /bin/rm $file*
  /bin/rm $aout*
  echo "true"
else 
  /bin/rm $file*
  /bin/rm $aout*
  echo "$strip"
fi

