# Creates a makefile for building the libsvnruby
# Assumes SVN has already been successfully installed
#
# Options: --with-svn-dir=<path to svn install>
#
# -- Sean Russell <ser@germane-software.com>
#
# *2002-028+136 SER :: Initial submission
# *2002-029+676 SER :: Fetching flags from apr-config; removed some
# 	platform dependancy checking

if(/mswin32/ =~ PLATFORM)
  require "env"
else
  require "Env"
end

require 'mkmf'	# Here's the ruby module that does the grunt work

dir_config("svn")

$CFLAGS << " -I. "

# Extra libraries needed to compile
libraries = %w{ apr mm pthread svn_subr neon svn_delta expat svn_client svn_wc svn_ra }
libraries.each do |lib| 
  unless have_library(lib,nil)
    puts "You seem to be missing the #{lib} library.\nI can't compile the "+
      "libsvnruby library without this." 
    exit(1)
  end
end
# These aren't required, but we'll link them if we have them
have_library("svn_fs")
have_library("svn_repos")

$CFLAGS << `apr-config --libs`.chop
$CFLAGS << `apr-config --cflags`.chop

with_config("svn")

create_makefile('svn')
