diff mbox

[3/3,RFC] nfs-utils: include headers from srcdir

Message ID 20141202124004.13015.5604.stgit@zeus.muc.hardeman.nu (mailing list archive)
State New, archived
Headers show

Commit Message

David Härdeman Dec. 2, 2014, 12:40 p.m. UTC
Some of the headers in ./support/include get generated as part of the
build process (and end up in the build dir hierarchy) and some are
not (so they stay in the srcdir hierarchy).

That means the build breaks when using a separate build dir. I'm not sure
what the best way to make sure that -I$(top_srcdir)/support/include is
defined everywhere is. Consider this a basis for discussion rather than
a real patch. Someone with more autoconf-fu can surely come up with a better
solution.
---
 configure.ac |    3 +++
 1 file changed, 3 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Steve Dickson Dec. 8, 2014, 6:04 p.m. UTC | #1
On 12/02/2014 07:40 AM, David Härdeman wrote:
> Some of the headers in ./support/include get generated as part of the
> build process (and end up in the build dir hierarchy) and some are
> not (so they stay in the srcdir hierarchy).
> 
> That means the build breaks when using a separate build dir. I'm not sure
> what the best way to make sure that -I$(top_srcdir)/support/include is
> defined everywhere is. Consider this a basis for discussion rather than
> a real patch. Someone with more autoconf-fu can surely come up with a better
> solution.
This one I didn't commit because it caused -I../../support/include to 
defined twice. That path gets define ing  Makefile.in file in the 
DEFAULT_INCLUDES macro. 

steved.

> ---
>  configure.ac |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index e3af723..5d0ab2b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -479,6 +479,9 @@ my_am_cflags="-Wall -Wextra -Wstrict-prototypes $ARCHFLAGS -pipe"
>  
>  AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
>  
> +AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/support/include"
> +AC_SUBST([AM_CPPFLAGS])
> +
>  # Make sure that $ACLOCAL_FLAGS are used during a rebuild
>  AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Härdeman Dec. 8, 2014, 8:45 p.m. UTC | #2
On Mon, Dec 08, 2014 at 01:04:28PM -0500, Steve Dickson wrote:
>On 12/02/2014 07:40 AM, David Härdeman wrote:
>> Some of the headers in ./support/include get generated as part of the
>> build process (and end up in the build dir hierarchy) and some are
>> not (so they stay in the srcdir hierarchy).
>> 
>> That means the build breaks when using a separate build dir. I'm not sure
>> what the best way to make sure that -I$(top_srcdir)/support/include is
>> defined everywhere is. Consider this a basis for discussion rather than
>> a real patch. Someone with more autoconf-fu can surely come up with a better
>> solution.
>
>This one I didn't commit because it caused -I../../support/include to 
>defined twice. That path gets define ing  Makefile.in file in the 
>DEFAULT_INCLUDES macro. 

But only if $(top_srcdir) == $(top_builddir)

So, for example, if you do:

	cd nfs-utils
	mkdir tmp
	cd tmp
	../configure
	make

Then you'd have -I../../support/include and -I../../../support/include?

I think this is in line with:
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

See the section on AM_CPPFLAGS...

An example from Gutenprint2:
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)

Though a more "complete" fix might be to either have a common include
file, or a non-recursive make :)
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index e3af723..5d0ab2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,9 @@  my_am_cflags="-Wall -Wextra -Wstrict-prototypes $ARCHFLAGS -pipe"
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
 
+AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/support/include"
+AC_SUBST([AM_CPPFLAGS])
+
 # Make sure that $ACLOCAL_FLAGS are used during a rebuild
 AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])