[PPL-devel] [PATCH] fix --with-gmp-build= when gmp builddir != srcdir

Serge Belyshev belyshev at depni.sinp.msu.ru
Sun Nov 6 13:16:53 CET 2011


Roberto Bagnara <bagnara at cs.unipr.it> writes:

> Concerning the joint use of --with-gmp-build= and --enable-shared,
> I guess the problem is that the dynamic linker/loader must be taught
> where to find the GMP library just build.  What might be a portable
> way to do that?

The problem is that @extra_libraries@ was not set for ppl-config.
Here is a better patch, using libtool to find gmp libs:

---
 m4/ac_check_gmp.m4 |   17 ++++++++++-------
 src/Makefile.am    |    2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

Index: ppl/m4/ac_check_gmp.m4
===================================================================
--- ppl.orig/m4/ac_check_gmp.m4
+++ ppl/m4/ac_check_gmp.m4
@@ -53,23 +53,25 @@ then
   gmp_library_options="-L$gmp_library_paths"
 fi
 
+gmp_libs="-lgmpxx -lgmp"
+
 AC_ARG_WITH(gmp-build,
   AS_HELP_STRING([--with-gmp-build=DIR],
                  [use a non-installed build of GMP in DIR]),
   gmp_build_dir=$with_gmp_build
-  if test -n "$with_gmp" \
-  || test -n "$with_gmp_include" || test -n "$with_gmp_lib"
+  if test -z "$with_gmp" && test -z "$with_gmp_include" && test -z "$with_gmp_lib"
   then
-    gmp_include_options="-I$gmp_build_dir -I$gmp_build_dir/tune"
-    gmp_library_paths="$gmp_build_dir$PATH_SEPARATOR$gmp_build_dir/.libs:$gmp_build_dir/tune"
-    gmp_library_options="-L$gmp_build_dir -L$gmp_build_dir/.libs"
-    gmp_library_options="$gmp_library_options -L$gmp_build_dir/tune"
+    gmp_srcdir=`echo @abs_srcdir@ | $gmp_build_dir/config.status --file=-`
+    gmp_include_options="-I$gmp_build_dir -I$gmp_srcdir"
+    gmp_libs="$gmp_build_dir/libgmp.la $gmp_build_dir/libgmpxx.la"
   else
     AC_MSG_ERROR([cannot use --with-gmp-build and other --with-gmp* options together])
   fi)
 
-gmp_library_options="$gmp_library_options -lgmpxx -lgmp"
+gmp_library_options="$gmp_library_options $gmp_libs"
 
+ac_save_CXX="$CXX"
+CXX="libtool --mode=link $CXX"
 ac_save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $gmp_include_options"
 ac_save_LIBS="$LIBS"
@@ -220,4 +222,5 @@ AC_LANG_POP(C++)
 eval $shared_library_path_env_var=\"$ac_save_shared_library_path\"
 LIBS="$ac_save_LIBS"
 CPPFLAGS="$ac_save_CPPFLAGS"
+CXX="$ac_save_CXX"
 ])
Index: ppl/src/Makefile.am
===================================================================
--- ppl.orig/src/Makefile.am
+++ ppl/src/Makefile.am
@@ -81,7 +81,7 @@ ppl-config.cc \
 ppl.hh
 
 ppl_config_LDADD = \
-libppl.la
+libppl.la @extra_libraries@
 
 if USE_NATIVE_INTEGERS
 



More information about the PPL-devel mailing list