Merge pull request #63 from real-or-random/zkp-cflags-for-build
configure: Use CFLAGS_FOR_BUILD when checking native compiler
This commit is contained in:
commit
9ecd8bf38a
@ -152,7 +152,6 @@ endif
|
|||||||
|
|
||||||
if USE_ECMULT_STATIC_PRECOMPUTATION
|
if USE_ECMULT_STATIC_PRECOMPUTATION
|
||||||
CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)
|
CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)
|
||||||
CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function
|
|
||||||
|
|
||||||
gen_context_OBJECTS = gen_context.o
|
gen_context_OBJECTS = gen_context.o
|
||||||
gen_context_BIN = gen_context$(BUILD_EXEEXT)
|
gen_context_BIN = gen_context$(BUILD_EXEEXT)
|
||||||
@ -160,7 +159,7 @@ gen_%.o: src/gen_%.c
|
|||||||
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@
|
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@
|
||||||
|
|
||||||
$(gen_context_BIN): $(gen_context_OBJECTS)
|
$(gen_context_BIN): $(gen_context_OBJECTS)
|
||||||
$(CC_FOR_BUILD) $^ -o $@
|
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@
|
||||||
|
|
||||||
$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h
|
$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h
|
||||||
$(tests_OBJECTS): src/ecmult_static_context.h
|
$(tests_OBJECTS): src/ecmult_static_context.h
|
||||||
|
41
configure.ac
41
configure.ac
@ -219,27 +219,54 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_popcount(0);}]])],
|
|||||||
])
|
])
|
||||||
|
|
||||||
if test x"$use_ecmult_static_precomputation" != x"no"; then
|
if test x"$use_ecmult_static_precomputation" != x"no"; then
|
||||||
|
# Temporarily switch to an environment for the native compiler
|
||||||
save_cross_compiling=$cross_compiling
|
save_cross_compiling=$cross_compiling
|
||||||
cross_compiling=no
|
cross_compiling=no
|
||||||
TEMP_CC="$CC"
|
SAVE_CC="$CC"
|
||||||
CC="$CC_FOR_BUILD"
|
CC="$CC_FOR_BUILD"
|
||||||
AC_MSG_CHECKING([native compiler: ${CC_FOR_BUILD}])
|
SAVE_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS_FOR_BUILD"
|
||||||
|
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS_FOR_BUILD"
|
||||||
|
SAVE_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS_FOR_BUILD"
|
||||||
|
|
||||||
|
warn_CFLAGS_FOR_BUILD="-Wall -Wextra -Wno-unused-function"
|
||||||
|
saved_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $warn_CFLAGS_FOR_BUILD"
|
||||||
|
AC_MSG_CHECKING([if native ${CC_FOR_BUILD} supports ${warn_CFLAGS_FOR_BUILD}])
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
||||||
|
[ AC_MSG_RESULT([yes]) ],
|
||||||
|
[ AC_MSG_RESULT([no])
|
||||||
|
CFLAGS="$saved_CFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
|
||||||
AC_RUN_IFELSE(
|
AC_RUN_IFELSE(
|
||||||
[AC_LANG_PROGRAM([], [return 0])],
|
[AC_LANG_PROGRAM([], [])],
|
||||||
[working_native_cc=yes],
|
[working_native_cc=yes],
|
||||||
[working_native_cc=no],[dnl])
|
[working_native_cc=no],[dnl])
|
||||||
CC="$TEMP_CC"
|
|
||||||
|
CFLAGS_FOR_BUILD="$CFLAGS"
|
||||||
|
|
||||||
|
# Restore the environment
|
||||||
cross_compiling=$save_cross_compiling
|
cross_compiling=$save_cross_compiling
|
||||||
|
CC="$SAVE_CC"
|
||||||
|
CFLAGS="$SAVE_CFLAGS"
|
||||||
|
CPPFLAGS="$SAVE_CPPFLAGS"
|
||||||
|
LDFLAGS="$SAVE_LDFLAGS"
|
||||||
|
|
||||||
if test x"$working_native_cc" = x"no"; then
|
if test x"$working_native_cc" = x"no"; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
set_precomp=no
|
set_precomp=no
|
||||||
|
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
|
||||||
if test x"$use_ecmult_static_precomputation" = x"yes"; then
|
if test x"$use_ecmult_static_precomputation" = x"yes"; then
|
||||||
AC_MSG_ERROR([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD])
|
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD])
|
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([ok])
|
AC_MSG_RESULT([yes])
|
||||||
set_precomp=yes
|
set_precomp=yes
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user