Skip to content

Commit aa22f2c

Browse files
shawwncperciva
authored andcommitted
build: add checks for openssl dir via brew on macOS
1 parent 24cca66 commit aa22f2c

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/configure~
1111
# m4/ directory: only keep certain files
1212
/m4/*
13+
!/m4/check_darwin_paths.m4
1314
!/m4/check_disable_compiler_warnings.m4
1415
!/m4/check_libcperciva_posix.m4
1516
!/m4/check_memlimit_support.m4

configure.ac

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ CHECK_POSIX_SH
2727
# Check if we need -std=c99 in LDFLAGS (for gcc on Solaris).
2828
CHECK_SOLARIS_C99
2929

30+
# Check if we need to add extra paths to CPPFLAGS and LDFLAGS for macOS.
31+
CHECK_DARWIN_PATHS
32+
3033
# Checks for AES support in OpenSSL.
3134
AC_SEARCH_LIBS([AES_encrypt], [crypto],,
3235
AC_MSG_ERROR([function AES_ENCRYPT not found]))

m4/check_darwin_paths.m4

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CHECK_DARWIN_PATHS
2+
# -------------------
3+
AC_DEFUN([CHECK_DARWIN_PATHS],
4+
[AC_REQUIRE([AC_CANONICAL_TARGET])
5+
6+
case $target_os in
7+
*darwin*)
8+
# Get the homebrew directory, which varies based on arch.
9+
case "$(uname -m)" in
10+
arm64)
11+
homebrew_dir=/opt/homebrew
12+
;;
13+
*)
14+
homebrew_dir=/usr/local
15+
;;
16+
esac
17+
18+
# Use the homebrew directory to specify the paths to openssl.
19+
CPPFLAGS="${CPPFLAGS} -I${homebrew_dir}/opt/openssl/include"
20+
LDFLAGS="${LDFLAGS} -L${homebrew_dir}/opt/openssl/lib"
21+
;;
22+
esac
23+
])# CHECK_DARWIN_PATHS

0 commit comments

Comments
 (0)