hack: Support picking cc and cpp via environment variables.

Until now `cc' was hard-coded as the only compiler used.  Supporting selecting
the compiler and preprocessor to be used via environment variables makes life
easier for distributors, so this commit mimics how podman does it in its hack/*
scripts.

Signed-off-by: Tomas Volf <~@wolfsden.cz>
This commit is contained in:
Tomas Volf 2024-05-09 01:42:50 +02:00
parent 2b6c7ad225
commit 60a609bec8
No known key found for this signature in database
GPG Key ID: 2FBFEE7DB67FC1A9
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
#include <btrfs/ioctl.h>
EOF
if test $? -ne 0 ; then

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
#include <btrfs/version.h>
EOF
if test $? -ne 0 ; then

View File

@ -5,7 +5,8 @@ fi
tmpdir="$PWD/tmp.$RANDOM"
mkdir -p "$tmpdir"
trap 'rm -fr "$tmpdir"' EXIT
cc -o "$tmpdir"/libsubid_tag -x c - -l subid > /dev/null 2> /dev/null << EOF
${CC:-cc} ${CPPFLAGS} ${CFLAGS} -o "$tmpdir"/libsubid_tag -x c - -l subid \
> /dev/null 2> /dev/null << EOF
#include <shadow/subid.h>
#include <stdlib.h>
int main() {