#!/bin/sh
#
# copy_include
#
# Copyright:
#         Copyright (c) 2002, 2003 SFNT Finland Oy.
# All rights reserved.
#
# Links or copies an include file to the include directory
#

if [ "$#" -lt 2 ]; then
  echo "$0: usage: copy_include source destination [relative]"; exit 1
fi

src=$1
dest=$2

if [ -d $dest ]; then
  base=`echo $src | sed 's-^.*/\([^/]*\)\$-\1-'`
  dest="$dest/$base"
fi

rm -f $dest

ln $src $dest 2>/dev/null || (cp -p $src $dest; chmod a-w $dest)
