class Psqlodbc < Formula desc "Official PostgreSQL ODBC driver" homepage "https://odbc.postgresql.org" url "https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-09.06.0410.tar.gz" sha256 "965b74587a2fd09368acff340ed3bdf2e831cee4e78d1caa79d0cc621364a88c" bottle do cellar :any sha256 "ea65d3c1ab051fe19fd431704ac5a1f4602d6e9103f199866d3965982ebbd0f8" => :sierra sha256 "f6f472ae0d6cb4022c3a7900dd7dbae0617e4a8317f542349efc9ee84089e849" => :el_capitan sha256 "851118d307bdefb65b07e789f2770809c9e3f76f93ca570e256bacabe9bb353b" => :yosemite end head do url "https://git.postgresql.org/git/psqlodbc.git" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build end depends_on "openssl" depends_on :postgresql depends_on "unixodbc" => :recommended depends_on "libiodbc" => :optional def install if build.with?("libiodbc") && build.with?("unixodbc") odie "psqlodbc: --without-unixodbc must be specified when using --with-libiodbc" end args = %W[ --prefix=#{prefix} ] args << "--with-iodbc=#{Formula["libiodbc"].opt_prefix}" if build.with?("libiodbc") args << "--with-unixodbc=#{Formula["unixodbc"].opt_prefix}" if build.with?("unixodbc") system "./bootstrap" if build.head? system "./configure", *args system "make" system "make", "install" end test do output = shell_output("#{Formula["unixodbc"].bin}/dltest #{lib}/psqlodbcw.so") assert_equal "SUCCESS: Loaded #{lib}/psqlodbcw.so\n", output end end