build: improve check for ::(w)system #22845

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:dont_literally_use_have_or_have changing 1 files +6 −3
  1. fanquake commented at 12:44 PM on August 31, 2021: member

    AC_DEFINE() takes HAVE_STD__SYSTEM || HAVE_WSYSTEM literally, meaning you end up with the following in bitcoin-config.h:

    /* std::system or ::wsystem */
    #define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM
    

    This works for the preprocessor, because HAVE_SYSTEM, is defined, just unusually. Remove this in favor of setting have_any_system in either case, given we don't actually use HAVE_STD__SYSTEM or HAVE_WSYSTEM, and defining HAVE_SYSTEM to 1 thereafter.

  2. fanquake added the label Build system on Aug 31, 2021
  3. jarolrod commented at 7:29 PM on August 31, 2021: member

    GUIX hashes:

    find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
    
    9ecbd16356c3b39b42f1b844fe2f2888678a08536a952bddc1ebb0e8a32121ed  guix-build-ab746798950c/output/aarch64-linux-gnu/SHA256SUMS.part
    fcb48482cc072c6bbf68bba1d7909c045b43b4ff166c64f60f5bbfaa79bd91a1  guix-build-ab746798950c/output/aarch64-linux-gnu/bitcoin-ab746798950c-aarch64-linux-gnu-debug.tar.gz
    4608522b668148b886a2910ccbcaa5c56b74f0e17acf43d7804c4119ffe83a0d  guix-build-ab746798950c/output/aarch64-linux-gnu/bitcoin-ab746798950c-aarch64-linux-gnu.tar.gz
    401574d266276c55ab8c4aa8f0b5bd5b2db2019fcc9e017a108619fd6fdfcaca  guix-build-ab746798950c/output/arm-linux-gnueabihf/SHA256SUMS.part
    c04defcc660dba07a855a7de78312f68f9a9252f7275e55dcff354457566a401  guix-build-ab746798950c/output/arm-linux-gnueabihf/bitcoin-ab746798950c-arm-linux-gnueabihf-debug.tar.gz
    6a40e35b2a37242afec43596a112fc53b903a2775ee91334d2d3531320fdea8c  guix-build-ab746798950c/output/arm-linux-gnueabihf/bitcoin-ab746798950c-arm-linux-gnueabihf.tar.gz
    7349a6b9bc126ccd1774a4ac9df1979124a1a777e3a2e6c55f75018e6901c0ae  guix-build-ab746798950c/output/dist-archive/bitcoin-ab746798950c.tar.gz
    3ac0d7e840e6c6d314865fa4a9fa5d33c051280ea67672c18d0ce66553d11103  guix-build-ab746798950c/output/powerpc64-linux-gnu/SHA256SUMS.part
    7f543d2b52fba4d03221bb30ad0021f2cf50e02ed733e794086ab685d990f84b  guix-build-ab746798950c/output/powerpc64-linux-gnu/bitcoin-ab746798950c-powerpc64-linux-gnu-debug.tar.gz
    6fae41d30e9ac4b2220ffd809fb014bbaa8a80af3a56378a1f3e78b5ebe01718  guix-build-ab746798950c/output/powerpc64-linux-gnu/bitcoin-ab746798950c-powerpc64-linux-gnu.tar.gz
    e8b3aa3bb8fc5474897e61d520612b2ab7bfa3bfde792663a4ccff38b089047e  guix-build-ab746798950c/output/powerpc64le-linux-gnu/SHA256SUMS.part
    43b81aab1b4af654ac3f85bffdf3a99b426e0e81eb10df1f324453a11257811f  guix-build-ab746798950c/output/powerpc64le-linux-gnu/bitcoin-ab746798950c-powerpc64le-linux-gnu-debug.tar.gz
    0db3dcfa33e2ec24b61f42403e1cc48c50d82bfa4af4da91d3cc751d99f1edc8  guix-build-ab746798950c/output/powerpc64le-linux-gnu/bitcoin-ab746798950c-powerpc64le-linux-gnu.tar.gz
    6bd5466ff9188324a0e44758c284cd2c4412e836be3e5d3f1c3f443e0a70c592  guix-build-ab746798950c/output/riscv64-linux-gnu/SHA256SUMS.part
    e824fddbac653fd039c42ae06d0ca0041a27ae9409798448c2b5e940b9c3891d  guix-build-ab746798950c/output/riscv64-linux-gnu/bitcoin-ab746798950c-riscv64-linux-gnu-debug.tar.gz
    39384b48bdf06fd021881b67d185f7fb6fbc35993cda8771bd1fd3e9fc30805a  guix-build-ab746798950c/output/riscv64-linux-gnu/bitcoin-ab746798950c-riscv64-linux-gnu.tar.gz
    9d0c2df08025ca849b0559896e5451392090ab17334d36bf5172283b1c172370  guix-build-ab746798950c/output/x86_64-apple-darwin18/SHA256SUMS.part
    4047fe6ff55625f30f817018646686897604be93e02ca5012d9670a881fe9398  guix-build-ab746798950c/output/x86_64-apple-darwin18/bitcoin-ab746798950c-osx-unsigned.dmg
    7f786cc9d429c3bbbedd030afd5e6630118cbfc04875e6d84ca0c1bb5215473d  guix-build-ab746798950c/output/x86_64-apple-darwin18/bitcoin-ab746798950c-osx-unsigned.tar.gz
    a4fa450417520d572a09d5ad37540962fd4a69a172a3aa1000b74d7942ec4bbe  guix-build-ab746798950c/output/x86_64-apple-darwin18/bitcoin-ab746798950c-osx64.tar.gz
    ad52ce6bf58eb57c5d455a77f1f213dd7049f245e00e4db48a5fe0650662a3b1  guix-build-ab746798950c/output/x86_64-linux-gnu/SHA256SUMS.part
    aa33ad90cf56947cfc4391e692ca37094d8d57a2840c48a27f6d8ec3ce615df9  guix-build-ab746798950c/output/x86_64-linux-gnu/bitcoin-ab746798950c-x86_64-linux-gnu-debug.tar.gz
    724942c02c6cba9a8fe9601a1ea8c64049c728be6cc848aabbf14379a8659ede  guix-build-ab746798950c/output/x86_64-linux-gnu/bitcoin-ab746798950c-x86_64-linux-gnu.tar.gz
    d1f4859b7a5763762c5cdabfbb8a33b0a8cf3b5c44fd5765bc607689a78bea46  guix-build-ab746798950c/output/x86_64-w64-mingw32/SHA256SUMS.part
    37c63d2b54b40ff080fd36bb29df21583022a824f893fd0f1523aaaf4caeb1f6  guix-build-ab746798950c/output/x86_64-w64-mingw32/bitcoin-ab746798950c-win-unsigned.tar.gz
    715c14e7ba175e706a20175fee6226907a0ddf852cdd232d7f77bc5a2fb1bedf  guix-build-ab746798950c/output/x86_64-w64-mingw32/bitcoin-ab746798950c-win64-debug.zip
    884877e1c3617f3275d98f00ae34041ec68cba224dff3a1a00102fb6290df2dc  guix-build-ab746798950c/output/x86_64-w64-mingw32/bitcoin-ab746798950c-win64-setup-unsigned.exe
    de1e324799c9e90fac7b1f74e42ed7a36f23446fdc56f5dcb49a347d1ce14459  guix-build-ab746798950c/output/x86_64-w64-mingw32/bitcoin-ab746798950c-win64.zip
    
  4. practicalswift commented at 6:48 PM on September 4, 2021: contributor

    Concept ACK

  5. fanquake deleted a comment on Sep 5, 2021
  6. laanwj commented at 3:26 PM on September 9, 2021: member

    I'm not sure it's canonically 'allowed' to have multiple AC_DEFINE define the same thing. On some level I dislike it. I guess if we're going to change this anyway, why not set an internal variable e.g.

    have_any_system=no
    …
    [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSTEM, 1, Define to 1 if std::system is available.); have_any_system=yes ],
    …
    [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if ::wsystem is available.); have_any_system=yes],
    …
    if test "x${have_any_system}" == "xyes"; then
        AC_DEFINE(HAVE_ANY_SYSTEM, 1, Define to 1 if ::system or ::wsystem is available.)
    fi
    

    This makes it possible to check for either separately, and also defines a setting for either-is-set. If the former is unnecessary you could leave out the AC_DEFINE in the specific checks.

    Edit: thinking of it, we should probably make sure the end result is HAVE_SYSTEM to avoid having to change all over the code… :woman_facepalming:

  7. build: improve check for ::(w)system
    `AC_DEFINE()` takes `HAVE_STD__SYSTEM || HAVE_WSYSTEM` literally, meaning you
    end up with the following in bitcoin-config.h:
    ```cpp
    /* std::system or ::wsystem */
    #define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM
    ```
    
    This works for the preprocessor, because `HAVE_SYSTEM`, is defined, just unusually.
    Remove this in favor of defining `HAVE_SYSTEM` to 1 in either case, given we
    don't actually use `HAVE_STD__SYSTEM` or `HAVE_WSYSTEM`. We just use ::system if
    we aren't building for Windows.
    3ec633ef1a
  8. fanquake force-pushed on Sep 10, 2021
  9. laanwj commented at 6:04 PM on September 16, 2021: member

    Code review ACK 3ec633ef1a99d3a71c19ab5563a82bc275659d2e

  10. laanwj merged this on Sep 16, 2021
  11. laanwj closed this on Sep 16, 2021

  12. fanquake deleted the branch on Sep 17, 2021
  13. sidhujag referenced this in commit cfeef98e60 on Sep 19, 2021
  14. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me