Skip to content
Permalink
Browse files

configure: remove -L$prefix/* and -I$prefix/* from env variables affe…

…cting the compiler, provide an option to avoid this, see https://trac.macports.org/ticket/42756

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@117727 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
neverpanic committed Mar 9, 2014
1 parent 3268cf8 commit 43d0db0deb84ebc460344665f9171e85b5aa4d47
Showing with 55 additions and 0 deletions.
  1. +54 −0 aclocal.m4
  2. +1 −0 configure.ac
@@ -972,6 +972,60 @@ AC_DEFUN([MP_COMPILER_ATTRIBUTE_UNUSED], [
])

dnl This macro ensures MP installation prefix paths are NOT in CFLAGS,
dnl CPPFLAGS, OBJCFLAGS, LDFLAGS for configure to prevent potential problems
dnl when base/ code is updated and ports are installed that would match needed
dnl items.
AC_DEFUN([MP_FLAGS_SCAN],[
AC_ARG_ENABLE(
[flag-sanitization],
AS_HELP_STRING([--disable-flag-sanitization], [Do not sanitize CPPFLAGS, CFLAGS, OBJCFLAGS and LDFLAGS]),
[disable_mp_flags_scan=yes],
[disable_mp_flags_scan=no])
if test x"$disable_mp_flags_scan" != "xyes"; then
# Get a value for $prefix
oldprefix=$prefix
if test "x$prefix" = "xNONE" ; then
prefix=$ac_default_prefix
fi
mp_flags_scan_found=
# Clean CFLAGS CPPFLAGS OBJCFLAGS and LDFLAGS
for flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
mp_flags_scan_flag_cleaned=
eval "set x \$$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])
mp_flags_scan_found=1
;; #(
*)
AS_VAR_APPEND([mp_flags_scan_flag_cleaned], [" $mp_flags_scan_val"])
;;
esac
done
if test -z "$mp_flags_scan_flag_cleaned"; then
(unset $flagname) >/dev/null 2>&1 && unset $flagname
else
eval "$flagname=\"$mp_flags_scan_flag_cleaned\""
fi
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])
fi
# Restore $prefix
prefix=$oldprefix
fi
])


dnl This macro ensures MP installation prefix paths are NOT in PATH
dnl for configure to prevent potential problems when base/ code is updated
dnl and ports are installed that would match needed items.
@@ -16,6 +16,7 @@ AC_SUBST(MACPORTS_VERSION)

# Check user PATH for MP paths, and remove as necessary.
MP_PATH_SCAN
MP_FLAGS_SCAN

AC_PATH_PROG(SW_VERS, sw_vers)
AC_PATH_PROG(DEFAULTS, defaults)

0 comments on commit 43d0db0

Please sign in to comment.
You can’t perform that action at this time.