Changeset 117727 for trunk/base


Ignore:
Timestamp:
Mar 9, 2014, 9:13:07 PM (10 years ago)
Author:
cal@…
Message:

configure: remove -L$prefix/* and -I$prefix/* from env variables affecting the compiler, provide an option to avoid this, see #42756

Location:
trunk/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/aclocal.m4

    r117670 r117727  
    973973])
    974974
     975dnl This macro ensures MP installation prefix paths are NOT in CFLAGS,
     976dnl CPPFLAGS, OBJCFLAGS, LDFLAGS for configure to prevent potential problems
     977dnl when base/ code is updated and ports are installed that would match needed
     978dnl items.
     979AC_DEFUN([MP_FLAGS_SCAN],[
     980        AC_ARG_ENABLE(
     981                [flag-sanitization],
     982                AS_HELP_STRING([--disable-flag-sanitization], [Do not sanitize CPPFLAGS, CFLAGS, OBJCFLAGS and LDFLAGS]),
     983                [disable_mp_flags_scan=yes],
     984                [disable_mp_flags_scan=no])
     985
     986        if test x"$disable_mp_flags_scan" != "xyes"; then
     987                # Get a value for $prefix
     988                oldprefix=$prefix
     989                if test "x$prefix" = "xNONE" ; then
     990                        prefix=$ac_default_prefix
     991                fi
     992
     993                mp_flags_scan_found=
     994
     995                # Clean CFLAGS CPPFLAGS OBJCFLAGS and LDFLAGS
     996                for flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
     997                        mp_flags_scan_flag_cleaned=
     998                        eval "set x \$$flagname"
     999                        shift
     1000                        for mp_flags_scan_val; do
     1001                                case "$mp_flags_scan_val" in
     1002                                        -I$prefix/* | -L$prefix/*)
     1003                                                AC_MSG_NOTICE([Removing `$mp_flags_scan_val' from \$$flagname because it might cause a self-dependency])
     1004                                                mp_flags_scan_found=1
     1005                                                ;; #(
     1006                                        *)
     1007                                                AS_VAR_APPEND([mp_flags_scan_flag_cleaned], [" $mp_flags_scan_val"])
     1008                                                ;;
     1009                                esac
     1010                        done
     1011                        if test -z "$mp_flags_scan_flag_cleaned"; then
     1012                                (unset $flagname) >/dev/null 2>&1 && unset $flagname
     1013                        else
     1014                                eval "$flagname=\"$mp_flags_scan_flag_cleaned\""
     1015                        fi
     1016                done
     1017
     1018                if ! test -z "$mp_flags_scan_found"; then
     1019                        AC_MSG_NOTICE([See https://trac.macports.org/ticket/42756 for rationale on why this script is removing these values])
     1020                        AC_MSG_NOTICE([Pass --disable-flag-sanitization if you're aware of the potential problems and want to risk them anyway])
     1021                fi
     1022
     1023                # Restore $prefix
     1024                prefix=$oldprefix
     1025        fi
     1026])
     1027
     1028
    9751029dnl This macro ensures MP installation prefix paths are NOT in PATH
    9761030dnl for configure to prevent potential problems when base/ code is updated
  • trunk/base/configure.ac

    r117621 r117727  
    1717# Check user PATH for MP paths, and remove as necessary.
    1818MP_PATH_SCAN
     19MP_FLAGS_SCAN
    1920
    2021AC_PATH_PROG(SW_VERS, sw_vers)
Note: See TracChangeset for help on using the changeset viewer.