Skip to content

Commit 9a45e45

Browse files
committed
configure.ac: don't unset LDFLAGS
The `LDFLAGS` variable was initially cleared by commit c4d84aa in 2009, and reverted in commit 21a6e1f later that year, but the revert was reverted one day later in commit 937358e; the edit war continued another day later with another revert by commit 477649c, but was reverted again on the same day by commit 1645041 The reverts (don't clear) were documented: "unsetting LIBS and LDFLAGS just makes it impossible to specify LDFLAGS from the environment" ... but none of the "unset LDFLAGS" commits had any explanation in the commit message. Clearing `LDFLAGS` obviously breaks a feature that is documented by `./configure --help`: "Some influential environment variables: [...] LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>" This feature is used by several CI scripts, e.g. `.cirrus.yml`, `.github/actions/configure-x32/action.yml` and `.github/nightly_matrix.php` - but there, it didn't ever work. Apparently, nobody ever noticed this. Unlike the other reverts, this patch keeps the `unset LIBS`, because the `LIBS` variable had already been copied to `EXTRA_LIBS`. Same for the last `unset LIBS LDFLAGS` command in line 1374: prior to that, `LDFLAGS` had already been copied to `EXTRA_LDFLAGS`. Maybe that's enough to keep people from revert it again and again? With this patch, I can use the `mold` linker for the first time by simply doing `./configure .... LDFLAGS="-fuse-ld=mold"`.
1 parent 8995f60 commit 9a45e45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ if test "$ac_cv_lib_crypt_crypt" = "yes"; then
11871187
EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
11881188
fi
11891189

1190-
unset LIBS LDFLAGS
1190+
unset LIBS
11911191

11921192
dnl PEAR
11931193
dnl ----------------------------------------------------------------------------
@@ -1360,7 +1360,7 @@ if test "$abs_srcdir" != "$abs_builddir"; then
13601360
fi
13611361

13621362
ZEND_EXTRA_LIBS="$LIBS"
1363-
unset LIBS LDFLAGS
1363+
unset LIBS
13641364

13651365
PHP_HELP_SEPARATOR([TSRM:])
13661366
PHP_CONFIGURE_PART(Configuring TSRM)

0 commit comments

Comments
 (0)