git-wad

Manage files via git but not their content
git clone git://git.meso-star.fr/git-wad.git
Log | Files | Refs | README | LICENSE

commit a663e8ec55b90758d5412cd6e6342e0d25c3c538
parent 50c6dd29f6b2d33543ee9c1f0612f298a1f77b26
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sun, 26 Jan 2025 15:16:26 +0100

Improve the portability of the C compiler used

Although the c99 command is POSIX-compliant, systems can still use the
conventional cc command as the default C compiler (in which case c99 may
not be defined). Hence this commit to use either cc or c99.

Diffstat:
Mgit-wad | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/git-wad b/git-wad @@ -43,6 +43,16 @@ if ! command -v sha256sum 1> /dev/null 2>&1 \ die fi +# Check C compiler support +if command -v c99 1> /dev/null 2>&1; then + CC="c99" +elif command -v cc 1> /dev/null 2>&1; then + CC="cc" +else + >&2 printf 'No C compiler\n' + die +fi + # shellcheck disable=SC2310 working_tree="$(git rev-parse --show-toplevel)" || die "$?" git_wad_tmpdir="$(mktemp -d "${TMPDIR:-/tmp}/git_wad_XXXXXX")" || die "$?" @@ -276,7 +286,7 @@ int main(void) return 0; } EOF - c99 "${next_timestamp}.c" -o "${next_timestamp}" > /dev/null 2>&1 + "${CC}" "${next_timestamp}.c" -o "${next_timestamp}" > /dev/null 2>&1 } restore() # WAD file