1# -*- coding: us-ascii -*-
2# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
3# $Id: extconf.rb 37878 2012-11-27 00:58:52Z nobu $
4
5require "mkmf"
6
7$defs << "-DHAVE_CONFIG_H"
8$INCFLAGS << " -I$(srcdir)/.."
9
10$objs = [ "sha2init.#{$OBJEXT}" ]
11
12dir_config("openssl")
13pkg_config("openssl")
14require File.expand_path('../../../openssl/deprecation', __FILE__)
15
16if !with_config("bundled-sha2") &&
17    have_library("crypto") &&
18    %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
19    %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
20  $objs << "sha2ossl.#{$OBJEXT}"
21  $defs << "-DSHA2_USE_OPENSSL"
22else
23  have_type("u_int8_t")
24  $objs << "sha2.#{$OBJEXT}"
25end
26
27have_header("sys/cdefs.h")
28
29$preload = %w[digest]
30
31if have_type("uint64_t", "defs.h", $defs.join(' '))
32  create_makefile("digest/sha2")
33end
34