On 26 March 2016 at 02:06, Brian Brooks <brian.bro...@linaro.org> wrote:
> On 04/01 22:15:34, Anders Roxell wrote:
>> On 25 March 2016 at 20:25, Brian Brooks <brian.bro...@linaro.org> wrote:
>> > If --with-cunit-path=DIR is used, skip the AC_CHECK_LIB and modify the 
>> > linker
>> > flags accordingly.
>>
>> Why should we skip the AC_CHECK_LIB and AC_CHECK_HEADERS step
>> don't feel right.
>>
>> >
>> > Signed-off-by: Brian Brooks <brian.bro...@linaro.org>
>> > ---
>> >  test/m4/validation.m4 | 8 ++++++--
>> >  1 file changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/test/m4/validation.m4 b/test/m4/validation.m4
>> > index b137118..f6c93f7 100644
>> > --- a/test/m4/validation.m4
>> > +++ b/test/m4/validation.m4
>> > @@ -33,12 +33,16 @@ AC_HELP_STRING([--with-cunit-path=DIR   path to CUnit 
>> > libs and headers],
>> >  ##########################################################################
>> >  # Check for CUnit availability
>> >  ##########################################################################
>> > -if test x$cunit_support = xyes
>> > +if test x$cunit_support = xyes -a -z "$CUNIT_PATH"
>> >  then
>> >      AC_CHECK_LIB([cunit],[CU_get_error], [],
>> >          [AC_MSG_ERROR([CUnit libraries required])])
>> >      AC_CHECK_HEADERS([CUnit/Basic.h], [],
>> >          [AC_MSG_FAILURE(["can't find cunit headers"])])
>> >  else
>> > -    cunit_support=no
>> > +    if test -z "$CUNIT_PATH"; then
>> > +        cunit_support=no
>> > +    else
>> > +        AM_LDFLAGS="$AM_LDFLAGS -lcunit"
>> > +    fi
>>
>> this patch is still incomplete you miss to add the headers right.
>
> Hi Anders,
>
> Can you help me understand why this patch is incomplete?

I was wrong!
I forgot that we add cunits header and lib path above.

>
> The include & lib path for OOT CUnit is taken care of via AM_CPPFLAGS and
> AM_LDFLAGS when --with-cunit-path=DIR is used. Only "-lcunit" is required
> if AC_CHECK_LIB is skipped.

You are correct that is enough.

>
> AC_CHECK_LIB has side effect of LIBS+="-lcunit" which makes subsequent
> autoconf checking, e.g. for GCC atomics, fail because the include & lib
> path for OOT CUnit is in AM_CPPFLAGS and AM_LDFLAGS not CPPFLAGS and
> LDFLAGS. The previous workaround is rather tricky to do cleanly here--if
> possible at all. The reason is the location of the WAR and CUnit checking
> was at the very bottom of the configure stage. So, no subsequent building
> of tiny programs for checking feature support was happening. Now, the
> CUnit checking is happening earlier in configure stage which makes the
> previous WAR very difficult to support. I do not think it is possible.

If we think its acceptable to fail when build and not early during
configure then
we should remove AM_CHECK_* for other OOT as well, and not only this.

>
> The proposal here is to simply skip the AC_CHECK_LIB & AC_CHECK_HEADERS
> and add the "-lcunit" side effect via AM_LDFLAGS _only_ when
> --with-cunit-path=DIR is used. If DIR is incorrect, the build will still
> fail, just at later stage instead of in configure stage. This might be
> acceptable to developers who choose to work on ODP with an OOT CUnit.

I like the idea of failing early in the configure step and not when building.

>
> What do you think? Do you have alternate recommendation e.g. moving CUnit
> checking back to bottom of configure stage so WAR can be used?

that was basically what I did with [1], right.

Cheers,
Anders
[1] https://lists.linaro.org/pipermail/lng-odp/2016-April/021682.html
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to