#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/bigloo/bigloo/autoconf/macosx               */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Wed Oct 22 11:07:08 1997                          */
#*    Last change :  Wed Nov 16 13:17:17 2022 (serrano)                */
#*    -------------------------------------------------------------    */
#*    Check if the underlying is MacOSX >= 10.3                        */
#*=====================================================================*/

#*---------------------------------------------------------------------*/
#*    flags                                                            */
#*---------------------------------------------------------------------*/
cflags=""
cgcflags="-DSILENT -DNO_SIGNALS -DNO_DEBUGGING -Iinclude"

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

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

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

#*---------------------------------------------------------------------*/
#*    OS detection                                                     */
#*---------------------------------------------------------------------*/
base1=actest1$USER
file1=$TMP/actest1$USER

if( test -f $file1.c ); then
   rm -f $file1.c || exit $?
fi

cat > $file1.c <<EOF
int foo( int x ) {
   return x + 1;
}
EOF

#*---------------------------------------------------------------------*/
#*    Build the MacOSX shared library                                  */
#*---------------------------------------------------------------------*/
eval "$BUILDSH $CC -c $cflags $file1.c -c && mv `basename $file1.o` $file1.o" && \
eval "$BUILDSH $CC -dynamiclib -single_module $file1.o -o $file1.dylib -lc" 2>&1 \
| grep "unrecognized" 2> /dev/null > /dev/null && \
/bin/rm $file1.* && echo "no"

/bin/rm $file1.*
/bin/rm -f $base1.o
echo "yes" 
