diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-05 19:10:12 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-14 15:21:03 +0000 |
commit | 4df3e187b482a2bf2230c36c4b1c7bc4d439d51a (patch) | |
tree | 34ee00069881fc822185aa3e7cb8ab6311cdd18b | |
parent | d9b2259a342b968684c121f4c94546b46cab6c9c (diff) |
configure.in: use AC_TRY_COMPILE to avoid a symlink attack in /tmp during compilation
-rw-r--r-- | configure.in | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/configure.in b/configure.in index 1e663739..f23cc35f 100644 --- a/configure.in +++ b/configure.in @@ -972,17 +972,13 @@ AC_SUBST(DBUS_X_LIBS) #### gcc warning flags cc_supports_flag() { - AC_MSG_CHECKING(whether $CC supports "$@") - Cfile=/tmp/foo${$} - touch ${Cfile}.c - $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 - rc=$? - rm -f ${Cfile}.c ${Cfile}.o - case $rc in - 0) AC_MSG_RESULT(yes);; - *) AC_MSG_RESULT(no);; - esac - return $rc + AC_MSG_CHECKING(whether $CC supports "$*") + save_CFLAGS="$CFLAGS" + CFLAGS="$*" + AC_TRY_COMPILE([], [], [rc=yes], [rc=no]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$rc]) + test "x$rc" = xyes } ld_supports_flag() { |