[3/3] btrfs-progs: build: use m4_flatten instead of m4_chomp
diff mbox

Message ID 20180427185637.16642-4-jeffm@suse.com
State New
Headers show

Commit Message

Jeff Mahoney April 27, 2018, 6:56 p.m. UTC
From: Jeff Mahoney <jeffm@suse.com>

Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking)
started m4_chomp to strip the newlines from the version file.  m4_chomp
was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63.
For purposes of just stripping the newline, m4_flatten is sufficient.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Mahoney April 27, 2018, 7:18 p.m. UTC | #1
On 4/27/18 2:56 PM, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
> 
> Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking)
> started m4_chomp to strip the newlines from the version file.  m4_chomp
> was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63.
> For purposes of just stripping the newline, m4_flatten is sufficient.

Scratch that.  The previous patch also requires autoconf 2.64.

-Jeff

> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 17880206..a0cebf15 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,5 +1,5 @@
>  AC_INIT([btrfs-progs],
> -	m4_chomp(m4_include([VERSION])),
> +	m4_flatten(m4_include([VERSION])),
>  	[linux-btrfs@vger.kernel.org],,
>  	[http://btrfs.wiki.kernel.org])
>  
>
David Sterba April 29, 2018, 10:13 a.m. UTC | #2
On Fri, Apr 27, 2018 at 03:18:17PM -0400, Jeff Mahoney wrote:
> On 4/27/18 2:56 PM, jeffm@suse.com wrote:
> > From: Jeff Mahoney <jeffm@suse.com>
> > 
> > Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking)
> > started m4_chomp to strip the newlines from the version file.  m4_chomp
> > was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63.
> > For purposes of just stripping the newline, m4_flatten is sufficient.
> 
> Scratch that.  The previous patch also requires autoconf 2.64.

I wanted to avoid shell tricks, but this should work everywhere:

m4_esyscmd([echo -n $(cat VERSION)])
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Mahoney April 29, 2018, 1:19 p.m. UTC | #3
On 4/29/18 6:13 AM, David Sterba wrote:
> On Fri, Apr 27, 2018 at 03:18:17PM -0400, Jeff Mahoney wrote:
>> On 4/27/18 2:56 PM, jeffm@suse.com wrote:
>>> From: Jeff Mahoney <jeffm@suse.com>
>>>
>>> Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking)
>>> started m4_chomp to strip the newlines from the version file.  m4_chomp
>>> was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63.
>>> For purposes of just stripping the newline, m4_flatten is sufficient.
>>
>> Scratch that.  The previous patch also requires autoconf 2.64.
> 
> I wanted to avoid shell tricks, but this should work everywhere:
> 
> m4_esyscmd([echo -n $(cat VERSION)])
> 

m4_flatten should work everywhere.  It's the AX_CHECK_COMPILE_FLAGS that
depends on autoconf 2.64.

I can fix the dependency, but it ends up looking like:

m4_version_prereq([2.64], [
    AX_CHECK_COMPILE_FLAG([-std=gnu90],[CSTD=-std=gnu90],[CSTD=-std=gnu89])
  ], [
    AX_GCC_VERSION([4], [5], [0], [CSTD=-std=gnu90],[CSTD=-std=gnu89])
  ])
AC_SUBST([CSTD])

AX_GCC_VERSION is deprecated, but works with earlier autoconf versions.
I'm not thrilled about it, but keying off the autoconf version and using
the newer way for newer versions means it'll be easier to drop it later
when we drop support for earlier autoconf.

Alternatively, I can just put this patch in the OBS project.

-Jeff

Patch
diff mbox

diff --git a/configure.ac b/configure.ac
index 17880206..a0cebf15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@ 
 AC_INIT([btrfs-progs],
-	m4_chomp(m4_include([VERSION])),
+	m4_flatten(m4_include([VERSION])),
 	[linux-btrfs@vger.kernel.org],,
 	[http://btrfs.wiki.kernel.org])