This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add -lpwl to ppllibs.
* Sebastian Pop wrote on Wed, Feb 23, 2011 at 07:32:53AM CET:
> here is the updated patch. I tested this patch with the following
> configure options:
>
> without ppl
> --with-ppl with pwl
> --with-ppl without pwl
> --with-ppl=/path/to/ppl_with_pwl
> --with-ppl=/path/to/ppl_without_pwl
> --with-ppl-libs=/path/to/ppl_with_pwl
> --with-ppl-libs=/path/to/ppl_without_pwl
> in-tree ppl
> in-tree ppl --enable-watchdog
> in-tree ppl --disable-watchdog
>
> Usual bootstrap and regression test in progress using --with-ppl with pwl.
> Ok for trunk?
The patch is lacking a ChangeLog entry.
Does libpwl depend on libppl_c or libppl? If it does, then your
AC_CHECK_LIB test will fail on a system with only static libraries, as
the -lppl_c -lppl will be listed before -lpwl thus the link will fail
due to misordering. '-l' flags generally belong in LIBS not LDFLAGS,
but in the AC_CHECK_LIB test you would need to ensure that eventual -L
flags needed to find pwl would be listed in LDFLAGS.
If libpwl does not depend on libppl_c or libppl, then there is one more
questionable case: the AC_CHECK_LIB is also tried out if ppl is in-tree.
In that case it may be the case that an out-of-tree pwl is found. Would
that be problematic for libpwl? If not, then the patch is OK. If yes,
then the patch is still ok if you do the change I noted below inline.
Rainer's comment applies, but as the library list was duplicated before
your patch, I won't require fixing that issue within this patch. It can
be done separately, and as it is not release-critical, it can be done in
Stage 1.
Thanks,
Ralf
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1621,8 +1621,9 @@ AC_ARG_WITH(boot-ldflags,
> AC_SUBST(poststage1_ldflags)
>
> # Check for PPL
> -ppllibs=" -lppl_c -lppl -lgmpxx"
> +ppllibs=
> pplinc=
> +pwllib=
>
> AC_ARG_WITH(ppl,
> [AS_HELP_STRING([--with-ppl=PATH],
> @@ -1636,14 +1637,14 @@ AC_ARG_WITH(ppl-lib,
> [AS_HELP_STRING([--with-ppl-lib=PATH],
> [specify directory for the installed PPL library])])
>
> -case $with_ppl in
> +case $with_ppl in
> no)
> - ppllibs=
> ;;
> "" | yes)
> + ppllibs="-lppl_c -lppl"
> ;;
> *)
> - ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
> + ppllibs="-L$with_ppl/lib -lppl_c -lppl"
> pplinc="-I$with_ppl/include $pplinc"
> ;;
> esac
> @@ -1651,10 +1652,13 @@ 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"
> 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 '
> + if test "x$enable_watchdog" = xyes; then
> + pwllib="-lpwl"
> + fi
> + ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir"' -lppl_c -lppl '
> pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C '
> enable_ppl_version_check=no
> fi
> @@ -1677,6 +1681,16 @@ if test "x$with_ppl" != "xno" -a "${ENABLE_PPL_CHECK}" = "yes"; then
> CFLAGS="$saved_CFLAGS"
> fi
>
> +if test "x$ppllibs" != x; then
> + if test "x$pwllib" = x; then
Instead of this line, use
if test "x$pwllib" = x && test ! -d ${srcdir}/ppl; then
> + saved_LDFLAGS="$LDFLAGS"
> + LDFLAGS="$LDFLAGS $ppllibs"
> + AC_CHECK_LIB(pwl,PWL_handle_timeout,[pwllib="-lpwl"])
> + LDFLAGS="$saved_LDFLAGS"
> + fi
> + ppllibs="$ppllibs $pwllib -lgmpxx"
> +fi
> +
> # Flags needed for PPL
> AC_SUBST(ppllibs)
> AC_SUBST(pplinc)