Don't use ac_save_* in configure.ac since they are overwritten by macro

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-03 00:52:27 +09:00
parent 2a4d39b7e8
commit dbcf07fd11

View File

@ -132,17 +132,17 @@ AC_LANG([C++])
PKG_PROG_PKG_CONFIG([0.20])
# Check C++ compiler supports C++0x/C++11 feature
ac_save_CXXFLAGS="$CXXFLAGS"
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
CXX1XCXXFLAGS="$CXXFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
CXXFLAGS="$save_CXXFLAGS"
AC_SUBST([CXX1XCXXFLAGS])
# Check C++ compiler actually supports nullptr
ac_save_CXXFLAGS=$CXXFLAGS
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXX1XCXXFLAGS"
AC_MSG_CHECKING([whether the c++ compiler supports nullptr])
@ -175,7 +175,7 @@ Derived x;
AC_DEFINE_UNQUOTED([CXX11_OVERRIDE], [$cxx11_override],
[Define `override` keyword if the compiler supports it])
CXXFLAGS=$ac_save_CXXFLAGS
CXXFLAGS=$save_CXXFLAGS
# Check static build is requested
if test "x$ARIA2_STATIC" = "xyes"; then
@ -215,8 +215,8 @@ if test "x$with_libz" = "xyes"; then
AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if you have zlib.])
# Android NDK arch-mips contains gzbuffer symbol but it is missing
# in zlib.h
ac_save_CFLAGS=$CFLAGS
ac_save_LIBS=$LIBS
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $ZLIB_CFLAGS"
LIBS="$ZLIB_LIBS $LIBS"
AC_CHECK_DECL([gzbuffer], [have_decl_gzbuffer=yes], [],
@ -225,8 +225,8 @@ if test "x$with_libz" = "xyes"; then
AC_CHECK_FUNC([gzbuffer])
fi
AC_CHECK_FUNCS([gzsetparams])
CFLAGS=$ac_save_CFLAGS
LIBS=$ac_save_LIBS
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
fi
fi
@ -235,8 +235,8 @@ if test "x$with_libuv" = "xyes"; then
case "$host" in
*mingw*|*msvc*)
libuv_cflags="-D_WIN32_WINNT=0x0600"
ac_save_CPPFLAGS=$CPPFLAGS
ac_save_LIBS=$LIBS
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $libuv_cflags"
AC_SEARCH_LIBS([uv_poll_init_socket], [uv], [
AC_CHECK_HEADER([uv.h], [have_libuv=yes], [have_libuv=no])
@ -247,14 +247,14 @@ if test "x$with_libuv" = "xyes"; then
AC_SUBST([LIBUV_CFLAGS])
AC_SUBST([LIBUV_LIBS])
fi
CPPFLAGS=$ac_save_CPPFLAGS
CPPLIBS=$ac_save_LIBS
CPPFLAGS=$save_CPPFLAGS
CPPLIBS=$save_LIBS
;;
*darwin*)
libuv_ldflags="-framework Foundation -framework CoreServices -framework ApplicationServices"
ac_save_LDFLAGS=$LDFLAGS
ac_save_LIBS=$LIBS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
LDFLAGS="$LDFLAGS $libuv_ldflags"
AC_SEARCH_LIBS([uv_poll_init_socket], [uv], [
AC_CHECK_HEADER([uv.h], [have_libuv=yes], [have_libuv=no])
@ -265,16 +265,16 @@ if test "x$with_libuv" = "xyes"; then
AC_SUBST([LIBUV_CFLAGS])
AC_SUBST([LIBUV_LIBS])
fi
LDFLAGS=$ac_save_LDFLAGS
LIBS=$ac_save_LIBS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
;;
*)
dnl Yeah, sucks that luv does not bring a pkg-config or config-tool
AC_MSG_CHECKING([for libuv])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
for combo in "" "-lrt" "-ldl -lrt" "-ldl -lrt -lpthread" "-lkvm"; do
LIBS="-luv $combo $ac_save_LIBS -lm"
LIBS="-luv $combo $save_LIBS -lm"
AC_LINK_IFELSE([AC_LANG_SOURCE([
extern "C" int uv_poll_init_socket(void);
int main() { return uv_poll_init_socket(); }
@ -290,7 +290,7 @@ int main() { return uv_poll_init_socket(); }
break;
fi
done
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
if test "x$have_libuv" != "xyes"; then
AC_MSG_RESULT("no")
fi
@ -299,10 +299,10 @@ int main() { return uv_poll_init_socket(); }
if test "x$have_libuv" = "xyes"; then
AC_DEFINE([HAVE_LIBUV], [1], [Define to 1 if you have libuv.])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS="$LIBUV_LIBS $LIBS"
AC_CHECK_FUNCS([uv_last_error])
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
elif test "x$with_libuv_requested" = "xyes"; then
ARIA2_DEP_NOT_MET([libuv])
fi
@ -333,10 +333,10 @@ if test "x$with_sqlite3" = "xyes"; then
PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=yes],[have_sqlite3=no])
if test "x$have_sqlite3" = "xyes"; then
AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS="$SQLITE3_LIBS $LIBS"
AC_CHECK_FUNCS([sqlite3_open_v2])
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
else
AC_MSG_WARN([$SQLITE3_PKG_ERRORS])
if test "x$with_sqlite3_requested" = "xyes"; then
@ -447,10 +447,10 @@ if test "x$with_gnutls" = "xyes" && test "x$have_ssl" != "xyes"; then
if test "x$have_libgnutls" = "xyes"; then
have_ssl=yes
AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS="$LIBGNUTLS_LIBS $LIBS"
AC_CHECK_FUNCS([gnutls_certificate_set_x509_system_trust])
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
else
AC_MSG_WARN([$LIBGNUTLS_PKG_ERRORS])
if test "x$with_gnutls_requested" = "xyes"; then
@ -467,7 +467,7 @@ if test "x$with_openssl" = "xyes" && test "x$have_ssl" != "xyes"; then
have_ssl=yes
AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS="$OPENSSL_LIBS $LIBS"
AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
if test "x$have_digestinit_ex" = "x"; then
@ -477,7 +477,7 @@ if test "x$with_openssl" = "xyes" && test "x$have_ssl" != "xyes"; then
AC_CHECK_FUNCS([EVP_sha256])
AC_CHECK_FUNCS([EVP_sha384])
AC_CHECK_FUNCS([EVP_sha512])
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
else
AC_MSG_WARN([$OPENSSL_PKG_ERRORS])
if test "x$with_openssl_requested" = "xyes"; then
@ -513,10 +513,10 @@ if test "x$have_openssl" != "xyes"; then
AC_SUBST([LIBGMP_CFLAGS])
AC_SUBST([LIBGMP_LIBS])
AC_DEFINE([HAVE_LIBGMP], [1], [Define to 1 if you have libgmp.])
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS="$LIBGMP_LIBS $LIBS"
AC_CHECK_FUNCS([__gmpz_powm_sec], [have_mpz_powm_sec=yes])
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
if test "x$have_mpz_powm_sec" = "xyes"; then
AC_DEFINE([HAVE_GMP_SEC], [1], [Define to 1 if you have a GMP with sec functions.])
fi
@ -556,14 +556,14 @@ if test "x$with_libcares" = "xyes"; then
[have_libcares=no])
if test "x$have_libcares" = "xyes"; then
AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
ac_save_LIBS=$LIBS
ac_save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
save_CPPFLAGS=$CPPFLAGS
LIBS="$LIBCARES_LIBS $LIBS"
CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
AC_CHECK_FUNCS([ares_set_servers])
LIBS=$ac_save_LIBS
CPPFLAGS=$ac_save_CPPFLAGS
LIBS=$save_LIBS
CPPFLAGS=$save_CPPFLAGS
# -DCARES_STATICLIB is appended by pkg-config file libcares.pc
else
@ -703,11 +703,11 @@ AM_CONDITIONAL([HAVE_LIBSSH2], [test "x$have_libssh2" = "xyes"])
case "$host" in
*solaris*)
ac_save_LIBS=$LIBS
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS([getaddrinfo], [nsl socket], [], [$ac_save_LIBS])
AC_SEARCH_LIBS([getaddrinfo], [nsl socket], [], [$save_LIBS])
EXTRALIBS="$LIBS $EXTRALIBS"
LIBS=$ac_save_LIBS
LIBS=$save_LIBS
;;
esac
@ -934,7 +934,7 @@ AM_CONDITIONAL([HAVE_SOME_FALLOCATE],
|| test "x$have_osx" = "xyes" || test "x$win_build" = "xyes"])
# mingw needs this
ac_save_CPPFLAGS=$CPPFLAGS
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $EXTRACPPFLAGS"
AC_MSG_CHECKING([for asctime_r])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
@ -961,7 +961,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
AC_DEFINE([HAVE_LOCALTIME_R], [1], [Define to 1 if you have the `localtime_r' function or macro.])],
[AC_MSG_RESULT([no])
AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
CPPFLAGS=$ac_save_CPPFLAGS
CPPFLAGS=$save_CPPFLAGS
AC_CHECK_FUNCS([basename],
[AM_CONDITIONAL([HAVE_BASENAME], true)],
@ -1130,7 +1130,7 @@ AC_SUBST([EXTRACPPFLAGS])
AC_SUBST([EXTRALDFLAGS])
AC_SUBST([EXTRALIBS])
ac_save_CXXFLAGS=$CXXFLAGS
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS=
if test "x$enable_werror" = "xyes"; then
@ -1140,7 +1140,7 @@ if test "x$enable_werror" = "xyes"; then
fi
WARNCXXFLAGS=$CXXFLAGS
CXXFLAGS=$ac_save_CXXFLAGS
CXXFLAGS=$save_CXXFLAGS
AC_SUBST([WARNCXXFLAGS])