
Roberto Bagnara wrote:
Moreover all the generated Makefile's have
CPPFLAGS =
so that compilation fails miserably because gmpxx.h cannot be found.
This is because two other .m4 macros reset CPPFLAGS to empty. This patch fixes it:
*** m4/ac_cxx_attribute_weak.m4 27 Aug 2003 16:22:47 -0000 1.1 --- m4/ac_cxx_attribute_weak.m4 28 Oct 2003 20:57:10 -0000 *************** *** 24,29 **** --- 24,31 ---- dnl AC_DEFUN([AC_CXX_SUPPORTS_ATTRIBUTE_WEAK], [ + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LIBS="$LIBS" AC_LANG_PUSH(C++)
AC_MSG_CHECKING([whether the C++ compiler supports __attribute__ ((weak))]) *** m4/ac_cxx_flexible_arrays.m4 18 Apr 2003 19:37:18 -0000 1.6 --- m4/ac_cxx_flexible_arrays.m4 28 Oct 2003 20:57:10 -0000 *************** *** 23,28 **** --- 23,30 ---- dnl AC_DEFUN([AC_CXX_SUPPORTS_FLEXIBLE_ARRAYS], [ + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LIBS="$LIBS" AC_LANG_PUSH(C++)
AC_MSG_CHECKING([whether the C++ compiler supports flexible arrays])
Also, with the current macro, it's apparently needed to specify both --with-libgmp-prefix=/tmp/jank and --with-libgmpxx-prefix=/tmp/jank. The following two patches let the user get away with just one of these.
The first one should be used if some of your programs need only libgmp but not libgmpxx. The second one can be used if all you ever link with is libgmpxx. (I've tested the second one in three configurations: with libgmp installed as shared libs, installed as static libs, and installed as static libs with .la files removed.)
*** m4/ac_check_gmp.m4 27 Oct 2003 21:11:02 -0000 1.14 --- m4/ac_check_gmp.m4 28 Oct 2003 21:07:10 -0000 *************** *** 23,28 **** --- 23,38 ---- dnl AC_DEFUN([AC_CHECK_GMP], [ + dnl Since libgmp and libgmpxx are usually installed in the same location, + dnl let the prefixes default from each other, + if test -n "$with_libgmpxx_prefix" && test -z "$with_libgmp_prefix"; then + with_libgmp_prefix="$with_libgmpxx_prefix" + else + if test -n "$with_libgmp_prefix" && test -z "$with_libgmpxx_prefix"; then + with_libgmpxx_prefix="$with_libgmp_prefix" + fi + fi + dnl Check how to link with libgmp. AC_LIB_LINKFLAGS([gmp])
*** m4/ac_check_gmp.m4 27 Oct 2003 21:11:02 -0000 1.14 --- m4/ac_check_gmp.m4 28 Oct 2003 21:20:35 -0000 *************** *** 24,30 **** AC_DEFUN([AC_CHECK_GMP], [ dnl Check how to link with libgmp. ! AC_LIB_LINKFLAGS([gmp])
dnl Check how to link with libgmpxx. AC_LIB_LINKFLAGS([gmpxx], [gmp]) --- 24,33 ---- AC_DEFUN([AC_CHECK_GMP], [ dnl Check how to link with libgmp. ! dnl This is not needed here, because 1. libgmp is always installed in the ! dnl same directory as libgmpxx (since they come from the same package), ! dnl 2. all programs in this package need libgmpxx, not only libgmp. ! dnl AC_LIB_LINKFLAGS([gmp])
dnl Check how to link with libgmpxx. AC_LIB_LINKFLAGS([gmpxx], [gmp])
Best regards, Bruno