diff mbox series

[1/1] btrfs-progs: build system - do not use AC_DEFINE twice

Message ID 20210320092728.24673-2-pierre.labastie@neuf.fr (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: build system - do not use AC_DEFINE twice | expand

Commit Message

Pierre Labastie March 20, 2021, 9:27 a.m. UTC
From: Pierre Labastie <pierre.labastie@neuf.fr>

Autoheader uses the AC_DEFINE macros (and a few others) to populate
the config.h.in file. The autotools documentation does not tell
what happens if AC_DEFINE is used twice for the same identifier.

This patch prevents using AC_DEFINE twice for
HAVE_OWN_FIEMAP_EXTENT_DEFINE, preserving the logic (using the
fact that an undefined identifier in a preprocessor directive is
taken as zero).

Signed-off-by: Pierre Labastie <pierre.labastie@neuf.fr>
---
 configure.ac | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

David Sterba March 23, 2021, 4:07 p.m. UTC | #1
On Sat, Mar 20, 2021 at 10:27:28AM +0100, pierre.labastie@neuf.fr wrote:
> From: Pierre Labastie <pierre.labastie@neuf.fr>
> 
> Autoheader uses the AC_DEFINE macros (and a few others) to populate
> the config.h.in file. The autotools documentation does not tell
> what happens if AC_DEFINE is used twice for the same identifier.
> 
> This patch prevents using AC_DEFINE twice for
> HAVE_OWN_FIEMAP_EXTENT_DEFINE, preserving the logic (using the
> fact that an undefined identifier in a preprocessor directive is
> taken as zero).
> 
> Signed-off-by: Pierre Labastie <pierre.labastie@neuf.fr>

Added to devel, thanks.
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index aa3f7824..6ea29e0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,17 +240,11 @@  fi
 AC_SUBST([CRYPTOPROVIDER_BUILTIN])
 AC_DEFINE_UNQUOTED([CRYPTOPROVIDER],["$cryptoprovider"],[Crypto implementation source name])
 
-HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE=0
 AX_CHECK_DEFINE([linux/fiemap.h], [FIEMAP_EXTENT_SHARED], [],
-		[HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE=1
+		[AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [1],
+                           [Define to 1 if kernel headers do not define FIEMAP_EXTENT_SHARED])
 		 AC_MSG_WARN([no definition of FIEMAP_EXTENT_SHARED found, probably old kernel, will use own definition, 'btrfs fi du' might report wrong numbers])])
 
-if test "x$HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE" == "x1"; then
-AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [1], [We defined FIEMAP_EXTENT_SHARED])
-else
-AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [0], [We did not define FIEMAP_EXTENT_SHARED])
-fi
-
 AX_CHECK_DEFINE([ext2fs/ext2_fs.h], [EXT4_EPOCH_MASK],
 		[AC_DEFINE([HAVE_EXT4_EPOCH_MASK_DEFINE], [1],
 			   [Define to 1 if e2fsprogs defines EXT4_EPOCH_MASK])],