Patchwork Add -lpwl to ppllibs.

login
register
mail settings
Submitter Sebastian Pop
Date Feb. 18, 2011, 5:40 p.m.
Message ID <1298050820-10451-1-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/83630/
State New
Headers show

Comments

Sebastian Pop - Feb. 18, 2011, 5:40 p.m.
Hi Ralf,
here is the patch with the changes that you requested:

	* configure.ac: Use AC_CHECK_LIB to check for -lpwl.
	* configure: Regenerated.

This passed regstrap on amd64-linux.  I tested on two different
machines one having and the other one without libpwl.  Ok for trunk?

Thanks,
Sebastian

---
 configure    |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 configure.ac |   10 ++++++----
 2 files changed, 51 insertions(+), 8 deletions(-)
Ralf Wildenhues - Feb. 22, 2011, 5:48 a.m.
Hello Sebastian,

* Sebastian Pop wrote on Fri, Feb 18, 2011 at 06:40:20PM CET:
> here is the patch with the changes that you requested:
> 
> 	* configure.ac: Use AC_CHECK_LIB to check for -lpwl.
> 	* configure: Regenerated.
> 
> This passed regstrap on amd64-linux.  I tested on two different
> machines one having and the other one without libpwl.  Ok for trunk?

> --- a/configure.ac
> +++ b/configure.ac
> @@ -1621,7 +1621,9 @@ AC_ARG_WITH(boot-ldflags,
>  AC_SUBST(poststage1_ldflags)
>  
>  # Check for PPL
> -ppllibs=" -lppl_c -lppl -lgmpxx"
> +pwllib=
> +AC_CHECK_LIB(pwl,PWL_handle_timeout,[pwllib="-lpwl"])
> +ppllibs=" -lppl_c -lppl $pwllib -lgmpxx"

This seems is OK.

Although, looking again, this is the first AC_CHECK_LIB test added to
toplevel.  I'm wondering whether there is something I'm completely
overlooking again.  Hmm, one can do link tests for the host compiler,
no?  Paolo?

>  pplinc=
>  
>  AC_ARG_WITH(ppl,
> @@ -1643,7 +1645,7 @@ case $with_ppl in
>    "" | yes)
>      ;;
>    *)
> -    ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
> +    ppllibs="-L$with_ppl/lib -lppl_c -lppl $pwllib -lgmpxx"

This doesn't make sense to me.  If you need -L$with_ppl/lib to link with
PPL, then most likely the test for libpwl would have needed that flag as
well in order to be correct.  So it seems it would need here a link test
for libpwl with -L$with_ppl/lib but none of the other libraries added.

>      pplinc="-I$with_ppl/include $pplinc"
>      ;;
>  esac
> @@ -1651,10 +1653,10 @@ if test "x$with_ppl_include" != x; then
>    pplinc="-I$with_ppl_include $pplinc"
>  fi
>  if test "x$with_ppl_lib" != x; then
> -  ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx"
> +  ppllibs="-L$with_ppl_lib -lppl_c -lppl $pwllib -lgmpxx"

Likewise, the test would have needed -L$with_ppl_lib here.

>  fi
>  if test "x$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then
> -  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl -lgmpxx '
> +  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl '"$pwllib"' -lgmpxx '

The check above doesn't check the in-tree ppl, so it cannot tell you an
answer about the in-tree library (and it may not even have been built
yet).  OTOH, toplevel configure knows how ppl will be built: it will
create its configure command line.  I think your only chance to get
things right here is to look for --enable* or --with* flags passed by
the user (you can check the right $enable_* or $with_* variable instead,
i.e., in this case $enable_watchdog), or be sure to pass them correctly
to ppl.

>    pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C '
>    enable_ppl_version_check=no
>  fi

When testing a patch for this change, it should be completely sufficient
to run toplevel configure and then 'grep ppllibs config.status' to see
that things worked.  But configure should be run with each of the above
option combinations (--with-ppl, --with-ppl-lib, none of these, and
in-tree PPL with or without --enable-watchdog) and once each with the
library present and once absent.  And, I suppose, one cross setup
bootstrap.

Thanks,
Ralf
Paolo Bonzini - Feb. 22, 2011, 9:31 a.m.
On 02/22/2011 06:48 AM, Ralf Wildenhues wrote:
> Although, looking again, this is the first AC_CHECK_LIB test added to
> toplevel.  I'm wondering whether there is something I'm completely
> overlooking again.  Hmm, one can do link tests for the host compiler,
> no?  Paolo?

Yes.  It's just that all these tests should actually be moved to gcc/, 
IMO.  Graphite (and before it, GMP/MPFR) have been abusing a bit the 
toplevel.

Paolo

Patch

diff --git a/configure b/configure
index ac7db39..38e44fc 100755
--- a/configure
+++ b/configure
@@ -5660,7 +5660,48 @@  fi
 
 
 # Check for PPL
-ppllibs=" -lppl_c -lppl -lgmpxx"
+pwllib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PWL_handle_timeout in -lpwl" >&5
+$as_echo_n "checking for PWL_handle_timeout in -lpwl... " >&6; }
+if test "${ac_cv_lib_pwl_PWL_handle_timeout+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpwl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char PWL_handle_timeout ();
+int
+main ()
+{
+return PWL_handle_timeout ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pwl_PWL_handle_timeout=yes
+else
+  ac_cv_lib_pwl_PWL_handle_timeout=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pwl_PWL_handle_timeout" >&5
+$as_echo "$ac_cv_lib_pwl_PWL_handle_timeout" >&6; }
+if test "x$ac_cv_lib_pwl_PWL_handle_timeout" = x""yes; then :
+  pwllib="-lpwl"
+fi
+
+ppllibs=" -lppl_c -lppl $pwllib -lgmpxx"
 pplinc=
 
 
@@ -5689,7 +5730,7 @@  case $with_ppl in
   "" | yes)
     ;;
   *)
-    ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
+    ppllibs="-L$with_ppl/lib -lppl_c -lppl $pwllib -lgmpxx"
     pplinc="-I$with_ppl/include $pplinc"
     ;;
 esac
@@ -5697,10 +5738,10 @@  if test "x$with_ppl_include" != x; then
   pplinc="-I$with_ppl_include $pplinc"
 fi
 if test "x$with_ppl_lib" != x; then
-  ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx"
+  ppllibs="-L$with_ppl_lib -lppl_c -lppl $pwllib -lgmpxx"
 fi
 if test "x$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then
-  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl -lgmpxx '
+  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl '"$pwllib"' -lgmpxx '
   pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C '
   enable_ppl_version_check=no
 fi
diff --git a/configure.ac b/configure.ac
index 9121d65..4adb989 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1621,7 +1621,9 @@  AC_ARG_WITH(boot-ldflags,
 AC_SUBST(poststage1_ldflags)
 
 # Check for PPL
-ppllibs=" -lppl_c -lppl -lgmpxx"
+pwllib=
+AC_CHECK_LIB(pwl,PWL_handle_timeout,[pwllib="-lpwl"])
+ppllibs=" -lppl_c -lppl $pwllib -lgmpxx"
 pplinc=
 
 AC_ARG_WITH(ppl,
@@ -1643,7 +1645,7 @@  case $with_ppl in
   "" | yes)
     ;;
   *)
-    ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
+    ppllibs="-L$with_ppl/lib -lppl_c -lppl $pwllib -lgmpxx"
     pplinc="-I$with_ppl/include $pplinc"
     ;;
 esac
@@ -1651,10 +1653,10 @@  if test "x$with_ppl_include" != x; then
   pplinc="-I$with_ppl_include $pplinc"
 fi
 if test "x$with_ppl_lib" != x; then
-  ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx"
+  ppllibs="-L$with_ppl_lib -lppl_c -lppl $pwllib -lgmpxx"
 fi
 if test "x$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then
-  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl -lgmpxx '
+  ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl '"$pwllib"' -lgmpxx '
   pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C '
   enable_ppl_version_check=no
 fi