Skip to content

Commit

Permalink
build: add checks for openssl dir via brew on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
shawwn authored and gperciva committed Oct 30, 2023
1 parent f4d4f2c commit 37e991d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/configure~
# m4/ directory: only keep certain files
/m4/*
!/m4/check_darwin_paths.m4
!/m4/check_disable_compiler_warnings.m4
!/m4/check_libcperciva_posix.m4
!/m4/check_memlimit_support.m4
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ CHECK_POSIX_SH
# Check if we need -std=c99 in LDFLAGS (for gcc on Solaris).
CHECK_SOLARIS_C99

# Check if we need to add extra paths to CPPFLAGS and LDFLAGS for macOS.
CHECK_DARWIN_PATHS

# Checks for AES support in OpenSSL.
AC_SEARCH_LIBS([AES_encrypt], [crypto],,
AC_MSG_ERROR([function AES_ENCRYPT not found]))
Expand Down
23 changes: 23 additions & 0 deletions m4/check_darwin_paths.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CHECK_DARWIN_PATHS
# -------------------
AC_DEFUN([CHECK_DARWIN_PATHS],
[AC_REQUIRE([AC_CANONICAL_TARGET])
case $target_os in
*darwin*)
# Get the homebrew directory, which varies based on arch.
case "$(uname -m)" in
arm64)
homebrew_dir=/opt/homebrew
;;
*)
homebrew_dir=/usr/local
;;
esac
# Use the homebrew directory to specify the paths to openssl.
CPPFLAGS="${CPPFLAGS} -I${homebrew_dir}/opt/openssl/include"
LDFLAGS="${LDFLAGS} -L${homebrew_dir}/opt/openssl/lib"
;;
esac
])# CHECK_DARWIN_PATHS

0 comments on commit 37e991d

Please sign in to comment.