diff options
author | fanquake <fanquake@gmail.com> | 2021-11-24 20:16:53 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-12-03 21:03:35 +0800 |
commit | d6d402bd2b8211e9e111acae433ca4e3cfd8d370 (patch) | |
tree | f4a09fba13530762b33e881536d5bf76f0885d5e /build-aux/m4/bitcoin_find_bdb48.m4 | |
parent | c9b63ab61e4c0c94430064c9025c040f2abaeefc (diff) | |
download | bitcoin-d6d402bd2b8211e9e111acae433ca4e3cfd8d370.tar.xz |
build: remove x-prefix comparisons
Very old shells suffered from bugs which meant that prefixing variables
with an "x" to ensure that the lefthand side of a comparison always
started with an alphanumeric character was needed. Modern shells don't
suffer from this issue (i.e Bash was fixed in 1996).
In any case, we've already got unprefixed checks used in our codebase,
i.e https://github.com/bitcoin/bitcoin/blob/master/configure.ac#L292,
and have dependencies (in depends) that also use unprefixed comparisons.
I think it's time that we can consolidate on not using the x-prefix
workaround. At best it's mostly just confusing.
More info:
https://github.com/koalaman/shellcheck/wiki/SC2268
https://www.vidarholen.net/contents/blog/?p=1035
Diffstat (limited to 'build-aux/m4/bitcoin_find_bdb48.m4')
-rw-r--r-- | build-aux/m4/bitcoin_find_bdb48.m4 | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build-aux/m4/bitcoin_find_bdb48.m4 b/build-aux/m4/bitcoin_find_bdb48.m4 index da6e7064a7..d2f01907c3 100644 --- a/build-aux/m4/bitcoin_find_bdb48.m4 +++ b/build-aux/m4/bitcoin_find_bdb48.m4 @@ -6,9 +6,9 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[ AC_ARG_VAR([BDB_CFLAGS], [C compiler flags for BerkeleyDB, bypasses autodetection]) AC_ARG_VAR([BDB_LIBS], [Linker flags for BerkeleyDB, bypasses autodetection]) - if test "x$use_bdb" = "xno"; then + if test "$use_bdb" = "no"; then use_bdb=no - elif test "x$BDB_CFLAGS" = "x"; then + elif test "$BDB_CFLAGS" = ""; then AC_MSG_CHECKING([for Berkeley DB C++ headers]) BDB_CPPFLAGS= bdbpath=X @@ -28,7 +28,7 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[ #error "failed to find bdb 4.8+" #endif ]])],[ - if test "x$bdbpath" = "xX"; then + if test "$bdbpath" = "X"; then bdbpath="${searchpath}" fi ],[ @@ -45,13 +45,13 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[ break ],[]) done - if test "x$bdbpath" = "xX"; then + if test "$bdbpath" = "X"; then use_bdb=no AC_MSG_RESULT([no]) AC_MSG_WARN([libdb_cxx headers missing]) AC_MSG_WARN(AC_PACKAGE_NAME[ requires this library for BDB (legacy) wallet support]) AC_MSG_WARN([Passing --without-bdb will suppress this warning]) - elif test "x$bdb48path" = "xX"; then + elif test "$bdb48path" = "X"; then BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[ AC_MSG_WARN([Found Berkeley DB other than 4.8]) @@ -74,9 +74,9 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[ fi AC_SUBST(BDB_CPPFLAGS) - if test "x$use_bdb" = "xno"; then + if test "$use_bdb" = "no"; then use_bdb=no - elif test "x$BDB_LIBS" = "x"; then + elif test "$BDB_LIBS" = ""; then # TODO: Ideally this could find the library version and make sure it matches the headers being used for searchlib in db_cxx-4.8 db_cxx db4_cxx; do AC_CHECK_LIB([$searchlib],[main],[ @@ -84,13 +84,13 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[ break ]) done - if test "x$BDB_LIBS" = "x"; then + if test "$BDB_LIBS" = ""; then AC_MSG_WARN([libdb_cxx headers missing]) AC_MSG_WARN(AC_PACKAGE_NAME[ requires this library for BDB (legacy) wallet support]) AC_MSG_WARN([Passing --without-bdb will suppress this warning]) fi fi - if test "x$use_bdb" != "xno"; then + if test "$use_bdb" != "no"; then AC_SUBST(BDB_LIBS) AC_DEFINE([USE_BDB], [1], [Define if BDB support should be compiled in]) use_bdb=yes |