#! /bin/sh
#-----------------------------------------------------------------------------
#-- Name:        distrib/mac/pbsetup-sh
#-- Purpose:     Copy setup.h for ProjectBuilder
#-- Author:      Gilles Depeyrot
#-- Modified by:
#-- Created:     12.09.2003
#-- Copyright:   (c) 2003 Gilles Depeyrot
#-- Licence:     wxWindows licence
#-----------------------------------------------------------------------------
#
# Usage: $0 SRCROOT SYMROOT
#
# Display errors/warnings in the correct format for ProjectBuilder parsing
#
if [ $# -ne 2 ] ; then
    echo "${0}:${LINENO}: error: Usage: ${0} SRCROOT SYMROOT"
    exit 1
fi
#
# Create wx include directory if necessary
#
if [ ! -d "${2}/include/wx" ]; then
    mkdir -p "${2}/include/wx"
    if [ ! -d "${2}/include/wx" ] ; then
        echo "${0}:${LINENO}: error: unable to create directory \"${2}/include/wx\""
        exit 1
    fi
fi
#
# Copy user setup.h to build setup.h if the latter doesn't exist or is older
#
if [ ! -f "${2}/include/wx/setup.h" -o \
     "${1}/../include/wx/osx/setup.h" -nt "${2}/include/wx/setup.h" ] ; then 
    cp "${1}/../include/wx/osx/setup.h" "${2}/include/wx/setup.h"
    if [ ! -f "${2}/include/wx/setup.h" ] ; then
        echo "${0}:${LINENO}: error: unable to create target setup file \"${2}/include/wx/setup.h\""
        exit 1
    fi
fi
