build: osx: attempt to work with homebrew keg-only packages
This commit is contained in:
parent
ad2028f989
commit
e2274c58e6
|
@ -68,12 +68,13 @@ bench_sign_LDFLAGS = -static
|
||||||
bench_inv_SOURCES = src/bench_inv.c
|
bench_inv_SOURCES = src/bench_inv.c
|
||||||
bench_inv_LDADD = $(COMMON_LIB) $(SECP_LIBS)
|
bench_inv_LDADD = $(COMMON_LIB) $(SECP_LIBS)
|
||||||
bench_inv_LDFLAGS = -static
|
bench_inv_LDFLAGS = -static
|
||||||
|
bench_inv_CPPFLAGS = $(SECP_INCLUDES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_TESTS
|
if USE_TESTS
|
||||||
noinst_PROGRAMS += tests
|
noinst_PROGRAMS += tests
|
||||||
tests_SOURCES = src/tests.c
|
tests_SOURCES = src/tests.c
|
||||||
tests_CPPFLAGS = -DVERIFY $(SECP_TEST_INCLUDES)
|
tests_CPPFLAGS = -DVERIFY $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
|
||||||
tests_LDADD = $(COMMON_LIB) $(SECP_LIBS) $(SECP_TEST_LIBS)
|
tests_LDADD = $(COMMON_LIB) $(SECP_LIBS) $(SECP_TEST_LIBS)
|
||||||
tests_LDFLAGS = -static
|
tests_LDFLAGS = -static
|
||||||
TESTS = tests
|
TESTS = tests
|
||||||
|
|
|
@ -78,7 +78,13 @@ fi
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN([SECP_GMP_CHECK],[
|
AC_DEFUN([SECP_GMP_CHECK],[
|
||||||
if test x"$has_gmp" != x"yes"; then
|
if test x"$has_gmp" != x"yes"; then
|
||||||
AC_CHECK_HEADER(gmp.h,[AC_CHECK_LIB(gmp, __gmpz_init,[has_gmp=yes; GMP_LIBS=-lgmp; AC_DEFINE(HAVE_LIBGMP,1,[Define this symbol if libgmp is installed])])])
|
CPPFLAGS_TEMP="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
|
||||||
|
LIBS_TEMP="$LIBS"
|
||||||
|
LIBS="$GMP_LIBS $LIBS"
|
||||||
|
AC_CHECK_HEADER(gmp.h,[AC_CHECK_LIB(gmp, __gmpz_init,[has_gmp=yes; GMP_LIBS="$GMP_LIBS -lgmp"; AC_DEFINE(HAVE_LIBGMP,1,[Define this symbol if libgmp is installed])])])
|
||||||
|
CPPFLAGS="$CPPFLAGS_TEMP"
|
||||||
|
LIBS="$LIBS_TEMP"
|
||||||
fi
|
fi
|
||||||
if test x"$set_field" = x"gmp" && test x"$has_gmp" != x"yes"; then
|
if test x"$set_field" = x"gmp" && test x"$has_gmp" != x"yes"; then
|
||||||
AC_MSG_ERROR([$set_field field support explicitly requested but libgmp was not found])
|
AC_MSG_ERROR([$set_field field support explicitly requested but libgmp was not found])
|
||||||
|
|
36
configure.ac
36
configure.ac
|
@ -33,9 +33,34 @@ case $host in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $host_os in
|
case $host_os in
|
||||||
darwin*)
|
*darwin*)
|
||||||
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
|
if test x$cross_compiling != xyes; then
|
||||||
|
AC_PATH_PROG([BREW],brew,)
|
||||||
|
if test x$BREW != x; then
|
||||||
|
dnl These Homebrew packages may be keg-only, meaning that they won't be found
|
||||||
|
dnl in expected paths because they may conflict with system files. Ask
|
||||||
|
dnl Homebrew where each one is located, then adjust paths accordingly.
|
||||||
|
|
||||||
|
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
||||||
|
gmp_prefix=`$BREW --prefix gmp 2>/dev/null`
|
||||||
|
if test x$openssl_prefix != x; then
|
||||||
|
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
|
export PKG_CONFIG_PATH
|
||||||
|
fi
|
||||||
|
if test x$gmp_prefix != x; then
|
||||||
|
GMP_CPPFLAGS="-I$gmp_prefix/include"
|
||||||
|
GMP_LIBS="-L$gmp_prefix/lib"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_PATH_PROG([PORT],port,)
|
||||||
|
dnl if homebrew isn't installed and macports is, add the macports default paths
|
||||||
|
dnl as a last resort.
|
||||||
|
if test x$PORT != x; then
|
||||||
|
CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
|
||||||
LDFLAGS="$LDFLAGS -L/opt/local/lib"
|
LDFLAGS="$LDFLAGS -L/opt/local/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -236,6 +261,7 @@ fi
|
||||||
|
|
||||||
if test x"$set_field" = x"gmp" || test x"$set_bignum" = x"gmp"; then
|
if test x"$set_field" = x"gmp" || test x"$set_bignum" = x"gmp"; then
|
||||||
SECP_LIBS="$SECP_LIBS $GMP_LIBS"
|
SECP_LIBS="$SECP_LIBS $GMP_LIBS"
|
||||||
|
SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$use_endomorphism" = x"yes"; then
|
if test x"$use_endomorphism" = x"yes"; then
|
||||||
|
@ -256,4 +282,10 @@ AC_SUBST(YASM_BINFMT)
|
||||||
AM_CONDITIONAL([USE_ASM], [test x"$set_field" == x"64bit_asm"])
|
AM_CONDITIONAL([USE_ASM], [test x"$set_field" == x"64bit_asm"])
|
||||||
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
|
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
|
||||||
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" != x"no"])
|
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" != x"no"])
|
||||||
|
|
||||||
|
dnl make sure nothing new is exported so that we don't break the cache
|
||||||
|
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
|
||||||
|
unset PKG_CONFIG_PATH
|
||||||
|
PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
Loading…
Reference in New Issue