diff mbox

[1/2] configure: support out-of-tree CUnit

Message ID 1458933927-77722-1-git-send-email-brian.brooks@linaro.org
State New
Headers show

Commit Message

Brian Brooks March 25, 2016, 7:25 p.m. UTC
If --with-cunit-path=DIR is used, skip the AC_CHECK_LIB and modify the linker
flags accordingly.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>
---
 test/m4/validation.m4 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Brian Brooks March 26, 2016, 1:06 a.m. UTC | #1
On 04/01 22:15:34, Anders Roxell wrote:
> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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?

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.

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.

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.

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?

AC_CHECK_LIB can also be considered dangerous for this LIBS side effect.
It is possible to end up with many objects having unnecessary lib deps.

Brian
Anders Roxell April 1, 2016, 8:15 p.m. UTC | #2
On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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.

Cheers,
Anders
Anders Roxell April 4, 2016, 2:08 p.m. UTC | #3
On 26 March 2016 at 02:06, Brian Brooks <brian.brooks@linaro.org> wrote:
> On 04/01 22:15:34, Anders Roxell wrote:
>> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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
Mike Holmes April 4, 2016, 2:22 p.m. UTC | #4
On 4 April 2016 at 10:08, Anders Roxell <anders.roxell@linaro.org> wrote:

> On 26 March 2016 at 02:06, Brian Brooks <brian.brooks@linaro.org> wrote:

> > On 04/01 22:15:34, Anders Roxell wrote:

> >> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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.

>


I can't see a rationale for not failing as soon as possible, but I might be
missing something since I did not study this patch.


>

> >

> > 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

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Ricardo Salveti April 4, 2016, 9:55 p.m. UTC | #5
On Mon, Apr 4, 2016 at 11:08 AM, Anders Roxell <anders.roxell@linaro.org> wrote:
> On 26 March 2016 at 02:06, Brian Brooks <brian.brooks@linaro.org> wrote:
>> On 04/01 22:15:34, Anders Roxell wrote:
>>> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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.

Here we should fail when running configure instead of waiting for the
build itself to fail. We shouldn't avoid AC_CHECK_LIB as that will
check if the path given contains the library, besides setting up the
lib list as a consequence.

I see two ways for us to fix this situation. First is by just fixing
the check order, and second is by making sure that the cunit path is
available for the following checks.

Cheers,
Brian Brooks April 5, 2016, 5:12 p.m. UTC | #6
On 04/04 16:08:26, Anders Roxell wrote:
> On 26 March 2016 at 02:06, Brian Brooks <brian.brooks@linaro.org> wrote:
> > On 04/01 22:15:34, Anders Roxell wrote:
> >> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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.

Looks good to me. Cheers

> Cheers,
> Anders
> [1] https://lists.linaro.org/pipermail/lng-odp/2016-April/021682.html
Mike Holmes April 7, 2016, 12:02 p.m. UTC | #7
CI is still failing and I think this is the needed fix, any progress ?

On 5 April 2016 at 13:12, Brian Brooks <brian.brooks@linaro.org> wrote:

> On 04/04 16:08:26, Anders Roxell wrote:

> > On 26 March 2016 at 02:06, Brian Brooks <brian.brooks@linaro.org> wrote:

> > > On 04/01 22:15:34, Anders Roxell wrote:

> > >> On 25 March 2016 at 20:25, Brian Brooks <brian.brooks@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.brooks@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.

>

> Looks good to me. Cheers

>

> > 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

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
diff mbox

Patch

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
 fi