Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* include path
@ 2009-02-02 11:55 Richard Stuckey
  2009-02-02 15:03 ` Daniel Jacobowitz
  2009-02-02 18:02 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Stuckey @ 2009-02-02 11:55 UTC (permalink / raw)
  To: gdb

Hello,

Does anyone know how to add a filepath to the gcc compilation command
used in building gdb?

I am trying to change the gdb configure.ac script to handle the
configuration options

       --with-xiss  --with-xiss-prefix=/<somepath>

i.e. much like the existing options

       -with-expat --with-libexpat-prefix=/<somepath>

If the user does specify these options, I want the script simply to
define a macro, e.g. HAVE_LIBXISS (actual name not too important!) and
add the given path as a -I<path> option to the gcc command line used
when building gdb (this additional path is necessary for compiling only
one target-specific module).

I have copied and altered the code in configure.ac which handles expat
to give me 

AC_ARG_WITH(xiss,
  AS_HELP_STRING([--with-xiss], [include xiss support (auto/yes/no)]),
  [], [with_xiss=auto])
AC_MSG_CHECKING([whether to use xiss])
AC_MSG_RESULT([$with_xiss])

 
if test "${with_xiss}" = no; then
    AC_MSG_WARN([xiss support disabled; target arcxiss will be
unavailable.])
    HAVE_LIBXISS=no
else
    HAVE_LIBXISS=yes
    AC_DEFINE(HAVE_LIBXISS, 1, [Define if you have the xISS library.])
fi

so that the AC_DEFINE macro defines HAVE_LIBXISS as needed.  However, I
can not find a way of adding the include path.

I do not want to use the AC_LIB_HAVE_LINKFLAGS macro as that performs a
stronger check than is required here: it checks that the library
specified really does exist, and is loadable, whereas I simply want to
get a path to the header file which defines the interface to that
library, as the target-specific module checks for the existence of the
library at runtime and loads it dynamically if required.

I have tried using the AC_LIB_APPENDTOVAR macro to add the path to the
CPPFLAGS macro, but that has no effect.

Anyone know how to do this?

      Thanks,

            Richard




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: include path
  2009-02-02 11:55 include path Richard Stuckey
@ 2009-02-02 15:03 ` Daniel Jacobowitz
  2009-02-02 16:20   ` Richard Stuckey
  2009-02-02 18:02 ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2009-02-02 15:03 UTC (permalink / raw)
  To: Richard Stuckey; +Cc: gdb

On Mon, Feb 02, 2009 at 11:55:39AM -0000, Richard Stuckey wrote:
> I have tried using the AC_LIB_APPENDTOVAR macro to add the path to the
> CPPFLAGS macro, but that has no effect.

What do you mean, has no effect?  Have you tried just adding it to
CPPFLAGS by hand?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: include path
  2009-02-02 15:03 ` Daniel Jacobowitz
@ 2009-02-02 16:20   ` Richard Stuckey
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stuckey @ 2009-02-02 16:20 UTC (permalink / raw)
  To: gdb

Sorry, should have been more specific. I meant that I do not get a
-I<path> option for the given path as part of the gdb command line when
building gdb.

I have tried explicitly adding this path to CPPFLAGS, by adding 

   CPPFLAGS="$CPPFLAGS -I<path>"

to the configure.ac script, and that does work.

So if I can just get the path from the script variables, instead of
hard-coding it into the script, that should be sufficient.

      Richad



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: include path
  2009-02-02 11:55 include path Richard Stuckey
  2009-02-02 15:03 ` Daniel Jacobowitz
@ 2009-02-02 18:02 ` Tom Tromey
  2009-02-03 12:43   ` Richard Stuckey
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2009-02-02 18:02 UTC (permalink / raw)
  To: Richard Stuckey; +Cc: gdb

>>>>> "Richard" == Richard Stuckey <Richard.Stuckey@arc.com> writes:

Richard> AC_ARG_WITH(xiss,
Richard>   AS_HELP_STRING([--with-xiss], [include xiss support (auto/yes/no)]),
Richard>   [], [with_xiss=auto])
Richard> AC_MSG_CHECKING([whether to use xiss])
Richard> AC_MSG_RESULT([$with_xiss])

Richard> However, I can not find a way of adding the include path.

A typical approach is to define a new variable in configure.ac, then
AC_SUBST it:

    XISS_INCLUDES="-Iwhatever"
    AC_SUBST(XISS_INCLUDES)

Then in Makefile.in:

    XISS_INCLUDES = @XISS_INCLUDES@

Finally, add $(XISS_INCLUDES) to INTERNAL_CFLAGS_BASE.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: include path
  2009-02-02 18:02 ` Tom Tromey
@ 2009-02-03 12:43   ` Richard Stuckey
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stuckey @ 2009-02-03 12:43 UTC (permalink / raw)
  To: gdb

> A typical approach is to define a new variable in configure.ac, then
> AC_SUBST it:
>
>    XISS_INCLUDES="-Iwhatever"
>    AC_SUBST(XISS_INCLUDES)
>
> Then in Makefile.in:
>
>    XISS_INCLUDES = @XISS_INCLUDES@
>
> Finally, add $(XISS_INCLUDES) to INTERNAL_CFLAGS_BASE.


Ah, that's it.

It finally dawned on me that I get the "whatever" from the script
variable 'with_xiss_prefix', i.e. the script creates a variable
corresponding to each command-line option to 'configure'.  So I now have

  AC_DEFINE(HAVE_LIBXISS, 1, [Define if you have the xISS library.])
  XISS_INCLUDES="-I${with_xiss_prefix}/include"
  AC_SUBST(XISS_INCLUDES)

which gives the required result.

Thanks for your help!

     Richard



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-03 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-02 11:55 include path Richard Stuckey
2009-02-02 15:03 ` Daniel Jacobowitz
2009-02-02 16:20   ` Richard Stuckey
2009-02-02 18:02 ` Tom Tromey
2009-02-03 12:43   ` Richard Stuckey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox