# ***************************************************************************
#     PCRE_DIR.msvc      (!INCLUDE ed by "makefile-dllmod.msvc")
# --------------------------------------------------------------------------
# (C) Copyright Roger Bowler, 2005-2007
# --------------------------------------------------------------------------
# $Id$
#
#  Handles support for PCRE (Perl Compatible Regular Expressions),
#  for MSVC, needed by HAO (Hercules Automatic Operator) facility
#
# ***************************************************************************

# ---------------------------------------------------------------------
# To enable PCRE (Perl-Compatible Regular Expressions) support, first
# download "32 and 64-bit PCRE for Windows" from www.airesoft.co.uk/pcre
# File name: http://www.airesoft.co.uk/files/pcre/pcre-8.20.zip
# Then create a permanent directory somewhere called whatever you want
# and unzip pcre-8.20.zip into that directory. Finally define an
# environment variable called "PCRE_DIR" pointing to that directory.
# ---------------------------------------------------------------------

!IFNDEF PCRE_DIR
# Undefined: use default value, if it exists.
# PCRE_DIR defaults to winbuild\pcre relative to current directory
!IF "$(CPU)" == "i386" && EXIST(winbuild\pcre)
PCRE_DIR = winbuild\pcre
!ELSEIF "$(CPU)" == "AMD64" && EXIST(winbuild\pcre\x64)
PCRE_DIR = winbuild\pcre\x64
!ELSEIF "$(CPU)" == "IA64" && EXIST(winbuild\pcre\ia64)
PCRE_DIR = winbuild\pcre\ia64
!ELSEIF EXIST(winbuild\pcre)
PCRE_DIR = winbuild\pcre
!ENDIF
!ELSE
# Defined: use explicit directory or subdirectory
# unless "NONE" is specified or it doesn't exist.
!IF "$(PCRE_DIR)" == "NONE"
!UNDEF PCRE_DIR
!ELSE
!IF "$(CPU)" == "i386"
!IF !EXIST($(PCRE_DIR))
!UNDEF PCRE_DIR
!ENDIF
!ELSEIF "$(CPU)" == "AMD64"
!IF EXIST($(PCRE_DIR)\x64)
PCRE_DIR = $(PCRE_DIR)\x64
!ENDIF
!ELSEIF "$(CPU)" == "IA64"
!IF EXIST($(PCRE_DIR)\ia64)
PCRE_DIR = $(PCRE_DIR)\ia64
!ENDIF
!ENDIF
!ENDIF
!ENDIF

!IFDEF PCRE_DIR
PCRE_INCNAME  = pcreposix.h
PCRE_LIBNAME1 = pcre.lib
PCRE_LIBNAME2 = pcreposix.lib
PCRE_DLLNAME1 = pcre3.dll
PCRE_DLLNAME2 = pcreposix3.dll
!IF EXIST("$(PCRE_DIR)\include")
PCRE_INCDIR   = $(PCRE_DIR)\include
!ELSEIF EXIST("$(PCRE_DIR)\inc")
PCRE_INCDIR   = $(PCRE_DIR)\inc
!ELSE
PCRE_INCDIR   = $(PCRE_DIR)
!ENDIF
PCRE_LIBDIR   = $(PCRE_DIR)\lib
!IF "$(CPU)" == "AMD64" && EXIST($(PCRE_LIBDIR)\x64)
PCRE_LIBDIR   = $(PCRE_LIBDIR)\x64
!ELSEIF "$(CPU)" == "IA64" && EXIST($(PCRE_LIBDIR)\ia64)
PCRE_LIBDIR   = $(PCRE_LIBDIR)\ia64
!ENDIF
!IF !EXIST("$(PCRE_LIBDIR)\$(PCRE_LIBNAME1)")
PCRE_LIBNAME1 = pcre3.lib
PCRE_LIBNAME2 = pcreposix3.lib
!ENDIF
PCRE_DLLDIR   = $(PCRE_DIR)\bin
!IF "$(CPU)" == "AMD64" && EXIST($(PCRE_DLLDIR)\x64)
PCRE_DLLDIR   = $(PCRE_DLLDIR)\x64
!ELSEIF "$(CPU)" == "IA64" && EXIST($(PCRE_DLLDIR)\ia64)
PCRE_DLLDIR   = $(PCRE_DLLDIR)\ia64
!ENDIF
PCRE_INCPATH  = $(PCRE_INCDIR)\$(PCRE_INCNAME)
PCRE_LIBPATH1 = $(PCRE_LIBDIR)\$(PCRE_LIBNAME1)
PCRE_LIBPATH2 = $(PCRE_LIBDIR)\$(PCRE_LIBNAME2)
PCRE_DLLPATH1 = $(PCRE_DLLDIR)\$(PCRE_DLLNAME1)
PCRE_DLLPATH2 = $(PCRE_DLLDIR)\$(PCRE_DLLNAME2)
!IF !EXIST("$(PCRE_INCPATH)")
!ERROR PCRE_DIR "$(PCRE_INCPATH)" does not exist. Check PCRE_DIR
!ELSEIF !EXIST("$(PCRE_LIBPATH1)")
!ERROR PCRE_DIR "$(PCRE_LIBPATH1)" does not exist. Check PCRE_DIR
!ELSEIF !EXIST("$(PCRE_LIBPATH2)")
!ERROR PCRE_DIR "$(PCRE_LIBPATH2)" does not exist. Check PCRE_DIR
!ELSEIF !EXIST("$(PCRE_DLLPATH1)")
!ERROR PCRE_DIR "$(PCRE_DLLPATH1)" does not exist. Check PCRE_DIR
!ELSEIF !EXIST("$(PCRE_DLLPATH2)")
!ERROR PCRE_DIR "$(PCRE_DLLPATH2)" does not exist. Check PCRE_DIR
!ENDIF
!MESSAGE PCRE support will be included from "$(PCRE_DIR)"
!ELSE
!MESSAGE PCRE support will not be generated
!ENDIF
