Allow customization of compiler in configure.

This commit is contained in:
Jordan Bancino 2023-11-04 15:56:57 -04:00
parent 582c79b608
commit 1f02f3c2a2
1 changed files with 7 additions and 6 deletions

13
configure vendored
View File

@ -19,7 +19,7 @@ LIBS="-lm -pthread -lCytoplasm"
# Set default args for all platforms
SCRIPT_ARGS="--prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@"
SCRIPT_ARGS="--cc=cc --prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@"
echo "Processing options..."
echo "Ran with arguments: $SCRIPT_ARGS"
@ -27,6 +27,9 @@ echo "Ran with arguments: $SCRIPT_ARGS"
# Process all arguments
for arg in $SCRIPT_ARGS; do
case "$arg" in
--cc=*)
CC=$(echo "$arg" | cut -d '=' -f 2-)
;;
--prefix=*)
PREFIX=$(echo "$arg" | cut -d '=' -f 2-)
;;
@ -60,7 +63,7 @@ for arg in $SCRIPT_ARGS; do
STATIC=""
;;
*)
echo "Invalid argument: $1"
echo "Invalid argument: $arg"
exit 1
;;
esac
@ -112,9 +115,7 @@ compile_obj() {
src="$1"
obj="$2"
# TODO: Add a --cc flag to set the C compiler to use for
# Makefile generation.
pref=$(cc -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}")
pref=$(${CC} -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}")
echo "$pref $(collect ${SCHEMA}/ .json .h ${BUILD}/Schema/ print_obj)"
echo "${TAB}@mkdir -p $(dirname ${obj})"
echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\""
@ -202,7 +203,7 @@ cat << EOF > Makefile
# Generated by '$0' on $(date).
# This file should generally not be manually edited.
CC = cc
CC = ${CC}
PREFIX = ${PREFIX}
CFLAGS = ${CFLAGS}
LDFLAGS = ${LDFLAGS}