FreeBSD has (and possibly other platforms as well) a header file named "version"
in the system C++ headers, particularly `/usr/include/c++/v1/version`, which is
supposed to get picked up during the compilation of compile-cxx test as it gets
included by other system files.  However, because there is also a "version" file
in the tests/ directory (one of the tests to check nbd_get_version() function)
it prefers that one for some reason.  And the C preprocessor gets thoroughly
confused, mainly by comments in the libtool script that is ./version, so this
commit changes the `version` binary name to `get-version` to avoid the issue.

Signed-off-by: Martin Kletzander <[email protected]>
---
 tests/Makefile.am                  | 12 ++++++------
 tests/{version.c => get-version.c} |  0
 .gitignore                         |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
 rename tests/{version.c => get-version.c} (100%)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index c65bf8be399e..09de0798ff30 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,7 +68,7 @@ check_PROGRAMS += \
        close-null \
        debug \
        debug-environment \
-       version \
+       get-version \
        export-name \
        private-data \
        $(NULL)
@@ -80,7 +80,7 @@ TESTS += \
        close-null \
        debug \
        debug-environment \
-       version \
+       get-version \
        export-name \
        private-data \
        $(NULL)
@@ -120,10 +120,10 @@ debug_environment_CPPFLAGS = -I$(top_srcdir)/include
 debug_environment_CFLAGS = $(WARNINGS_CFLAGS)
 debug_environment_LDADD = $(top_builddir)/lib/libnbd.la
 
-version_SOURCES = version.c
-version_CPPFLAGS = -I$(top_srcdir)/include
-version_CFLAGS = $(WARNINGS_CFLAGS)
-version_LDADD = $(top_builddir)/lib/libnbd.la
+get_version_SOURCES = get-version.c
+get_version_CPPFLAGS = -I$(top_srcdir)/include
+get_version_CFLAGS = $(WARNINGS_CFLAGS)
+get_version_LDADD = $(top_builddir)/lib/libnbd.la
 
 export_name_SOURCES = export-name.c
 export_name_CPPFLAGS = -I$(top_srcdir)/include
diff --git a/tests/version.c b/tests/get-version.c
similarity index 100%
rename from tests/version.c
rename to tests/get-version.c
diff --git a/.gitignore b/.gitignore
index e942c5a17823..865b6896ac12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -183,6 +183,7 @@ Makefile.in
 /tests/export-name
 /tests/functions.sh
 /tests/get-size
+/tests/get-version
 /tests/is-not-rotational-flag
 /tests/is-rotational-flag
 /tests/keys.psk
@@ -201,5 +202,4 @@ Makefile.in
 /tests/shutdown-flags
 /tests/synch-parallel
 /tests/synch-parallel-tls
-/tests/version
 /valgrind/suppressions
-- 
2.32.0

_______________________________________________
Libguestfs mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to