Skip to content

Commit

Permalink
Fix configure so the right CC gets picked up
Browse files Browse the repository at this point in the history
unlike one would expect, setting `CC?=gcc -m32` in config.mak did not actually
lead to `gcc -m32` being used as compiler when running make, even though CC
was not declared anywhere else.
it appears as if the CC variable is implicitly defined by GNU make, so using
the ?= assignment (meaning "assign only if not already assigned") did not have
an effect.
when this configure script and Makefile here were written, they were modeled
after the interface provided by GNU autoconf (so there are no surprises for the
user). the assumption was that environment variables passed during configure
are usually stored and used for the compile, but can be overridden when running
make by exporting the variables again.
in reality though they can not be overridden by environment when running make,
as tests showed.
because of that, the other user-supplied variables will now be hard-assigned as
well.

closes rofl0r#152

commit message by @rofl0r.
  • Loading branch information
urdarinda authored and rofl0r committed Dec 24, 2016
1 parent bf6eeff commit c91e6a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ check_compile_run 'whether OpenBSDs fclose() (illegally) calls close()' \
'#include <stdio.h>\n#include<stdlib.h>\nint close(int x){exit(0);}int main(){fclose(stdin);return 1;}' && \
OUR_CPPFLAGS="$OUR_CPPFLAGS -DBROKEN_FCLOSE"

echo CC?=$CC>config.mak
[ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak
[ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>config.mak
[ -z "$LDFLAGS" ] || echo USER_LDFLAGS?=$LDFLAGS>>config.mak
echo CC=$CC>config.mak
[ -z "$CPPFLAGS" ] || echo CPPFLAGS=$CPPFLAGS>>config.mak
[ -z "$CFLAGS" ] || echo USER_CFLAGS=$CFLAGS>>config.mak
[ -z "$LDFLAGS" ] || echo USER_LDFLAGS=$LDFLAGS>>config.mak
echo prefix=$prefix>>config.mak
echo exec_prefix=$exec_prefix>>config.mak
echo bindir=$bindir>>config.mak
Expand Down

0 comments on commit c91e6a0

Please sign in to comment.