User-visible changes to lib-link.m4 and lib-prefix.m4

Hi there,
we have been using the AC_LIB_LINKFLAGS for years without any problem. A few days ago, that is, a few days before the release of the Parma Polyhedra Library (http://www.cs.unipr.it/ppl/) we thought it was a good idea to update lib-link.m4 and lib-prefix.m4, since we were still using the version distributed with Gettext 0.14.6. However, this update broke the build. Looking at config.log it seems that, despite using the --with-lib-prefix option, no -I option is added to the compiler options. We tried to understand what was changed in lib-link.m4 and lib-prefix.m4, but we failed. We discovered, though, that things stop working for us in passing from the versions distributed with with Gettext 0.14.6 to the versions distributed with Gettext 0.15. We have looked in the sources and at the NEWS file to understand whether the AC_LIB_LINKFLAGS should be used differently with the newer versions, but we failed again.
Here is how we use the AC_LIB_LINKFLAGS macro in an Autoconf macro by ourselves:
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])
dnl Check how to link with libgmpxx. AC_LIB_LINKFLAGS([gmpxx], [gmp]) ...
What are we missing? Is there some documentation on how to properly use these macros? All the best,
Roberto

Dear Prof. Bagnara,
We discovered, though, that things stop working for us in passing from the versions distributed with with Gettext 0.14.6 to the versions distributed with Gettext 0.15.
The change between lib-link.m4 of version 0.14.6 and 0.15 is that before, it assumed the libraries to be installed in $prefix/lib. In 0.15, on Linux bi-arch systems, i.e. systems which have the system libraries both in 32-bit mode and in 64-bit mode, when you are compiling in 64-bit mode, the macros will look for the libraries in $prefix/lib64 rather than in $prefix/lib.
In 0.18 (or already with the macros in gnulib today) a similar change is done for Solaris bi-arch systems.
For you, the simple fix is cd $prefix ln -s lib lib64
The vendor conventions on bi-arch Linux systems are to store 32-bit libraries in $prefix/lib and 64-bit libraries in $prefix/lib64. Unfortunately this does not coincide with the GNU default $(libdir), which is $prefix/lib always. Feel free to follow-up to the discussion started at http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html
Bruno

Bruno Haible wrote:
We discovered, though, that things stop working for us in passing from the versions distributed with with Gettext 0.14.6 to the versions distributed with Gettext 0.15.
The change between lib-link.m4 of version 0.14.6 and 0.15 is that before, it assumed the libraries to be installed in $prefix/lib. In 0.15, on Linux bi-arch systems, i.e. systems which have the system libraries both in 32-bit mode and in 64-bit mode, when you are compiling in 64-bit mode, the macros will look for the libraries in $prefix/lib64 rather than in $prefix/lib.
In 0.18 (or already with the macros in gnulib today) a similar change is done for Solaris bi-arch systems.
For you, the simple fix is cd $prefix ln -s lib lib64
The vendor conventions on bi-arch Linux systems are to store 32-bit libraries in $prefix/lib and 64-bit libraries in $prefix/lib64. Unfortunately this does not coincide with the GNU default $(libdir), which is $prefix/lib always. Feel free to follow-up to the discussion started at http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html
Hi Bruno,
thanks for your message. However, the problem we observe is not in the location of the library. The problem is that, passing from the version distributed with Gettext 0.14.6 to the version distributed with Gettext 0.15, the right -Idir flag is not added to CPPFLAGS. Looking at the text of our macro, which begins with
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])
dnl Check how to link with libgmpxx. AC_LIB_LINKFLAGS([gmpxx], [gmp])
ac_save_LIBS="$LIBS" LIBS="$LIBS $LIBGMPXX" AC_LANG_PUSH(C++)
AC_MSG_CHECKING([for the GMP library version 4.1.3 or above]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <gmpxx.h> #include <cstdlib>
#if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1) || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR == 1 && __GNU_MP_VERSION_PATCHLEVEL < 3) #error "GMP version 4.1.3 or higher is required" #endif
int main() { mpz_class n("3141592653589793238462643383279502884"); exit(0); } ]])], AC_MSG_RESULT(yes) ac_cv_have_gmp=yes, AC_MSG_RESULT(no) ac_cv_have_gmp=no, AC_MSG_RESULT(no) ac_cv_have_gmp=no)
what happens is that, with the newer version, configure attempts compilation of the program in AC_RUN_IFELSE without the -Idir option that should have been determined by AC_LIB_LINKFLAGS, which of course causes the compilation to fail. Did something change that could explain this behavior? Thanks again,
Roberto

Hi Roberto,
However, the problem we observe is not in the location of the library.
The problem should go away if, on Linux/x86_64 systems, you use --prefix=PREFIX --libdir=PREFIX/lib64 when installing the gmp library or, as a simple measure afterwards, copy or symlink lib to lib64.
The problem is that, passing from the version distributed with Gettext 0.14.6 to the version distributed with Gettext 0.15, the right -Idir flag is not added to CPPFLAGS.
The AC_LIB_LINKFLAGS macro does not augment CPPFLAGS if it does not find the library. Augmenting CPPFLAGS without setting the LIBGMP, LIBGMPXX variables accordingly would only cause trouble.
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]) dnl Check how to link with libgmpxx. AC_LIB_LINKFLAGS([gmpxx], [gmp])
This all OK.
Bruno
participants (2)
-
Bruno Haible
-
Roberto Bagnara