[117754] trunk/base/aclocal.m4
cal at macports.org
cal at macports.org
Mon Mar 10 16:50:03 PDT 2014
Revision: 117754
https://trac.macports.org/changeset/117754
Author: cal at macports.org
Date: 2014-03-10 16:50:03 -0700 (Mon, 10 Mar 2014)
Log Message:
-----------
aclocal: Remove dangerous flags in MP_FLAGS_SCAN from $ac_configure_args and the $ac_env_* and $ac_cv_env_* variables, too. Fixes #42756.
Also rename some variables to avoid conflicts and fix some sed expressions (because we're in m4 with [] as quote characters).
Modified Paths:
--------------
trunk/base/aclocal.m4
Modified: trunk/base/aclocal.m4
===================================================================
--- trunk/base/aclocal.m4 2014-03-10 23:40:38 UTC (rev 117753)
+++ trunk/base/aclocal.m4 2014-03-10 23:50:03 UTC (rev 117754)
@@ -93,7 +93,7 @@
dnl - The variable name to assign to
dnl - The (quoted, if necessary) key-value pair
AC_DEFUN([_MP_EXTRACT_KEY], [dnl
- $1=$(AS_ECHO([$2]) | sed -E 's/^--?([^=]+)=.*$/\1/')dnl
+ $1=$(AS_ECHO([$2]) | sed -E 's/^--?([[^=]]+)=.*$/\1/')dnl
])
dnl Configure a project contained in a .tar.gz (or .tgz) tarball, extracting it
@@ -993,28 +993,58 @@
mp_flags_scan_found=
# Clean CFLAGS CPPFLAGS OBJCFLAGS and LDFLAGS
- for flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
+ for mp_flags_flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
mp_flags_scan_flag_cleaned=
- eval "set x \$$flagname"
+ eval "set x \$$mp_flags_flagname"
shift
for mp_flags_scan_val; do
case "$mp_flags_scan_val" in
-I$prefix/* | -L$prefix/*)
- AC_MSG_NOTICE([Removing `$mp_flags_scan_val' from \$$flagname because it might cause a self-dependency])
+ AC_MSG_NOTICE([Removing `$mp_flags_scan_val' from \$$mp_flags_flagname because it might cause a self-dependency])
mp_flags_scan_found=1
;; #(
*)
- AS_VAR_APPEND([mp_flags_scan_flag_cleaned], [" $mp_flags_scan_val"])
+ if test -z "$mp_flags_scan_flag_cleaned"; then
+ mp_flags_scan_flag_cleaned=$mp_flags_scan_val
+ else
+ AS_VAR_APPEND([mp_flags_scan_flag_cleaned], [" $mp_flags_scan_val"])
+ fi
;;
esac
done
if test -z "$mp_flags_scan_flag_cleaned"; then
- (unset $flagname) >/dev/null 2>&1 && unset $flagname
+ (unset $mp_flags_flagname) >/dev/null 2>&1 && unset $mp_flags_flagname
+ (export -n $mp_flags_flagname) >/dev/null 2>&1 && export -n $mp_flags_flagname
else
- eval "$flagname=\"$mp_flags_scan_flag_cleaned\""
+ eval "$mp_flags_flagname=\"$mp_flags_scan_flag_cleaned\""
+ export $mp_flags_flagname
fi
+ eval "ac_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+ eval "ac_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
+ eval "ac_cv_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+ eval "ac_cv_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
done
+ # Since those are all precious variables they have been saved into config.cache and put into $ac_configure_args
+ # We need to remove them at least from $ac_configure_args, because that's being passed to sub-configures
+ eval "set x $ac_configure_args"
+ shift
+ ac_configure_args=
+ for mp_flags_configure_arg; do
+ case "$mp_flags_configure_arg" in
+ CFLAGS=* | CPPFLAGS=* | OBJCFLAGS=* | LDFLAGS=*)
+ mp_flags_configure_arg_key=$(AS_ECHO(["$mp_flags_configure_arg"]) | sed -E 's/^([[^=]]+)=.*$/\1/')
+ eval "mp_flags_configure_arg_newval=\$$mp_flags_configure_arg_key"
+ if test -n "$mp_flags_configure_arg_newval"; then
+ AS_VAR_APPEND([ac_configure_args], [" '$mp_flags_configure_arg_key=$mp_flags_configure_arg_newval'"])
+ fi
+ ;;
+ *)
+ AS_VAR_APPEND([ac_configure_args], [" '$mp_flags_configure_arg'"])
+ ;;
+ esac
+ done
+
if ! test -z "$mp_flags_scan_found"; then
AC_MSG_NOTICE([See https://trac.macports.org/ticket/42756 for rationale on why this script is removing these values])
AC_MSG_NOTICE([Pass --disable-flag-sanitization if you're aware of the potential problems and want to risk them anyway])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140310/a2628bdb/attachment.html>
More information about the macports-changes
mailing list