Skip to content

Commit

Permalink
configure.inc: fix LDFLAGS validation
Browse files Browse the repository at this point in the history
Change the CFLAGS validation to create ngc$$ instead of ngc$$.o since
it doesn't specify -c.

Change the LDFLAGS validation to create the .o file it needs.
Previously it relied on the CFLAGS test, which was optional, to do
that, and the CFLAGS test was actually creating an executable, not an
object file.

Thanks to Greg Troxel for reporting the omission.

Signed-off-by: Rob Browning <[email protected]>
Tested-by: Rob Browning <[email protected]>
  • Loading branch information
rlbdv committed Jul 11, 2022
1 parent 386a280 commit 36fce27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config/configure.inc
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ EOF

if [ "$CFLAGS" ]; then
test "$CFLAGS" && echo "validating CFLAGS=${CFLAGS}"
if $AC_CC $CFLAGS -o "$__ac_tmpdir/ngc$$.o" "$__ac_tmpdir/ngc$$.c" ; then
if $AC_CC $CFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.c" ; then
AC_CFLAGS=${CFLAGS:-"-g"}
test "$CFLAGS" && echo "CFLAGS=\"${CFLAGS}\" are okay"
elif [ "$CFLAGS" ]; then
Expand All @@ -502,8 +502,9 @@ EOF
AC_CFLAGS=-g
fi
if [ "$LDFLAGS" ]; then
test "$LDFLAGS" && echo "validating LDFLAGS=${LDFLAGS}"
if $AC_CC $LDFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.o"; then
echo "validating LDFLAGS=${LDFLAGS}"
$AC_CC $AC_CFLAGS -c -o "$__ac_tmpdir/ngc$$.o" "$__ac_tmpdir/ngc$$.c"
if $AC_CC $AC_CFLAGS $LDFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.o"; then
AC_LDFLAGS=${LDFLAGS:-"-g"}
test "$LDFLAGS" && TLOG "LDFLAGS=\"${LDFLAGS}\" are okay"
elif [ "$LDFLAGS" ]; then
Expand Down

0 comments on commit 36fce27

Please sign in to comment.