summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.h11
-rw-r--r--src/main.c1
-rw-r--r--src/parse.c2
-rw-r--r--src/version.c6
4 files changed, 14 insertions, 6 deletions
diff --git a/src/config.h b/src/config.h
index 506ad3e..2eff1fc 100644
--- a/src/config.h
+++ b/src/config.h
@@ -29,13 +29,14 @@
#ifndef BFS_COMMAND
# define BFS_COMMAND "bfs"
#endif
-#ifndef BFS_VERSION
-# define BFS_VERSION "3.1.3"
-#endif
#ifndef BFS_HOMEPAGE
# define BFS_HOMEPAGE "https://tavianator.com/projects/bfs.html"
#endif
+// This is a symbol instead of a literal so we don't have to rebuild everything
+// when the version number changes
+extern const char bfs_version[];
+
// Check for system headers
#ifdef __has_include
@@ -97,10 +98,10 @@
# define BFS_USE_PATHS_H BFS_HAS_PATHS_H
#endif
#ifndef BFS_USE_SYS_ACL_H
-# define BFS_USE_SYS_ACL_H (BFS_HAS_SYS_ACL_H && !__illumos__)
+# define BFS_USE_SYS_ACL_H (BFS_HAS_SYS_ACL_H && !__illumos__ && (!__linux__ || BFS_USE_LIBACL))
#endif
#ifndef BFS_USE_SYS_CAPABILITY_H
-# define BFS_USE_SYS_CAPABILITY_H (BFS_HAS_SYS_CAPABILITY_H && !__FreeBSD__)
+# define BFS_USE_SYS_CAPABILITY_H (BFS_HAS_SYS_CAPABILITY_H && !__FreeBSD__ && (!__linux__ || BFS_USE_LIBCAP))
#endif
#ifndef BFS_USE_SYS_EXTATTR_H
# define BFS_USE_SYS_EXTATTR_H (BFS_HAS_SYS_EXTATTR_H && !__DragonFly__)
diff --git a/src/main.c b/src/main.c
index e120f03..b4d65ce 100644
--- a/src/main.c
+++ b/src/main.c
@@ -40,6 +40,7 @@
* - thread.h (multi-threading)
* - trie.[ch] (a trie set/map implementation)
* - typo.[ch] (fuzzy matching for typos)
+ * - version.c (defines the version number)
* - xregex.[ch] (regular expression support)
* - xspawn.[ch] (spawns processes)
* - xtime.[ch] (date/time handling utilities)
diff --git a/src/parse.c b/src/parse.c
index 2dfcab2..38ebf3f 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -2909,7 +2909,7 @@ static struct bfs_expr *parse_help(struct bfs_parser *parser, int arg1, int arg2
* "Parse" -version.
*/
static struct bfs_expr *parse_version(struct bfs_parser *parser, int arg1, int arg2) {
- cfprintf(parser->ctx->cout, "${ex}%s${rs} ${bld}%s${rs}\n\n", BFS_COMMAND, BFS_VERSION);
+ cfprintf(parser->ctx->cout, "${ex}%s${rs} ${bld}%s${rs}\n\n", BFS_COMMAND, bfs_version);
printf("%s\n", BFS_HOMEPAGE);
diff --git a/src/version.c b/src/version.c
new file mode 100644
index 0000000..736f3d5
--- /dev/null
+++ b/src/version.c
@@ -0,0 +1,6 @@
+// Copyright © Tavian Barnes <tavianator@tavianator.com>
+// SPDX-License-Identifier: 0BSD
+
+#include "config.h"
+
+const char bfs_version[] = BFS_VERSION;